Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add username who made the commit - Issue #85 #86

Merged
merged 3 commits into from
Feb 6, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion SeeGitApp/Extensions/CommitTemplatedAdorner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace SeeGit
/// </summary>
internal class CommitTemplatedAdorner : Adorner
{
private FrameworkElement _adornedElement;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, but since this isn't settable, it should be readonly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just committed the change to use readonly.

/// <summary>
///
/// </summary>
Expand All @@ -17,6 +18,8 @@ internal class CommitTemplatedAdorner : Adorner
public CommitTemplatedAdorner(UIElement adornedElement, FrameworkElement frameworkElementAdorner)
: base(adornedElement)
{
_adornedElement = (FrameworkElement) adornedElement;

// Assure we get mouse hits
_frameworkElementAdorner = frameworkElementAdorner;
AddVisualChild(_frameworkElementAdorner);
Expand Down Expand Up @@ -57,7 +60,9 @@ protected override Size MeasureOverride(Size constraint)
/// <returns></returns>
protected override Size ArrangeOverride(Size finalSize)
{
_frameworkElementAdorner.Arrange(new Rect(new Point(0, 0), finalSize));
// Make sure to align to the right of the element being adorned
double xloc = _adornedElement.ActualWidth;
_frameworkElementAdorner.Arrange(new Rect(new Point(xloc, 0), finalSize));
return finalSize;
}

Expand Down
6 changes: 6 additions & 0 deletions SeeGitApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@ private void OnToggleSettings(object sender, RoutedEventArgs args)
foreach (var vertex in _viewModel.Graph.Vertices)
{
vertex.AdornerMessageVisibilityType = Configuration.GetSetting("AdornerCommitMessageVisibility", "ExpandedHidden");
vertex.AuthorShown = Configuration.GetSetting("AuthorInHeader", false);
vertex.DescriptionShown = Configuration.GetSetting("DescriptionInExpander", false);
vertex.ShaLength = Configuration.GetSetting("SHALength", 8);
}
Configuration.Save();
_viewModel.Refresh();
// Ideally we wouldn't have to call relayout. Refreshing the view model would
// update the Graph which would then cause the RepositoryGraphLayout control to adjust its layout.
// Unfortunately, I am not as familiar with the RepositoryGraphLayout control and when the vertices have their
// width's increased due to displaying the author, the graph needs to have its layout adjusted.
graphLayout.Relayout();
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions SeeGitApp/Models/CommitVertex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public CommitVertex(string sha, string message)
Branches.CollectionChanged += (o, e) => RaisePropertyChanged(() => HasBranches);
ShaLength = MainWindow.Configuration.GetSetting("SHALength", 8);
DescriptionShown = MainWindow.Configuration.GetSetting("DescriptionInExpander", false);
AuthorShown = MainWindow.Configuration.GetSetting("AuthorInHeader", false);
AdornerMessageVisibilityType = MainWindow.Configuration.GetSetting("AdornerCommitMessageVisibility", "ExpandedHidden");
Expanded = false;
}
Expand Down Expand Up @@ -48,6 +49,22 @@ public bool DescriptionShown
}
}

private bool _authorShown;

public bool AuthorShown
{
get
{
return _authorShown;

}
set
{
_authorShown = value;
RaisePropertyChanged(() => AuthorShown);
}
}

public bool AdornerMessageVisibility
{
get;
Expand Down
11 changes: 9 additions & 2 deletions SeeGitApp/Views/CommitVertexView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</Style>
</Border.Style>
<i:Interaction.Behaviors>
<local:CommitAdornerBehavior AdornerVisible="Visible" AdornerMargin="105,10,0,0" DataContext="{Binding}">
<local:CommitAdornerBehavior AdornerVisible="Visible" AdornerMargin="10,10,0,0" DataContext="{Binding}">
<local:CommitAdornerBehavior.AdornerTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
Expand Down Expand Up @@ -91,8 +91,15 @@
<DropShadowEffect BlurRadius="2" Color="LightGray" Opacity="0.3" Direction="315" />
</Border.Effect>

<Expander IsExpanded="False" Header="{Binding ShortSha, Mode=OneWay}" Padding="5"
<Expander IsExpanded="False" Padding="5"
ToolTip="{Binding Message, Mode=OneWay}" Expanded="Expander_Expanded" Collapsed="Expander_Collapsed">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ShortSha, Mode=OneWay}"></TextBlock>
<TextBlock Text=" " Visibility="{Binding AuthorShown, Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock>
<TextBlock Text="{Binding Author, Mode=OneWay}" Visibility="{Binding AuthorShown, Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock>
</StackPanel>
</Expander.Header>
<Expander.Style>
<Style TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="White" />
Expand Down
7 changes: 7 additions & 0 deletions SeeGitApp/Views/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
IsChecked="{Binding Path=CommitDescriptionShown}"/>
</StackPanel>

<StackPanel Orientation="Vertical">
<Label VerticalAlignment="Center" VerticalContentAlignment="Center" Foreground="White" FontSize="10"
FontFamily="Verdana" FontWeight="Bold" Margin="0,0,0,0" Content="Show Commit Author" />
<CheckBox Name="CommitAuthor" HorizontalAlignment="Center" Margin="10 2 0 0" Background="White"
IsChecked="{Binding Path=CommitAuthorShown}"/>
</StackPanel>

<StackPanel Orientation="Vertical">
<Label VerticalAlignment="Center" VerticalContentAlignment="Center" Foreground="White" FontSize="10"
FontFamily="Verdana" FontWeight="Bold" Margin="0,0,0,0" Content="SHA Length" />
Expand Down
12 changes: 12 additions & 0 deletions SeeGitApp/Views/SettingsView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ public bool CommitDescriptionShown
_config.SetSetting("DescriptionInExpander", value ? "True" : "False");
}
}

public bool CommitAuthorShown
{
get
{
return _config.GetSetting("AuthorInHeader", false);
}
set
{
_config.SetSetting("AuthorInHeader", value ? "True" : "False");
}
}
}
}
}