style<Preference>: new layout for Preference window

This commit is contained in:
leo 2021-08-05 16:37:29 +08:00
parent eeeeafbf0a
commit 6f5cfe078e
4 changed files with 28 additions and 50 deletions

View file

@ -361,26 +361,25 @@
<sys:String x:Key="Text.Preference">Preference</sys:String>
<sys:String x:Key="Text.Preference.General">GENERAL SETTING</sys:String>
<sys:String x:Key="Text.Preference.Locale">Language :</sys:String>
<sys:String x:Key="Text.Preference.AvatarServer">Avatar Server :</sys:String>
<sys:String x:Key="Text.Preference.Locale">Language</sys:String>
<sys:String x:Key="Text.Preference.AvatarServer">Avatar Server</sys:String>
<sys:String x:Key="Text.Preference.CheckUpdate">Check for update</sys:String>
<sys:String x:Key="Text.Preference.AutoFetch">Fetch remotes automatically (need restart)</sys:String>
<sys:String x:Key="Text.Preference.RestoreTabs">Restore windows</sys:String>
<sys:String x:Key="Text.Preference.Git">GIT SETTING</sys:String>
<sys:String x:Key="Text.Preference.Git.Path">Install Path :</sys:String>
<sys:String x:Key="Text.Preference.Git.Path">Install Path</sys:String>
<sys:String x:Key="Text.Preference.Git.Path.Placeholder">Input path for git.exe</sys:String>
<sys:String x:Key="Text.Preference.Git.Dir">Default Clone Dir :</sys:String>
<sys:String x:Key="Text.Preference.Git.Dir">Default Clone Dir</sys:String>
<sys:String x:Key="Text.Preference.Git.Dir.Placeholder">Default path to clone repo into</sys:String>
<sys:String x:Key="Text.Preference.Git.User">User Name :</sys:String>
<sys:String x:Key="Text.Preference.Git.User">User Name</sys:String>
<sys:String x:Key="Text.Preference.Git.User.Placeholder">Global git user name</sys:String>
<sys:String x:Key="Text.Preference.Git.Email">User Email :</sys:String>
<sys:String x:Key="Text.Preference.Git.Email">User Email</sys:String>
<sys:String x:Key="Text.Preference.Git.Email.Placeholder">Global git user email</sys:String>
<sys:String x:Key="Text.Preference.Git.CRLF">Enable Auto CRLF :</sys:String>
<sys:String x:Key="Text.Preference.Git.CRLF">Enable Auto CRLF</sys:String>
<sys:String x:Key="Text.Preference.Merger">MERGE TOOL</sys:String>
<sys:String x:Key="Text.Preference.Merger.Type">Merger :</sys:String>
<sys:String x:Key="Text.Preference.Merger.Path">Install Path :</sys:String>
<sys:String x:Key="Text.Preference.Merger.Type">Merger</sys:String>
<sys:String x:Key="Text.Preference.Merger.Path">Install Path</sys:String>
<sys:String x:Key="Text.Preference.Merger.Path.Placeholder">Input path for merge tool</sys:String>
<sys:String x:Key="Text.Preference.Merger.Cmd">Command :</sys:String>
<sys:String x:Key="Text.Preference.Dialog.GitExe">Select Git Executable File</sys:String>
<sys:String x:Key="Text.Preference.Dialog.Merger">Select {0} Install Path</sys:String>

View file

@ -360,26 +360,25 @@
<sys:String x:Key="Text.Preference">偏好设置</sys:String>
<sys:String x:Key="Text.Preference.General">通用配置</sys:String>
<sys:String x:Key="Text.Preference.Locale">显示语言 </sys:String>
<sys:String x:Key="Text.Preference.AvatarServer">头像服务 </sys:String>
<sys:String x:Key="Text.Preference.Locale">显示语言</sys:String>
<sys:String x:Key="Text.Preference.AvatarServer">头像服务</sys:String>
<sys:String x:Key="Text.Preference.CheckUpdate">启用检测更新</sys:String>
<sys:String x:Key="Text.Preference.AutoFetch">启用定时自动拉取远程更新(重启生效)</sys:String>
<sys:String x:Key="Text.Preference.RestoreTabs">启动时恢复上次打开的仓库</sys:String>
<sys:String x:Key="Text.Preference.Git">GIT配置</sys:String>
<sys:String x:Key="Text.Preference.Git.Path">安装路径 </sys:String>
<sys:String x:Key="Text.Preference.Git.Path">安装路径</sys:String>
<sys:String x:Key="Text.Preference.Git.Path.Placeholder">填写git.exe所在位置</sys:String>
<sys:String x:Key="Text.Preference.Git.Dir">默认克隆路径 </sys:String>
<sys:String x:Key="Text.Preference.Git.Dir">默认克隆路径</sys:String>
<sys:String x:Key="Text.Preference.Git.Dir.Placeholder">默认的仓库本地存放位置</sys:String>
<sys:String x:Key="Text.Preference.Git.User">用户名 </sys:String>
<sys:String x:Key="Text.Preference.Git.User">用户名</sys:String>
<sys:String x:Key="Text.Preference.Git.User.Placeholder">默认GIT用户名</sys:String>
<sys:String x:Key="Text.Preference.Git.Email">邮箱 </sys:String>
<sys:String x:Key="Text.Preference.Git.Email">邮箱</sys:String>
<sys:String x:Key="Text.Preference.Git.Email.Placeholder">默认GIT用户邮箱</sys:String>
<sys:String x:Key="Text.Preference.Git.CRLF">自动换行转换 </sys:String>
<sys:String x:Key="Text.Preference.Git.CRLF">自动换行转换</sys:String>
<sys:String x:Key="Text.Preference.Merger">外部合并工具</sys:String>
<sys:String x:Key="Text.Preference.Merger.Type">工具 </sys:String>
<sys:String x:Key="Text.Preference.Merger.Path">安装路径 </sys:String>
<sys:String x:Key="Text.Preference.Merger.Type">工具</sys:String>
<sys:String x:Key="Text.Preference.Merger.Path">安装路径</sys:String>
<sys:String x:Key="Text.Preference.Merger.Path.Placeholder">填写工具可执行文件所在位置</sys:String>
<sys:String x:Key="Text.Preference.Merger.Cmd">命令行参数 </sys:String>
<sys:String x:Key="Text.Preference.Dialog.GitExe">选择git.exe所在位置</sys:String>
<sys:String x:Key="Text.Preference.Dialog.Merger">选择{0}所在位置</sys:String>

View file

@ -69,12 +69,11 @@
<RowDefinition Height="36"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="6"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="132"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
@ -90,7 +89,7 @@
Grid.Row="1" Grid.Column="0"
Text="{DynamicResource Text.Preference.Locale}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="1" Grid.Column="1"
Height="24"
@ -105,7 +104,7 @@
Grid.Row="2" Grid.Column="0"
Text="{DynamicResource Text.Preference.AvatarServer}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="2" Grid.Column="1"
Height="24"
@ -144,7 +143,7 @@
Grid.Row="8" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Path}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
Margin="0,0,8,0"/>
<Grid Grid.Row="8" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
@ -171,7 +170,7 @@
Grid.Row="9" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Dir}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
Margin="0,0,8,0"/>
<Grid Grid.Row="9" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
@ -198,7 +197,7 @@
Grid.Row="10" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.User}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
Margin="0,0,8,0"/>
<controls:TextEdit
Grid.Row="10" Grid.Column="1"
Height="24"
@ -210,7 +209,7 @@
Grid.Row="11" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Email}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
Margin="0,0,8,0"/>
<controls:TextEdit
Grid.Row="11" Grid.Column="1"
Height="24"
@ -222,7 +221,7 @@
Grid.Row="12" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.CRLF}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="12" Grid.Column="1"
Height="24"
@ -251,7 +250,7 @@
Grid.Row="15" Grid.Column="0"
Text="{DynamicResource Text.Preference.Merger.Type}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
Margin="0,0,8,0"/>
<ComboBox
Grid.Row="15" Grid.Column="1"
Height="24"
@ -266,7 +265,7 @@
Grid.Row="16" Grid.Column="0"
Text="{DynamicResource Text.Preference.Merger.Path}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
Margin="0,0,8,0"/>
<Grid Grid.Row="16" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
@ -287,18 +286,6 @@
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"
Icon="{StaticResource Icon.Folder.Open}"/>
</Grid>
<!-- Merge Tool Command -->
<TextBlock
Grid.Row="17" Grid.Column="0"
Text="{DynamicResource Text.Preference.Merger.Cmd}"
HorizontalAlignment="Right"
Margin="0,0,6,0"/>
<TextBlock
Grid.Row="17" Grid.Column="1"
x:Name="txtMergeCmd"
Text="{Binding ElementName=me, Path=MergeCmd}"
Foreground="{DynamicResource Brush.FG2}"/>
</Grid>
</Grid>
</controls:Window>

View file

@ -13,7 +13,6 @@ namespace SourceGit.Views {
public string User { get; set; }
public string Email { get; set; }
public string CRLF { get; set; }
public string MergeCmd { get; set; }
public Preference() {
if (Models.Preference.Instance.IsReady) {
@ -27,9 +26,6 @@ namespace SourceGit.Views {
CRLF = "false";
}
var merger = Models.MergeTool.Supported.Find(x => x.Type == Models.Preference.Instance.MergeTool.Type);
if (merger != null) MergeCmd = merger.Cmd;
InitializeComponent();
}
@ -84,9 +80,6 @@ namespace SourceGit.Views {
var tool = Models.MergeTool.Supported.Find(x => x.Type == type);
if (tool == null) return;
MergeCmd = tool.Cmd;
txtMergeCmd?.GetBindingExpression(TextBlock.TextProperty).UpdateTarget();
if (IsLoaded) {
Models.Preference.Instance.MergeTool.Path = tool.Finder();
txtMergeExec?.GetBindingExpression(TextBox.TextProperty).UpdateTarget();