mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-02 01:34:58 +00:00
code_style: move hardcoded brush/strings (for outlier Conflict-icon) into named constants (#1350)
This makes code more consistent and gives better overview of all the icons. (Potentially, this special/outlier icon could be moved into the existing arrays as an extra ChangeState enum-value.)
This commit is contained in:
parent
1ee7d1184e
commit
9fb8af51ff
1 changed files with 7 additions and 3 deletions
|
@ -64,6 +64,10 @@ namespace SourceGit.Views
|
|||
private static readonly string[] INDICATOR = ["?", "±", "T", "+", "−", "➜", "❏", "U", "★"];
|
||||
private static readonly string[] TIPS = ["Unknown", "Modified", "Type Changed", "Added", "Deleted", "Renamed", "Copied", "Unmerged", "Untracked"];
|
||||
|
||||
private static readonly IBrush BACKGROUND_CONFLICT = Brushes.OrangeRed;
|
||||
private const string INDICATOR_CONFLICT = "!";
|
||||
private const string TIP_CONFLICT = "Conflict";
|
||||
|
||||
public static readonly StyledProperty<bool> IsUnstagedChangeProperty =
|
||||
AvaloniaProperty.Register<ChangeStatusIcon, bool>(nameof(IsUnstagedChange));
|
||||
|
||||
|
@ -95,8 +99,8 @@ namespace SourceGit.Views
|
|||
{
|
||||
if (Change.IsConflict)
|
||||
{
|
||||
background = Brushes.OrangeRed;
|
||||
indicator = "!";
|
||||
background = BACKGROUND_CONFLICT;
|
||||
indicator = INDICATOR_CONFLICT;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -139,7 +143,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
|
||||
if (isUnstaged)
|
||||
ToolTip.SetTip(this, c.IsConflict ? "Conflict" : TIPS[(int)c.WorkTree]);
|
||||
ToolTip.SetTip(this, c.IsConflict ? TIP_CONFLICT : TIPS[(int)c.WorkTree]);
|
||||
else
|
||||
ToolTip.SetTip(this, TIPS[(int)c.Index]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue