feature<Preference>: supports for customizing max number of displayed history commits

This commit is contained in:
leo 2023-08-23 11:39:47 +08:00
parent 9006752705
commit 63a6ef256e
5 changed files with 45 additions and 17 deletions

View file

@ -54,7 +54,8 @@ namespace SourceGit.Models {
/// </summary> /// </summary>
public string FontFamilyContentSetting { get; set; } = "Consolas"; public string FontFamilyContentSetting { get; set; } = "Consolas";
[JsonIgnore] public string FontFamilyContent { [JsonIgnore]
public string FontFamilyContent {
get => FontFamilyContentSetting + ",Microsoft YaHei UI"; get => FontFamilyContentSetting + ",Microsoft YaHei UI";
set => FontFamilyContentSetting = value; set => FontFamilyContentSetting = value;
} }
@ -64,6 +65,11 @@ namespace SourceGit.Models {
/// </summary> /// </summary>
public bool UseDarkTheme { get; set; } = false; public bool UseDarkTheme { get; set; } = false;
/// <summary>
/// 历史提交记录最多显示的条目数
/// </summary>
public uint MaxHistoryCommits { get; set; } = 20000;
/// <summary> /// <summary>
/// 起始页仓库列表排序规则 /// 起始页仓库列表排序规则
/// </summary> /// </summary>

View file

@ -355,15 +355,12 @@
<sys:String x:Key="Text.Preference">Preference</sys:String> <sys:String x:Key="Text.Preference">Preference</sys:String>
<sys:String x:Key="Text.Preference.General">GENERAL</sys:String> <sys:String x:Key="Text.Preference.General">GENERAL</sys:String>
<sys:String x:Key="Text.Preference.Locale">Language</sys:String> <sys:String x:Key="Text.Preference.Locale">Display Language</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyWindow">Window Font</sys:String> <sys:String x:Key="Text.Preference.FontFamilyWindow">Window Font</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyContent">Content Font</sys:String> <sys:String x:Key="Text.Preference.FontFamilyContent">Content Font</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.UseDarkTheme">Use dark theme</sys:String> <sys:String x:Key="Text.Preference.UseDarkTheme">Use dark theme</sys:String>
<sys:String x:Key="Text.Preference.RestoreTabs">Restore windows</sys:String> <sys:String x:Key="Text.Preference.RestoreTabs">Restore windows</sys:String>
<sys:String x:Key="Text.Preference.EnableCrashReport">Enable crash report (maybe include related path)</sys:String> <sys:String x:Key="Text.Preference.MaxHistoryCommits">Max History Commits</sys:String>
<sys:String x:Key="Text.Preference.UseWindowsTerminal">Use Windows Terminal instead of cmd.exe</sys:String>
<sys:String x:Key="Text.Preference.Git">GIT</sys:String> <sys:String x:Key="Text.Preference.Git">GIT</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.Path.Placeholder">Input path for git.exe</sys:String>

View file

@ -357,12 +357,9 @@
<sys:String x:Key="Text.Preference.Locale">显示语言</sys:String> <sys:String x:Key="Text.Preference.Locale">显示语言</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyWindow">系统字体</sys:String> <sys:String x:Key="Text.Preference.FontFamilyWindow">系统字体</sys:String>
<sys:String x:Key="Text.Preference.FontFamilyContent">文本字体</sys:String> <sys:String x:Key="Text.Preference.FontFamilyContent">文本字体</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.UseDarkTheme">启用暗色主题</sys:String> <sys:String x:Key="Text.Preference.UseDarkTheme">启用暗色主题</sys:String>
<sys:String x:Key="Text.Preference.RestoreTabs">启动时恢复上次打开的仓库</sys:String> <sys:String x:Key="Text.Preference.RestoreTabs">启动时恢复上次打开的仓库</sys:String>
<sys:String x:Key="Text.Preference.EnableCrashReport">开启崩溃上报(可能涉及上报相关路径)</sys:String> <sys:String x:Key="Text.Preference.MaxHistoryCommits">最大历史提交数</sys:String>
<sys:String x:Key="Text.Preference.UseWindowsTerminal">使用 Windows Terminal 打开 Git 终端</sys:String>
<sys:String x:Key="Text.Preference.Git">GIT配置</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.Path.Placeholder">填写git.exe所在位置</sys:String>

View file

@ -68,7 +68,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
@ -131,16 +131,44 @@
</ComboBox.Resources> </ComboBox.Resources>
</ComboBox> </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="4"/>
<ColumnDefinition Width="56"/>
</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>
<controls:TextEdit
Grid.Column="2"
Height="24"
IsReadOnly="True"
Text="{Binding Source={x:Static models:Preference.Instance}, Path=General.MaxHistoryCommits}"/>
</Grid>
<!-- Enable Dark Theme --> <!-- Enable Dark Theme -->
<CheckBox <CheckBox
Grid.Row="3" Grid.Column="1" Grid.Row="4" Grid.Column="1"
Content="{DynamicResource Text.Preference.UseDarkTheme}" Content="{DynamicResource Text.Preference.UseDarkTheme}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseDarkTheme, Mode=TwoWay}" IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.UseDarkTheme, Mode=TwoWay}"
Checked="ChangeTheme" Unchecked="ChangeTheme"/> Checked="ChangeTheme" Unchecked="ChangeTheme"/>
<!-- Restore Windows --> <!-- Restore Windows -->
<CheckBox <CheckBox
Grid.Row="4" Grid.Column="1" Grid.Row="5" Grid.Column="1"
Content="{DynamicResource Text.Preference.RestoreTabs}" Content="{DynamicResource Text.Preference.RestoreTabs}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/> IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
</Grid> </Grid>
@ -160,7 +188,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
@ -297,7 +325,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="8"/> <ColumnDefinition Width="8"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
@ -358,7 +386,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>

View file

@ -51,7 +51,7 @@ namespace SourceGit.Views.Widgets {
}); });
Task.Run(() => { Task.Run(() => {
var limits = "-20000 "; var limits = $"-{Models.Preference.Instance.General.MaxHistoryCommits} ";
repo.UpdateFilters(); repo.UpdateFilters();
if (repo.Filters.Count > 0) { if (repo.Filters.Count > 0) {