ux: re-arrange options in apperance page

This commit is contained in:
leo 2024-06-05 18:32:55 +08:00
parent 7d49d2b913
commit 7b71f8512d
No known key found for this signature in database
GPG key ID: B528468E49CD0E58
3 changed files with 22 additions and 34 deletions

View file

@ -132,14 +132,10 @@ namespace SourceGit
var app = Current as App; var app = Current as App;
var targetLocale = app.Resources[localeKey] as ResourceDictionary; var targetLocale = app.Resources[localeKey] as ResourceDictionary;
if (targetLocale == null || targetLocale == app._activeLocale) if (targetLocale == null || targetLocale == app._activeLocale)
{
return; return;
}
if (app._activeLocale != null) if (app._activeLocale != null)
{
app.Resources.MergedDictionaries.Remove(app._activeLocale); app.Resources.MergedDictionaries.Remove(app._activeLocale);
}
app.Resources.MergedDictionaries.Add(targetLocale); app.Resources.MergedDictionaries.Add(targetLocale);
app._activeLocale = targetLocale; app._activeLocale = targetLocale;
@ -150,17 +146,11 @@ namespace SourceGit
var app = Current as App; var app = Current as App;
if (theme.Equals("Light", StringComparison.OrdinalIgnoreCase)) if (theme.Equals("Light", StringComparison.OrdinalIgnoreCase))
{
app.RequestedThemeVariant = ThemeVariant.Light; app.RequestedThemeVariant = ThemeVariant.Light;
}
else if (theme.Equals("Dark", StringComparison.OrdinalIgnoreCase)) else if (theme.Equals("Dark", StringComparison.OrdinalIgnoreCase))
{
app.RequestedThemeVariant = ThemeVariant.Dark; app.RequestedThemeVariant = ThemeVariant.Dark;
}
else else
{
app.RequestedThemeVariant = ThemeVariant.Default; app.RequestedThemeVariant = ThemeVariant.Default;
}
if (app._colorOverrides != null) if (app._colorOverrides != null)
{ {
@ -173,6 +163,7 @@ namespace SourceGit
try try
{ {
var resDic = new ResourceDictionary(); var resDic = new ResourceDictionary();
var schema = JsonSerializer.Deserialize(File.ReadAllText(colorsFile), JsonCodeGen.Default.DictionaryStringString); var schema = JsonSerializer.Deserialize(File.ReadAllText(colorsFile), JsonCodeGen.Default.DictionaryStringString);
foreach (var kv in schema) foreach (var kv in schema)
resDic[kv.Key] = Color.Parse(kv.Value); resDic[kv.Key] = Color.Parse(kv.Value);
@ -191,9 +182,7 @@ namespace SourceGit
if (Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) if (Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{ {
if (desktop.MainWindow.Clipboard is { } clipbord) if (desktop.MainWindow.Clipboard is { } clipbord)
{
await clipbord.SetTextAsync(data); await clipbord.SetTextAsync(data);
}
} }
} }

View file

@ -100,7 +100,6 @@ namespace SourceGit.ViewModels
{ {
SetProgressDescription("Fetching from added remote ..."); SetProgressDescription("Fetching from added remote ...");
new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null); new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
new Commands.Fetch(_repo.FullPath, _name, true, SetProgressDescription).Exec(); new Commands.Fetch(_repo.FullPath, _name, true, SetProgressDescription).Exec();
} }
CallUIThread(() => CallUIThread(() =>

View file

@ -163,25 +163,10 @@
</ComboBox> </ComboBox>
<TextBlock Grid.Row="1" Grid.Column="0" <TextBlock Grid.Row="1" Grid.Column="0"
Text="{DynamicResource Text.Preference.Appearance.ColorOverrides}"
HorizontalAlignment="Right"
Margin="0,0,16,0"/>
<TextBox Grid.Row="1" Grid.Column="1"
Height="28"
CornerRadius="3"
Text="{Binding ColorOverrides, Mode=TwoWay}">
<TextBox.InnerRightContent>
<Button Classes="icon_button" Width="30" Height="30" Click="SelectColorSchemaFile">
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
</Button>
</TextBox.InnerRightContent>
</TextBox>
<TextBlock Grid.Row="2" Grid.Column="0"
Text="{DynamicResource Text.Preference.Appearance.DefaultFont}" Text="{DynamicResource Text.Preference.Appearance.DefaultFont}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,16,0"/> Margin="0,0,16,0"/>
<ComboBox Grid.Row="2" Grid.Column="1" <ComboBox Grid.Row="1" Grid.Column="1"
MinHeight="28" MinHeight="28"
Padding="8,0" Padding="8,0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
@ -196,11 +181,11 @@
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
<TextBlock Grid.Row="3" Grid.Column="0" <TextBlock Grid.Row="2" Grid.Column="0"
Text="{DynamicResource Text.Preference.Appearance.MonospaceFont}" Text="{DynamicResource Text.Preference.Appearance.MonospaceFont}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,16,0"/> Margin="0,0,16,0"/>
<ComboBox Grid.Row="3" Grid.Column="1" <ComboBox Grid.Row="2" Grid.Column="1"
MinHeight="28" MinHeight="28"
Padding="8,0" Padding="8,0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
@ -215,11 +200,11 @@
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
<TextBlock Grid.Row="4" Grid.Column="0" <TextBlock Grid.Row="3" Grid.Column="0"
Text="{DynamicResource Text.Preference.Appearance.DefaultFontSize}" Text="{DynamicResource Text.Preference.Appearance.DefaultFontSize}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,16,0"/> Margin="0,0,16,0"/>
<NumericUpDown Grid.Row="4" Grid.Column="1" <NumericUpDown Grid.Row="3" Grid.Column="1"
Minimum="10" Maximum="16" Increment="0.5" Minimum="10" Maximum="16" Increment="0.5"
Height="28" Height="28"
Padding="4" Padding="4"
@ -239,6 +224,21 @@
</Style> </Style>
</NumericUpDown.Styles> </NumericUpDown.Styles>
</NumericUpDown> </NumericUpDown>
<TextBlock Grid.Row="4" Grid.Column="0"
Text="{DynamicResource Text.Preference.Appearance.ColorOverrides}"
HorizontalAlignment="Right"
Margin="0,0,16,0"/>
<TextBox Grid.Row="4" Grid.Column="1"
Height="28"
CornerRadius="3"
Text="{Binding ColorOverrides, Mode=TwoWay}">
<TextBox.InnerRightContent>
<Button Classes="icon_button" Width="30" Height="30" Click="SelectColorSchemaFile">
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
</Button>
</TextBox.InnerRightContent>
</TextBox>
</Grid> </Grid>
</TabItem> </TabItem>