mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
Merge branch 'develop' into feature/treedatagrid
This commit is contained in:
commit
cce4e5348c
8 changed files with 56 additions and 7 deletions
|
@ -1,12 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using Avalonia.Data.Converters;
|
using Avalonia.Data.Converters;
|
||||||
using Avalonia.Styling;
|
using Avalonia.Styling;
|
||||||
|
|
||||||
namespace SourceGit.Converters
|
namespace SourceGit.Converters
|
||||||
{
|
{
|
||||||
public static class StringConverters
|
public static partial class StringConverters
|
||||||
{
|
{
|
||||||
public class ToLocaleConverter : IValueConverter
|
public class ToLocaleConverter : IValueConverter
|
||||||
{
|
{
|
||||||
|
@ -69,5 +70,26 @@ namespace SourceGit.Converters
|
||||||
|
|
||||||
public static readonly FuncValueConverter<string, string> ToShortSHA =
|
public static readonly FuncValueConverter<string, string> ToShortSHA =
|
||||||
new FuncValueConverter<string, string>(v => v.Length > 10 ? v.Substring(0, 10) : v);
|
new FuncValueConverter<string, string>(v => v.Length > 10 ? v.Substring(0, 10) : v);
|
||||||
|
|
||||||
|
public static readonly FuncValueConverter<string, bool> UnderRecommendGitVersion =
|
||||||
|
new(v =>
|
||||||
|
{
|
||||||
|
var match = REG_GIT_VERSION().Match(v ?? "");
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
var major = int.Parse(match.Groups[1].Value);
|
||||||
|
var minor = int.Parse(match.Groups[2].Value);
|
||||||
|
var build = int.Parse(match.Groups[3].Value);
|
||||||
|
|
||||||
|
return new Version(major, minor, build) < MINIMAL_GIT_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^[\s\w]*(\d+)\.(\d+)[\.\-](\d+).*$")]
|
||||||
|
private static partial Regex REG_GIT_VERSION();
|
||||||
|
|
||||||
|
private static readonly Version MINIMAL_GIT_VERSION = new Version(2, 23, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,6 +308,7 @@
|
||||||
<x:String x:Key="Text.Preference.Git.User" xml:space="preserve">User Name</x:String>
|
<x:String x:Key="Text.Preference.Git.User" xml:space="preserve">User Name</x:String>
|
||||||
<x:String x:Key="Text.Preference.Git.User.Placeholder" xml:space="preserve">Global git user name</x:String>
|
<x:String x:Key="Text.Preference.Git.User.Placeholder" xml:space="preserve">Global git user name</x:String>
|
||||||
<x:String x:Key="Text.Preference.Git.Version" xml:space="preserve">Git version</x:String>
|
<x:String x:Key="Text.Preference.Git.Version" xml:space="preserve">Git version</x:String>
|
||||||
|
<x:String x:Key="Text.Preference.Git.Invalid" xml:space="preserve">Git (>= 2.23.0) is required by this app</x:String>
|
||||||
<x:String x:Key="Text.Preference.GPG" xml:space="preserve">GPG SIGNING</x:String>
|
<x:String x:Key="Text.Preference.GPG" xml:space="preserve">GPG SIGNING</x:String>
|
||||||
<x:String x:Key="Text.Preference.GPG.Enabled" xml:space="preserve">Commit GPG signing</x:String>
|
<x:String x:Key="Text.Preference.GPG.Enabled" xml:space="preserve">Commit GPG signing</x:String>
|
||||||
<x:String x:Key="Text.Preference.GPG.Path" xml:space="preserve">Install Path</x:String>
|
<x:String x:Key="Text.Preference.GPG.Path" xml:space="preserve">Install Path</x:String>
|
||||||
|
|
|
@ -308,6 +308,7 @@
|
||||||
<x:String x:Key="Text.Preference.Git.User" xml:space="preserve">用户名</x:String>
|
<x:String x:Key="Text.Preference.Git.User" xml:space="preserve">用户名</x:String>
|
||||||
<x:String x:Key="Text.Preference.Git.User.Placeholder" xml:space="preserve">默认GIT用户名</x:String>
|
<x:String x:Key="Text.Preference.Git.User.Placeholder" xml:space="preserve">默认GIT用户名</x:String>
|
||||||
<x:String x:Key="Text.Preference.Git.Version" xml:space="preserve">Git 版本</x:String>
|
<x:String x:Key="Text.Preference.Git.Version" xml:space="preserve">Git 版本</x:String>
|
||||||
|
<x:String x:Key="Text.Preference.Git.Invalid" xml:space="preserve">本软件要求GIT最低版本为2.23.0</x:String>
|
||||||
<x:String x:Key="Text.Preference.GPG" xml:space="preserve">GPG签名</x:String>
|
<x:String x:Key="Text.Preference.GPG" xml:space="preserve">GPG签名</x:String>
|
||||||
<x:String x:Key="Text.Preference.GPG.Enabled" xml:space="preserve">启用提交签名</x:String>
|
<x:String x:Key="Text.Preference.GPG.Enabled" xml:space="preserve">启用提交签名</x:String>
|
||||||
<x:String x:Key="Text.Preference.GPG.Path" xml:space="preserve">可执行文件位置</x:String>
|
<x:String x:Key="Text.Preference.GPG.Path" xml:space="preserve">可执行文件位置</x:String>
|
||||||
|
|
|
@ -60,6 +60,12 @@
|
||||||
</Animation>
|
</Animation>
|
||||||
</Style.Animations>
|
</Style.Animations>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style Selector="Path.change_mode_switcher_icon">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource Brush.FG2}"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Button:pointerover Path.change_mode_switcher_icon">
|
||||||
|
<Setter Property="Fill" Value="{DynamicResource Brush.Accent}"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="TextBlock">
|
<Style Selector="TextBlock">
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
|
|
@ -30,6 +30,6 @@
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
</Button.Flyout>
|
</Button.Flyout>
|
||||||
|
|
||||||
<Path Stretch="Uniform" Fill="{DynamicResource Brush.FG2}" Data="{Binding ViewMode, Converter={x:Static c:ChangeViewModeConverters.ToIcon}}"/>
|
<Path Classes="change_mode_switcher_icon" Stretch="Uniform" Data="{Binding ViewMode, Converter={x:Static c:ChangeViewModeConverters.ToIcon}}"/>
|
||||||
</Button>
|
</Button>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto">
|
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto">
|
||||||
<v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/>
|
<v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/>
|
||||||
<TextBlock Grid.Column="1" Classes="monospace" Text="{Binding Author.Name}" Margin="8,0,0,0"/>
|
<TextBlock Grid.Column="1" Classes="monospace" Text="{Binding Author.Name}" Margin="8,0,0,0"/>
|
||||||
<TextBlock Grid.Column="2" Classes="monospace" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange" Margin="8,0,0,0" TextDecorations="Underline" Cursor="Hand"/>
|
<TextBlock Grid.Column="2" Classes="monospace" Text="{Binding SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange" Margin="8,0,0,0"/>
|
||||||
<TextBlock Grid.Column="3" Classes="monospace" Text="{Binding AuthorTimeShortStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
|
<TextBlock Grid.Column="3" Classes="monospace" Text="{Binding AuthorTimeShortStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|
|
@ -251,8 +251,18 @@
|
||||||
Text="{DynamicResource Text.Preference.Git.Version}"
|
Text="{DynamicResource Text.Preference.Git.Version}"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Margin="0,0,16,0"/>
|
Margin="0,0,16,0"/>
|
||||||
<TextBlock Grid.Row="1" Grid.Column="1"
|
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
|
||||||
x:Name="txtVersion"/>
|
<TextBlock Classes="monospace"
|
||||||
|
Margin="0,0,8,0"
|
||||||
|
Text="{Binding #me.GitVersion}"
|
||||||
|
IsVisible="{Binding #me.GitVersion, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||||
|
|
||||||
|
<Border Background="Transparent"
|
||||||
|
ToolTip.Tip="{DynamicResource Text.Preference.Git.Invalid}"
|
||||||
|
IsVisible="{Binding #me.GitVersion, Converter={x:Static c:StringConverters.UnderRecommendGitVersion}}">
|
||||||
|
<Path Width="14" Height="14" Data="{StaticResource Icons.Error}" Fill="Red"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<Border Grid.Row="2" Grid.Column="0"
|
<Border Grid.Row="2" Grid.Column="0"
|
||||||
Height="32"
|
Height="32"
|
||||||
|
|
|
@ -45,6 +45,15 @@ namespace SourceGit.Views
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<string> GitVersionProperty =
|
||||||
|
AvaloniaProperty.Register<Preference, string>(nameof(GitVersion));
|
||||||
|
|
||||||
|
public string GitVersion
|
||||||
|
{
|
||||||
|
get => GetValue(GitVersionProperty);
|
||||||
|
set => SetValue(GitVersionProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
public bool EnableGPGSigning
|
public bool EnableGPGSigning
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
@ -140,7 +149,7 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
txtVersion.Text = ver;
|
GitVersion = ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
||||||
|
@ -189,7 +198,7 @@ namespace SourceGit.Views
|
||||||
if (selected.Count == 1)
|
if (selected.Count == 1)
|
||||||
{
|
{
|
||||||
ViewModels.Preference.Instance.GitInstallPath = selected[0].Path.LocalPath;
|
ViewModels.Preference.Instance.GitInstallPath = selected[0].Path.LocalPath;
|
||||||
txtVersion.Text = new Commands.Version().Query();
|
GitVersion = new Commands.Version().Query();
|
||||||
}
|
}
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
|
Loading…
Reference in a new issue