From ad0c0f37c96dc9e3d73902438ff07e4f48a60a36 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Wed, 9 Jul 2025 08:58:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B0=83=E6=8D=A2=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E6=AD=8C=E8=AF=8D=E4=B8=8E=E7=BD=97=E9=A9=AC=E9=9F=B3?= =?UTF-8?q?=E6=AD=8C=E8=AF=8D=E4=BD=8D=E7=BD=AE=E8=AE=BE=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=AD=8C=E8=AF=8D=E6=98=BE=E7=A4=BA=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=88#2451=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 6 ++++++ src/common/defaultSetting.ts | 1 + src/common/types/app_setting.d.ts | 5 +++++ src/common/types/desktop_lyric.d.ts | 1 + src/lang/en-us.json | 1 + src/lang/zh-cn.json | 1 + src/lang/zh-tw.json | 1 + src/main/modules/winLyric/utils.ts | 1 + src/renderer-lyric/core/lyric.ts | 3 ++- src/renderer-lyric/store/state.ts | 1 + src/renderer-lyric/useApp/useLyric.ts | 1 + src/renderer/core/lyric.ts | 4 +++- src/renderer/core/useApp/usePlayer/useLyric.ts | 1 + src/renderer/views/Setting/components/SettingPlay.vue | 2 ++ 14 files changed, 27 insertions(+), 2 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index bf3e5bf2..09ceca1a 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -3,7 +3,13 @@ - 新增「设置 → 其他设置 → 主窗口使用软件内置的圆角及阴影」设置(#2360) *默认启用,关闭后将使用系统原生的窗口样式,该设置重启软件后生效* - 开放API新增播放器声音大小、静音、播放进度控制,详情看接入文档(#2386) +- 新增「设置 → 播放设置 → 调换翻译歌词与罗马音歌词位置」设置,默认关闭(#2451) ### 变更 +- 调换 翻译歌词 与 罗马音歌词的位置,若你想要恢复默认的行为,可以开启 调换翻译歌词与罗马音歌词位置 设置 - 更新代理配置规则,现在不启用代理时,图片、音频加载将不再走系统代理(#2382 @Folltoshe) + +### 其他 + +- 更新 Electron 到 36.5.0 diff --git a/src/common/defaultSetting.ts b/src/common/defaultSetting.ts index 88664105..564e9948 100644 --- a/src/common/defaultSetting.ts +++ b/src/common/defaultSetting.ts @@ -38,6 +38,7 @@ const defaultSetting: LX.AppSetting = { 'player.isMediaDeviceRemovedStopPlay': false, 'player.isShowLyricTranslation': false, 'player.isShowLyricRoma': false, + 'player.isSwapLyricTranslationAndRoma': false, 'player.isS2t': false, 'player.isPlayLxlrc': !isMac, 'player.isSavePlayTime': false, diff --git a/src/common/types/app_setting.d.ts b/src/common/types/app_setting.d.ts index aeff0891..ac343786 100644 --- a/src/common/types/app_setting.d.ts +++ b/src/common/types/app_setting.d.ts @@ -159,6 +159,11 @@ declare global { */ 'player.isShowLyricRoma': boolean + /** + * 是否调换翻译歌词与罗马音歌词位置 + */ + 'player.isSwapLyricTranslationAndRoma': boolean + /** * 是否将歌词从简体转换为繁体 */ diff --git a/src/common/types/desktop_lyric.d.ts b/src/common/types/desktop_lyric.d.ts index e02a0c16..81ebc87c 100644 --- a/src/common/types/desktop_lyric.d.ts +++ b/src/common/types/desktop_lyric.d.ts @@ -34,6 +34,7 @@ declare namespace LX { 'common.langId': LX.AppSetting['common.langId'] 'player.isShowLyricTranslation': LX.AppSetting['player.isShowLyricTranslation'] 'player.isShowLyricRoma': LX.AppSetting['player.isShowLyricRoma'] + 'player.isSwapLyricTranslationAndRoma': LX.AppSetting['player.isSwapLyricTranslationAndRoma'] 'player.isPlayLxlrc': LX.AppSetting['player.isPlayLxlrc'] 'player.playbackRate': LX.AppSetting['player.playbackRate'] } diff --git a/src/lang/en-us.json b/src/lang/en-us.json index a58c6fa7..31d81c47 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -555,6 +555,7 @@ "setting__play_task_bar": "Show playback progress on the taskbar", "setting__play_timeout": "Timed Pause", "setting__player_audio_visualization_tip": "The custom audio output device feature conflicts with the audio visualization feature. After the audio visualization is enabled, the audio output device will be reset to the default. At present, this problem cannot be resolved. Do you still want to enable it?", + "setting__player_awap_lyric_trans_roma": "Swap lyric translation and roman", "setting__search": "Search", "setting__search_focus_search_box": "Automatically focus search box on startup", "setting__search_history": "Enable Search History", diff --git a/src/lang/zh-cn.json b/src/lang/zh-cn.json index d9d39423..5ec6fda7 100644 --- a/src/lang/zh-cn.json +++ b/src/lang/zh-cn.json @@ -555,6 +555,7 @@ "setting__play_task_bar": "在任务栏上显示当前歌曲播放进度", "setting__play_timeout": "定时暂停", "setting__player_audio_visualization_tip": "自定义音频输出设备与音频可视化功能冲突,启用「音频可视化」后音频输出设备将会被重置为默认,目前此问题暂无法解决。是否仍要开启?", + "setting__player_awap_lyric_trans_roma": "调换歌词翻译与歌词罗马音位置", "setting__search": "搜索设置", "setting__search_focus_search_box": "启动时自动聚焦搜索框", "setting__search_history": "显示历史搜索记录", diff --git a/src/lang/zh-tw.json b/src/lang/zh-tw.json index 43ebe1fe..920d0f19 100644 --- a/src/lang/zh-tw.json +++ b/src/lang/zh-tw.json @@ -555,6 +555,7 @@ "setting__play_task_bar": "在工具列上顯示目前歌曲播放進度", "setting__play_timeout": "定時暫停", "setting__player_audio_visualization_tip": "自訂音訊輸出裝置與音訊可視化功能衝突,啟用「音訊可視化」後音訊輸出裝置將會被重設為預設,目前此問題暫無法解決。是否仍要開啟?", + "setting__player_awap_lyric_trans_roma": "調換歌詞翻譯與歌詞羅馬音位置", "setting__search": "搜尋設定", "setting__search_focus_search_box": "啟動時自動聚焦搜尋框", "setting__search_history": "顯示歷史搜尋記錄", diff --git a/src/main/modules/winLyric/utils.ts b/src/main/modules/winLyric/utils.ts index 1846f65e..2175ccd3 100644 --- a/src/main/modules/winLyric/utils.ts +++ b/src/main/modules/winLyric/utils.ts @@ -81,6 +81,7 @@ export const watchConfigKeys = [ 'common.langId', 'player.isShowLyricTranslation', 'player.isShowLyricRoma', + 'player.isSwapLyricTranslationAndRoma', 'player.isPlayLxlrc', 'player.playbackRate', ] satisfies Array diff --git a/src/renderer-lyric/core/lyric.ts b/src/renderer-lyric/core/lyric.ts index 23cf56f0..c12d9d16 100644 --- a/src/renderer-lyric/core/lyric.ts +++ b/src/renderer-lyric/core/lyric.ts @@ -41,8 +41,9 @@ export const setPlaybackRate = (rate: number) => { export const setLyric = () => { if (!musicInfo.id) return const extendedLyrics = [] - if (setting['player.isShowLyricTranslation'] && lyrics.tlyric) extendedLyrics.push(lyrics.tlyric) if (setting['player.isShowLyricRoma'] && lyrics.rlyric) extendedLyrics.push(lyrics.rlyric) + if (setting['player.isShowLyricTranslation'] && lyrics.tlyric) extendedLyrics.push(lyrics.tlyric) + if (setting['player.isSwapLyricTranslationAndRoma']) extendedLyrics.reverse() lrc.setLyric( setting['player.isPlayLxlrc'] && lyrics.lxlyric ? lyrics.lxlyric : lyrics.lyric, extendedLyrics, diff --git a/src/renderer-lyric/store/state.ts b/src/renderer-lyric/store/state.ts index 9eb9c7a7..35c6445c 100644 --- a/src/renderer-lyric/store/state.ts +++ b/src/renderer-lyric/store/state.ts @@ -34,6 +34,7 @@ export const setting = shallowReactive({ 'common.langId': 'zh-cn', 'player.isShowLyricTranslation': false, 'player.isShowLyricRoma': false, + 'player.isSwapLyricTranslationAndRoma': false, 'player.isPlayLxlrc': false, 'player.playbackRate': 1, }) diff --git a/src/renderer-lyric/useApp/useLyric.ts b/src/renderer-lyric/useApp/useLyric.ts index 13469caf..ba26c57a 100644 --- a/src/renderer-lyric/useApp/useLyric.ts +++ b/src/renderer-lyric/useApp/useLyric.ts @@ -6,6 +6,7 @@ import { isPlay, setting } from '@lyric/store/state' export default () => { watch(() => setting['player.isShowLyricTranslation'], setLyric) watch(() => setting['player.isShowLyricRoma'], setLyric) + watch(() => setting['player.isSwapLyricTranslationAndRoma'], setLyric) watch(() => setting['player.isPlayLxlrc'], setLyric) watch(() => setting['player.playbackRate'], (rate) => { setPlaybackRate(rate) diff --git a/src/renderer/core/lyric.ts b/src/renderer/core/lyric.ts index bfe8cb75..fc5840fe 100644 --- a/src/renderer/core/lyric.ts +++ b/src/renderer/core/lyric.ts @@ -160,8 +160,10 @@ export const setLyric = () => { if (!musicInfo.id) return if (musicInfo.lrc) { const extendedLyrics = [] - if (appSetting['player.isShowLyricTranslation'] && musicInfo.tlrc) extendedLyrics.push(musicInfo.tlrc) if (appSetting['player.isShowLyricRoma'] && musicInfo.rlrc) extendedLyrics.push(musicInfo.rlrc) + if (appSetting['player.isShowLyricTranslation'] && musicInfo.tlrc) extendedLyrics.push(musicInfo.tlrc) + if (appSetting['player.isSwapLyricTranslationAndRoma']) extendedLyrics.reverse() + lrc.setLyric( appSetting['player.isPlayLxlrc'] && musicInfo.lxlrc ? musicInfo.lxlrc : musicInfo.lrc, extendedLyrics, diff --git a/src/renderer/core/useApp/usePlayer/useLyric.ts b/src/renderer/core/useApp/usePlayer/useLyric.ts index 9e7d88f8..9c04d5cb 100644 --- a/src/renderer/core/useApp/usePlayer/useLyric.ts +++ b/src/renderer/core/useApp/usePlayer/useLyric.ts @@ -25,6 +25,7 @@ export default () => { watch(() => appSetting['player.isShowLyricTranslation'], setLyric) watch(() => appSetting['player.isShowLyricRoma'], setLyric) + watch(() => appSetting['player.isSwapLyricTranslationAndRoma'], setLyric) watch(() => appSetting['player.isPlayLxlrc'], setLyric) window.app_event.on('play', play) diff --git a/src/renderer/views/Setting/components/SettingPlay.vue b/src/renderer/views/Setting/components/SettingPlay.vue index 0659fff2..6aeb3f2c 100644 --- a/src/renderer/views/Setting/components/SettingPlay.vue +++ b/src/renderer/views/Setting/components/SettingPlay.vue @@ -14,6 +14,8 @@ dd base-checkbox(id="setting_player_lyric_transition" :model-value="appSetting['player.isShowLyricTranslation']" :label="$t('setting__play_lyric_transition')" @update:model-value="updateSetting({'player.isShowLyricTranslation': $event})") .gap-top base-checkbox(id="setting_player_lyric_roma" :model-value="appSetting['player.isShowLyricRoma']" :label="$t('setting__play_lyric_roma')" @update:model-value="updateSetting({'player.isShowLyricRoma': $event})") + .gap-top + base-checkbox(id="setting_player_awap_lyric_trans_roma" :model-value="appSetting['player.isSwapLyricTranslationAndRoma']" :label="$t('setting__player_awap_lyric_trans_roma')" @update:model-value="updateSetting({'player.isSwapLyricTranslationAndRoma': $event})") .gap-top base-checkbox(id="setting_player_auto_skip_on_error" :model-value="appSetting['player.autoSkipOnError']" :label="$t('setting__play_auto_skip_on_error')" @update:model-value="updateSetting({'player.autoSkipOnError': $event})") .gap-top