refactor<RevisionCompare, Histories>: show author rather than committer in RevisionCompare/Histories

This commit is contained in:
leo 2023-10-11 15:37:23 +08:00
parent e17fbab4cf
commit 2516f11231
3 changed files with 52 additions and 56 deletions

View file

@ -122,8 +122,8 @@
<controls:Avatar <controls:Avatar
Width="16" Height="16" Width="16" Height="16"
HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"
Email="{Binding Committer.Email}" Email="{Binding Author.Email}"
FallbackLabel="{Binding Committer.Name}"/> FallbackLabel="{Binding Author.Name}"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
@ -131,7 +131,7 @@
<DataGridTemplateColumn Width="80" IsReadOnly="True"> <DataGridTemplateColumn Width="80" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding Committer.Name}" Margin="0,0,8,0"/> <TextBlock Text="{Binding Author.Name}" Margin="0,0,8,0"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>

View file

@ -10,7 +10,7 @@
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid Margin="4,8,4,4"> <Grid Margin="4,8,4,4">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="44"/> <RowDefinition Height="48"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
@ -28,16 +28,10 @@
BorderBrush="{DynamicResource Brush.Border2}" BorderBrush="{DynamicResource Brush.Border2}"
BorderThickness="1" BorderThickness="1"
Background="{DynamicResource Brush.Contents}" Background="{DynamicResource Brush.Contents}"
CornerRadius="4"> CornerRadius="4"
<Grid Margin="4"> Padding="4"
<Grid.ColumnDefinitions> TextElement.FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}">
<ColumnDefinition Width="Auto"/> <Grid>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<controls:Avatar Grid.Column="0" Width="32" Height="32" x:Name="avatarStart"/>
<Grid Grid.Column="1" Margin="8,0,0,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@ -47,14 +41,17 @@
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" x:Name="txtStartSHA" Foreground="DarkOrange" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/> <controls:Avatar Grid.Column="0" Width="14" Height="14" x:Name="avatarStart"/>
<TextBlock Grid.Column="1" x:Name="txtStartTime" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/> <TextBlock Grid.Column="1" x:Name="txtStartAuthor" Foreground="{DynamicResource Brush.FG1}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="2" x:Name="txtStartSHA" Foreground="DarkOrange" Margin="8,0,0,0" />
<TextBlock Grid.Column="3" x:Name="txtStartTime" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid> </Grid>
<TextBlock Grid.Row="1" x:Name="txtStartSubject" VerticalAlignment="Bottom" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" FontSize="10pt"/> <TextBlock Grid.Row="1" Margin="4,0" x:Name="txtStartSubject" VerticalAlignment="Bottom" FontSize="10pt"/>
</Grid>
</Grid> </Grid>
</Border> </Border>
@ -74,16 +71,10 @@
BorderBrush="{DynamicResource Brush.Border2}" BorderBrush="{DynamicResource Brush.Border2}"
BorderThickness="1" BorderThickness="1"
Background="{DynamicResource Brush.Contents}" Background="{DynamicResource Brush.Contents}"
CornerRadius="4"> Padding="4"
<Grid Margin="4"> CornerRadius="4"
<Grid.ColumnDefinitions> TextElement.FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}">
<ColumnDefinition Width="Auto"/> <Grid>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<controls:Avatar Grid.Column="0" Width="32" Height="32" x:Name="avatarEnd"/>
<Grid Grid.Column="1" Margin="8,0,0,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@ -93,14 +84,17 @@
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" x:Name="txtEndSHA" Foreground="DarkOrange" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" /> <controls:Avatar Grid.Column="0" Width="14" Height="14" x:Name="avatarEnd"/>
<TextBlock Grid.Column="1" x:Name="txtEndTime" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" /> <TextBlock Grid.Column="1" x:Name="txtEndAuthor" Foreground="{DynamicResource Brush.FG1}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="2" x:Name="txtEndSHA" Foreground="DarkOrange" Margin="8,0,0,0" />
<TextBlock Grid.Column="3" x:Name="txtEndTime" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid> </Grid>
<TextBlock Grid.Row="1" x:Name="txtEndSubject" VerticalAlignment="Bottom" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" FontSize="10pt"/> <TextBlock Grid.Row="1" Margin="4,0" x:Name="txtEndSubject" VerticalAlignment="Bottom" FontSize="10pt"/>
</Grid>
</Grid> </Grid>
</Border> </Border>
</Grid> </Grid>

View file

@ -13,16 +13,18 @@ namespace SourceGit.Views.Widgets {
} }
public void SetData(string repo, Models.Commit start, Models.Commit end) { public void SetData(string repo, Models.Commit start, Models.Commit end) {
avatarStart.Email = start.Committer.Email; avatarStart.Email = start.Author.Email;
avatarStart.FallbackLabel = start.Committer.Name; avatarStart.FallbackLabel = start.Author.Name;
avatarStart.ToolTip = start.Committer.Name; avatarStart.ToolTip = start.Committer.Name;
txtStartAuthor.Text = start.Author.Name;
txtStartSHA.Text = start.ShortSHA; txtStartSHA.Text = start.ShortSHA;
txtStartTime.Text = start.CommitterTimeStr; txtStartTime.Text = start.CommitterTimeStr;
txtStartSubject.Text = start.Subject; txtStartSubject.Text = start.Subject;
avatarEnd.Email = end.Committer.Email; avatarEnd.Email = end.Author.Email;
avatarEnd.FallbackLabel = end.Committer.Name; avatarEnd.FallbackLabel = end.Author.Name;
avatarEnd.ToolTip = end.Committer.Name; avatarEnd.ToolTip = end.Committer.Name;
txtEndAuthor.Text = end.Author.Name;
txtEndSHA.Text = end.ShortSHA; txtEndSHA.Text = end.ShortSHA;
txtEndTime.Text = end.CommitterTimeStr; txtEndTime.Text = end.CommitterTimeStr;
txtEndSubject.Text = end.Subject; txtEndSubject.Text = end.Subject;