mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-22 20:37:19 -08:00
feature<CommitViewer>: support avatar from gravatar.com
This commit is contained in:
parent
730cf2a842
commit
dab5302fc8
2 changed files with 269 additions and 190 deletions
|
@ -18,201 +18,243 @@
|
|||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition x:Name="committerRow" Height="Auto"/>
|
||||
<RowDefinition Height="16"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="16"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Base information -->
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="72"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="96"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="96"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition x:Name="refRow" Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition x:Name="committerRow" Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- SHA -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="SHA" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
x:Name="SHA"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Margin="11,0,0,0"/>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="96"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="96"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Refs -->
|
||||
<Label x:Name="lblRefs" Grid.Row="0" Grid.Column="2" Content="REFS" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<ItemsControl Grid.Row="0" Grid.Column="3" x:Name="refs" Margin="8,0,0,0">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<!-- SHA -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="SHA" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox
|
||||
Grid.Row="0" Grid.Column="1"
|
||||
x:Name="SHA"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Margin="11,0,0,0"/>
|
||||
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border x:Name="BG" Height="16" Margin="2">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="18"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- PARENTS -->
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="PARENTS" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<ItemsControl Grid.Row="0" Grid.Column="3" x:Name="parents" Margin="8,0,0,0">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
|
||||
<Border Grid.Column="0" Background="{StaticResource Brush.BG5}">
|
||||
<Path x:Name="Icon" Width="8" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Branch}"/>
|
||||
</Border>
|
||||
|
||||
<Label x:Name="Name" Grid.Column="1" Content="{Binding Name}" FontSize="11" Padding="4,0" Foreground="Black"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Type}" Value="{x:Static git:DecoratorType.Tag}">
|
||||
<Setter TargetName="BG" Property="Background" Value="#FF02C302"/>
|
||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Tag}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Type}" Value="{x:Static git:DecoratorType.LocalBranchHead}">
|
||||
<Setter TargetName="BG" Property="Background" Value="#FFFFB835"/>
|
||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Branch}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Type}" Value="{x:Static git:DecoratorType.RemoteBranchHead}">
|
||||
<Setter TargetName="BG" Property="Background" Value="#FFFFB835"/>
|
||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Remote}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Type}" Value="{x:Static git:DecoratorType.CurrentBranchHead}">
|
||||
<Setter TargetName="BG" Property="Background" Value="#FFFFB835"/>
|
||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Check}"/>
|
||||
<Setter TargetName="Icon" Property="Fill" Value="Orange"/>
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- PARENTS -->
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="PARENTS" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<ItemsControl Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" x:Name="parents" Margin="8,0,0,0">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Label Margin="0,0,8,0">
|
||||
<Hyperlink
|
||||
RequestNavigate="NavigateParent"
|
||||
NavigateUri="{Binding .}"
|
||||
ToolTip="NAVIGATE TO COMMIT">
|
||||
<Run Text="{Binding .}"/>
|
||||
</Hyperlink>
|
||||
</Label>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- AUTHOR -->
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="AUTHOR" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" x:Name="author"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="0"
|
||||
Margin="11,0,0,0"/>
|
||||
|
||||
<!-- AUTHOR TIME -->
|
||||
<Label Grid.Row="2" Grid.Column="2" Content="AUTHOR TIME" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="3" x:Name="authorTime"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="0"
|
||||
Margin="8,0,0,0"/>
|
||||
|
||||
<!-- COMMITTER -->
|
||||
<Label Grid.Row="3" Grid.Column="0" Content="COMMITTER" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" x:Name="committer"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="0"
|
||||
Margin="11,0,0,0"/>
|
||||
|
||||
<!-- COMMIT TIME -->
|
||||
<Label Grid.Row="3" Grid.Column="2" Content="COMMIT TIME" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3" x:Name="committerTime"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="0"
|
||||
Margin="8,0,0,0"/>
|
||||
|
||||
<Rectangle Grid.Row="4" Grid.ColumnSpan="4" Height="1" Margin="8,0" Fill="{StaticResource Brush.Border2}"/>
|
||||
|
||||
<!-- SUBJECT -->
|
||||
<Label Grid.Row="5" Grid.Column="0" Content="SUBJECT" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3"
|
||||
x:Name="subject"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Margin="8,0,16,0"/>
|
||||
|
||||
<!-- MESSAGE -->
|
||||
<Label Grid.Row="6" Grid.Column="0" Content="DESCRIPTION" HorizontalAlignment="Right" VerticalAlignment="Top" Opacity=".6"/>
|
||||
<TextBox Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="3"
|
||||
x:Name="message"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="11"
|
||||
Margin="11,8,0,0"/>
|
||||
|
||||
<Rectangle Grid.Row="7" Grid.ColumnSpan="4" Height="1" Margin="8,0" Fill="{StaticResource Brush.Border2}"/>
|
||||
|
||||
<!-- CHANGELIST -->
|
||||
<Label Grid.Row="8" Grid.Column="0" Content="CHANGED" HorizontalAlignment="Right" VerticalAlignment="Top" Opacity=".6"/>
|
||||
<DataGrid
|
||||
Grid.Row="8"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
x:Name="changeList1"
|
||||
RowHeight="20"
|
||||
Margin="11,2,0,2">
|
||||
<DataGrid.Resources>
|
||||
<converters:FileStatusToColor x:Key="StatusColorConverter"/>
|
||||
<converters:FileStatusToIcon x:Key="StatusIconConverter"/>
|
||||
|
||||
<Style x:Key="Style.DataGridText.VerticalCenter" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="22">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Width="14" Height="14" x:Name="status" Background="{Binding ., Converter={StaticResource StatusColorConverter}}" CornerRadius="2" Margin="2,0,4,0">
|
||||
<TextBlock Text="{Binding ., Converter={StaticResource StatusIconConverter}}" Foreground="{StaticResource Brush.FG}" TextAlignment="Center" VerticalAlignment="Center" FontSize="8"/>
|
||||
</Border>
|
||||
<Label Margin="0,0,8,0">
|
||||
<Hyperlink RequestNavigate="NavigateParent" NavigateUri="{Binding .}" ToolTip="NAVIGATE TO COMMIT">
|
||||
<Run Text="{Binding .}"/>
|
||||
</Hyperlink>
|
||||
</Label>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Width="*" Binding="{Binding Path}" Foreground="{StaticResource Brush.FG}" FontFamily="Consolas" ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
|
||||
</DataGrid.Columns>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
||||
<EventSetter Event="ContextMenuOpening" Handler="ChangeListContextMenuOpening"/>
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ChangeListMouseDoubleClick"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
</DataGrid>
|
||||
<!-- Refs -->
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="REFS" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<ItemsControl Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" x:Name="refs" Margin="8,0,0,0">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border x:Name="BG" Height="16" Margin="2">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="18"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Grid.Column="0" Background="{StaticResource Brush.BG5}">
|
||||
<Path x:Name="Icon" Width="8" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Branch}"/>
|
||||
</Border>
|
||||
|
||||
<Label x:Name="Name" Grid.Column="1" Content="{Binding Name}" FontSize="11" Padding="4,0" Foreground="Black"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Type}" Value="{x:Static git:DecoratorType.Tag}">
|
||||
<Setter TargetName="BG" Property="Background" Value="#FF02C302"/>
|
||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Tag}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Type}" Value="{x:Static git:DecoratorType.LocalBranchHead}">
|
||||
<Setter TargetName="BG" Property="Background" Value="#FFFFB835"/>
|
||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Branch}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Type}" Value="{x:Static git:DecoratorType.RemoteBranchHead}">
|
||||
<Setter TargetName="BG" Property="Background" Value="#FFFFB835"/>
|
||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Remote}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Type}" Value="{x:Static git:DecoratorType.CurrentBranchHead}">
|
||||
<Setter TargetName="BG" Property="Background" Value="#FFFFB835"/>
|
||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Check}"/>
|
||||
<Setter TargetName="Icon" Property="Fill" Value="Orange"/>
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- AUTHOR -->
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="AUTHOR" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox
|
||||
x:Name="author"
|
||||
Grid.Row="2" Grid.Column="1"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="0"
|
||||
Margin="11,0,0,0"/>
|
||||
|
||||
<!-- AUTHOR TIME -->
|
||||
<Label Grid.Row="2" Grid.Column="2" Content="AUTHOR TIME" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox
|
||||
Grid.Row="2" Grid.Column="3"
|
||||
x:Name="authorTime"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="0"
|
||||
Margin="8,0,0,0"/>
|
||||
|
||||
<!-- COMMITTER -->
|
||||
<Label Grid.Row="3" Grid.Column="0" Content="COMMIT" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox
|
||||
Grid.Row="3" Grid.Column="1"
|
||||
x:Name="committer"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="0"
|
||||
Margin="11,0,0,0"/>
|
||||
|
||||
<!-- COMMIT TIME -->
|
||||
<Label Grid.Row="3" Grid.Column="2" Content="COMMIT TIME" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox
|
||||
Grid.Row="3" Grid.Column="3"
|
||||
x:Name="committerTime"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="0"
|
||||
Margin="8,0,0,0"/>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Column="1" Padding="8,8,8,0">
|
||||
<Image x:Name="avatar" VerticalAlignment="Top"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Rectangle Grid.Row="1" Height="1" Margin="8" Fill="{StaticResource Brush.Border2}"/>
|
||||
|
||||
<!-- Commit message -->
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="96"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- SUBJECT -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="SUBJECT" HorizontalAlignment="Right" Opacity=".6"/>
|
||||
<TextBox
|
||||
Grid.Row="0" Grid.Column="1"
|
||||
x:Name="subject"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Margin="8,0,16,0"/>
|
||||
|
||||
<!-- MESSAGE -->
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="DESCRIPTION" HorizontalAlignment="Right" VerticalAlignment="Top" Opacity=".6"/>
|
||||
<TextBox
|
||||
Grid.Row="1" Grid.Column="1"
|
||||
x:Name="message"
|
||||
IsReadOnly="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="11"
|
||||
Margin="11,8,0,0"/>
|
||||
</Grid>
|
||||
|
||||
<Rectangle Grid.Row="3" Grid.ColumnSpan="2" Height="1" Margin="8" Fill="{StaticResource Brush.Border2}"/>
|
||||
|
||||
<!-- Changes -->
|
||||
<Grid Grid.Row="4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="96"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Column="0" Content="CHANGED" HorizontalAlignment="Right" VerticalAlignment="Top" Opacity=".6"/>
|
||||
<DataGrid
|
||||
Grid.Column="1"
|
||||
x:Name="changeList1"
|
||||
RowHeight="20"
|
||||
Margin="11,2,0,2">
|
||||
<DataGrid.Resources>
|
||||
<converters:FileStatusToColor x:Key="StatusColorConverter"/>
|
||||
<converters:FileStatusToIcon x:Key="StatusIconConverter"/>
|
||||
|
||||
<Style x:Key="Style.DataGridText.VerticalCenter" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="22">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border Width="14" Height="14" x:Name="status" Background="{Binding ., Converter={StaticResource StatusColorConverter}}" CornerRadius="2" Margin="2,0,4,0">
|
||||
<TextBlock Text="{Binding ., Converter={StaticResource StatusIconConverter}}" Foreground="{StaticResource Brush.FG}" TextAlignment="Center" VerticalAlignment="Center" FontSize="8"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Width="*" Binding="{Binding Path}" Foreground="{StaticResource Brush.FG}" FontFamily="Consolas" ElementStyle="{StaticResource Style.DataGridText.VerticalCenter}"/>
|
||||
</DataGrid.Columns>
|
||||
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
||||
<EventSetter Event="ContextMenuOpening" Handler="ChangeListContextMenuOpening"/>
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ChangeListMouseDoubleClick"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
|
@ -338,7 +380,7 @@
|
|||
</DataGrid.RowStyle>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
|
||||
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent"/>
|
||||
|
||||
<local:DiffViewer Grid.Column="2" x:Name="diffViewer" Background="{StaticResource Brush.BG3}"/>
|
||||
|
@ -413,7 +455,7 @@
|
|||
<Label Margin="0,16,0,0" Content="BINARY FILE DETECTED" FontFamily="Consolas" FontSize="18" FontWeight="UltraBold" HorizontalAlignment="Center" Foreground="{StaticResource Brush.FG2}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace SourceGit.UI {
|
||||
|
@ -14,6 +18,11 @@ namespace SourceGit.UI {
|
|||
/// Commit detail viewer
|
||||
/// </summary>
|
||||
public partial class CommitViewer : UserControl {
|
||||
private static readonly string AVATAR_PATH = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"SourceGit",
|
||||
"avatars");
|
||||
|
||||
private Git.Repository repo = null;
|
||||
private Git.Commit commit = null;
|
||||
private List<Git.Change> cachedChanges = new List<Git.Change>();
|
||||
|
@ -87,13 +96,41 @@ namespace SourceGit.UI {
|
|||
subject.Text = commit.Subject;
|
||||
message.Text = commit.Message.Trim();
|
||||
|
||||
if (commit.Decorators.Count == 0) lblRefs.Visibility = Visibility.Collapsed;
|
||||
else lblRefs.Visibility = Visibility.Visible;
|
||||
byte[] hash = MD5.Create().ComputeHash(Encoding.Default.GetBytes(commit.Author.Email.ToLower().Trim()));
|
||||
string md5 = "";
|
||||
for (int i = 0; i < hash.Length; i++) md5 += hash[i].ToString("x2");
|
||||
md5 = md5.ToLower();
|
||||
|
||||
if (commit.Committer.Email == commit.Author.Email && commit.Committer.Time == commit.Author.Time) {
|
||||
committerRow.Height = new GridLength(0);
|
||||
if (!Directory.Exists(AVATAR_PATH)) Directory.CreateDirectory(AVATAR_PATH);
|
||||
|
||||
string filePath = Path.Combine(AVATAR_PATH, md5);
|
||||
if (File.Exists(filePath)) {
|
||||
avatar.Source = new BitmapImage(new Uri(filePath));
|
||||
} else {
|
||||
var bitmap = new BitmapImage(new Uri("https://www.gravatar.com/avatar/" + md5 + "?d=identicon"));
|
||||
bitmap.DownloadCompleted += (o, e) => {
|
||||
var owner = o as BitmapImage;
|
||||
if (owner != null) {
|
||||
var encoder = new PngBitmapEncoder();
|
||||
encoder.Frames.Add(BitmapFrame.Create(owner));
|
||||
using (var fs = new FileStream(filePath, FileMode.Create)) {
|
||||
encoder.Save(fs);
|
||||
}
|
||||
}
|
||||
};
|
||||
avatar.Source = bitmap;
|
||||
}
|
||||
|
||||
if (commit.Decorators.Count == 0) {
|
||||
refRow.Height = new GridLength(0);
|
||||
committerRow.Height = GridLength.Auto;
|
||||
} else {
|
||||
refRow.Height = GridLength.Auto;
|
||||
if (commit.Committer.Email == commit.Author.Email && commit.Committer.Time == commit.Author.Time) {
|
||||
committerRow.Height = new GridLength(0);
|
||||
} else {
|
||||
committerRow.Height = GridLength.Auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue