From 68d8369a8b6cd7441e2b69a686d96fc613367c93 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Fri, 12 Mar 2021 09:02:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=8D=95=E8=AF=8D=E6=8B=BC?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/defaultSetting.js | 2 +- src/common/utils.js | 8 ++++++-- src/main/modules/winLyric/event.js | 2 +- src/main/modules/winLyric/rendererEvent.js | 2 +- src/renderer-lyric/App.vue | 8 ++++---- src/renderer-lyric/components/core/Lyric.vue | 8 ++++---- src/renderer/components/core/Player.vue | 6 +++--- src/renderer/components/material/PactModal.vue | 2 +- src/renderer/utils/lyric-font-player/index.js | 1 + src/renderer/views/Setting.vue | 2 +- 10 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/common/defaultSetting.js b/src/common/defaultSetting.js index f2a463ca..b2830f2d 100644 --- a/src/common/defaultSetting.js +++ b/src/common/defaultSetting.js @@ -11,7 +11,7 @@ const defaultSetting = { isMute: false, mediaDeviceId: 'default', isMediaDeviceRemovedStopPlay: false, - isShowLyricTransition: false, + isShowLyricTranslation: false, isPlayLxlrc: true, isSavePlayTime: false, }, diff --git a/src/common/utils.js b/src/common/utils.js index 439a6191..78e7c5b8 100644 --- a/src/common/utils.js +++ b/src/common/utils.js @@ -182,6 +182,11 @@ exports.initSetting = () => { electronStore_config.set('setting.list.isSaveScrollLocation', scroll.enable) delete setting.list.scroll } + + if (setting.player.isShowLyricTransition != null) { // 修正拼写问题 v1.8.2 及以前 + setting.player.isShowLyricTranslation = setting.player.isShowLyricTransition + delete setting.player.isShowLyricTransition + } } // 从我的列表分离下载列表 v1.7.0 后 @@ -197,8 +202,7 @@ exports.initSetting = () => { if (!newSetting.leaderboard.tabId.includes('__')) newSetting.leaderboard.tabId = 'kw__16' // newSetting.controlBtnPosition = 'right' - electronStore_config.set('version', settingVersion) - electronStore_config.set('setting', newSetting) + electronStore_config.set({ version: settingVersion, setting: newSetting }) return { version: settingVersion, setting: newSetting } } diff --git a/src/main/modules/winLyric/event.js b/src/main/modules/winLyric/event.js index 4997dfff..658725dd 100644 --- a/src/main/modules/winLyric/event.js +++ b/src/main/modules/winLyric/event.js @@ -13,7 +13,7 @@ const setLrcConfig = () => { mainSend(global.modules.lyricWindow, ipcWinLyricNames.set_lyric_config, { config: desktopLyric, languageId: global.appSetting.langId, - isShowLyricTransition: global.appSetting.player.isShowLyricTransition, + isShowLyricTranslation: global.appSetting.player.isShowLyricTranslation, isPlayLxlrc: global.appSetting.player.isPlayLxlrc, }) if (isLock != desktopLyric.isLock) { diff --git a/src/main/modules/winLyric/rendererEvent.js b/src/main/modules/winLyric/rendererEvent.js index 091e81f8..39e60d0d 100644 --- a/src/main/modules/winLyric/rendererEvent.js +++ b/src/main/modules/winLyric/rendererEvent.js @@ -27,7 +27,7 @@ mainHandle(ipcWinLyricNames.get_lyric_config, async() => { return { config: global.appSetting.desktopLyric, languageId: global.appSetting.langId, - isShowLyricTransition: global.appSetting.player.isShowLyricTransition, + isShowLyricTranslation: global.appSetting.player.isShowLyricTranslation, isPlayLxlrc: global.appSetting.player.isPlayLxlrc, } }) diff --git a/src/renderer-lyric/App.vue b/src/renderer-lyric/App.vue index 0bbc1532..fc5a61d0 100644 --- a/src/renderer-lyric/App.vue +++ b/src/renderer-lyric/App.vue @@ -4,7 +4,7 @@ transition(enter-active-class="animated-fast fadeIn" leave-active-class="animated-fast fadeOut") .control-bar(v-show="!lrcConfig.isLock") core-control-bar(:lrcConfig="lrcConfig" :themes="themeList") - core-lyric(:lrcConfig="lrcConfig" :isPlayLxlrc="isPlayLxlrc" :isShowLyricTransition="isShowLyricTransition") + core-lyric(:lrcConfig="lrcConfig" :isPlayLxlrc="isPlayLxlrc" :isShowLyricTranslation="isShowLyricTranslation") div.resize-left(@mousedown.self="handleMouseDown('left', $event)") div.resize-top(@mousedown.self="handleMouseDown('top', $event)") div.resize-right(@mousedown.self="handleMouseDown('right', $event)") @@ -44,7 +44,7 @@ export default { isZoomActiveLrc: true, }, }, - isShowLyricTransition: true, + isShowLyricTranslation: true, isPlayLxlrc: true, themeList: [ { @@ -119,9 +119,9 @@ export default { document.removeEventListener('mouseup', this.handleMouseUp) }, methods: { - handleUpdateConfig({ config, languageId, isShowLyricTransition, isPlayLxlrc }) { + handleUpdateConfig({ config, languageId, isShowLyricTranslation, isPlayLxlrc }) { this.lrcConfig = config - this.isShowLyricTransition = isShowLyricTransition + this.isShowLyricTranslation = isShowLyricTranslation this.isPlayLxlrc = isPlayLxlrc if (this.$i18n.locale !== languageId && languageId != null) this.$i18n.locale = languageId }, diff --git a/src/renderer-lyric/components/core/Lyric.vue b/src/renderer-lyric/components/core/Lyric.vue index fd1927a0..88d505d4 100644 --- a/src/renderer-lyric/components/core/Lyric.vue +++ b/src/renderer-lyric/components/core/Lyric.vue @@ -32,7 +32,7 @@ export default { type: Boolean, default: true, }, - isShowLyricTransition: { + isShowLyricTranslation: { type: Boolean, default: true, }, @@ -126,7 +126,7 @@ export default { }, immediate: true, }, - isShowLyricTransition() { + isShowLyricTranslation() { this.setLyric() rendererSend(NAMES.winLyric.get_lyric_info, 'status') }, @@ -306,8 +306,8 @@ export default { setLyric() { window.lrc.setLyric( this.isPlayLxlrc && this.lyrics.lxlyric ? this.lyrics.lxlyric : this.lyrics.lyric, - this.isShowLyricTransition && this.lyrics.tlyric ? this.lyrics.tlyric : '', - // (this.isShowLyricTransition && this.lyrics.tlyric ? (this.lyrics.tlyric + '\n') : '') + (this.lyrics.lyric || ''), + this.isShowLyricTranslation && this.lyrics.tlyric ? this.lyrics.tlyric : '', + // (this.isShowLyricTranslation && this.lyrics.tlyric ? (this.lyrics.tlyric + '\n') : '') + (this.lyrics.lyric || ''), ) }, }, diff --git a/src/renderer/components/core/Player.vue b/src/renderer/components/core/Player.vue index 842e476c..89b71e12 100644 --- a/src/renderer/components/core/Player.vue +++ b/src/renderer/components/core/Player.vue @@ -272,7 +272,7 @@ export default { 'setting.player.mediaDeviceId'(n) { this.setMediaDevice() }, - 'setting.player.isShowLyricTransition'() { + 'setting.player.isShowLyricTranslation'() { this.setLyric() }, 'setting.player.isPlayLxlrc'() { @@ -860,9 +860,9 @@ export default { setLyric() { window.lrc.setLyric( this.setting.player.isPlayLxlrc && this.musicInfo.lxlrc ? this.musicInfo.lxlrc : this.musicInfo.lrc, - this.setting.player.isShowLyricTransition && this.musicInfo.tlrc ? this.musicInfo.tlrc : '', + this.setting.player.isShowLyricTranslation && this.musicInfo.tlrc ? this.musicInfo.tlrc : '', // ( - // this.setting.player.isShowLyricTransition && this.musicInfo.tlrc + // this.setting.player.isShowLyricTranslation && this.musicInfo.tlrc // ? (this.musicInfo.tlrc + '\n') // : '' // ) + (this.musicInfo.lrc || ''), diff --git a/src/renderer/components/material/PactModal.vue b/src/renderer/components/material/PactModal.vue index 9b42af54..ff6cee06 100644 --- a/src/renderer/components/material/PactModal.vue +++ b/src/renderer/components/material/PactModal.vue @@ -80,7 +80,7 @@ export default { watch: { 'setting.isAgreePact'(n) { if (n) return - this.time = 10 + this.time = 5 this.startTimeout() }, }, diff --git a/src/renderer/utils/lyric-font-player/index.js b/src/renderer/utils/lyric-font-player/index.js index b855e667..d542b640 100644 --- a/src/renderer/utils/lyric-font-player/index.js +++ b/src/renderer/utils/lyric-font-player/index.js @@ -139,6 +139,7 @@ module.exports = class Lyric { return { text: line.text.replace(fontTimeExp, ''), time: line.time, + translation: line.translation, dom_line: fontPlayer.lineContent, } }) diff --git a/src/renderer/views/Setting.vue b/src/renderer/views/Setting.vue index 6a45292d..555929d1 100644 --- a/src/renderer/views/Setting.vue +++ b/src/renderer/views/Setting.vue @@ -68,7 +68,7 @@ div(:class="$style.main") div(:class="$style.gapTop") material-checkbox(id="setting_player_save_play_time" v-model="current_setting.player.isSavePlayTime" :label="$t('view.setting.play_save_play_time')") div(:class="$style.gapTop") - material-checkbox(id="setting_player_lyric_transition" v-model="current_setting.player.isShowLyricTransition" :label="$t('view.setting.play_lyric_transition')") + material-checkbox(id="setting_player_lyric_transition" v-model="current_setting.player.isShowLyricTranslation" :label="$t('view.setting.play_lyric_transition')") div(:class="$style.gapTop") material-checkbox(id="setting_player_lyric_play_lxlrc" v-model="current_setting.player.isPlayLxlrc" :label="$t('view.setting.play_lyric_lxlrc')") div(:class="$style.gapTop")