diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index 5b652d8a..27e9520d 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -83,4 +83,5 @@ M469 235V107h85v128h-85zm-162-94 85 85-60 60-85-85 60-60zm469 60-85 85-60-60 85-85 60 60zm-549 183A85 85 0 01302 341H722a85 85 0 0174 42l131 225A85 85 0 01939 652V832a85 85 0 01-85 85H171a85 85 0 01-85-85v-180a85 85 0 0112-43l131-225zM722 427H302l-100 171h255l10 29a59 59 0 002 5c2 4 5 9 9 14 8 9 18 17 34 17 16 0 26-7 34-17a72 72 0 0011-18l0-0 10-29h255l-100-171zM853 683H624a155 155 0 01-12 17C593 722 560 747 512 747c-48 0-81-25-99-47a155 155 0 01-12-17H171v149h683v-149z M719 85 388 417l-209-165L87 299v427l92 47 210-164L720 939 939 850V171zM186 610V412l104 104zm526 55L514 512l198-153z M296 912H120c-4.4 0-8-3.6-8-8V520c0-4.4 3.6-8 8-8h176c4.4 0 8 3.6 8 8v384c0 4.4-3.6 8-8 8zM600 912H424c-4.4 0-8-3.6-8-8V121c0-4.4 3.6-8 8-8h176c4.4 0 8 3.6 8 8v783c0 4.4-3.6 8-8 8zM904 912H728c-4.4 0-8-3.6-8-8V280c0-4.4 3.6-8 8-8h176c4.4 0 8 3.6 8 8v624c0 4.4-3.6 8-8 8z + M512 0C229.216 0 0 229.216 0 512c0 282.752 229.216 512 512 512s512-229.248 512-512c0-282.784-229.216-512-512-512z m0 957.92C266.112 957.92 66.08 757.888 66.08 512S266.112 66.08 512 66.08 957.92 266.112 957.92 512 757.888 957.92 512 957.92zM192 416h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32H192a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM384 416h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32h-96a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM576 416h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32h-96a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM832 320h-64a32 32 0 0 0-32 32v128h-160a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32h256a32 32 0 0 0 32-32v-192a32 32 0 0 0-32-32zM320 544v-32a32 32 0 0 0-32-32H192a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32h96a32 32 0 0 0 32-32zM384 576h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32h-96a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM800 640H256a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32h544a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32z diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 9d068e94..193b5094 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -470,6 +470,19 @@ COMMITTER COMMITS + HotKeys + GLOBAL + Create new page + Close current page + Go to next page + Cancel current popup + REPOSITORY + Switch to 'Histories' + Switch to 'Changes' + Switch to 'Stashes' + Toggle commit search + Stage/Unstage selected changes + Git has NOT been configured. Please to go [Preference] and configure it first. BINARY FILE NOT SUPPORTED!!! BLAME ON THIS FILE IS NOT SUPPORTED!!! diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 3deb6206..a3d0201d 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -469,6 +469,19 @@ 提交者 提交次数 + 快捷键 + 全局快捷键 + 新建页面 + 关闭当前页面 + 切换到下一个页面 + 取消弹出面板 + 仓库页面快捷键 + 显示历史记录 + 显示本地更改 + 显示贮藏列表 + 打开/关闭历史搜索 + 将选中的变更暂存或从暂存列表中移除 + GIT尚未配置。请打开【偏好设置】配置GIT路径。 二进制文件不支持该操作!!! 选中文件不支持该操作!!! diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml new file mode 100644 index 00000000..a34bf163 --- /dev/null +++ b/src/Views/Hotkeys.axaml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Views/Hotkeys.axaml.cs b/src/Views/Hotkeys.axaml.cs new file mode 100644 index 00000000..5a68b6c2 --- /dev/null +++ b/src/Views/Hotkeys.axaml.cs @@ -0,0 +1,14 @@ +using Avalonia.Controls; +using Avalonia.Interactivity; + +namespace SourceGit.Views { + public partial class Hotkeys : Window { + public Hotkeys() { + InitializeComponent(); + } + + private void CloseWindow(object sender, RoutedEventArgs e) { + Close(); + } + } +} diff --git a/src/Views/Launcher.axaml b/src/Views/Launcher.axaml index 3aee0759..d9ea85ac 100644 --- a/src/Views/Launcher.axaml +++ b/src/Views/Launcher.axaml @@ -47,6 +47,11 @@ + + + + + @@ -212,6 +217,10 @@ + + diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index c77e051a..491434ad 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -82,7 +82,25 @@ namespace SourceGit.Views { vm.GotoNextTab(); e.Handled = true; return; - } + } else if (vm.ActivePage.Data is ViewModels.Repository repo) { + if (e.Key == Key.D1 || e.Key == Key.NumPad1) { + repo.SelectedViewIndex = 0; + e.Handled = true; + return; + } else if (e.Key == Key.D2 || e.Key == Key.NumPad2) { + repo.SelectedViewIndex = 1; + e.Handled = true; + return; + } else if (e.Key == Key.D3 || e.Key == Key.NumPad3) { + repo.SelectedViewIndex = 2; + e.Handled = true; + return; + } else if (e.Key == Key.F) { + repo.IsSearching = !repo.IsSearching; + e.Handled = true; + return; + } + } } else if (e.Key == Key.Escape) { vm.ActivePage.CancelPopup(); e.Handled = true; @@ -213,6 +231,12 @@ namespace SourceGit.Views { e.Handled = true; } + private async void OpenHotkeys(object sender, RoutedEventArgs e) { + var dialog = new Hotkeys(); + await dialog.ShowDialog(this); + e.Handled = true; + } + private async void OpenAboutDialog(object sender, RoutedEventArgs e) { var dialog = new About(); await dialog.ShowDialog(this); diff --git a/src/Views/Repository.axaml.cs b/src/Views/Repository.axaml.cs index 536a1da9..08ff6a94 100644 --- a/src/Views/Repository.axaml.cs +++ b/src/Views/Repository.axaml.cs @@ -45,18 +45,6 @@ namespace SourceGit.Views { InitializeComponent(); } - protected override void OnKeyDown(KeyEventArgs e) { - if (e.Key == Key.F && e.KeyModifiers == KeyModifiers.Control) { - if (DataContext is ViewModels.Repository repo) { - repo.IsSearching = true; - e.Handled = true; - return; - } - } - - base.OnKeyDown(e); - } - private void OnLocalBranchTreeLostFocus(object sender, RoutedEventArgs e) { if (sender is TreeView tree) tree.UnselectAll(); }