mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-16 16:05:00 +00:00
code_review: PR #1415
- Column for hotkey in `Reset` popup should use `Auto` for width - Add `SelectionBoxItemTemplate` for current selected mode in `Reset` popup Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
ffac71b15f
commit
7de5991ecb
6 changed files with 15 additions and 28 deletions
|
@ -681,7 +681,7 @@ namespace SourceGit
|
|||
}
|
||||
|
||||
var name = sb.ToString();
|
||||
if (name.Contains('#'))
|
||||
if (name.Contains('#', StringComparison.Ordinal))
|
||||
{
|
||||
if (!name.Equals("fonts:Inter#Inter", StringComparison.Ordinal) &&
|
||||
!name.Equals("fonts:SourceGit#JetBrains Mono", StringComparison.Ordinal))
|
||||
|
|
|
@ -127,23 +127,17 @@ namespace SourceGit.Native
|
|||
Microsoft.Win32.RegistryHive.LocalMachine,
|
||||
Microsoft.Win32.RegistryView.Registry64);
|
||||
|
||||
var git = reg.OpenSubKey("SOFTWARE\\GitForWindows");
|
||||
var git = reg.OpenSubKey(@"SOFTWARE\GitForWindows");
|
||||
if (git?.GetValue("InstallPath") is string installPath)
|
||||
{
|
||||
return Path.Combine(installPath, "bin", "git.exe");
|
||||
}
|
||||
|
||||
var builder = new StringBuilder("git.exe", 259);
|
||||
if (!PathFindOnPath(builder, null))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var exePath = builder.ToString();
|
||||
if (!string.IsNullOrEmpty(exePath))
|
||||
{
|
||||
return exePath;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -299,9 +293,7 @@ namespace SourceGit.Native
|
|||
// VSCode (system)
|
||||
var systemVScode = localMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EA457B21-F73E-494C-ACAB-524FDE069978}_is1");
|
||||
if (systemVScode != null)
|
||||
{
|
||||
return systemVScode.GetValue("DisplayIcon") as string;
|
||||
}
|
||||
|
||||
var currentUser = Microsoft.Win32.RegistryKey.OpenBaseKey(
|
||||
Microsoft.Win32.RegistryHive.CurrentUser,
|
||||
|
@ -310,9 +302,7 @@ namespace SourceGit.Native
|
|||
// VSCode (user)
|
||||
var vscode = currentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{771FD6B0-FA20-440A-A002-3B3BAC16DC50}_is1");
|
||||
if (vscode != null)
|
||||
{
|
||||
return vscode.GetValue("DisplayIcon") as string;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
@ -326,9 +316,7 @@ namespace SourceGit.Native
|
|||
// VSCode - Insiders (system)
|
||||
var systemVScodeInsiders = localMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1287CAD5-7C8D-410D-88B9-0D1EE4A83FF2}_is1");
|
||||
if (systemVScodeInsiders != null)
|
||||
{
|
||||
return systemVScodeInsiders.GetValue("DisplayIcon") as string;
|
||||
}
|
||||
|
||||
var currentUser = Microsoft.Win32.RegistryKey.OpenBaseKey(
|
||||
Microsoft.Win32.RegistryHive.CurrentUser,
|
||||
|
@ -337,9 +325,7 @@ namespace SourceGit.Native
|
|||
// VSCode - Insiders (user)
|
||||
var vscodeInsiders = currentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{217B4C08-948D-4276-BFBB-BEE930AE5A2C}_is1");
|
||||
if (vscodeInsiders != null)
|
||||
{
|
||||
return vscodeInsiders.GetValue("DisplayIcon") as string;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
@ -353,9 +339,7 @@ namespace SourceGit.Native
|
|||
// VSCodium (system)
|
||||
var systemVSCodium = localMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{88DA3577-054F-4CA1-8122-7D820494CFFB}_is1");
|
||||
if (systemVSCodium != null)
|
||||
{
|
||||
return systemVSCodium.GetValue("DisplayIcon") as string;
|
||||
}
|
||||
|
||||
var currentUser = Microsoft.Win32.RegistryKey.OpenBaseKey(
|
||||
Microsoft.Win32.RegistryHive.CurrentUser,
|
||||
|
@ -364,9 +348,7 @@ namespace SourceGit.Native
|
|||
// VSCodium (user)
|
||||
var vscodium = currentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{2E1F05D1-C245-4562-81EE-28188DB6FD17}_is1");
|
||||
if (vscodium != null)
|
||||
{
|
||||
return vscodium.GetValue("DisplayIcon") as string;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
@ -409,9 +391,7 @@ namespace SourceGit.Native
|
|||
if (launcher.GetValue(string.Empty) is string CLSID &&
|
||||
localMachine.OpenSubKey(@$"SOFTWARE\Classes\CLSID\{CLSID}\LocalServer32") is Microsoft.Win32.RegistryKey devenv &&
|
||||
devenv.GetValue(string.Empty) is string localServer32)
|
||||
{
|
||||
return localServer32!.Trim('\"');
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
public ConfigureWorkspace()
|
||||
{
|
||||
Workspaces = new AvaloniaList<Workspace>(Preferences.Instance.Workspaces);
|
||||
Workspaces = new(Preferences.Instance.Workspaces);
|
||||
}
|
||||
|
||||
public void Add()
|
||||
|
|
|
@ -296,9 +296,7 @@ namespace SourceGit.ViewModels
|
|||
var removeIdx = Pages.IndexOf(page);
|
||||
var activeIdx = Pages.IndexOf(_activePage);
|
||||
if (removeIdx == activeIdx)
|
||||
{
|
||||
ActivePage = Pages[removeIdx > 0 ? removeIdx - 1 : removeIdx + 1];
|
||||
}
|
||||
|
||||
CloseRepositoryInTab(page);
|
||||
Pages.RemoveAt(removeIdx);
|
||||
|
|
|
@ -64,7 +64,6 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
|
||||
Preferences.Instance.AutoRemoveInvalidNode();
|
||||
Preferences.Instance.SortNodes(Preferences.Instance.RepositoryNodes);
|
||||
Preferences.Instance.Save();
|
||||
|
||||
Welcome.Instance.Refresh();
|
||||
|
@ -154,8 +153,8 @@ namespace SourceGit.ViewModels
|
|||
IsExpanded = true,
|
||||
};
|
||||
collection.Add(added);
|
||||
Preferences.Instance.SortNodes(collection);
|
||||
|
||||
Preferences.Instance.SortNodes(collection);
|
||||
return added;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
KeyDown="OnResetModeKeyDown">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="m:ResetMode">
|
||||
<Grid ColumnDefinitions="16,60,*,*">
|
||||
<Grid ColumnDefinitions="16,60,*,Auto">
|
||||
<Ellipse Grid.Column="0" Width="12" Height="12" Fill="{Binding Color}"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" Margin="2,0,0,0"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Desc}" Margin="2,0,16,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right"/>
|
||||
|
@ -53,6 +53,16 @@
|
|||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
|
||||
<ComboBox.SelectionBoxItemTemplate>
|
||||
<DataTemplate DataType="m:ResetMode">
|
||||
<Grid ColumnDefinitions="16,60,*">
|
||||
<Ellipse Grid.Column="0" Width="12" Height="12" Fill="{Binding Color}"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" Margin="2,0,0,0"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Desc}" Margin="2,0,16,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.SelectionBoxItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue