Add settings UI for theme and language (#780)

This commit is contained in:
Jeffrey
2026-10-04 22:43:56 +02:00
committed by GitHub
parent 680f21ccfa
commit 0bc0c9a49e
27 changed files with 1216 additions and 144 deletions
+2 -17
View File
@@ -363,6 +363,7 @@
</TextBlock>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button x:Name="KofiBtn" shell:WindowChrome.IsHitTestVisibleInChrome="True" Content="&#xEB52;" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="%LANG:TitleBarSupportCreator%" AutomationProperties.Name="%LANG:TitleBarSupportCreator%"/>
<Button x:Name="SettingsBtn" shell:WindowChrome.IsHitTestVisibleInChrome="True" Content="&#xE713;" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="%LANG:SettingsTitle%" AutomationProperties.Name="%LANG:SettingsTitle%"/>
<Button x:Name="MenuBtn" shell:WindowChrome.IsHitTestVisibleInChrome="True" Content="&#xE700;" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="%LANG:TitleBarOptions%" AutomationProperties.Name="%LANG:TitleBarOptions%">
<Button.ContextMenu>
<ContextMenu x:Name="MainMenu">
@@ -685,23 +686,7 @@
</ScrollViewer>
<Border x:Name="LoadingAppsIndicator" CornerRadius="0,0,4,4" Background="{DynamicResource CardBgColor}" Opacity="0.8" Visibility="Collapsed">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="&#xF16A;" FontFamily="{DynamicResource AppIconFontFamily}" FontSize="28" Foreground="{DynamicResource AppFgColor}" HorizontalAlignment="Center" Margin="0,0,0,8" RenderTransformOrigin="0.5,0.5">
<TextBlock.RenderTransform>
<RotateTransform Angle="0"/>
</TextBlock.RenderTransform>
<TextBlock.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="0" To="360"
Duration="0:0:1.5"
RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>
<TextBlock Style="{DynamicResource LoadingSpinnerStyle}" Margin="0,0,0,8"/>
<TextBlock Text="%LANG:AppLoadingIndicator%" FontSize="16" FontWeight="SemiBold" Foreground="{DynamicResource AppFgColor}" HorizontalAlignment="Center"/>
</StackPanel>
</Border>
+71
View File
@@ -0,0 +1,71 @@
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="%LANG:SettingsTitle%" Width="500" SizeToContent="Height"
ResizeMode="NoResize" WindowStartupLocation="CenterOwner" WindowStyle="None"
AllowsTransparency="True" Background="Transparent" ShowInTaskbar="False">
<Border Style="{DynamicResource ModalCardBorderStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid x:Name="TitleBar" Style="{DynamicResource ModalTitleBarStyle}">
<TextBlock Text="%LANG:SettingsTitle%" Style="{DynamicResource ModalTitleTextStyle}" HorizontalAlignment="Left"/>
</Grid>
<Button x:Name="CloseBtn" Grid.Row="0"
HorizontalAlignment="Right" VerticalAlignment="Top"
Width="36" Height="32"
BorderThickness="0" IsCancel="True"
Cursor="Hand"
ToolTip="%LANG:TitleBarClose%"
AutomationProperties.Name="%LANG:TitleBarClose%">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" BorderThickness="0" CornerRadius="0,8,0,0">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<Button.Style>
<Style TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource AppFgColor}"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource TitleBarCloseHoverColor}"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
<TextBlock Text="&#xE8BB;" FontFamily="{DynamicResource AppIconFontFamily}" FontSize="10"/>
</Button>
<StackPanel Grid.Row="1" Margin="20,4,20,10">
<TextBlock Text="%LANG:SettingsTheme%" Style="{DynamicResource ModalInfoLabelTextStyle}" HorizontalAlignment="Left" Margin="0,0,0,10"/>
<UniformGrid Columns="3" Margin="0,0,0,20">
<Button x:Name="ThemeAutoButton" Tag="Auto" Style="{DynamicResource SecondaryButtonStyle}" Height="32" Padding="12,0" Margin="0,0,6,0" AutomationProperties.Name="%LANG:SettingsThemeAuto%">
<StackPanel Orientation="Horizontal"><TextBlock Text="&#xE770;" FontFamily="{DynamicResource AppIconFontFamily}" Margin="0,0,8,0" VerticalAlignment="Center"/><TextBlock Text="%LANG:SettingsThemeAuto%"/></StackPanel>
</Button>
<Button x:Name="ThemeLightButton" Tag="Light" Style="{DynamicResource SecondaryButtonStyle}" Height="32" Padding="12,0" Margin="3,0,3,0" AutomationProperties.Name="%LANG:SettingsThemeLight%">
<StackPanel Orientation="Horizontal"><TextBlock Text="&#xE706;" FontFamily="{DynamicResource AppIconFontFamily}" Margin="0,0,8,0" VerticalAlignment="Center"/><TextBlock Text="%LANG:SettingsThemeLight%"/></StackPanel>
</Button>
<Button x:Name="ThemeDarkButton" Tag="Dark" Style="{DynamicResource SecondaryButtonStyle}" Height="32" Padding="12,0" Margin="6,0,0,0" AutomationProperties.Name="%LANG:SettingsThemeDark%">
<StackPanel Orientation="Horizontal"><TextBlock Text="&#xE708;" FontFamily="{DynamicResource AppIconFontFamily}" Margin="0,0,8,0" VerticalAlignment="Center"/><TextBlock Text="%LANG:SettingsThemeDark%"/></StackPanel>
</Button>
</UniformGrid>
<TextBlock Text="%LANG:SettingsLanguage%" Style="{DynamicResource ModalInfoLabelTextStyle}" HorizontalAlignment="Left" Margin="0,0,0,10"/>
<ComboBox x:Name="SettingsLanguageCombo" AutomationProperties.Name="%LANG:SettingsLanguage%"/>
<TextBlock x:Name="SettingsErrorText" Style="{DynamicResource ModalSubtextStyle}" Visibility="Collapsed" Margin="0,12,0,0"/>
</StackPanel>
<Border Grid.Row="2" Style="{DynamicResource ModalFooterBorderStyle}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="SaveButton" Grid.Column="1" Content="%LANG:SettingsSave%" IsDefault="True" Padding="12,0" Style="{DynamicResource ModalPrimaryStretchedButtonStyle}"/>
</Grid>
</Border>
</Grid>
</Border>
</Window>
+24
View File
@@ -1,6 +1,30 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Loading spinner for app inventory. -->
<Style x:Key="LoadingSpinnerStyle" TargetType="TextBlock">
<Setter Property="Text" Value="&#xF16A;"/>
<Setter Property="FontFamily" Value="{DynamicResource AppIconFontFamily}"/>
<Setter Property="FontSize" Value="28"/>
<Setter Property="Foreground" Value="{DynamicResource AppFgColor}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="RenderTransform"><Setter.Value><RotateTransform Angle="0"/></Setter.Value></Setter>
<Style.Triggers>
<Trigger Property="IsVisible" Value="True">
<Trigger.EnterActions>
<BeginStoryboard x:Name="LoadingSpinStoryboard">
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="0" To="360" Duration="0:0:1.5" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions><RemoveStoryboard BeginStoryboardName="LoadingSpinStoryboard"/></Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
<!-- Primary Button Style -->
<Style x:Key="PrimaryButtonStyle" TargetType="Button">
<Setter Property="Background" Value="{DynamicResource ButtonBgColor}"/>