diff --git a/README.md b/README.md index 47c32222..69e0d738 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.22%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.96%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.00%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.13%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.57%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.57%25-yellow)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.08%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.42%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.83%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-89.87%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-98.99%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 5895b971..05bf208c 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 95.22% +### de_DE.axaml: 95.08%
@@ -25,9 +25,10 @@ - Text.Diff.VisualLines.All - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name +- Text.Hotkeys.Repo.CreateBranchOnCommit +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink - Text.Preference.AI.AnalyzeDiffPrompt @@ -40,19 +41,20 @@
-### es_ES.axaml: 99.57% +### es_ES.axaml: 99.42%
Missing Keys +- Text.Hotkeys.Repo.CreateBranchOnCommit +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit
-### fr_FR.axaml: 86.96% +### fr_FR.axaml: 86.83%
@@ -108,10 +110,11 @@ - Text.Histories.Tips.MacOS - Text.Histories.Tips.Prefix - Text.Hotkeys.Repo.CommitWithAutoStage +- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.Hotkeys.Repo.DiscardSelected +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink - Text.MoveRepositoryNode @@ -151,7 +154,7 @@
-### pt_BR.axaml: 90.00% +### pt_BR.axaml: 89.87%
@@ -205,9 +208,10 @@ - Text.FileHistory.FileContent - Text.FileHistory.FileChange - Text.GitLFS.Locks.OnlyMine +- Text.Hotkeys.Repo.CreateBranchOnCommit +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink - Text.MoveRepositoryNode @@ -229,41 +233,38 @@
-### ru_RU.axaml: 99.13% +### ru_RU.axaml: 98.99%
Missing Keys - Text.Diff.VisualLines.All +- Text.Hotkeys.Repo.CreateBranchOnCommit +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink
-### zh_CN.axaml: 99.57% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.Hotkeys.Repo.Pull -- Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit +
-### zh_TW.axaml: 99.57% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.Hotkeys.Repo.Pull -- Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit +
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 2b6c8ce9..ee44181b 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -363,17 +363,18 @@ Commit staged changes Commit and push staged changes Stage all changes and commit + Creates a new branch based on selected commit Discard selected changes + Fetch, starts directly Dashboard mode (Default) + Pull, starts directly + Push, starts directly Force to reload this repository Stage/Unstage selected changes Commit search mode Switch to 'Changes' Switch to 'Histories' Switch to 'Stashes' - Pull, starts directly - Push, starts directly - Creates a new branch based on selected commit TEXT EDITOR Close search panel Find next match diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 04bf7e3e..b97f9aab 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -366,8 +366,12 @@ 提交暂存区更改 提交暂存区更改并推送 自动暂存全部变更并提交 + 基于选中提交创建新分支 丢弃选中的更改 + 拉取 (fetch) 远程变更 切换左边栏为分支/标签等显示模式(默认) + 拉回 (pull) 远程变更 + 推送本地变更到远程 重新加载仓库状态 将选中的变更暂存或从暂存列表中移除 切换左边栏为提交搜索模式 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 0c268c75..494616ab 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -366,8 +366,12 @@ 提交暫存區變更 提交暫存區變更並推送 自動暫存全部變更並提交 + 根據選取的提交建立新的分支 捨棄選取的變更 + 提取 (fetch) 遠端的變更 切換左邊欄為分支/標籤等顯示模式 (預設) + 拉取 (pull) 遠端的變更 + 推送 (push) 本地變更到遠端存放庫 強制重新載入存放庫 暫存或取消暫存選取的變更 切換左邊欄為歷史搜尋模式 diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 3fb048ae..713e1635 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Text; using Avalonia.Controls; -using Avalonia.Input; using Avalonia.Platform.Storage; using CommunityToolkit.Mvvm.ComponentModel; @@ -545,7 +544,6 @@ namespace SourceGit.ViewModels var createBranch = new MenuItem(); createBranch.Icon = App.CreateMenuIcon("Icons.Branch.Add"); createBranch.Header = App.Text("CreateBranch"); - createBranch.HotKey = new KeyGesture(Key.B, KeyModifiers.Control); createBranch.Click += (_, e) => { if (PopupHost.CanCreatePopup()) diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index e621a0aa..e72888fe 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -12,7 +12,6 @@ using Avalonia.Interactivity; using Avalonia.Media; using Avalonia.Threading; using Avalonia.VisualTree; -using SourceGit.ViewModels; namespace SourceGit.Views { @@ -723,11 +722,15 @@ namespace SourceGit.Views private void OnCommitListKeyDown(object sender, KeyEventArgs e) { + bool isSystemCmdKeyDown = (OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) || + (!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control)); + if (!isSystemCmdKeyDown) + return; + // These shortcuts are not mentioned in the Shortcut Reference window. Is this expected? - if (sender is ListBox { SelectedItems: { Count: > 0 } selected } && - e.KeyModifiers.HasFlag(KeyModifiers.Control)) + if (sender is ListBox { SelectedItems: { Count: > 0 } selected }) { - // CTRL + C -> Copy selected commit SHA and subject. + // CTRL/COMMAND + C -> Copy selected commit SHA and subject. if (e.Key == Key.C) { var builder = new StringBuilder(); @@ -742,17 +745,16 @@ namespace SourceGit.Views return; } - // CTRL + B -> shows Create Branch pop-up at selected commit. + // CTRL/COMMAND + B -> shows Create Branch pop-up at selected commit. if (e.Key == Key.B) { if (selected.Count == 1 && selected[0] is Models.Commit commit && DataContext is ViewModels.Histories histories && - PopupHost.CanCreatePopup()) + ViewModels.PopupHost.CanCreatePopup()) { - PopupHost.ShowPopup(new ViewModels.CreateBranch(histories.Repo, commit)); + ViewModels.PopupHost.ShowPopup(new ViewModels.CreateBranch(histories.Repo, commit)); e.Handled = true; - } } } diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index cb6f6e64..4fe77066 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -71,7 +71,7 @@ FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}" Margin="0,8"/> - + @@ -102,17 +102,20 @@ - - + + - - + + - - + + - - + + + + + - diff --git a/src/Views/RepositoryToolbar.axaml.cs b/src/Views/RepositoryToolbar.axaml.cs index a4a05dc4..e2c7df8c 100644 --- a/src/Views/RepositoryToolbar.axaml.cs +++ b/src/Views/RepositoryToolbar.axaml.cs @@ -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(); - (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(); - (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(); - (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)