From 59ee2a6fc3944cdf8b968042d9c1f07010f5e142 Mon Sep 17 00:00:00 2001 From: Zhe Fang Date: Wed, 16 Jul 2025 20:23:01 -0400 Subject: [PATCH] fix #25 --- .../Services/ISettingsService.cs | 2 ++ .../Services/SettingsService.cs | 8 +++++++ .../Strings/en-US/Resources.resw | 3 +++ .../Strings/ja-JP/Resources.resw | 3 +++ .../Strings/ko-KR/Resources.resw | 3 +++ .../Strings/zh-CN/Resources.resw | 3 +++ .../Strings/zh-TW/Resources.resw | 3 +++ .../LyricsRendererViewModel.Ctor.cs | 1 + .../LyricsRendererViewModel.Messages.cs | 5 +++++ .../ViewModels/LyricsRendererViewModel.cs | 2 +- .../ViewModels/SettingsPageViewModel.cs | 9 ++++++++ .../Views/SettingsPage.xaml | 21 ++++++++++++++++++- 12 files changed, 61 insertions(+), 2 deletions(-) diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ISettingsService.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ISettingsService.cs index 3fbec6f..8724884 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ISettingsService.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/ISettingsService.cs @@ -54,6 +54,8 @@ namespace BetterLyrics.WinUI3.Services Color LyricsCustomFgFontColor { get; set; } Color LyricsCustomStrokeFontColor { get; set; } + int LyricsBgFontOpacity { get; set; } + LyricsFontColorType LyricsBgFontColorType { get; set; } LyricsFontColorType LyricsFgFontColorType { get; set; } LyricsFontColorType LyricsStrokeFontColorType { get; set; } diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/SettingsService.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/SettingsService.cs index 93384a4..4ca3693 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/SettingsService.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Services/SettingsService.cs @@ -95,6 +95,7 @@ namespace BetterLyrics.WinUI3.Services private const string LockHotKeyIndexKey = "LockHotKeyIndex"; private const string DockPlacementKey = "DockPlacement"; + private const string LyricsBgFontOpacityKey = "LyricsBgFontOpacity"; private readonly ApplicationDataContainer _localSettings; @@ -219,6 +220,13 @@ namespace BetterLyrics.WinUI3.Services SetDefault(PositionOffsetKey, 0); SetDefault(LockHotKeyIndexKey, 'U' - 'A'); SetDefault(DockPlacementKey, (int)DockPlacement.Top); + SetDefault(LyricsBgFontOpacityKey, 30); // 30% + } + + public int LyricsBgFontOpacity + { + get => GetValue(LyricsBgFontOpacityKey); + set => SetValue(LyricsBgFontOpacityKey, value); } public bool ShowTranslationOnly diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw index 9df9195..4595dfe 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/en-US/Resources.resw @@ -765,4 +765,7 @@ Show translation only + + Font opacity (Non-current playback area) + \ No newline at end of file diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw index 31f3bc5..4ff084e 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ja-JP/Resources.resw @@ -765,4 +765,7 @@ 翻訳のみを表示します + + フォントの不透明度(非電流再生エリア) + \ No newline at end of file diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw index e8df292..a51cca9 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/ko-KR/Resources.resw @@ -765,4 +765,7 @@ 번역 만 표시하십시오 + + 글꼴 불투명 (비 전류 재생 영역) + \ No newline at end of file diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw index 75a1154..23fd639 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-CN/Resources.resw @@ -765,4 +765,7 @@ 仅显示翻译 + + 字体不透明度(非当前播放区域) + \ No newline at end of file diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw index 337d87e..7228fe7 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Strings/zh-TW/Resources.resw @@ -765,4 +765,7 @@ 僅顯示翻譯 + + 字體不透明度(非目前播放區域) + \ No newline at end of file diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Ctor.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Ctor.cs index cc4f201..69c32e2 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Ctor.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Ctor.cs @@ -51,6 +51,7 @@ namespace BetterLyrics.WinUI3.ViewModels _canvasYScrollTransition.SetDuration(_settingsService.LyricsScrollDuration / 1000f); _canvasYScrollTransition.SetEasingType(_settingsService.LyricsScrollEasingType); + _defaultOpacity = _settingsService.LyricsBgFontOpacity / 100f; _isLyricsFloatAnimationEnabled = _settingsService.IsLyricsFloatAnimationEnabled; diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Messages.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Messages.cs index 243afa9..aff3e2f 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Messages.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.Messages.cs @@ -213,6 +213,11 @@ namespace BetterLyrics.WinUI3.ViewModels { _timelineSyncThreshold = message.NewValue; } + else if (message.PropertyName == nameof(SettingsPageViewModel.LyricsBgFontOpacity)) + { + _defaultOpacity = message.NewValue / 100f; + _isLayoutChanged = true; + } } else if (message.Sender is LyricsPageViewModel) { diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.cs index 4ed7461..6695deb 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/LyricsRendererViewModel.cs @@ -58,7 +58,7 @@ namespace BetterLyrics.WinUI3.ViewModels private float _canvasWidth = 0f; private float _canvasHeight = 0f; - private readonly float _defaultOpacity = 0.3f; + private float _defaultOpacity; private readonly float _highlightedOpacity = 1.0f; private readonly float _defaultScale = 0.75f; diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SettingsPageViewModel.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SettingsPageViewModel.cs index a16f0d8..0e0e30b 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SettingsPageViewModel.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/ViewModels/SettingsPageViewModel.cs @@ -96,6 +96,7 @@ namespace BetterLyrics.WinUI3.ViewModels LXMusicServer = _settingsService.LXMusicServer; DockPlacement = _settingsService.DockPlacement; + LyricsBgFontOpacity = _settingsService.LyricsBgFontOpacity; _playbackService.MediaSourceProvidersInfoChanged += PlaybackService_SessionIdsChanged; @@ -201,6 +202,10 @@ namespace BetterLyrics.WinUI3.ViewModels [NotifyPropertyChangedRecipients] public partial Color LyricsCustomStrokeFontColor { get; set; } + [ObservableProperty] + [NotifyPropertyChangedRecipients] + public partial int LyricsBgFontOpacity { get; set; } + [ObservableProperty] [NotifyPropertyChangedRecipients] public partial LyricsFontColorType LyricsBgFontColorType { get; set; } @@ -661,5 +666,9 @@ namespace BetterLyrics.WinUI3.ViewModels { _settingsService.ResetPositionOffsetOnSongChanged = value; } + partial void OnLyricsBgFontOpacityChanged(int value) + { + _settingsService.LyricsBgFontOpacity = value; + } } } diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml index a783585..1f31d5a 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsPage.xaml @@ -187,7 +187,7 @@ - + @@ -500,6 +500,25 @@ + + + + + + + + +