mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-06 11:34:59 +00:00
refactor: use a new Models.ChangeState.Conflicted
to represent all the unmerged
file state (#1359)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
30d4c1008a
commit
ef53dd0025
6 changed files with 87 additions and 135 deletions
|
@ -48,25 +48,16 @@ namespace SourceGit.Views
|
|||
EndPoint = new RelativePoint(0, 1, RelativeUnit.Relative),
|
||||
},
|
||||
new LinearGradientBrush
|
||||
{
|
||||
GradientStops = new GradientStops() { new GradientStop(Color.FromRgb(238, 160, 14), 0), new GradientStop(Color.FromRgb(228, 172, 67), 1) },
|
||||
StartPoint = new RelativePoint(0, 0, RelativeUnit.Relative),
|
||||
EndPoint = new RelativePoint(0, 1, RelativeUnit.Relative),
|
||||
},
|
||||
new LinearGradientBrush
|
||||
{
|
||||
GradientStops = new GradientStops() { new GradientStop(Color.FromRgb(47, 185, 47), 0), new GradientStop(Color.FromRgb(75, 189, 75), 1) },
|
||||
StartPoint = new RelativePoint(0, 0, RelativeUnit.Relative),
|
||||
EndPoint = new RelativePoint(0, 1, RelativeUnit.Relative),
|
||||
},
|
||||
Brushes.OrangeRed,
|
||||
];
|
||||
|
||||
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";
|
||||
private static readonly string[] INDICATOR = ["?", "±", "T", "+", "−", "➜", "❏", "★", "!"];
|
||||
private static readonly string[] TIPS = ["Unknown", "Modified", "Type Changed", "Added", "Deleted", "Renamed", "Copied", "Untracked", "Conflict"];
|
||||
|
||||
public static readonly StyledProperty<bool> IsUnstagedChangeProperty =
|
||||
AvaloniaProperty.Register<ChangeStatusIcon, bool>(nameof(IsUnstagedChange));
|
||||
|
@ -97,16 +88,8 @@ namespace SourceGit.Views
|
|||
string indicator;
|
||||
if (IsUnstagedChange)
|
||||
{
|
||||
if (Change.IsConflict)
|
||||
{
|
||||
background = BACKGROUND_CONFLICT;
|
||||
indicator = INDICATOR_CONFLICT;
|
||||
}
|
||||
else
|
||||
{
|
||||
background = BACKGROUNDS[(int)Change.WorkTree];
|
||||
indicator = INDICATOR[(int)Change.WorkTree];
|
||||
}
|
||||
background = BACKGROUNDS[(int)Change.WorkTree];
|
||||
indicator = INDICATOR[(int)Change.WorkTree];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -143,7 +126,7 @@ namespace SourceGit.Views
|
|||
}
|
||||
|
||||
if (isUnstaged)
|
||||
ToolTip.SetTip(this, c.IsConflict ? TIP_CONFLICT : TIPS[(int)c.WorkTree]);
|
||||
ToolTip.SetTip(this, TIPS[(int)c.WorkTree]);
|
||||
else
|
||||
ToolTip.SetTip(this, TIPS[(int)c.Index]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue