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