Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/Converters/BoolConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,23 @@ public static class BoolConverters

public static readonly FuncValueConverter<bool, IBrush> IsWarningToBrush =
new(x => x ? Brushes.DarkGoldenrod : Application.Current?.FindResource("Brush.FG1") as IBrush);

public static readonly FuncValueConverter<bool, int> IsStagedOnTopToUnstagedRow =
new(x => x ? 3 : 1);

public static readonly FuncValueConverter<bool, int> IsStagedOnTopToStagedRow =
new(x => x ? 1 : 3);

public static readonly FuncValueConverter<bool, StreamGeometry> IsStagedOnTopToStageIcon =
new(x => Application.Current?.FindResource(x ? "Icons.Up" : "Icons.Down") as StreamGeometry);

public static readonly FuncValueConverter<bool, StreamGeometry> IsStagedOnTopToStageAllIcon =
new(x => Application.Current?.FindResource(x ? "Icons.DoubleUp" : "Icons.DoubleDown") as StreamGeometry);

public static readonly FuncValueConverter<bool, StreamGeometry> IsStagedOnTopToUnstageIcon =
new(x => Application.Current?.FindResource(x ? "Icons.Down" : "Icons.Up") as StreamGeometry);

public static readonly FuncValueConverter<bool, StreamGeometry> IsStagedOnTopToUnstageAllIcon =
new(x => Application.Current?.FindResource(x ? "Icons.DoubleDown" : "Icons.DoubleUp") as StreamGeometry);
}
}
1 change: 1 addition & 0 deletions src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@
<x:String x:Key="Text.Preferences.General.ShowChangesPageByDefault" xml:space="preserve">Show `LOCAL CHANGES` page by default</x:String>
<x:String x:Key="Text.Preferences.General.ShowChangesTabInCommitDetailByDefault" xml:space="preserve">Show `CHANGES` tab in commit detail by default</x:String>
<x:String x:Key="Text.Preferences.General.ShowRelativeTimeInGraph" xml:space="preserve">Show relative time in commit graph</x:String>
<x:String x:Key="Text.Preferences.General.ShowStagedChangesOnTop" xml:space="preserve">Show staged changes above unstaged changes</x:String>
<x:String x:Key="Text.Preferences.General.ShowTagsInGraph" xml:space="preserve">Show tags in commit graph</x:String>
<x:String x:Key="Text.Preferences.General.SubjectGuideLength" xml:space="preserve">Subject Guide Length</x:String>
<x:String x:Key="Text.Preferences.General.Use24Hours" xml:space="preserve">24-Hours</x:String>
Expand Down
7 changes: 7 additions & 0 deletions src/ViewModels/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@ public int ImageDiffActiveIdx
set => SetProperty(ref _imageDiffActiveIdx, value);
}

public bool ShowStagedChangesOnTop
{
get => _showStagedChangesOnTop;
set => SetProperty(ref _showStagedChangesOnTop, value);
}

public bool EnableCompactFoldersInChangesTree
{
get => _enableCompactFoldersInChangesTree;
Expand Down Expand Up @@ -830,6 +836,7 @@ private bool RemoveInvalidRepositoriesRecursive(List<RepositoryNode> collection)
private string _ignoreUpdateTag = string.Empty;

private bool _showTagsInGraph = true;
private bool _showStagedChangesOnTop = false;
private bool _useTwoColumnsLayoutInHistories = false;
private bool _displayTimeAsPeriodInHistories = false;
private bool _useSideBySideDiff = false;
Expand Down
9 changes: 7 additions & 2 deletions src/Views/Preferences.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<TabItem.Header>
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Preferences.General}"/>
</TabItem.Header>
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32,32,32,32,32,32,Auto" ColumnDefinitions="Auto,*">
<Grid Margin="8" RowDefinitions="32,32,32,32,32,32,32,32,32,32,32,32,32,Auto" ColumnDefinitions="Auto,*">
<TextBlock Grid.Row="0" Grid.Column="0"
Text="{DynamicResource Text.Preferences.General.Locale}"
HorizontalAlignment="Right"
Expand Down Expand Up @@ -172,11 +172,16 @@
IsChecked="{Binding EnableCompactFoldersInChangesTree, Mode=TwoWay}"/>

<CheckBox Grid.Row="11" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Preferences.General.ShowStagedChangesOnTop}"
IsChecked="{Binding ShowStagedChangesOnTop, Mode=TwoWay}"/>

<CheckBox Grid.Row="12" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Preferences.General.UseGitHubStyleAvatar}"
IsChecked="{Binding UseGitHubStyleAvatar, Mode=TwoWay}"/>

<CheckBox Grid.Row="12" Grid.Column="1"
<CheckBox Grid.Row="13" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Preferences.General.Check4UpdatesOnStartup}"
IsVisible="{x:Static s:App.IsCheckForUpdateCommandVisible}"
Expand Down
12 changes: 6 additions & 6 deletions src/Views/WorkingCopy.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</Border>

<!-- Unstaged -->
<Grid Grid.Row="1" RowDefinitions="28,*">
<Grid Grid.Row="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowStagedChangesOnTop, Converter={x:Static c:BoolConverters.IsStagedOnTopToUnstagedRow}}" RowDefinitions="28,*">
<!-- Unstaged Toolbar -->
<Border Grid.Row="0" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}">
<Grid ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto,Auto,Auto,Auto">
Expand Down Expand Up @@ -129,15 +129,15 @@
VerticalAlignment="Center"/>
</StackPanel>
</ToolTip.Tip>
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{StaticResource Icons.Down}"/>
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowStagedChangesOnTop, Converter={x:Static c:BoolConverters.IsStagedOnTopToStageIcon}}"/>
</Button>
<Button Grid.Column="8"
Classes="icon_button"
Width="26" Height="14"
Padding="0"
ToolTip.Tip="{DynamicResource Text.WorkingCopy.Unstaged.StageAll}"
Click="OnStageAllButtonClicked">
<Path Width="14" Height="14" Data="{StaticResource Icons.DoubleDown}"/>
<Path Width="14" Height="14" Data="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowStagedChangesOnTop, Converter={x:Static c:BoolConverters.IsStagedOnTopToStageAllIcon}}"/>
</Button>
</Grid>
</Border>
Expand All @@ -164,7 +164,7 @@
Focusable="False"/>

<!-- Staged -->
<Grid Grid.Row="3" RowDefinitions="27,*">
<Grid Grid.Row="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowStagedChangesOnTop, Converter={x:Static c:BoolConverters.IsStagedOnTopToStagedRow}}" RowDefinitions="27,*">
<!-- Staged Toolbar -->
<Border Grid.Row="0" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}">
<Grid ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto">
Expand All @@ -185,10 +185,10 @@
Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
</StackPanel>
</ToolTip.Tip>
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{StaticResource Icons.Up}"/>
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowStagedChangesOnTop, Converter={x:Static c:BoolConverters.IsStagedOnTopToUnstageIcon}}"/>
</Button>
<Button Grid.Column="5" Classes="icon_button" Width="26" Height="14" Padding="0" ToolTip.Tip="{DynamicResource Text.WorkingCopy.Staged.UnstageAll}" Click="OnUnstageAllButtonClicked">
<Path Width="14" Height="14" Data="{StaticResource Icons.DoubleUp}"/>
<Path Width="14" Height="14" Data="{Binding Source={x:Static vm:Preferences.Instance}, Path=ShowStagedChangesOnTop, Converter={x:Static c:BoolConverters.IsStagedOnTopToUnstageAllIcon}}"/>
</Button>
</Grid>
</Border>
Expand Down