新增全屏时自动关闭歌词设置

pull/1229/head
lyswhut 2023-03-04 16:10:34 +08:00
parent 7f008d1f9c
commit cb4ab411f9
10 changed files with 37 additions and 2 deletions

View File

@ -1,6 +1,7 @@
### 新增
- 重构数据同步功能,新增客户端模式
- 新增全屏时自动关闭歌词设置,默认开启,可以去设置-桌面歌词设置更改
### 优化

View File

@ -49,6 +49,7 @@ const defaultSetting: LX.AppSetting = {
'desktopLyric.isAlwaysOnTopLoop': false,
'desktopLyric.isShowTaskbar': false,
'desktopLyric.audioVisualization': false,
'desktopLyric.fullscreenHide': true,
'desktopLyric.width': 450,
'desktopLyric.height': 300,
'desktopLyric.x': null,

View File

@ -219,6 +219,11 @@ declare global {
*/
'desktopLyric.audioVisualization': boolean
/**
*
*/
'desktopLyric.fullscreenHide': boolean
/**
*
*/

View File

@ -319,6 +319,7 @@
"setting__desktop_lyric_font": "Lyric font",
"setting__desktop_lyric_font_default": "Default",
"setting__desktop_lyric_font_weight": "Bold font",
"setting__desktop_lyric_fullscreen_hide": "Automatically close lyrics when full screen",
"setting__desktop_lyric_hover_hide": "Reduce the transparency of lyrics when the mouse moves into the lyrics area (this feature has platform compatibility issues)",
"setting__desktop_lyric_line_gap": "Lyric spacing ({num})",
"setting__desktop_lyric_line_gap_add": "Increase spacing",

View File

@ -321,6 +321,7 @@
"setting__desktop_lyric_font": "歌词字体",
"setting__desktop_lyric_font_default": "默认",
"setting__desktop_lyric_font_weight": "加粗字体",
"setting__desktop_lyric_fullscreen_hide": "全屏时自动关闭歌词",
"setting__desktop_lyric_hover_hide": "鼠标移入歌词区域时降低歌词透明度(此功能存在平台兼容性问题)",
"setting__desktop_lyric_line_gap": "歌词间距({num}",
"setting__desktop_lyric_line_gap_add": "加大间距",

View File

@ -320,6 +320,7 @@
"setting__desktop_lyric_font": "歌詞字體",
"setting__desktop_lyric_font_default": "默認",
"setting__desktop_lyric_font_weight": "加粗字體",
"setting__desktop_lyric_fullscreen_hide": "全屏時自動關閉歌詞",
"setting__desktop_lyric_hover_hide": "鼠標移入歌詞區域時降低歌詞透明度(此功能存在平台兼容性問題)",
"setting__desktop_lyric_line_gap": "歌詞間距({num}",
"setting__desktop_lyric_line_gap_add": "加大間距",

View File

@ -88,6 +88,10 @@ export class Event extends EventEmitter {
main_window_close() {
this.emit('main_window_close')
}
main_window_fullscreen(isFullscreen: boolean) {
this.emit('main_window_fullscreen', isFullscreen)
}
}

View File

@ -6,6 +6,7 @@ import { closeWindow, createWindow, isExistWindow } from './main'
// import main from './main'
// import { Event, EVENT_NAMES } from './event'
let isMainWidnowFullscreen = false
export default () => {
initRendererEvent()
@ -13,17 +14,34 @@ export default () => {
// global.app_event.winMain.
global.lx.event_app.on('main_window_inited', () => {
isMainWidnowFullscreen = global.lx.appSetting['common.startInFullscreen']
if (global.lx.appSetting['desktopLyric.enable']) {
if (isExistWindow()) sendMainWindowInitedEvent()
else createWindow()
if (global.lx.appSetting['desktopLyric.fullscreenHide'] && isMainWidnowFullscreen) {
closeWindow()
} else {
if (isExistWindow()) sendMainWindowInitedEvent()
else createWindow()
}
}
})
global.lx.event_app.on('updated_config', (keys, setting) => {
setLrcConfig(keys, setting)
if (keys.includes('desktopLyric.fullscreenHide') && global.lx.appSetting['desktopLyric.enable'] && isMainWidnowFullscreen) {
if (global.lx.appSetting['desktopLyric.fullscreenHide']) closeWindow()
else if (!isExistWindow()) createWindow()
}
})
global.lx.event_app.on('main_window_close', () => {
closeWindow()
})
global.lx.event_app.on('main_window_fullscreen', (isFullscreen) => {
isMainWidnowFullscreen = isFullscreen
if (global.lx.appSetting['desktopLyric.enable'] && global.lx.appSetting['desktopLyric.fullscreenHide']) {
if (isFullscreen) closeWindow()
else if (!isExistWindow()) createWindow()
}
})
// global.lx_event.mainWindow.on(MAIN_WINDOW_EVENT_NAME.setLyricInfo, info => {

View File

@ -64,6 +64,7 @@ export default () => {
})
// 全屏
mainHandle<boolean, boolean>(WIN_MAIN_RENDERER_EVENT_NAME.fullscreen, async({ params: isFullscreen }) => {
global.lx.event_app.main_window_fullscreen(isFullscreen)
return setFullScreen(isFullscreen)
})

View File

@ -5,6 +5,8 @@ dd
base-checkbox(id="setting_desktop_lyric_enable" :modelValue="appSetting['desktopLyric.enable']" @update:modelValue="updateSetting({ 'desktopLyric.enable': $event })" :label="$t('setting__desktop_lyric_enable')")
.gap-top
base-checkbox(id="setting_desktop_lyric_lock" :modelValue="appSetting['desktopLyric.isLock']" @update:modelValue="updateSetting({ 'desktopLyric.isLock': $event })" :label="$t('setting__desktop_lyric_lock')")
.gap-top
base-checkbox(id="setting_desktop_lyric_fullscreen_hide" :modelValue="appSetting['desktopLyric.fullscreenHide']" @update:modelValue="updateSetting({ 'desktopLyric.fullscreenHide': $event })" :label="$t('setting__desktop_lyric_fullscreen_hide')")
.gap-top
base-checkbox(id="setting_desktop_lyric_audio_visualization" :modelValue="appSetting['desktopLyric.audioVisualization']" @update:modelValue="updateSetting({ 'desktopLyric.audioVisualization': $event })" :label="$t('setting__desktop_lyric_audio_visualization')")
.gap-top