mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
code_review: PR #657
* add hotkey `Ctrl+Down/⌘+Down` to fetch directly * keep translation keys of en_US in order * add translations for zh_CN and zh_TW * do NOT using namespace under `SourceGit` * use `⇧` instead of `Shift` in hotkey tips * hotkey mismatch on macOS * hotkeys to start fetch/pull/push directly not work on macOS * remove the hotkey of `Create Branch` context menu item - there are other objects (such as branch and tag) also have the `Create Branch` context menu item without hotkeys - on macOS, we already use `⌘+B` to create branch with selected commit, not `Ctrl + B` Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
dc49c1bf76
commit
d50b2c0298
10 changed files with 84 additions and 49 deletions
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
@ -45,22 +47,43 @@ namespace SourceGit.Views
|
|||
private void Fetch(object _, RoutedEventArgs e)
|
||||
{
|
||||
var launcher = this.FindAncestorOfType<Launcher>();
|
||||
(DataContext as ViewModels.Repository)?.Fetch(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false);
|
||||
e.Handled = true;
|
||||
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
repo.Fetch(startDirectly);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Pull(object _, RoutedEventArgs e)
|
||||
{
|
||||
var launcher = this.FindAncestorOfType<Launcher>();
|
||||
(DataContext as ViewModels.Repository)?.Pull(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false);
|
||||
e.Handled = true;
|
||||
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
repo.Pull(startDirectly);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Push(object _, RoutedEventArgs e)
|
||||
{
|
||||
var launcher = this.FindAncestorOfType<Launcher>();
|
||||
(DataContext as ViewModels.Repository)?.Push(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false);
|
||||
e.Handled = true;
|
||||
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
repo.Push(startDirectly);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void StashAll(object _, RoutedEventArgs e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue