mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
- Add GroupName
- Adjust Labels
This commit is contained in:
parent
b9bc7002b0
commit
e154b12674
7 changed files with 106 additions and 25 deletions
43
Flow.Launcher/Converters/TextConverter.cs
Normal file
43
Flow.Launcher/Converters/TextConverter.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
|
||||
namespace Flow.Launcher.Converters
|
||||
{
|
||||
public class TextConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var ID = value.ToString();
|
||||
switch(ID)
|
||||
{
|
||||
case "NewRelease":
|
||||
return InternationalizationManager.Instance.GetTranslation("pluginStore_NewRelease");
|
||||
break;
|
||||
case "RecentlyUpdated":
|
||||
return InternationalizationManager.Instance.GetTranslation("pluginStore_RecentlyUpdated");
|
||||
break;
|
||||
case "None":
|
||||
return InternationalizationManager.Instance.GetTranslation("pluginStore_None");
|
||||
break;
|
||||
case "installed":
|
||||
return InternationalizationManager.Instance.GetTranslation("pluginStore_Installed");
|
||||
break;
|
||||
default:
|
||||
return ID;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
|
@ -87,6 +87,10 @@
|
|||
|
||||
<!-- Setting Plugin Store -->
|
||||
<system:String x:Key="pluginStore">Plugin Store</system:String>
|
||||
<system:String x:Key="pluginStore_NewRelease">New Release</system:String>
|
||||
<system:String x:Key="pluginStore_RecentlyUpdated">Recently Updated</system:String>
|
||||
<system:String x:Key="pluginStore_None">Plugins</system:String>
|
||||
<system:String x:Key="pluginStore_Installed">Installed</system:String>
|
||||
<system:String x:Key="refresh">Refresh</system:String>
|
||||
<system:String x:Key="installbtn">Install</system:String>
|
||||
<system:String x:Key="uninstallbtn">Uninstall</system:String>
|
||||
|
|
@ -95,7 +99,6 @@
|
|||
<system:String x:Key="LabelInstalledToolTip">Plug-in already installed</system:String>
|
||||
<system:String x:Key="LabelNew">New Version</system:String>
|
||||
<system:String x:Key="LabelNewToolTip">This plug-in has been updated within the last 7 days</system:String>
|
||||
<system:String x:Key="LabelUpdate">Update</system:String>
|
||||
<system:String x:Key="LabelUpdateToolTip">New Update is Available</system:String>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -177,9 +177,9 @@
|
|||
AllowDrop="True"
|
||||
Background="Transparent"
|
||||
PreviewDragOver="OnPreviewDragOver"
|
||||
PreviewKeyUp="QueryTextBox_KeyUp"
|
||||
Style="{DynamicResource QueryBoxStyle}"
|
||||
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
PreviewKeyUp="QueryTextBox_KeyUp"
|
||||
Visibility="Visible">
|
||||
<TextBox.CommandBindings>
|
||||
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
<Window.Resources>
|
||||
<converters:BorderClipConverter x:Key="BorderClipConverter" />
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
<converters:TextConverter x:Key="TextConverter" />
|
||||
<CollectionViewSource x:Key="SortedFonts" Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}">
|
||||
<CollectionViewSource.SortDescriptions>
|
||||
<scm:SortDescription PropertyName="Source" />
|
||||
|
|
@ -1463,6 +1464,32 @@
|
|||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
SelectionMode="Single"
|
||||
Style="{DynamicResource StoreListStyle}">
|
||||
<ListBox.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.ContainerStyle>
|
||||
<Style TargetType="{x:Type GroupItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Grid>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock
|
||||
Margin="0,0,0,10"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Text="{Binding Name, Converter={StaticResource TextConverter}}" />
|
||||
<ItemsPresenter />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</GroupStyle.ContainerStyle>
|
||||
</GroupStyle>
|
||||
</ListBox.GroupStyle>
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid
|
||||
|
|
@ -1518,36 +1545,17 @@
|
|||
Margin="0,0,2,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
x:Name="LabelNew"
|
||||
Margin="0,10,8,0"
|
||||
Padding="6,2,6,2"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Background="#f14551"
|
||||
CornerRadius="4"
|
||||
ToolTip="{DynamicResource LabelNewToolTip}"
|
||||
Visibility="{Binding LabelNew, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock
|
||||
FontSize="11"
|
||||
Foreground="{DynamicResource Color01B}"
|
||||
Text="{DynamicResource LabelNew}" />
|
||||
</Border>
|
||||
<Border
|
||||
x:Name="LabelUpdate"
|
||||
Height="12"
|
||||
Margin="0,10,8,0"
|
||||
Padding="6,2,6,2"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Background="#45BD59"
|
||||
CornerRadius="4"
|
||||
CornerRadius="36"
|
||||
ToolTip="{DynamicResource LabelUpdateToolTip}"
|
||||
Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<TextBlock
|
||||
FontSize="11"
|
||||
Foreground="{DynamicResource Color01B}"
|
||||
Text="{DynamicResource LabelUpdate}" />
|
||||
</Border>
|
||||
Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<Border
|
||||
x:Name="Labelinstalled"
|
||||
Margin="0,10,8,0"
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ namespace Flow.Launcher
|
|||
API = api;
|
||||
InitializePosition();
|
||||
InitializeComponent();
|
||||
|
||||
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(StoreListBox.ItemsSource);
|
||||
PropertyGroupDescription groupDescription = new PropertyGroupDescription("Category");
|
||||
view.GroupDescriptions.Add(groupDescription);
|
||||
}
|
||||
|
||||
#region General
|
||||
|
|
|
|||
|
|
@ -29,5 +29,27 @@ namespace Flow.Launcher.ViewModel
|
|||
public bool LabelInstalled => PluginManager.GetPluginForId(_plugin.ID) != null;
|
||||
public bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version;
|
||||
public bool LabelNew => DateTime.Now - _plugin.LatestReleaseDate < TimeSpan.FromDays(7) && !LabelUpdate; // Show Update Label show first.
|
||||
|
||||
public string Category
|
||||
{
|
||||
get
|
||||
{
|
||||
string category = "None";
|
||||
if (DateTime.Now - _plugin.LatestReleaseDate < TimeSpan.FromDays(7))
|
||||
{
|
||||
category = "RecentlyUpdated";
|
||||
}
|
||||
if (DateTime.Now - _plugin.DateAdded < TimeSpan.FromDays(7))
|
||||
{
|
||||
category = "NewRelease";
|
||||
}
|
||||
if (PluginManager.GetPluginForId(_plugin.ID) != null)
|
||||
{
|
||||
category = "Installed";
|
||||
}
|
||||
|
||||
return category;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
|
@ -326,7 +328,6 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region theme
|
||||
|
|
|
|||
Loading…
Reference in a new issue