mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 11:44:59 +00:00
feature: show tags count in tags tree (#1306)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
5b72b15cf2
commit
6bf930a9e0
3 changed files with 24 additions and 6 deletions
|
@ -56,8 +56,16 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public string Tooltip
|
public string Tooltip
|
||||||
{
|
{
|
||||||
get => Backend is Models.Branch b ?
|
get
|
||||||
b.FriendlyName : (Backend is Models.Remote r ? r.URL : null);
|
{
|
||||||
|
if (Backend is Models.Branch b)
|
||||||
|
return b.FriendlyName;
|
||||||
|
|
||||||
|
if (Backend is Models.Remote r)
|
||||||
|
return r.URL;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Models.FilterMode _filterMode = Models.FilterMode.None;
|
private Models.FilterMode _filterMode = Models.FilterMode.None;
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace SourceGit.ViewModels
|
||||||
public Models.Tag Tag { get; private set; } = null;
|
public Models.Tag Tag { get; private set; } = null;
|
||||||
public TagTreeNodeToolTip ToolTip { get; private set; } = null;
|
public TagTreeNodeToolTip ToolTip { get; private set; } = null;
|
||||||
public List<TagTreeNode> Children { get; private set; } = [];
|
public List<TagTreeNode> Children { get; private set; } = [];
|
||||||
|
public int Counter { get; set; } = 0;
|
||||||
|
|
||||||
public bool IsFolder
|
public bool IsFolder
|
||||||
{
|
{
|
||||||
|
@ -38,6 +39,11 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _isExpanded, value);
|
set => SetProperty(ref _isExpanded, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string TagsCount
|
||||||
|
{
|
||||||
|
get => Counter > 0 ? $"({Counter})" : string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public TagTreeNode(Models.Tag t, int depth)
|
public TagTreeNode(Models.Tag t, int depth)
|
||||||
{
|
{
|
||||||
FullPath = t.Name;
|
FullPath = t.Name;
|
||||||
|
@ -52,6 +58,7 @@ namespace SourceGit.ViewModels
|
||||||
FullPath = path;
|
FullPath = path;
|
||||||
Depth = depth;
|
Depth = depth;
|
||||||
IsExpanded = isExpanded;
|
IsExpanded = isExpanded;
|
||||||
|
Counter = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<TagTreeNode> Build(IList<Models.Tag> tags, HashSet<string> expaneded)
|
public static List<TagTreeNode> Build(IList<Models.Tag> tags, HashSet<string> expaneded)
|
||||||
|
@ -77,6 +84,7 @@ namespace SourceGit.ViewModels
|
||||||
if (folders.TryGetValue(folder, out var value))
|
if (folders.TryGetValue(folder, out var value))
|
||||||
{
|
{
|
||||||
lastFolder = value;
|
lastFolder = value;
|
||||||
|
lastFolder.Counter++;
|
||||||
}
|
}
|
||||||
else if (lastFolder == null)
|
else if (lastFolder == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<Path Width="10" Height="10" Data="{StaticResource Icons.Tag}"/>
|
<Path Width="10" Height="10" Data="{StaticResource Icons.Tag}"/>
|
||||||
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Text="{Binding Name}"/>
|
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Text="{Binding Name}"/>
|
||||||
<Border Background="Green" Margin="4,0,0,0" CornerRadius="4" IsVisible="{Binding IsAnnotated}">
|
<Border Background="Green" Margin="4,0,0,0" CornerRadius="4" IsVisible="{Binding IsAnnotated}">
|
||||||
<TextBlock Text="{DynamicResource Text.CreateTag.Type.Annotated}" Classes="primary" Margin="4,0" Foreground="#FFDDDDDD"/>
|
<TextBlock Text="{DynamicResource Text.CreateTag.Type.Annotated}" Classes="primary" Margin="4,0" Foreground="White"/>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
@ -59,8 +59,10 @@
|
||||||
|
|
||||||
<TextBlock Grid.Column="2"
|
<TextBlock Grid.Column="2"
|
||||||
Classes="primary"
|
Classes="primary"
|
||||||
Text="{Binding FullPath, Converter={x:Static c:PathConverters.PureFileName}}"
|
Margin="8,0,0,0">
|
||||||
Margin="8,0,0,0"/>
|
<Run Text="{Binding FullPath, Converter={x:Static c:PathConverters.PureFileName}}"/>
|
||||||
|
<Run Text="{Binding TagsCount}" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
<ContentControl Grid.Column="3" Content="{Binding Tag}">
|
<ContentControl Grid.Column="3" Content="{Binding Tag}">
|
||||||
<ContentControl.DataTemplates>
|
<ContentControl.DataTemplates>
|
||||||
|
@ -91,7 +93,7 @@
|
||||||
<Path Width="10" Height="10" Data="{StaticResource Icons.Tag}"/>
|
<Path Width="10" Height="10" Data="{StaticResource Icons.Tag}"/>
|
||||||
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Text="{Binding Name}"/>
|
<TextBlock FontWeight="Bold" Margin="4,0,0,0" Text="{Binding Name}"/>
|
||||||
<Border Background="Green" Margin="4,0,0,0" CornerRadius="4" IsVisible="{Binding IsAnnotated}">
|
<Border Background="Green" Margin="4,0,0,0" CornerRadius="4" IsVisible="{Binding IsAnnotated}">
|
||||||
<TextBlock Text="{DynamicResource Text.CreateTag.Type.Annotated}" Classes="primary" Margin="4,0" Foreground="#FFDDDDDD"/>
|
<TextBlock Text="{DynamicResource Text.CreateTag.Type.Annotated}" Classes="primary" Margin="4,0" Foreground="White"/>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue