Skip to content

Commit

Permalink
Added tabbable content and design time data.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisellgren committed Mar 10, 2012
1 parent 0a88d82 commit 174e5e1
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 108 deletions.
1 change: 1 addition & 0 deletions App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ResourceDictionary Source="Styles/DataGrid.xaml"/>
<ResourceDictionary Source="Styles/LeftToolbar.xaml"/>
<ResourceDictionary Source="Styles/TopToolbar.xaml"/>
<!--<ResourceDictionary Source="SampleData/RepositoryData.xaml"/>-->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
6 changes: 3 additions & 3 deletions ChangesetHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public ChangesetHistory(MainWindow window)

public void Load()
{
Repository repo = new Repository("Z:/www/git1");
LibGit2Sharp.Repository repo = new LibGit2Sharp.Repository("Z:/www/git1");
//Branch master = repo.Branches.ElementAt(0);

foreach (LibGit2Sharp.Commit commit in repo.Commits)
Expand All @@ -33,11 +33,11 @@ public void Load()
c.Hash = commit.Sha;
c.Source = branches.ElementAt(0).ToString();

this.window.ChangesetHistory.Items.Add(c);
//this.window.ChangesetHistory.Items.Add(c);
}
}

private IEnumerable<Branch> ListBranchesContaininingCommit(Repository repo, string commitSha)
private IEnumerable<Branch> ListBranchesContaininingCommit(LibGit2Sharp.Repository repo, string commitSha)
{
bool directBranchHasBeenFound = false;
foreach (var branch in repo.Branches)
Expand Down
7 changes: 7 additions & 0 deletions DesignData/RepositoryData/SampleRepositories.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<local:RepositoryCollection xmlns:local="clr-namespace:GG">

<local:Repository Name="Sample" FullPath="Z:/www/git1" />
<local:Repository Name="Sample 2" FullPath="Z:/www/git1" />
<local:Repository Name="Sample 3" FullPath="Z:/www/git1" />

</local:RepositoryCollection>
2 changes: 2 additions & 0 deletions DesignData/RepositoryData/SampleRepository.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<local:Repository xmlns:local="clr-namespace:GG"
Name="Sample" FullPath="Z:/www/git1" />
5 changes: 4 additions & 1 deletion Git-GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Models\Repository.cs" />
<DesignData Include="DesignData\RepositoryData\SampleRepositories.xaml" />
<DesignData Include="DesignData\RepositoryData\SampleRepository.xaml" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand All @@ -94,7 +97,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="ChangesetHistory.cs" />
<Compile Include="Commit.cs" />
<Compile Include="Models\Commit.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
Expand Down
199 changes: 105 additions & 94 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell"
xmlns:local="clr-namespace:GG"
Title="Git-GUI" Height="417" Width="1020" Icon="Resources/Icons/Git-GUI.png" WindowStartupLocation="CenterScreen" WindowState="Maximized">
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
Title="Git-GUI" Height="417" Width="1020" Icon="Resources/Icons/Git-GUI.png" WindowState="Maximized">
<Window.Resources>
<Style x:Key="GlassStyle" TargetType="{x:Type local:MainWindow}">
<Setter Property="shell:WindowChrome.WindowChrome">
Expand All @@ -23,101 +25,110 @@
</Style>
</Window.Resources>

<Grid Margin="0,-24,0,0">
<TabControl shell:WindowChrome.IsHitTestVisibleInChrome="True" Background="#e9e9e9">
<TabItem Header="Linux kernel">
<DockPanel>
<Menu DockPanel.Dock="Top" VerticalAlignment="Top" Background="{x:Null}">
<MenuItem Header="_File">
<MenuItem Header="_Create repository" />
<MenuItem Header="_Open repository" />
<Separator />
<MenuItem Header="_Exit" />
</MenuItem>
<MenuItem Header="_Edit">
<MenuItem Header="_Preferences" />
</MenuItem>
<MenuItem Header="_Tools">
<MenuItem Header="_Statistics" />
<MenuItem Header="Search" />
<MenuItem Header="File removal from _history" />
<MenuItem Header="File _browser" />
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="_About" />
<MenuItem Header="_Documentation" />
</MenuItem>
</Menu>
<WrapPanel DockPanel.Dock="Top" Style="{StaticResource TopToolbar}">
<Button>
<StackPanel>
<Image Source="Resources/Icons/Settings.png" Width="24" Height="24" />
<TextBlock>Settings</TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Fetch.png" Width="24" Height="24" />
<TextBlock>Fetch</TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Pull.png" Width="24" Height="24" />
<TextBlock>Pull</TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Push.png" Width="24" Height="24" />
<TextBlock>Push</TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Search.png" Width="24" Height="24" />
<TextBlock>Search</TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Statistics.png" Width="24" Height="24" />
<TextBlock>Statistics</TextBlock>
</StackPanel>
</Button>
</WrapPanel>
<DockPanel DockPanel.Dock="Bottom">
<Border CornerRadius="8,0,0,8" BorderBrush="#bbb" BorderThickness="1,1,0,1" ClipToBounds="True">
<Grid>
<Border Name="LeftToolbarMask" Background="White" CornerRadius="8,0,0,8"/>
<StackPanel Style="{StaticResource LeftToolbar}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="160" DockPanel.Dock="Left" ClipToBounds="True">
<StackPanel.OpacityMask>
<VisualBrush Visual="{Binding ElementName=LeftToolbarMask}"/>
</StackPanel.OpacityMask>
<StackPanel Margin="8">
<TextBlock><Image Source="Resources/Icons/Branch.png" Width="16" />BRANCHES</TextBlock>
<TextBlock><Image Source="Resources/Icons/Tag.png" Width="16" />TAGS</TextBlock>
<TextBlock><Image Source="Resources/Icons/Remote.png" Width="16" />REMOTES</TextBlock>
<TextBlock><Image Source="Resources/Icons/Stash.png" Width="16" />STASHES</TextBlock>
<TextBlock><Image Source="Resources/Icons/Submodule.png" Width="16" />SUBMODULES</TextBlock>
</StackPanel>
<Grid Margin="0,-24,0,0" d:DataContext="{d:DesignData Source=./DesignData/RepositoryData/SampleRepositories.xaml}">
<TabControl x:Name="RepositoryTabs" ItemsSource="{Binding Mode=OneWay}" shell:WindowChrome.IsHitTestVisibleInChrome="True" Background="#e9e9e9">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock>
<TextBlock Text="{Binding Name}"/>
</TextBlock>
</DataTemplate>
</TabControl.ItemTemplate>

<TabControl.ContentTemplate>
<DataTemplate>
<DockPanel>
<Menu DockPanel.Dock="Top" VerticalAlignment="Top" Background="{x:Null}">
<MenuItem Header="_File">
<MenuItem Header="_Create repository" />
<MenuItem Header="_Open repository" />
<Separator />
<MenuItem Header="_Exit" />
</MenuItem>
<MenuItem Header="_Edit">
<MenuItem Header="_Preferences" />
</MenuItem>
<MenuItem Header="_Tools">
<MenuItem Header="_Statistics" />
<MenuItem Header="Search" />
<MenuItem Header="File removal from _history" />
<MenuItem Header="File _browser" />
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="_About" />
<MenuItem Header="_Documentation" />
</MenuItem>
</Menu>
<WrapPanel DockPanel.Dock="Top" Style="{StaticResource TopToolbar}">
<Button>
<StackPanel>
<Image Source="Resources/Icons/Settings.png" Width="24" Height="24" />
<TextBlock>Settings <TextBlock Text="{Binding FirstName}"/></TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Fetch.png" Width="24" Height="24" />
<TextBlock>Fetch</TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Pull.png" Width="24" Height="24" />
<TextBlock>Pull</TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Push.png" Width="24" Height="24" />
<TextBlock>Push</TextBlock>
</StackPanel>
</Grid>
</Border>
<DataGrid SelectionUnit="FullRow" HeadersVisibility="Column" ItemsSource="{Binding Commit}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" Name="ChangesetHistory" VerticalAlignment="Stretch" DockPanel.Dock="Right">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=Hash}" Header="Hash"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=Source}" Header="Source"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=Description}" Header="Description"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=Date}" Header="Date"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=AuthorName}" Header="Author name"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=AuthorEmail}" Header="Author email"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Search.png" Width="24" Height="24" />
<TextBlock>Search</TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="Resources/Icons/Statistics.png" Width="24" Height="24" />
<TextBlock>Statistics</TextBlock>
</StackPanel>
</Button>
</WrapPanel>
<DockPanel DockPanel.Dock="Bottom">
<Border CornerRadius="8,0,0,8" BorderBrush="#bbb" BorderThickness="1,1,0,1" ClipToBounds="True">
<Grid>
<Border Name="LeftToolbarMask" Background="White" CornerRadius="8,0,0,8"/>
<StackPanel Style="{StaticResource LeftToolbar}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="160" DockPanel.Dock="Left" ClipToBounds="True">
<StackPanel.OpacityMask>
<VisualBrush Visual="{Binding ElementName=LeftToolbarMask}"/>
</StackPanel.OpacityMask>
<StackPanel Margin="8">
<TextBlock><Image Source="Resources/Icons/Branch.png" Width="16" />BRANCHES</TextBlock>
<TextBlock><Image Source="Resources/Icons/Tag.png" Width="16" />TAGS</TextBlock>
<TextBlock><Image Source="Resources/Icons/Remote.png" Width="16" />REMOTES</TextBlock>
<TextBlock><Image Source="Resources/Icons/Stash.png" Width="16" />STASHES</TextBlock>
<TextBlock><Image Source="Resources/Icons/Submodule.png" Width="16" />SUBMODULES</TextBlock>
</StackPanel>
</StackPanel>
</Grid>
</Border>
<DataGrid SelectionUnit="FullRow" HeadersVisibility="Column" ItemsSource="{Binding Commit}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" x:Name="ChangesetHistory" VerticalAlignment="Stretch" DockPanel.Dock="Right">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=Hash}" Header="Hash"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=Source}" Header="Source"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=Description}" Header="Description"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=Date}" Header="Date"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=AuthorName}" Header="Author name"></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=AuthorEmail}" Header="Author email"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</DockPanel>
</DockPanel>
</DockPanel>
</TabItem>
<TabItem Header="Symfony 2"></TabItem>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</Grid>
</Window>
32 changes: 22 additions & 10 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Windows;

namespace GG
Expand All @@ -9,21 +10,32 @@ namespace GG
public partial class MainWindow : Window
{
protected ChangesetHistory changesetHistory;
protected List<Repository> repositories;

public List<Repository> Repositories
{
get;
set;
}

public MainWindow()
{
try
{
InitializeComponent();
}
catch (Exception e)
{
System.Console.WriteLine(e.Message);
}
InitializeComponent();

this.Style = (Style) Resources["GlassStyle"];
this.changesetHistory = new ChangesetHistory(this);
this.Preload();

//create all
this.repositories = new List<Repository>{
new Repository {Name = "Linux Kernel", FullPath = "Z:/www/git1"},
new Repository {Name = "Symfony 2", FullPath = "Z:/www/7th-Degree"}
};

//show
this.RepositoryTabs.ItemsSource = this.repositories;
this.RepositoryTabs.SelectedIndex = 0;

//this.changesetHistory = new ChangesetHistory(this);
//this.Preload();
}

/// <summary>
Expand Down
18 changes: 18 additions & 0 deletions Models/Commit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GG
{
public struct Commit
{
public string AuthorEmail { set; get; }
public string AuthorName { set; get; }
public string Date { set; get; }
public string Description { set; get; }
public string Hash { set; get; }
public string Source { set; get; }
}
}
17 changes: 17 additions & 0 deletions Models/Repository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Collections.Generic;

namespace GG
{
public class Repository
{
public Repository() {}

public string Name { get; set; }
public string FullPath { get; set; }
}

public class RepositoryCollection : List<Repository>
{
public RepositoryCollection() {}
}
}
11 changes: 11 additions & 0 deletions SampleDataScenarios.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;

namespace SampleDataScenarios.Model
{
public class DesignTimeSampleDataCollection : List<Object>
{

public DesignTimeSampleDataCollection() { }
}
}

0 comments on commit 174e5e1

Please sign in to comment.