mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-29 16:14:59 +00:00
feature: use Ctrl
+ click to start fetch/pull/push automatically with default options (#351)
This commit is contained in:
parent
2e12717235
commit
965a4b21ae
7 changed files with 78 additions and 9 deletions
|
@ -31,15 +31,36 @@
|
|||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
<Button Classes="icon_button" Width="32" Command="{Binding Fetch}" ToolTip.Tip="{DynamicResource Text.Fetch}">
|
||||
<Button Classes="icon_button" Width="32" Click="Fetch">
|
||||
<ToolTip.Tip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{DynamicResource Text.Fetch}"/>
|
||||
<TextBlock Classes="small italic" Margin="0,4,0,0" Text="{DynamicResource Text.CtrlClickTip}" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
</StackPanel>
|
||||
</ToolTip.Tip>
|
||||
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Fetch}"/>
|
||||
</Button>
|
||||
|
||||
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Command="{Binding Pull}" ToolTip.Tip="{DynamicResource Text.Pull}">
|
||||
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Click="Pull">
|
||||
<ToolTip.Tip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{DynamicResource Text.Pull}"/>
|
||||
<TextBlock Classes="small italic" Margin="0,4,0,0" Text="{DynamicResource Text.CtrlClickTip}" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
</StackPanel>
|
||||
</ToolTip.Tip>
|
||||
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Pull}"/>
|
||||
</Button>
|
||||
|
||||
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Command="{Binding Push}" ToolTip.Tip="{DynamicResource Text.Push}">
|
||||
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Click="Push">
|
||||
<ToolTip.Tip>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{DynamicResource Text.Push}"/>
|
||||
<TextBlock Classes="small italic" Margin="0,4,0,0" Text="{DynamicResource Text.CtrlClickTip}" Foreground="{DynamicResource Brush.FG2}"/>
|
||||
</StackPanel>
|
||||
</ToolTip.Tip>
|
||||
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Push}"/>
|
||||
</Button>
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace SourceGit.Views
|
||||
|
@ -10,6 +11,18 @@ namespace SourceGit.Views
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
_hasCtrl = e.KeyModifiers.HasFlag(KeyModifiers.Control);
|
||||
}
|
||||
|
||||
protected override void OnKeyUp(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyUp(e);
|
||||
_hasCtrl = false;
|
||||
}
|
||||
|
||||
private void OpenWithExternalTools(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button button && DataContext is ViewModels.Repository repo)
|
||||
|
@ -40,6 +53,24 @@ namespace SourceGit.Views
|
|||
}
|
||||
}
|
||||
|
||||
private void Fetch(object _, RoutedEventArgs e)
|
||||
{
|
||||
(DataContext as ViewModels.Repository)?.Fetch(_hasCtrl);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Pull(object _, RoutedEventArgs e)
|
||||
{
|
||||
(DataContext as ViewModels.Repository)?.Pull(_hasCtrl);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Push(object _, RoutedEventArgs e)
|
||||
{
|
||||
(DataContext as ViewModels.Repository)?.Push(_hasCtrl);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OpenGitFlowMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.Repository repo)
|
||||
|
@ -61,6 +92,8 @@ namespace SourceGit.Views
|
|||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private bool _hasCtrl = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue