sourcegit/src/Views/Preference.xaml

433 lines
21 KiB
XML

<controls:Window
x:Class="SourceGit.Views.Preference"
x:Name="me"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
Title="{DynamicResource Text.Preference}"
Width="500" Height="312">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Title bar -->
<Grid Grid.Row="0" Background="{DynamicResource Brush.TitleBar}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Icon -->
<Path Grid.Column="0" Width="14" Height="14" Margin="6,0" Data="{StaticResource Icon.Preference}"/>
<!-- Title -->
<TextBlock Grid.Column="1" Text="{DynamicResource Text.Preference}"/>
<!-- Close -->
<controls:IconButton
Grid.Column="3"
Click="Quit"
Width="28" IconSize="10"
Icon="{StaticResource Icon.Close}"
HoverBackground="Red"
WindowChrome.IsHitTestVisibleInChrome="True"/>
</Grid>
<Rectangle
Grid.Row="1"
HorizontalAlignment="Stretch"
Fill="{DynamicResource Brush.Border0}"/>
<!-- Tabs -->
<TabControl Grid.Row="2" Margin="0,4">
<!-- General Setting -->
<TabItem Header="{DynamicResource Text.Preference.General}">
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Language -->
<TextBlock
Grid.Row="0" Grid.Column="0"
Text="{DynamicResource Text.Preference.Locale}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="0" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:Locale.Supported}}"
DisplayMemberPath="Name"
SelectedValuePath="Resource"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.Locale, Mode=TwoWay}"
SelectionChanged="LocaleChanged"/>
<!-- System Font -->
<TextBlock
Grid.Row="1" Grid.Column="0"
Text="{DynamicResource Text.Preference.FontFamilyWindow}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="1" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:InstalledFont.GetFonts}}"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyWindow, Mode=TwoWay, Converter={StaticResource FontFamiliesToName}}"
DisplayMemberPath="Name"
SelectedValuePath="Name"
SelectionChanged="LocaleChanged">
<ComboBox.Resources>
<Style TargetType="ComboBoxItem">
<Setter Property="FontFamily" Value="{Binding Name}"/>
<Setter Property="ToolTip" Value="{Binding Name}"/>
</Style>
</ComboBox.Resources>
</ComboBox>
<!-- Content Font -->
<TextBlock
Grid.Row="2" Grid.Column="0"
Text="{DynamicResource Text.Preference.FontFamilyContent}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="2" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:InstalledFont.GetFonts}}"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=TwoWay, Converter={StaticResource FontFamiliesToName}}"
DisplayMemberPath="Name"
SelectedValuePath="Name"
SelectionChanged="LocaleChanged">
<ComboBox.Resources>
<Style TargetType="ComboBoxItem">
<Setter Property="FontFamily" Value="{Binding Name}"/>
<Setter Property="ToolTip" Value="{Binding Name}"/>
</Style>
</ComboBox.Resources>
</ComboBox>
<!-- Max Number Of Displayed Commits -->
<TextBlock
Grid.Row="3" Grid.Column="0"
Text="{DynamicResource Text.Preference.MaxHistoryCommits}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<Grid Grid.Row="3" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="48"/>
</Grid.ColumnDefinitions>
<Slider
Grid.Column="0"
Minimum="20000" Maximum="100000"
TickPlacement="BottomRight" TickFrequency="5000" IsSnapToTickEnabled="True"
VerticalAlignment="Center" Foreground="{DynamicResource Brush.Border1}"
Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.MaxHistoryCommits, Mode=TwoWay}">
</Slider>
<TextBlock
Grid.Column="1"
HorizontalAlignment="Right" VerticalAlignment="Center"
Foreground="{DynamicResource Brush.FG1}"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=General.MaxHistoryCommits}"/>
</Grid>
<!-- Enable Dark Theme -->
<CheckBox
Grid.Row="4" Grid.Column="1"
Content="{DynamicResource Text.Preference.UseDarkTheme}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseDarkTheme, Mode=TwoWay}"
Checked="ChangeTheme" Unchecked="ChangeTheme"/>
<!-- Restore Windows -->
<CheckBox
Grid.Row="5" Grid.Column="1"
Content="{DynamicResource Text.Preference.RestoreTabs}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
</Grid>
</TabItem>
<!-- Git Setting -->
<TabItem Header="{DynamicResource Text.Preference.Git}">
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Git Executable Path -->
<TextBlock
Grid.Row="0" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Path}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<Grid Grid.Row="0" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextEdit
Grid.Column="0"
x:Name="editGitPath"
Height="24"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=Git.Path, Mode=TwoWay}"
Placeholder="{DynamicResource Text.Preference.Git.Path.Placeholder}"/>
<controls:IconButton
Grid.Column="1"
Click="SelectGitPath"
Width="24" Height="24"
Margin="4,0,0,0" IconSize="16"
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<!-- Git Version -->
<TextBlock
Grid.Row="1" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Version}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<TextBlock
Grid.Row="1" Grid.Column="1"
x:Name="textGitVersion"
Text="{Binding ElementName=me, Path=Version}"/>
<!-- Default Clone Dir -->
<TextBlock
Grid.Row="2" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Dir}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<Grid Grid.Row="2" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextEdit
Grid.Column="0"
x:Name="txtGitCloneDir"
Height="24"
Placeholder="{DynamicResource Text.Preference.Git.Dir.Placeholder}"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=Git.DefaultCloneDir, Mode=TwoWay}"/>
<controls:IconButton
Grid.Column="1"
Click="SelectGitCloneDir"
Width="24" Height="24"
Margin="4,0,0,0" IconSize="16"
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<!-- User -->
<TextBlock
Grid.Row="3" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.User}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<controls:TextEdit
Grid.Row="3" Grid.Column="1"
x:Name="editGitUser"
Height="24"
Text="{Binding ElementName=me, Path=User, Mode=TwoWay}"
Placeholder="{DynamicResource Text.Preference.Git.User.Placeholder}"/>
<!-- Email -->
<TextBlock
Grid.Row="4" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Email}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<controls:TextEdit
Grid.Row="4" Grid.Column="1"
x:Name="editGitEmail"
Height="24"
Text="{Binding ElementName=me, Path=Email, Mode=TwoWay}"
Placeholder="{DynamicResource Text.Preference.Git.Email.Placeholder}"/>
<!-- CRLF -->
<TextBlock
Grid.Row="5" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.CRLF}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="5" Grid.Column="1"
x:Name="editGitCrlf"
Height="24"
ItemsSource="{Binding Source={x:Static models:CRLFOption.Supported}}"
SelectedValuePath="Value"
SelectedValue="{Binding ElementName=me, Path=CRLF, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="20">
<TextBlock Text="{Binding Display}" Margin="2,0"/>
<TextBlock Text="{Binding Desc}" Margin="8,0,0,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Auto Fetch -->
<CheckBox
Grid.Row="6" Grid.Column="1"
VerticalAlignment="Bottom"
Content="{DynamicResource Text.Preference.Git.AutoFetch}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Git.AutoFetchRemotes, Mode=TwoWay}"/>
</Grid>
</TabItem>
<!-- GPG Signing -->
<TabItem Header="{DynamicResource Text.GPG}">
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0" Grid.Column="0"
Text="{DynamicResource Text.GPG.Enabled}"
HorizontalAlignment="Right"/>
<CheckBox
Grid.Row="0" Grid.Column="2"
IsChecked="{Binding ElementName=me, Path=GPGSigningEnabled, Mode=TwoWay}"/>
<TextBlock
Grid.Row="1" Grid.Column="0"
Text="{DynamicResource Text.GPG.Path}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<Grid Grid.Row="1" Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextEdit
Grid.Column="0"
Height="24"
x:Name="txtGPGExec"
Placeholder="{DynamicResource Text.GPG.Path.Placeholder}"
Text="{Binding ElementName=me, Path=GPGExec, Mode=TwoWay}"/>
<controls:IconButton
Grid.Column="1"
Click="SelectGPGExec"
Width="24" Height="24"
Margin="4,0,0,0" IconSize="16"
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<TextBlock
Grid.Row="2" Grid.Column="0"
Text="{DynamicResource Text.GPG.UserKey}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<controls:TextEdit
Grid.Row="2" Grid.Column="2"
Height="24"
Text="{Binding ElementName=me, Path=GPGUserSigningKey, Mode=TwoWay}"
Placeholder="{DynamicResource Text.GPG.UserKey.Placeholder}"/>
</Grid>
</TabItem>
<!-- External Merger -->
<TabItem Header="{DynamicResource Text.Preference.Merger}">
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Merge Tool Type -->
<TextBlock
Grid.Row="0" Grid.Column="0"
Text="{DynamicResource Text.Preference.Merger.Type}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="0" Grid.Column="1"
Height="24"
ItemsSource="{Binding Source={x:Static models:MergeTool.Supported}}"
DisplayMemberPath="Name"
SelectedValuePath="Type"
SelectedValue="{Binding Source={x:Static models:Preference.Instance}, Path=MergeTool.Type, Mode=TwoWay}"
SelectionChanged="MergeToolChanged"/>
<!-- Merge Tool Executable Path -->
<TextBlock
Grid.Row="1" Grid.Column="0"
Text="{DynamicResource Text.Preference.Merger.Path}"
HorizontalAlignment="Right"
Margin="0,0,8,0"/>
<Grid Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextEdit
Grid.Column="0"
Height="24"
x:Name="txtMergeExec"
Placeholder="{DynamicResource Text.Preference.Merger.Path.Placeholder}"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=MergeTool.Path, Mode=TwoWay}"/>
<controls:IconButton
Grid.Column="1"
Click="SelectMergeTool"
Width="24" Height="24"
Margin="4,0,0,0" IconSize="16"
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
</Grid>
</TabItem>
</TabControl>
</Grid>
</controls:Window>