新增设置-桌面歌词设置-自动刷新歌词置顶

pull/930/merge
lyswhut 2022-03-31 17:54:22 +08:00
parent 5938f4e591
commit 4dfa4d9525
7 changed files with 45 additions and 2 deletions

View File

@ -5,6 +5,7 @@
- 新增播放详情页歌词右键菜单,原来设置-播放详情页设置的字体重置已迁移到此菜单内
- 新增歌词偏移设置,可以在播放详情页歌词右键菜单中使用
- 新增设置-播放设置-播放错误时自动切换歌曲设置默认开启原来的行为若你不想在遇到音频加载失败、url获取失败等错误时自动切歌可以关闭此设置
- 新增设置-桌面歌词设置-自动刷新歌词置顶(当歌词置顶后仍被某些程序遮挡时可尝试启用此设置)
### 优化

View File

@ -2,7 +2,7 @@ const path = require('path')
const os = require('os')
const defaultSetting = {
version: '1.0.55',
version: '1.0.56',
player: {
togglePlayMethod: 'listLoop',
highQuality: false,
@ -32,6 +32,7 @@ const defaultSetting = {
enable: false,
isLock: false,
isAlwaysOnTop: false,
isAlwaysOnTopLoop: false,
width: 380,
height: 420,
x: null,

View File

@ -257,6 +257,7 @@
"setting__click_open": "Click to open",
"setting__desktop_lyric": "Desktop Lyric Settings",
"setting__desktop_lyric_always_on_top": "Make the lyrics always above other windows",
"setting__desktop_lyric_always_on_top_loop": "Automatically refresh the top of the lyrics (try to enable this setting when the lyrics are still blocked by some programs)",
"setting__desktop_lyric_delay_scroll": "Delayed lyrics scroll",
"setting__desktop_lyric_enable": "Display lyrics",
"setting__desktop_lyric_font": "Lyric font",

View File

@ -257,6 +257,7 @@
"setting__click_open": "点击打开",
"setting__desktop_lyric": "桌面歌词设置",
"setting__desktop_lyric_always_on_top": "使歌词总是在其他窗口之上",
"setting__desktop_lyric_always_on_top_loop": "自动刷新歌词置顶(当歌词置顶后仍被某些程序遮挡时可尝试启用此设置)",
"setting__desktop_lyric_delay_scroll": "延迟歌词滚动",
"setting__desktop_lyric_enable": "显示歌词",
"setting__desktop_lyric_font": "歌词字体",

View File

@ -257,6 +257,7 @@
"setting__click_open": "點擊打開",
"setting__desktop_lyric": "桌面歌詞設置",
"setting__desktop_lyric_always_on_top": "使歌詞總是在其他窗口之上",
"setting__desktop_lyric_always_on_top_loop": "自動刷新歌詞置頂(當歌詞置頂後仍被某些程序遮擋時可嘗試啟用此設置)",
"setting__desktop_lyric_delay_scroll": "延遲歌詞滾動",
"setting__desktop_lyric_enable": "顯示歌詞",
"setting__desktop_lyric_font": "歌詞字體",

View File

@ -6,7 +6,34 @@ const { getLyricWindowBounds } = require('./utils')
let isLock = null
let isEnable = null
let isAlwaysOnTop = null
let isAlwaysOnTopLoop = null
let isLockScreen = null
const alwaysOnTopTools = {
timeout: null,
alwaysOnTop: false,
setAlwaysOnTop(flag, isLoop) {
this.alwaysOnTop = flag
this.clearLoop()
global.modules.lyricWindow.setAlwaysOnTop(flag, 'screen-saver')
console.log(isLoop)
if (flag && isLoop) this.startLoop()
},
startLoop() {
if (!this.alwaysOnTop) return
this.timeout = setInterval(() => {
if (!global.modules.lyricWindow) return this.clearLoop()
global.modules.lyricWindow.setAlwaysOnTop(true, 'screen-saver')
}, 1000)
},
clearLoop() {
if (!this.timeout) return
clearInterval(this.timeout)
this.timeout = null
},
}
const setLrcConfig = () => {
let desktopLyric = global.appSetting.desktopLyric
if (global.modules.lyricWindow) {
@ -26,7 +53,15 @@ const setLrcConfig = () => {
}
if (isAlwaysOnTop != desktopLyric.isAlwaysOnTop) {
isAlwaysOnTop = desktopLyric.isAlwaysOnTop
global.modules.lyricWindow.setAlwaysOnTop(desktopLyric.isAlwaysOnTop, 'screen-saver')
alwaysOnTopTools.setAlwaysOnTop(desktopLyric.isAlwaysOnTop, desktopLyric.isAlwaysOnTopLoop)
}
if (isAlwaysOnTopLoop != desktopLyric.isAlwaysOnTopLoop) {
isAlwaysOnTopLoop = desktopLyric.isAlwaysOnTopLoop
if (isAlwaysOnTopLoop) {
alwaysOnTopTools.startLoop()
} else {
alwaysOnTopTools.clearLoop()
}
}
if (isLockScreen != desktopLyric.isLockScreen) {
isLockScreen = desktopLyric.isLockScreen
@ -45,6 +80,7 @@ const setLrcConfig = () => {
if (desktopLyric.enable) {
global.lx_event.winLyric.create()
} else {
alwaysOnTopTools.clearLoop()
global.lx_event.winLyric.close()
}
}

View File

@ -9,6 +9,8 @@ dd
base-checkbox(id="setting_desktop_lyric_delayScroll" v-model="currentStting.desktopLyric.isDelayScroll" :label="$t('setting__desktop_lyric_delay_scroll')")
.gap-top
base-checkbox(id="setting_desktop_lyric_alwaysOnTop" v-model="currentStting.desktopLyric.isAlwaysOnTop" :label="$t('setting__desktop_lyric_always_on_top')")
.gap-top
base-checkbox(id="setting_desktop_lyric_alwaysOnTopLoop" v-model="currentStting.desktopLyric.isAlwaysOnTopLoop" :label="$t('setting__desktop_lyric_always_on_top_loop')")
.gap-top
base-checkbox(id="setting_desktop_lyric_lockScreen" v-model="currentStting.desktopLyric.isLockScreen" :label="$t('setting__desktop_lyric_lock_screen')")
dd