From 92c77332a06469dc609513f48044fb2656996659 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Mon, 5 Dec 2022 13:05:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A1=8C=E9=9D=A2=E6=AD=8C?= =?UTF-8?q?=E8=AF=8D=E5=9C=A8=E5=85=B3=E9=97=AD=E8=BD=AF=E4=BB=B6=E6=97=B6?= =?UTF-8?q?=E8=A2=AB=E9=87=8D=E7=BD=AE=E5=9B=9E=E5=85=B3=E9=97=AD=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 4 ++-- src/main/app.ts | 5 +++-- src/main/modules/winLyric/main.ts | 17 +++++------------ src/main/modules/winMain/autoUpdate.ts | 2 +- src/main/modules/winMain/main.ts | 6 +++++- src/main/types/app.d.ts | 12 +++++++++++- src/main/types/global.d.ts | 11 ----------- src/renderer/views/Leaderboard/action.ts | 2 +- src/renderer/views/songList/Detail/action.ts | 2 +- 9 files changed, 29 insertions(+), 32 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index 6129c65c..19002f44 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -19,10 +19,10 @@ - 桌面歌词新增歌词对齐方式、是否不允许歌词换行、歌词颜色、滚动对齐方式、歌词间距设置 - 桌面歌词新增歌曲频谱显示(得益于主窗口与桌面歌词进程通信的改进,可以将此功能以CPU使用率“相对较低”的方式带到桌面歌词中) - 桌面歌词新增在任务栏显示歌词进程设置(此设置用于在录屏软件无法捕获歌词窗口时的变通解决方法)(#1063) -- 添加kg源罗马音歌词的支持 +- 添加kg源罗马音歌词的支持(感谢@helloplhm-qwq) - 支持打开波点音乐歌单(需在酷我源打开) - 新增设置-基本设置-播放栏进度条样式设置(此版本默认使用迷你进度条样式,对于某些不喜欢该样式的人可以将其换成其他样式) -- 添加kg源评论图片展示(感谢 彭狸花喵) +- 添加kg源评论图片展示(感谢@helloplhm-qwq) ### 优化(界面/交互/功能) diff --git a/src/main/app.ts b/src/main/app.ts index 99d28b6e..465843a0 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -204,7 +204,8 @@ export const initAppSetting = async() => { const config = await initHotKey() global.lx = { isTrafficLightClose: false, - isQuitting: false, + isSkipTrayQuit: false, + // mainWindowClosed: true, event_app: createAppEvent(), event_list: createListEvent(), appSetting: defaultSetting, @@ -241,6 +242,6 @@ export const initAppSetting = async() => { } export const quitApp = () => { - global.lx.isQuitting = true + global.lx.isSkipTrayQuit = true closeWindow() } diff --git a/src/main/modules/winLyric/main.ts b/src/main/modules/winLyric/main.ts index 27b76dec..7cdda3cd 100644 --- a/src/main/modules/winLyric/main.ts +++ b/src/main/modules/winLyric/main.ts @@ -17,23 +17,16 @@ const setLyricsConfig = debounce((config: Partial) => { const winEvent = () => { if (!browserWindow) return - // let bounds - // lyricWindow.on('close', event => { - // if (global.isQuitting || !global.appSetting.tray.enable || (!isWin && !global.isTrafficLightClose)) { - // lyricWindow.setProgressBar(-1) - // return - // } - // if (global.isTrafficLightClose) global.isTrafficLightClose = false - // event.preventDefault() - // lyricWindow.hide() + // browserWindow.on('close', () => { + // if (global.lx.appSetting['desktopLyric.enable'] && !global.lx.mainWindowClosed) { + // browserWindow = null + // global.lx.event_app.update_config({ 'desktopLyric.enable': false }) + // } // }) browserWindow.on('closed', () => { browserWindow = null - if (global.lx.appSetting['desktopLyric.enable']) { - global.lx.event_app.update_config({ 'desktopLyric.enable': false }) - } }) browserWindow.on('move', () => { diff --git a/src/main/modules/winMain/autoUpdate.ts b/src/main/modules/winMain/autoUpdate.ts index 7273c900..e5f7da9e 100644 --- a/src/main/modules/winMain/autoUpdate.ts +++ b/src/main/modules/winMain/autoUpdate.ts @@ -109,7 +109,7 @@ export default () => { }) mainOn(WIN_MAIN_RENDERER_EVENT_NAME.quit_update, () => { - global.lx.isQuitting = true + global.lx.isSkipTrayQuit = true setTimeout(() => { autoUpdater.quitAndInstall(true, true) diff --git a/src/main/modules/winMain/main.ts b/src/main/modules/winMain/main.ts index 10c1fa26..a60faa2d 100644 --- a/src/main/modules/winMain/main.ts +++ b/src/main/modules/winMain/main.ts @@ -13,8 +13,9 @@ const winEvent = () => { if (!browserWindow) return browserWindow.on('close', event => { - if (global.lx.isQuitting || !global.lx.appSetting['tray.enable'] || (!isWin && !global.lx.isTrafficLightClose)) { + if (global.lx.isSkipTrayQuit || !global.lx.appSetting['tray.enable'] || (!isWin && !global.lx.isTrafficLightClose)) { browserWindow!.setProgressBar(-1) + // global.lx.mainWindowClosed = true global.lx.event_app.main_window_close() return } @@ -25,6 +26,7 @@ const winEvent = () => { }) browserWindow.on('closed', () => { + // global.lx.mainWindowClosed = true browserWindow = null }) @@ -100,6 +102,8 @@ export const createWindow = () => { winEvent() if (global.envParams.cmdParams.odt) handleOpenDevTools(browserWindow.webContents) + + // global.lx.mainWindowClosed = false // browserWindow.webContents.openDevTools() } diff --git a/src/main/types/app.d.ts b/src/main/types/app.d.ts index facc2eab..ee4223fb 100644 --- a/src/main/types/app.d.ts +++ b/src/main/types/app.d.ts @@ -11,8 +11,18 @@ interface Lx { config: LX.HotKeyConfigAll state: LX.HotKeyState } + /** + * 是否红绿灯关闭 + */ isTrafficLightClose: boolean - isQuitting: boolean + /** + * 是否跳过托盘退出 + */ + isSkipTrayQuit: boolean + /** + * main window 是否关闭 + */ + // mainWindowClosed: boolean event_app: AppType event_list: ListType worker: { diff --git a/src/main/types/global.d.ts b/src/main/types/global.d.ts index 177ed414..ad542067 100644 --- a/src/main/types/global.d.ts +++ b/src/main/types/global.d.ts @@ -1,16 +1,5 @@ -// interface Lx { -// appSetting: LX.AppSetting -// hotKey: { -// enable: boolean -// config: LX.HotKeyConfigAll -// state: LX.HotKeyState -// } -// isTrafficLightClose: boolean -// isQuitting: boolean -// } - // // declare module NodeJS { // // interface Global { // // isDev: boolean diff --git a/src/renderer/views/Leaderboard/action.ts b/src/renderer/views/Leaderboard/action.ts index 5c8d8d09..2b0f651a 100644 --- a/src/renderer/views/Leaderboard/action.ts +++ b/src/renderer/views/Leaderboard/action.ts @@ -36,7 +36,7 @@ export const addSongListDetail = async(id: string, name: string, source: LX.Onli export const playSongListDetail = async(id: string, list?: LX.Music.MusicInfoOnline[], index: number = 0) => { let isPlayingList = false - console.log(list) + // console.log(list) const listId = getListId(id) if (!list?.length) list = (await getListDetail(id, 1)).list if (list?.length) { diff --git a/src/renderer/views/songList/Detail/action.ts b/src/renderer/views/songList/Detail/action.ts index 7f2cc7fc..b8d95350 100644 --- a/src/renderer/views/songList/Detail/action.ts +++ b/src/renderer/views/songList/Detail/action.ts @@ -36,7 +36,7 @@ export const addSongListDetail = async(id: string, source: LX.OnlineSource, name export const playSongListDetail = async(id: string, source: LX.OnlineSource, list?: LX.Music.MusicInfoOnline[], index: number = 0) => { let isPlayingList = false - console.log(list) + // console.log(list) const listId = getListId(id, source) if (!list?.length) list = (await getListDetail(id, source, 1)).list if (list?.length) {