This commit is contained in:
Zhe Fang
2025-07-16 20:23:01 -04:00
parent fd5e752b43
commit 59ee2a6fc3
12 changed files with 61 additions and 2 deletions

View File

@@ -54,6 +54,8 @@ namespace BetterLyrics.WinUI3.Services
Color LyricsCustomFgFontColor { get; set; } Color LyricsCustomFgFontColor { get; set; }
Color LyricsCustomStrokeFontColor { get; set; } Color LyricsCustomStrokeFontColor { get; set; }
int LyricsBgFontOpacity { get; set; }
LyricsFontColorType LyricsBgFontColorType { get; set; } LyricsFontColorType LyricsBgFontColorType { get; set; }
LyricsFontColorType LyricsFgFontColorType { get; set; } LyricsFontColorType LyricsFgFontColorType { get; set; }
LyricsFontColorType LyricsStrokeFontColorType { get; set; } LyricsFontColorType LyricsStrokeFontColorType { get; set; }

View File

@@ -95,6 +95,7 @@ namespace BetterLyrics.WinUI3.Services
private const string LockHotKeyIndexKey = "LockHotKeyIndex"; private const string LockHotKeyIndexKey = "LockHotKeyIndex";
private const string DockPlacementKey = "DockPlacement"; private const string DockPlacementKey = "DockPlacement";
private const string LyricsBgFontOpacityKey = "LyricsBgFontOpacity";
private readonly ApplicationDataContainer _localSettings; private readonly ApplicationDataContainer _localSettings;
@@ -219,6 +220,13 @@ namespace BetterLyrics.WinUI3.Services
SetDefault(PositionOffsetKey, 0); SetDefault(PositionOffsetKey, 0);
SetDefault(LockHotKeyIndexKey, 'U' - 'A'); SetDefault(LockHotKeyIndexKey, 'U' - 'A');
SetDefault(DockPlacementKey, (int)DockPlacement.Top); SetDefault(DockPlacementKey, (int)DockPlacement.Top);
SetDefault(LyricsBgFontOpacityKey, 30); // 30%
}
public int LyricsBgFontOpacity
{
get => GetValue<int>(LyricsBgFontOpacityKey);
set => SetValue(LyricsBgFontOpacityKey, value);
} }
public bool ShowTranslationOnly public bool ShowTranslationOnly

View File

@@ -765,4 +765,7 @@
<data name="LyricsPageTranslationOnly.Header" xml:space="preserve"> <data name="LyricsPageTranslationOnly.Header" xml:space="preserve">
<value>Show translation only</value> <value>Show translation only</value>
</data> </data>
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
<value>Font opacity (Non-current playback area)</value>
</data>
</root> </root>

View File

@@ -765,4 +765,7 @@
<data name="LyricsPageTranslationOnly.Header" xml:space="preserve"> <data name="LyricsPageTranslationOnly.Header" xml:space="preserve">
<value>翻訳のみを表示します</value> <value>翻訳のみを表示します</value>
</data> </data>
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
<value>フォントの不透明度(非電流再生エリア)</value>
</data>
</root> </root>

View File

@@ -765,4 +765,7 @@
<data name="LyricsPageTranslationOnly.Header" xml:space="preserve"> <data name="LyricsPageTranslationOnly.Header" xml:space="preserve">
<value>번역 만 표시하십시오</value> <value>번역 만 표시하십시오</value>
</data> </data>
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
<value>글꼴 불투명 (비 전류 재생 영역)</value>
</data>
</root> </root>

View File

@@ -765,4 +765,7 @@
<data name="LyricsPageTranslationOnly.Header" xml:space="preserve"> <data name="LyricsPageTranslationOnly.Header" xml:space="preserve">
<value>仅显示翻译</value> <value>仅显示翻译</value>
</data> </data>
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
<value>字体不透明度(非当前播放区域)</value>
</data>
</root> </root>

View File

@@ -765,4 +765,7 @@
<data name="LyricsPageTranslationOnly.Header" xml:space="preserve"> <data name="LyricsPageTranslationOnly.Header" xml:space="preserve">
<value>僅顯示翻譯</value> <value>僅顯示翻譯</value>
</data> </data>
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
<value>字體不透明度(非目前播放區域)</value>
</data>
</root> </root>

View File

@@ -51,6 +51,7 @@ namespace BetterLyrics.WinUI3.ViewModels
_canvasYScrollTransition.SetDuration(_settingsService.LyricsScrollDuration / 1000f); _canvasYScrollTransition.SetDuration(_settingsService.LyricsScrollDuration / 1000f);
_canvasYScrollTransition.SetEasingType(_settingsService.LyricsScrollEasingType); _canvasYScrollTransition.SetEasingType(_settingsService.LyricsScrollEasingType);
_defaultOpacity = _settingsService.LyricsBgFontOpacity / 100f;
_isLyricsFloatAnimationEnabled = _settingsService.IsLyricsFloatAnimationEnabled; _isLyricsFloatAnimationEnabled = _settingsService.IsLyricsFloatAnimationEnabled;

View File

@@ -213,6 +213,11 @@ namespace BetterLyrics.WinUI3.ViewModels
{ {
_timelineSyncThreshold = message.NewValue; _timelineSyncThreshold = message.NewValue;
} }
else if (message.PropertyName == nameof(SettingsPageViewModel.LyricsBgFontOpacity))
{
_defaultOpacity = message.NewValue / 100f;
_isLayoutChanged = true;
}
} }
else if (message.Sender is LyricsPageViewModel) else if (message.Sender is LyricsPageViewModel)
{ {

View File

@@ -58,7 +58,7 @@ namespace BetterLyrics.WinUI3.ViewModels
private float _canvasWidth = 0f; private float _canvasWidth = 0f;
private float _canvasHeight = 0f; private float _canvasHeight = 0f;
private readonly float _defaultOpacity = 0.3f; private float _defaultOpacity;
private readonly float _highlightedOpacity = 1.0f; private readonly float _highlightedOpacity = 1.0f;
private readonly float _defaultScale = 0.75f; private readonly float _defaultScale = 0.75f;

View File

@@ -96,6 +96,7 @@ namespace BetterLyrics.WinUI3.ViewModels
LXMusicServer = _settingsService.LXMusicServer; LXMusicServer = _settingsService.LXMusicServer;
DockPlacement = _settingsService.DockPlacement; DockPlacement = _settingsService.DockPlacement;
LyricsBgFontOpacity = _settingsService.LyricsBgFontOpacity;
_playbackService.MediaSourceProvidersInfoChanged += PlaybackService_SessionIdsChanged; _playbackService.MediaSourceProvidersInfoChanged += PlaybackService_SessionIdsChanged;
@@ -201,6 +202,10 @@ namespace BetterLyrics.WinUI3.ViewModels
[NotifyPropertyChangedRecipients] [NotifyPropertyChangedRecipients]
public partial Color LyricsCustomStrokeFontColor { get; set; } public partial Color LyricsCustomStrokeFontColor { get; set; }
[ObservableProperty]
[NotifyPropertyChangedRecipients]
public partial int LyricsBgFontOpacity { get; set; }
[ObservableProperty] [ObservableProperty]
[NotifyPropertyChangedRecipients] [NotifyPropertyChangedRecipients]
public partial LyricsFontColorType LyricsBgFontColorType { get; set; } public partial LyricsFontColorType LyricsBgFontColorType { get; set; }
@@ -661,5 +666,9 @@ namespace BetterLyrics.WinUI3.ViewModels
{ {
_settingsService.ResetPositionOffsetOnSongChanged = value; _settingsService.ResetPositionOffsetOnSongChanged = value;
} }
partial void OnLyricsBgFontOpacityChanged(int value)
{
_settingsService.LyricsBgFontOpacity = value;
}
} }
} }

View File

@@ -187,7 +187,7 @@
<TextBlock x:Uid="SettingsPageAppDock" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" /> <TextBlock x:Uid="SettingsPageAppDock" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
<controls:SettingsCard x:Uid="SettingsPageDockPlacement" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=&#xE66A;}"> <controls:SettingsCard x:Uid="SettingsPageDockPlacement" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=&#xE8E3;}">
<ComboBox SelectedIndex="{x:Bind ViewModel.DockPlacement, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}"> <ComboBox SelectedIndex="{x:Bind ViewModel.DockPlacement, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
<ComboBoxItem x:Uid="SettingsPageDockPlacementTop" /> <ComboBoxItem x:Uid="SettingsPageDockPlacementTop" />
<ComboBoxItem x:Uid="SettingsPageDockPlacementBottom" /> <ComboBoxItem x:Uid="SettingsPageDockPlacementBottom" />
@@ -500,6 +500,25 @@
</ComboBox> </ComboBox>
</controls:SettingsCard> </controls:SettingsCard>
<controls:SettingsCard x:Uid="SettingsPageLyricsBgFontOpacity" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=&#xE799;}">
<StackPanel Orientation="Horizontal">
<TextBlock x:Uid="SettingsPageSliderPrefix" VerticalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Text="{x:Bind ViewModel.LyricsBgFontOpacity, Mode=OneWay}" />
<TextBlock
Margin="0,0,14,0"
VerticalAlignment="Center"
Text=" %" />
<Slider
Maximum="100"
Minimum="0"
SnapsTo="Ticks"
StepFrequency="1"
TickFrequency="1"
TickPlacement="Outside"
Value="{x:Bind ViewModel.LyricsBgFontOpacity, Mode=TwoWay}" />
</StackPanel>
</controls:SettingsCard>
<controls:SettingsCard x:Uid="SettingsPageLyricsFontStrokeWidth" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=&#xEC12;}"> <controls:SettingsCard x:Uid="SettingsPageLyricsFontStrokeWidth" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=&#xEC12;}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock x:Uid="SettingsPageSliderPrefix" VerticalAlignment="Center" /> <TextBlock x:Uid="SettingsPageSliderPrefix" VerticalAlignment="Center" />