2024-03-20 00:36:10 -07:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.Text.Json;
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
using Avalonia.Collections;
|
2024-03-21 08:19:09 -07:00
|
|
|
using Avalonia.Media;
|
2024-03-20 00:36:10 -07:00
|
|
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
|
|
|
namespace SourceGit.ViewModels
|
|
|
|
{
|
|
|
|
public class Preference : ObservableObject
|
|
|
|
{
|
|
|
|
[JsonIgnore]
|
|
|
|
public static Preference Instance
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (_instance == null)
|
|
|
|
{
|
|
|
|
if (!File.Exists(_savePath))
|
|
|
|
{
|
|
|
|
_instance = new Preference();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2024-03-26 07:11:06 -07:00
|
|
|
_instance = JsonSerializer.Deserialize(File.ReadAllText(_savePath), JsonCodeGen.Default.Preference);
|
2024-03-20 00:36:10 -07:00
|
|
|
}
|
|
|
|
catch
|
|
|
|
{
|
|
|
|
_instance = new Preference();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-05 16:08:29 -07:00
|
|
|
// It will cause some issue on Linux. See https://github.com/sourcegit-scm/sourcegit/issues/99
|
|
|
|
// _instance.Repositories.RemoveAll(x => !Directory.Exists(x.FullPath));
|
2024-03-20 00:36:10 -07:00
|
|
|
|
2024-03-21 08:19:09 -07:00
|
|
|
if (_instance.DefaultFont == null)
|
|
|
|
{
|
|
|
|
_instance.DefaultFont = FontManager.Current.DefaultFontFamily;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_instance.MonospaceFont == null)
|
|
|
|
{
|
|
|
|
_instance.MonospaceFont = new FontFamily("fonts:SourceGit#JetBrains Mono");
|
|
|
|
}
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
if (!_instance.IsGitConfigured)
|
|
|
|
{
|
|
|
|
_instance.GitInstallPath = Native.OS.FindGitExecutable();
|
|
|
|
}
|
|
|
|
|
|
|
|
return _instance;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string Locale
|
|
|
|
{
|
|
|
|
get => _locale;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (SetProperty(ref _locale, value))
|
|
|
|
App.SetLocale(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string Theme
|
|
|
|
{
|
|
|
|
get => _theme;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (SetProperty(ref _theme, value))
|
2024-06-05 03:23:28 -07:00
|
|
|
App.SetTheme(_theme, _colorOverrides);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string ColorOverrides
|
|
|
|
{
|
|
|
|
get => _colorOverrides;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (SetProperty(ref _colorOverrides, value))
|
|
|
|
App.SetTheme(_theme, value);
|
2024-03-20 00:36:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-21 08:19:09 -07:00
|
|
|
[JsonConverter(typeof(FontFamilyConverter))]
|
|
|
|
public FontFamily DefaultFont
|
2024-03-21 03:02:06 -07:00
|
|
|
{
|
|
|
|
get => _defaultFont;
|
|
|
|
set => SetProperty(ref _defaultFont, value);
|
|
|
|
}
|
|
|
|
|
2024-03-21 08:19:09 -07:00
|
|
|
[JsonConverter(typeof(FontFamilyConverter))]
|
|
|
|
public FontFamily MonospaceFont
|
2024-03-21 03:02:06 -07:00
|
|
|
{
|
|
|
|
get => _monospaceFont;
|
|
|
|
set => SetProperty(ref _monospaceFont, value);
|
|
|
|
}
|
|
|
|
|
2024-03-21 21:03:04 -07:00
|
|
|
public double DefaultFontSize
|
|
|
|
{
|
|
|
|
get => _defaultFontSize;
|
|
|
|
set => SetProperty(ref _defaultFontSize, value);
|
|
|
|
}
|
|
|
|
|
2024-06-11 01:36:52 -07:00
|
|
|
public LayoutInfo Layout
|
|
|
|
{
|
|
|
|
get => _layout;
|
|
|
|
set => SetProperty(ref _layout, value);
|
|
|
|
}
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
public string AvatarServer
|
|
|
|
{
|
|
|
|
get => Models.AvatarManager.SelectedServer;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (Models.AvatarManager.SelectedServer != value)
|
|
|
|
{
|
|
|
|
Models.AvatarManager.SelectedServer = value;
|
|
|
|
OnPropertyChanged(nameof(AvatarServer));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public int MaxHistoryCommits
|
|
|
|
{
|
|
|
|
get => _maxHistoryCommits;
|
|
|
|
set => SetProperty(ref _maxHistoryCommits, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool RestoreTabs
|
|
|
|
{
|
|
|
|
get => _restoreTabs;
|
|
|
|
set => SetProperty(ref _restoreTabs, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool UseFixedTabWidth
|
|
|
|
{
|
|
|
|
get => _useFixedTabWidth;
|
|
|
|
set => SetProperty(ref _useFixedTabWidth, value);
|
|
|
|
}
|
|
|
|
|
2024-03-26 07:11:06 -07:00
|
|
|
public bool Check4UpdatesOnStartup
|
|
|
|
{
|
|
|
|
get => _check4UpdatesOnStartup;
|
|
|
|
set => SetProperty(ref _check4UpdatesOnStartup, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public string IgnoreUpdateTag
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
} = string.Empty;
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
public bool UseTwoColumnsLayoutInHistories
|
|
|
|
{
|
|
|
|
get => _useTwoColumnsLayoutInHistories;
|
|
|
|
set => SetProperty(ref _useTwoColumnsLayoutInHistories, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool UseSideBySideDiff
|
|
|
|
{
|
|
|
|
get => _useSideBySideDiff;
|
|
|
|
set => SetProperty(ref _useSideBySideDiff, value);
|
|
|
|
}
|
|
|
|
|
2024-03-20 05:17:20 -07:00
|
|
|
public bool UseSyntaxHighlighting
|
|
|
|
{
|
|
|
|
get => _useSyntaxHighlighting;
|
|
|
|
set => SetProperty(ref _useSyntaxHighlighting, value);
|
|
|
|
}
|
|
|
|
|
2024-06-04 05:19:49 -07:00
|
|
|
public bool EnableDiffViewWordWrap
|
|
|
|
{
|
|
|
|
get => _enableDiffViewWordWrap;
|
|
|
|
set => SetProperty(ref _enableDiffViewWordWrap, value);
|
|
|
|
}
|
|
|
|
|
2024-06-19 03:15:32 -07:00
|
|
|
public bool ShowHiddenSymbolsInDiffView
|
|
|
|
{
|
|
|
|
get => _showHiddenSymbolsInDiffView;
|
|
|
|
set => SetProperty(ref _showHiddenSymbolsInDiffView, value);
|
|
|
|
}
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
public Models.ChangeViewMode UnstagedChangeViewMode
|
|
|
|
{
|
|
|
|
get => _unstagedChangeViewMode;
|
|
|
|
set => SetProperty(ref _unstagedChangeViewMode, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Models.ChangeViewMode StagedChangeViewMode
|
|
|
|
{
|
|
|
|
get => _stagedChangeViewMode;
|
|
|
|
set => SetProperty(ref _stagedChangeViewMode, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Models.ChangeViewMode CommitChangeViewMode
|
|
|
|
{
|
|
|
|
get => _commitChangeViewMode;
|
|
|
|
set => SetProperty(ref _commitChangeViewMode, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
public bool IsGitConfigured
|
|
|
|
{
|
|
|
|
get => !string.IsNullOrEmpty(GitInstallPath) && File.Exists(GitInstallPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
public string GitInstallPath
|
|
|
|
{
|
2024-04-05 22:14:22 -07:00
|
|
|
get => Native.OS.GitExecutable;
|
2024-03-20 00:36:10 -07:00
|
|
|
set
|
|
|
|
{
|
2024-04-05 22:14:22 -07:00
|
|
|
if (Native.OS.GitExecutable != value)
|
2024-03-20 00:36:10 -07:00
|
|
|
{
|
2024-04-05 22:14:22 -07:00
|
|
|
Native.OS.GitExecutable = value;
|
2024-03-20 00:36:10 -07:00
|
|
|
OnPropertyChanged(nameof(GitInstallPath));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-08 19:41:37 -07:00
|
|
|
public Models.Shell GitShell
|
|
|
|
{
|
|
|
|
get => Native.OS.GetShell();
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (Native.OS.SetShell(value))
|
|
|
|
{
|
|
|
|
OnPropertyChanged(nameof(GitShell));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
public string GitDefaultCloneDir
|
|
|
|
{
|
|
|
|
get => _gitDefaultCloneDir;
|
|
|
|
set => SetProperty(ref _gitDefaultCloneDir, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool GitAutoFetch
|
|
|
|
{
|
|
|
|
get => Commands.AutoFetch.IsEnabled;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (Commands.AutoFetch.IsEnabled != value)
|
|
|
|
{
|
|
|
|
Commands.AutoFetch.IsEnabled = value;
|
|
|
|
OnPropertyChanged(nameof(GitAutoFetch));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-11 02:37:54 -07:00
|
|
|
public int? GitAutoFetchInterval
|
|
|
|
{
|
|
|
|
get => Commands.AutoFetch.Interval;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value is null or < 1)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (Commands.AutoFetch.Interval != value)
|
|
|
|
{
|
|
|
|
Commands.AutoFetch.Interval = (int)value;
|
|
|
|
OnPropertyChanged(nameof(GitAutoFetchInterval));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
public int ExternalMergeToolType
|
|
|
|
{
|
|
|
|
get => _externalMergeToolType;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
var changed = SetProperty(ref _externalMergeToolType, value);
|
2024-04-08 19:41:37 -07:00
|
|
|
if (changed && !OperatingSystem.IsWindows() && value > 0 && value < Models.ExternalMerger.Supported.Count)
|
2024-03-20 00:36:10 -07:00
|
|
|
{
|
2024-04-08 19:41:37 -07:00
|
|
|
var tool = Models.ExternalMerger.Supported[value];
|
2024-03-31 01:54:29 -07:00
|
|
|
if (File.Exists(tool.Exec))
|
|
|
|
ExternalMergeToolPath = tool.Exec;
|
|
|
|
else
|
|
|
|
ExternalMergeToolPath = string.Empty;
|
2024-03-20 00:36:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string ExternalMergeToolPath
|
|
|
|
{
|
|
|
|
get => _externalMergeToolPath;
|
|
|
|
set => SetProperty(ref _externalMergeToolPath, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Repository> Repositories
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
} = new List<Repository>();
|
|
|
|
|
|
|
|
public AvaloniaList<RepositoryNode> RepositoryNodes
|
|
|
|
{
|
|
|
|
get => _repositoryNodes;
|
|
|
|
set => SetProperty(ref _repositoryNodes, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<string> OpenedTabs
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
} = new List<string>();
|
|
|
|
|
|
|
|
public int LastActiveTabIdx
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
} = 0;
|
|
|
|
|
2024-04-06 18:51:55 -07:00
|
|
|
public double LastCheckUpdateTime
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
} = 0;
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
public bool ShouldCheck4UpdateOnStartup
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (!_check4UpdatesOnStartup)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
var lastCheck = DateTime.UnixEpoch.AddSeconds(LastCheckUpdateTime).ToLocalTime();
|
|
|
|
var now = DateTime.Now;
|
|
|
|
|
|
|
|
if (lastCheck.Year == now.Year && lastCheck.Month == now.Month && lastCheck.Day == now.Day)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
LastCheckUpdateTime = now.Subtract(DateTime.UnixEpoch.ToLocalTime()).TotalSeconds;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
public static void AddNode(RepositoryNode node, RepositoryNode to = null)
|
|
|
|
{
|
|
|
|
var collection = to == null ? _instance._repositoryNodes : to.SubNodes;
|
|
|
|
var list = new List<RepositoryNode>();
|
|
|
|
list.AddRange(collection);
|
|
|
|
list.Add(node);
|
|
|
|
list.Sort((l, r) =>
|
|
|
|
{
|
|
|
|
if (l.IsRepository != r.IsRepository)
|
|
|
|
{
|
|
|
|
return l.IsRepository ? 1 : -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return l.Name.CompareTo(r.Name);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
collection.Clear();
|
|
|
|
foreach (var one in list)
|
|
|
|
{
|
|
|
|
collection.Add(one);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static RepositoryNode FindNode(string id)
|
|
|
|
{
|
|
|
|
return FindNodeRecursive(id, _instance.RepositoryNodes);
|
|
|
|
}
|
|
|
|
|
2024-05-20 02:36:43 -07:00
|
|
|
public static RepositoryNode FindOrAddNodeByRepositoryPath(string repo, RepositoryNode parent, bool shouldMoveNode)
|
2024-05-07 00:49:57 -07:00
|
|
|
{
|
|
|
|
var node = FindNodeRecursive(repo, _instance.RepositoryNodes);
|
|
|
|
if (node == null)
|
|
|
|
{
|
|
|
|
node = new RepositoryNode()
|
|
|
|
{
|
2024-05-07 00:52:04 -07:00
|
|
|
Id = repo,
|
2024-05-07 00:49:57 -07:00
|
|
|
Name = Path.GetFileName(repo),
|
|
|
|
Bookmark = 0,
|
|
|
|
IsRepository = true,
|
|
|
|
};
|
|
|
|
|
|
|
|
AddNode(node, parent);
|
|
|
|
}
|
2024-05-20 02:36:43 -07:00
|
|
|
else if (shouldMoveNode)
|
2024-05-07 00:49:57 -07:00
|
|
|
{
|
|
|
|
MoveNode(node, parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
public static void MoveNode(RepositoryNode node, RepositoryNode to = null)
|
|
|
|
{
|
2024-03-31 01:54:29 -07:00
|
|
|
if (to == null && _instance._repositoryNodes.Contains(node))
|
|
|
|
return;
|
|
|
|
if (to != null && to.SubNodes.Contains(node))
|
|
|
|
return;
|
2024-03-20 00:36:10 -07:00
|
|
|
|
|
|
|
RemoveNode(node);
|
|
|
|
AddNode(node, to);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void RemoveNode(RepositoryNode node)
|
|
|
|
{
|
|
|
|
RemoveNodeRecursive(node, _instance._repositoryNodes);
|
|
|
|
}
|
|
|
|
|
2024-05-07 00:28:54 -07:00
|
|
|
public static void SortByRenamedNode(RepositoryNode node)
|
|
|
|
{
|
|
|
|
var container = FindNodeContainer(node, _instance._repositoryNodes);
|
|
|
|
if (container == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var list = new List<RepositoryNode>();
|
|
|
|
list.AddRange(container);
|
|
|
|
list.Sort((l, r) =>
|
|
|
|
{
|
|
|
|
if (l.IsRepository != r.IsRepository)
|
|
|
|
{
|
|
|
|
return l.IsRepository ? 1 : -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return l.Name.CompareTo(r.Name);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
container.Clear();
|
2024-05-11 02:37:54 -07:00
|
|
|
foreach (var one in list)
|
|
|
|
container.Add(one);
|
2024-05-07 00:28:54 -07:00
|
|
|
}
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
public static Repository FindRepository(string path)
|
|
|
|
{
|
|
|
|
foreach (var repo in _instance.Repositories)
|
|
|
|
{
|
2024-03-31 01:54:29 -07:00
|
|
|
if (repo.FullPath == path)
|
|
|
|
return repo;
|
2024-03-20 00:36:10 -07:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Repository AddRepository(string rootDir, string gitDir)
|
|
|
|
{
|
|
|
|
var normalized = rootDir.Replace('\\', '/');
|
|
|
|
var repo = FindRepository(normalized);
|
|
|
|
if (repo != null)
|
|
|
|
{
|
|
|
|
repo.GitDir = gitDir;
|
|
|
|
return repo;
|
|
|
|
}
|
|
|
|
|
|
|
|
repo = new Repository()
|
|
|
|
{
|
|
|
|
FullPath = normalized,
|
|
|
|
GitDir = gitDir
|
|
|
|
};
|
|
|
|
|
|
|
|
_instance.Repositories.Add(repo);
|
|
|
|
return repo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Save()
|
|
|
|
{
|
2024-03-26 07:11:06 -07:00
|
|
|
var data = JsonSerializer.Serialize(_instance, JsonCodeGen.Default.Preference);
|
2024-03-20 00:36:10 -07:00
|
|
|
File.WriteAllText(_savePath, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static RepositoryNode FindNodeRecursive(string id, AvaloniaList<RepositoryNode> collection)
|
|
|
|
{
|
|
|
|
foreach (var node in collection)
|
|
|
|
{
|
2024-03-31 01:54:29 -07:00
|
|
|
if (node.Id == id)
|
|
|
|
return node;
|
2024-03-20 00:36:10 -07:00
|
|
|
|
|
|
|
var sub = FindNodeRecursive(id, node.SubNodes);
|
2024-03-31 01:54:29 -07:00
|
|
|
if (sub != null)
|
|
|
|
return sub;
|
2024-03-20 00:36:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-05-07 00:28:54 -07:00
|
|
|
private static AvaloniaList<RepositoryNode> FindNodeContainer(RepositoryNode node, AvaloniaList<RepositoryNode> collection)
|
|
|
|
{
|
|
|
|
foreach (var sub in collection)
|
|
|
|
{
|
|
|
|
if (node == sub)
|
|
|
|
return collection;
|
|
|
|
|
|
|
|
var subCollection = FindNodeContainer(node, sub.SubNodes);
|
|
|
|
if (subCollection != null)
|
|
|
|
return subCollection;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
private static bool RemoveNodeRecursive(RepositoryNode node, AvaloniaList<RepositoryNode> collection)
|
|
|
|
{
|
|
|
|
if (collection.Contains(node))
|
|
|
|
{
|
|
|
|
collection.Remove(node);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (RepositoryNode one in collection)
|
|
|
|
{
|
2024-03-31 01:54:29 -07:00
|
|
|
if (RemoveNodeRecursive(node, one.SubNodes))
|
|
|
|
return true;
|
2024-03-20 00:36:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Preference _instance = null;
|
2024-06-02 18:44:12 -07:00
|
|
|
private static readonly string _savePath = Path.Combine(Native.OS.DataDir, "preference.json");
|
2024-03-20 00:36:10 -07:00
|
|
|
|
|
|
|
private string _locale = "en_US";
|
|
|
|
private string _theme = "Default";
|
2024-06-05 03:23:28 -07:00
|
|
|
private string _colorOverrides = string.Empty;
|
2024-03-21 08:19:09 -07:00
|
|
|
private FontFamily _defaultFont = null;
|
|
|
|
private FontFamily _monospaceFont = null;
|
2024-03-21 21:03:04 -07:00
|
|
|
private double _defaultFontSize = 13;
|
2024-06-11 01:36:52 -07:00
|
|
|
private LayoutInfo _layout = new LayoutInfo();
|
2024-03-21 03:02:06 -07:00
|
|
|
|
2024-03-20 00:36:10 -07:00
|
|
|
private int _maxHistoryCommits = 20000;
|
|
|
|
private bool _restoreTabs = false;
|
|
|
|
private bool _useFixedTabWidth = true;
|
2024-03-26 07:11:06 -07:00
|
|
|
private bool _check4UpdatesOnStartup = true;
|
2024-03-20 00:36:10 -07:00
|
|
|
private bool _useTwoColumnsLayoutInHistories = false;
|
|
|
|
private bool _useSideBySideDiff = false;
|
2024-03-20 05:17:20 -07:00
|
|
|
private bool _useSyntaxHighlighting = false;
|
2024-06-04 05:19:49 -07:00
|
|
|
private bool _enableDiffViewWordWrap = false;
|
2024-06-19 03:15:32 -07:00
|
|
|
private bool _showHiddenSymbolsInDiffView = false;
|
2024-03-20 00:36:10 -07:00
|
|
|
|
|
|
|
private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List;
|
|
|
|
private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List;
|
|
|
|
private Models.ChangeViewMode _commitChangeViewMode = Models.ChangeViewMode.List;
|
|
|
|
|
|
|
|
private string _gitDefaultCloneDir = string.Empty;
|
|
|
|
|
|
|
|
private int _externalMergeToolType = 0;
|
|
|
|
private string _externalMergeToolPath = string.Empty;
|
|
|
|
|
|
|
|
private AvaloniaList<RepositoryNode> _repositoryNodes = new AvaloniaList<RepositoryNode>();
|
|
|
|
}
|
|
|
|
|
2024-03-21 08:19:09 -07:00
|
|
|
public class FontFamilyConverter : JsonConverter<FontFamily>
|
|
|
|
{
|
|
|
|
public override FontFamily Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
|
|
|
{
|
|
|
|
var name = reader.GetString();
|
|
|
|
return new FontFamily(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void Write(Utf8JsonWriter writer, FontFamily value, JsonSerializerOptions options)
|
|
|
|
{
|
|
|
|
writer.WriteStringValue(value.ToString());
|
|
|
|
}
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
}
|