mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08: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
|
@ -163,6 +163,7 @@
|
||||||
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">Kind:</x:String>
|
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">Kind:</x:String>
|
||||||
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">annotated</x:String>
|
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">annotated</x:String>
|
||||||
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">lightweight</x:String>
|
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">lightweight</x:String>
|
||||||
|
<x:String x:Key="Text.CtrlClickTip" xml:space="preserve">Hold Ctrl to start directly</x:String>
|
||||||
<x:String x:Key="Text.Cut" xml:space="preserve">Cut</x:String>
|
<x:String x:Key="Text.Cut" xml:space="preserve">Cut</x:String>
|
||||||
<x:String x:Key="Text.DeleteBranch" xml:space="preserve">Delete Branch</x:String>
|
<x:String x:Key="Text.DeleteBranch" xml:space="preserve">Delete Branch</x:String>
|
||||||
<x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">Branch:</x:String>
|
<x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">Branch:</x:String>
|
||||||
|
|
|
@ -166,6 +166,7 @@
|
||||||
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">类型 :</x:String>
|
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">类型 :</x:String>
|
||||||
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">附注标签</x:String>
|
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">附注标签</x:String>
|
||||||
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">轻量标签</x:String>
|
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">轻量标签</x:String>
|
||||||
|
<x:String x:Key="Text.CtrlClickTip" xml:space="preserve">按住Ctrl键点击将以默认参数运行</x:String>
|
||||||
<x:String x:Key="Text.Cut" xml:space="preserve">剪切</x:String>
|
<x:String x:Key="Text.Cut" xml:space="preserve">剪切</x:String>
|
||||||
<x:String x:Key="Text.DeleteBranch" xml:space="preserve">删除分支确认</x:String>
|
<x:String x:Key="Text.DeleteBranch" xml:space="preserve">删除分支确认</x:String>
|
||||||
<x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">分支名 :</x:String>
|
<x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">分支名 :</x:String>
|
||||||
|
|
|
@ -166,6 +166,7 @@
|
||||||
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">型別 :</x:String>
|
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">型別 :</x:String>
|
||||||
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">附註標籤</x:String>
|
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">附註標籤</x:String>
|
||||||
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">輕量標籤</x:String>
|
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">輕量標籤</x:String>
|
||||||
|
<x:String x:Key="Text.CtrlClickTip" xml:space="preserve">按住Ctrl鍵點擊將以預設參數運行</x:String>
|
||||||
<x:String x:Key="Text.Cut" xml:space="preserve">剪下</x:String>
|
<x:String x:Key="Text.Cut" xml:space="preserve">剪下</x:String>
|
||||||
<x:String x:Key="Text.DeleteBranch" xml:space="preserve">刪除分支確認</x:String>
|
<x:String x:Key="Text.DeleteBranch" xml:space="preserve">刪除分支確認</x:String>
|
||||||
<x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">分支名 :</x:String>
|
<x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">分支名 :</x:String>
|
||||||
|
|
|
@ -253,6 +253,9 @@
|
||||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||||
<Setter Property="FontSize" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize}"/>
|
<Setter Property="FontSize" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize}"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style Selector="TextBlock.small">
|
||||||
|
<Setter Property="FontSize" Value="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Decrease}}"/>
|
||||||
|
</Style>
|
||||||
<Style Selector="TextBlock.bold">
|
<Style Selector="TextBlock.bold">
|
||||||
<Setter Property="FontWeight" Value="Bold"/>
|
<Setter Property="FontWeight" Value="Bold"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
|
@ -420,7 +420,7 @@ namespace SourceGit.ViewModels
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Fetch()
|
public void Fetch(bool autoStart)
|
||||||
{
|
{
|
||||||
if (!PopupHost.CanCreatePopup())
|
if (!PopupHost.CanCreatePopup())
|
||||||
return;
|
return;
|
||||||
|
@ -431,10 +431,13 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupHost.ShowPopup(new Fetch(this));
|
if (autoStart)
|
||||||
|
PopupHost.ShowAndStartPopup(new Fetch(this));
|
||||||
|
else
|
||||||
|
PopupHost.ShowPopup(new Fetch(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Pull()
|
public void Pull(bool autoStart)
|
||||||
{
|
{
|
||||||
if (!PopupHost.CanCreatePopup())
|
if (!PopupHost.CanCreatePopup())
|
||||||
return;
|
return;
|
||||||
|
@ -445,10 +448,13 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupHost.ShowPopup(new Pull(this, null));
|
if (autoStart)
|
||||||
|
PopupHost.ShowAndStartPopup(new Pull(this, null));
|
||||||
|
else
|
||||||
|
PopupHost.ShowPopup(new Pull(this, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Push()
|
public void Push(bool autoStart)
|
||||||
{
|
{
|
||||||
if (!PopupHost.CanCreatePopup())
|
if (!PopupHost.CanCreatePopup())
|
||||||
return;
|
return;
|
||||||
|
@ -465,7 +471,10 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupHost.ShowPopup(new Push(this, null));
|
if (autoStart)
|
||||||
|
PopupHost.ShowAndStartPopup(new Push(this, null));
|
||||||
|
else
|
||||||
|
PopupHost.ShowPopup(new Push(this, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyPatch()
|
public void ApplyPatch()
|
||||||
|
|
|
@ -31,15 +31,36 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
<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}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.Fetch}"/>
|
||||||
</Button>
|
</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}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.Pull}"/>
|
||||||
</Button>
|
</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}"/>
|
<Path Width="14" Height="14" Data="{StaticResource Icons.Push}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
|
@ -10,6 +11,18 @@ namespace SourceGit.Views
|
||||||
InitializeComponent();
|
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)
|
private void OpenWithExternalTools(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is Button button && DataContext is ViewModels.Repository repo)
|
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)
|
private void OpenGitFlowMenu(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (DataContext is ViewModels.Repository repo)
|
if (DataContext is ViewModels.Repository repo)
|
||||||
|
@ -61,6 +92,8 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _hasCtrl = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue