Skip to content

Commit

Permalink
Merge branch 'release/v8.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
love-linger committed May 20, 2024
2 parents 283c681 + 6e12768 commit 12d7fa6
Show file tree
Hide file tree
Showing 22 changed files with 217 additions and 139 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ This software creates a folder `$"{System.Environment.SpecialFolder.ApplicationD
| OS | PATH |
| --- | --- |
| Windows | `C:\Users\USER_NAME\AppData\Roaming\SourceGit` |
| Linux | `/home/USER_NAME/.config/SourceGit` |
| macOS | `/Users/USER_NAME/.config/SourceGit` |
| Linux | `${HOME}/.config/SourceGit` |
| macOS | `${HOME}/Library/Application Support/SourceGit` |

For **Windows** users:

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.12
8.13
Empty file modified build/build.osx.command
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion build/resources/rpm/SPECS/build.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ chmod 755 -R $RPM_BUILD_ROOT

%files
/opt
/usr/bin
%attr(555,root,root)/usr/bin
/usr/share

%changelog
Expand Down
Binary file modified screenshots/theme_dark.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/theme_light.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
<NativeMenu.Menu>
<NativeMenu>
<NativeMenuItem Header="{DynamicResource Text.About.Menu}" Command="{x:Static s:App.OpenAboutCommand}"/>
<NativeMenuItem Header="{DynamicResource Text.Hotkeys.Menu}" Command="{x:Static s:App.OpenHotkeysCommand}"/>
<NativeMenuItem Header="{DynamicResource Text.Hotkeys}" Command="{x:Static s:App.OpenHotkeysCommand}"/>
<NativeMenuItem Header="{DynamicResource Text.SelfUpdate}" Command="{x:Static s:App.CheckForUpdateCommand}"/>
<NativeMenuItemSeparator/>
<NativeMenuItem Header="{DynamicResource Text.Preference}" Command="{x:Static s:App.OpenPreferenceCommand}" Gesture="⌘+,"/>
<NativeMenuItemSeparator/>
<NativeMenuItem Header="{DynamicResource Text.Quit}" Command="{x:Static s:App.QuitCommand}"/>
<NativeMenuItem Header="{DynamicResource Text.Quit}" Command="{x:Static s:App.QuitCommand}" Gesture="⌘+Q"/>
</NativeMenu>
</NativeMenu.Menu>
</Application>
1 change: 1 addition & 0 deletions src/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public override void OnFrameworkInitializationCompleted()
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
BindingPlugins.DataValidators.RemoveAt(0);
Native.OS.SetupEnternalTools();

var launcher = new Views.Launcher();
_notificationReceiver = launcher;
Expand Down
60 changes: 19 additions & 41 deletions src/Models/ExternalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,23 @@ namespace SourceGit.Models
{
public class ExternalTool
{
public string Name { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
public string Executable { get; set; } = string.Empty;
public string OpenCmdArgs { get; set; } = string.Empty;
public string Name { get; private set; } = string.Empty;
public string Executable { get; private set; } = string.Empty;
public string OpenCmdArgs { get; private set; } = string.Empty;
public Bitmap IconImage { get; private set; } = null;

public Bitmap IconImage
public ExternalTool(string name, string icon, string executable, string openCmdArgs)
{
get
{
if (_isFirstTimeGetIcon)
{
_isFirstTimeGetIcon = false;

if (!string.IsNullOrWhiteSpace(Icon))
{
try
{
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/ExternalToolIcons/{Icon}.png", UriKind.RelativeOrAbsolute));
_iconImage = new Bitmap(icon);
}
catch
{
}
}
}
Name = name;
Executable = executable;
OpenCmdArgs = openCmdArgs;

return _iconImage;
try
{
var asset = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/ExternalToolIcons/{icon}.png", UriKind.RelativeOrAbsolute));
IconImage = new Bitmap(asset);
}
catch { }
}

public void Open(string repo)
Expand All @@ -52,9 +41,6 @@ public void Open(string repo)
UseShellExecute = false,
});
}

private bool _isFirstTimeGetIcon = true;
private Bitmap _iconImage = null;
}

public class JetBrainsState
Expand Down Expand Up @@ -107,13 +93,7 @@ public void TryAdd(string name, string icon, string args, string env, Func<strin
return;
}

Founded.Add(new ExternalTool
{
Name = name,
Icon = icon,
OpenCmdArgs = args,
Executable = path
});
Founded.Add(new ExternalTool(name, icon, path, args));
}

public void VSCode(Func<string> platformFinder)
Expand Down Expand Up @@ -154,13 +134,11 @@ public void FindJetBrainsFromToolbox(Func<string> platformFinder)
if (exclude.Contains(tool.ToolId.ToLowerInvariant()))
continue;

Founded.Add(new ExternalTool
{
Name = $"{tool.DisplayName} {tool.DisplayVersion}",
Icon = supported_icons.Contains(tool.ProductCode) ? $"JetBrains/{tool.ProductCode}" : $"JetBrains/JB",
OpenCmdArgs = "\"{0}\"",
Executable = Path.Combine(tool.InstallLocation, tool.LaunchCommand),
});
Founded.Add(new ExternalTool(
$"{tool.DisplayName} {tool.DisplayVersion}",
supported_icons.Contains(tool.ProductCode) ? $"JetBrains/{tool.ProductCode}" : "JetBrains/JB",
Path.Combine(tool.InstallLocation, tool.LaunchCommand),
"\"{0}\""));
}
}
}
Expand Down
20 changes: 7 additions & 13 deletions src/Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,14 @@ public override int GetHashCode()

public static User FindOrAdd(string data)
{
if (_caches.TryGetValue(data, out var value))
return _caches.GetOrAdd(data, key =>
{
return value;
}
else
{
var nameEndIdx = data.IndexOf('<', System.StringComparison.Ordinal);
var name = nameEndIdx >= 2 ? data.Substring(0, nameEndIdx - 1) : string.Empty;
var email = data.Substring(nameEndIdx + 1);

User user = new User() { Name = name, Email = email };
_caches.TryAdd(data, user);
return user;
}
var nameEndIdx = key.IndexOf('<', System.StringComparison.Ordinal);
var name = nameEndIdx >= 2 ? key.Substring(0, nameEndIdx - 1) : string.Empty;
var email = key.Substring(nameEndIdx + 1);
return new User() { Name = name, Email = email };
});
}

private static ConcurrentDictionary<string, User> _caches = new ConcurrentDictionary<string, User>();
Expand Down
5 changes: 5 additions & 0 deletions src/Native/Linux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public void SetupApp(AppBuilder builder)
DefaultFamilyName = "fonts:SourceGit#JetBrains Mono",
});

builder.With(new X11PlatformOptions()
{
EnableIme = true,
});

// Free-desktop file picker has an extra black background panel.
builder.UseManagedSystemDialogs();
}
Expand Down
7 changes: 5 additions & 2 deletions src/Native/OS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ static OS()
{
throw new Exception("Platform unsupported!!!");
}

ExternalTools = _backend.FindExternalTools();
}

public static Models.Shell GetShell()
Expand Down Expand Up @@ -77,6 +75,11 @@ public static void SetupApp(AppBuilder builder)
_backend.SetupApp(builder);
}

public static void SetupEnternalTools()
{
ExternalTools = _backend.FindExternalTools();
}

public static string FindGitExecutable()
{
return _backend.FindGitExecutable();
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@
<x:String x:Key="Text.Histories.Search" xml:space="preserve">SEARCH SHA/SUBJECT/AUTHOR. PRESS ENTER TO SEARCH, ESC TO QUIT</x:String>
<x:String x:Key="Text.Histories.SearchClear" xml:space="preserve">CLEAR</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">SELECTED {0} COMMITS</x:String>
<x:String x:Key="Text.Hotkeys" xml:space="preserve">HotKeys</x:String>
<x:String x:Key="Text.Hotkeys.Menu" xml:space="preserve">About HotKeys</x:String>
<x:String x:Key="Text.Hotkeys" xml:space="preserve">Keyboard Shortcuts Reference</x:String>
<x:String x:Key="Text.Hotkeys.Global" xml:space="preserve">GLOBAL</x:String>
<x:String x:Key="Text.Hotkeys.Global.CancelPopup" xml:space="preserve">Cancel current popup</x:String>
<x:String x:Key="Text.Hotkeys.Global.CloseTab" xml:space="preserve">Close current page</x:String>
Expand Down Expand Up @@ -343,6 +342,7 @@
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configure this repository</x:String>
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUE</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Open In File Browser</x:String>
<x:String x:Key="Text.Repository.FilterBranchTip" xml:space="preserve">Filter Branches</x:String>
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">LOCAL BRANCHES</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Navigate To HEAD</x:String>
<x:String x:Key="Text.Repository.NewBranch" xml:space="preserve">Create Branch</x:String>
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/Locales/zh_CN.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@
<x:String x:Key="Text.Histories.Search" xml:space="preserve">查询提交指纹、信息、作者。回车键开始,ESC键取消</x:String>
<x:String x:Key="Text.Histories.SearchClear" xml:space="preserve">清空</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">已选中 {0} 项提交</x:String>
<x:String x:Key="Text.Hotkeys" xml:space="preserve">快捷键</x:String>
<x:String x:Key="Text.Hotkeys.Menu" xml:space="preserve">显示快捷键</x:String>
<x:String x:Key="Text.Hotkeys" xml:space="preserve">快捷键参考</x:String>
<x:String x:Key="Text.Hotkeys.Global" xml:space="preserve">全局快捷键</x:String>
<x:String x:Key="Text.Hotkeys.Global.CancelPopup" xml:space="preserve">取消弹出面板</x:String>
<x:String x:Key="Text.Hotkeys.Global.CloseTab" xml:space="preserve">关闭当前页面</x:String>
Expand Down Expand Up @@ -343,6 +342,7 @@
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">配置本仓库</x:String>
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">下一步</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">在文件浏览器中打开</x:String>
<x:String x:Key="Text.Repository.FilterBranchTip" xml:space="preserve">过滤显示分支</x:String>
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">本地分支</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">定位HEAD</x:String>
<x:String x:Key="Text.Repository.NewBranch" xml:space="preserve">新建分支</x:String>
Expand Down

0 comments on commit 12d7fa6

Please sign in to comment.