Merge pull request #152 from gadfly3173/fix/git-version

feat: show tooltip if git version too low
This commit is contained in:
leo 2024-05-29 17:56:18 +08:00 committed by GitHub
commit 13f7279c45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 4 deletions

View file

@ -251,8 +251,13 @@
Text="{DynamicResource Text.Preference.Git.Version}"
HorizontalAlignment="Right"
Margin="0,0,16,0"/>
<TextBlock Grid.Row="1" Grid.Column="1"
x:Name="txtVersion"/>
<Grid Grid.Row="1" Grid.Column="1" ColumnDefinitions="Auto,Auto">
<TextBlock Grid.Column="0" Text="{Binding #me.GitVersion, Mode=TwoWay}"/>
<Grid Grid.Column="1" ToolTip.Tip="{DynamicResource Text.Preference.Git.VersionUnderRecommend}" HorizontalAlignment="Left"
Background="Transparent" IsVisible="{Binding #me.GitVersion, Converter={x:Static c:StringConverters.UnderRecommendGitVersion}}">
<Path Width="14" Height="14" Margin="10,0,0,0" Data="{StaticResource Icons.Error}" Fill="Red"/>
</Grid>
</Grid>
<Border Grid.Row="2" Grid.Column="0"
Height="32"

View file

@ -45,6 +45,15 @@ namespace SourceGit.Views
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
{
get;
@ -140,7 +149,7 @@ namespace SourceGit.Views
}
InitializeComponent();
txtVersion.Text = ver;
GitVersion = ver;
}
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
@ -189,7 +198,7 @@ namespace SourceGit.Views
if (selected.Count == 1)
{
ViewModels.Preference.Instance.GitInstallPath = selected[0].Path.LocalPath;
txtVersion.Text = new Commands.Version().Query();
GitVersion = new Commands.Version().Query();
}
e.Handled = true;