mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-23 23:57:22 +08:00
feat(config): 添加GPU加速设置支持
This commit is contained in:
@@ -25,6 +25,7 @@ type SetConfig = {
|
||||
fontScope: 'global' | 'lyric';
|
||||
language: string;
|
||||
showTopAction: boolean;
|
||||
enableGpuAcceleration: boolean;
|
||||
};
|
||||
interface StoreType {
|
||||
set: SetConfig;
|
||||
@@ -57,6 +58,23 @@ export function initializeConfig() {
|
||||
_.returnValue = value || '';
|
||||
});
|
||||
|
||||
// GPU加速设置更新处理
|
||||
// 注意:GPU加速设置必须在应用启动时在app.ready之前设置才能生效
|
||||
ipcMain.on('update-gpu-acceleration', (event, enabled: boolean) => {
|
||||
try {
|
||||
console.log('GPU加速设置更新:', enabled);
|
||||
store.set('set.enableGpuAcceleration', enabled);
|
||||
|
||||
// GPU加速设置需要重启应用才能生效
|
||||
event.sender.send('gpu-acceleration-updated', enabled);
|
||||
console.log('GPU加速设置已保存,重启应用后生效');
|
||||
} catch (error) {
|
||||
console.error('GPU加速设置更新失败:', error);
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
event.sender.send('gpu-acceleration-update-error', errorMessage);
|
||||
}
|
||||
});
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user