Skip to content

Commit

Permalink
Merge branch 'release/v8.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
love-linger committed Jun 11, 2024
2 parents 38fd30d + f4a70ba commit e7c52d0
Show file tree
Hide file tree
Showing 81 changed files with 1,873 additions and 1,283 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Opensource Git GUI client.
* Supports Windows/macOS/Linux
* Opensource/Free
* Fast
* English/简体中文
* English/简体中文/繁體中文
* Built-in light/dark themes
* Visual commit graph
* Supports SSH access with each remote
Expand Down Expand Up @@ -75,6 +75,7 @@ This app supports open repository in external tools listed in the table below.

> * You can set the given environment variable for special tool if it can NOT be found by this app automatically.
> * Installing `JetBrains Toolbox` will help this app to find other JetBrains tools installed on your device.
> * On macOS, you may need to use `launchctl setenv` to make sure the app can read these environment variables.
## Screenshots

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.15
8.16
5 changes: 5 additions & 0 deletions build/resources/app/App.plist
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
<string>SOURCE_GIT_VERSION.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
<key>LSEnvironment</key>
<dict>
<key>PATH</key>
<string>/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<key>CFBundleExecutable</key>
<string>SourceGit</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand Down
4 changes: 3 additions & 1 deletion src/App.JsonCodeGen.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Text.Json.Serialization;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace SourceGit
{
[JsonSourceGenerationOptions(WriteIndented = true, IgnoreReadOnlyFields = true, IgnoreReadOnlyProperties = true)]
[JsonSerializable(typeof(Models.Version))]
[JsonSerializable(typeof(Models.JetBrainsState))]
[JsonSerializable(typeof(Dictionary<string, string>))]
[JsonSerializable(typeof(ViewModels.Preference))]
internal partial class JsonCodeGen : JsonSerializerContext { }
}
1 change: 1 addition & 0 deletions src/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

<ResourceInclude x:Key="en_US" Source="/Resources/Locales/en_US.axaml"/>
<ResourceInclude x:Key="zh_CN" Source="/Resources/Locales/zh_CN.axaml"/>
<ResourceInclude x:Key="zh_TW" Source="/Resources/Locales/zh_TW.axaml"/>
</ResourceDictionary>
</Application.Resources>

Expand Down
43 changes: 29 additions & 14 deletions src/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,32 +132,48 @@ public static void SetLocale(string localeKey)
var app = Current as App;
var targetLocale = app.Resources[localeKey] as ResourceDictionary;
if (targetLocale == null || targetLocale == app._activeLocale)
{
return;
}

if (app._activeLocale != null)
{
app.Resources.MergedDictionaries.Remove(app._activeLocale);
}

app.Resources.MergedDictionaries.Add(targetLocale);
app._activeLocale = targetLocale;
}

public static void SetTheme(string theme)
public static void SetTheme(string theme, string colorsFile)
{
var app = Current as App;

if (theme.Equals("Light", StringComparison.OrdinalIgnoreCase))
{
Current.RequestedThemeVariant = ThemeVariant.Light;
}
app.RequestedThemeVariant = ThemeVariant.Light;
else if (theme.Equals("Dark", StringComparison.OrdinalIgnoreCase))
app.RequestedThemeVariant = ThemeVariant.Dark;
else
app.RequestedThemeVariant = ThemeVariant.Default;

if (app._colorOverrides != null)
{
Current.RequestedThemeVariant = ThemeVariant.Dark;
app.Resources.MergedDictionaries.Remove(app._colorOverrides);
app._colorOverrides = null;
}
else

if (!string.IsNullOrEmpty(colorsFile) && File.Exists(colorsFile))
{
Current.RequestedThemeVariant = ThemeVariant.Default;
try
{
var resDic = new ResourceDictionary();

var schema = JsonSerializer.Deserialize(File.ReadAllText(colorsFile), JsonCodeGen.Default.DictionaryStringString);
foreach (var kv in schema)
resDic[kv.Key] = Color.Parse(kv.Value);

app.Resources.MergedDictionaries.Add(resDic);
app._colorOverrides = resDic;
}
catch
{
}
}
}

Expand All @@ -166,9 +182,7 @@ public static async void CopyText(string data)
if (Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
if (desktop.MainWindow.Clipboard is { } clipbord)
{
await clipbord.SetTextAsync(data);
}
}
}

Expand Down Expand Up @@ -256,7 +270,7 @@ public override void Initialize()
var pref = ViewModels.Preference.Instance;

SetLocale(pref.Locale);
SetTheme(pref.Theme);
SetTheme(pref.Theme, pref.ColorOverrides);
}

public override void OnFrameworkInitializationCompleted()
Expand Down Expand Up @@ -300,6 +314,7 @@ private static void ShowSelfUpdateResult(object data)
}

private ResourceDictionary _activeLocale = null;
private ResourceDictionary _colorOverrides = null;
private Models.INotificationReceiver _notificationReceiver = null;
}
}
4 changes: 2 additions & 2 deletions src/Commands/QueryBranches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ protected override void OnReadline(string line)
var refName = parts[0];
if (refName.EndsWith("/HEAD", StringComparison.Ordinal))
return;

if (refName.StartsWith(PREFIX_DETACHED, StringComparison.Ordinal))
{
branch.IsHead = true;
}

if (refName.StartsWith(PREFIX_LOCAL, StringComparison.Ordinal))
{
branch.Name = refName.Substring(PREFIX_LOCAL.Length);
Expand Down
19 changes: 19 additions & 0 deletions src/Commands/QueryCommitFullMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace SourceGit.Commands
{
public class QueryCommitFullMessage : Command
{
public QueryCommitFullMessage(string repo, string sha)
{
WorkingDirectory = repo;
Context = repo;
Args = $"show --no-show-signature --pretty=format:%B -s {sha}";
}

public string Result()
{
var rs = ReadToEnd();
if (rs.IsSuccess) return rs.StdOut.TrimEnd();
return string.Empty;
}
}
}
Loading

0 comments on commit e7c52d0

Please sign in to comment.