mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add global search panel
This commit is contained in:
parent
afce7022e9
commit
f7b1190f95
4 changed files with 105 additions and 37 deletions
|
|
@ -77,11 +77,25 @@ namespace Flow.Launcher
|
|||
{
|
||||
foreach (var actionKeyword in removedActionKeywords)
|
||||
{
|
||||
App.API.RemoveActionKeyword(id, actionKeyword);
|
||||
if (actionKeyword == Query.GlobalPluginWildcardSign)
|
||||
{
|
||||
pluginViewModel.GlobalSearch = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
App.API.RemoveActionKeyword(id, actionKeyword);
|
||||
}
|
||||
}
|
||||
foreach (var actionKeyword in addedActionKeywords)
|
||||
{
|
||||
App.API.AddActionKeyword(id, actionKeyword);
|
||||
if (actionKeyword == Query.GlobalPluginWildcardSign)
|
||||
{
|
||||
pluginViewModel.GlobalSearch = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
App.API.AddActionKeyword(id, actionKeyword);
|
||||
}
|
||||
}
|
||||
|
||||
// Update action keywords text and close window
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@
|
|||
<system:String x:Key="disable">Off</system:String>
|
||||
<system:String x:Key="actionKeywordsTitle">Action keyword Setting</system:String>
|
||||
<system:String x:Key="actionKeywords">Action keyword</system:String>
|
||||
<system:String x:Key="globalSearch">Global search</system:String>
|
||||
<system:String x:Key="currentActionKeywords">Current action keyword</system:String>
|
||||
<system:String x:Key="newActionKeyword">New action keyword</system:String>
|
||||
<system:String x:Key="actionKeywordsTooltip">Change Action Keywords</system:String>
|
||||
|
|
|
|||
|
|
@ -4,44 +4,80 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
xmlns:viewModel="clr-namespace:Flow.Launcher.ViewModel"
|
||||
d:DataContext="{d:DesignInstance viewModel:PluginViewModel}"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="300"
|
||||
mc:Ignorable="d">
|
||||
<Border
|
||||
Width="Auto"
|
||||
Height="52"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
BorderThickness="0 1 0 0"
|
||||
CornerRadius="0"
|
||||
Style="{DynamicResource SettingGroupBox}"
|
||||
Visibility="{Binding ActionKeywordsVisibility}">
|
||||
<DockPanel Margin="22 0 18 0" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="48 0 10 0"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource SettingTitleLabel}"
|
||||
Text="{DynamicResource actionKeywords}" />
|
||||
<Button
|
||||
Width="100"
|
||||
Height="34"
|
||||
Margin="5 0 0 0"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding SetActionKeywordsCommand}"
|
||||
Content="{Binding ActionKeywordsText}"
|
||||
Cursor="Hand"
|
||||
DockPanel.Dock="Right"
|
||||
FontWeight="Bold"
|
||||
ToolTip="{DynamicResource actionKeywordsTooltip}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Border
|
||||
Width="Auto"
|
||||
Height="52"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
BorderThickness="0 1 0 0"
|
||||
CornerRadius="0"
|
||||
Style="{DynamicResource SettingGroupBox}"
|
||||
Visibility="{Binding ActionKeywordsVisibility}">
|
||||
<DockPanel Margin="22 0 18 0" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="48 0 10 0"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource SettingTitleLabel}"
|
||||
Text="{DynamicResource actionKeywords}" />
|
||||
<Button
|
||||
Width="100"
|
||||
Height="34"
|
||||
Margin="5 0 0 0"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding SetActionKeywordsCommand}"
|
||||
Content="{Binding ActionKeywordsText}"
|
||||
Cursor="Hand"
|
||||
DockPanel.Dock="Right"
|
||||
FontWeight="Bold"
|
||||
ToolTip="{DynamicResource actionKeywordsTooltip}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Border
|
||||
Width="Auto"
|
||||
Height="52"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
BorderThickness="0 1 0 0"
|
||||
CornerRadius="0"
|
||||
Style="{DynamicResource SettingGroupBox}"
|
||||
Visibility="{Binding ActionKeywordsVisibility}">
|
||||
<DockPanel Margin="22 0 18 0" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Margin="48 0 10 0"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
Style="{DynamicResource SettingTitleLabel}"
|
||||
Text="{DynamicResource globalSearch}" />
|
||||
<ui:ToggleSwitch
|
||||
Height="34"
|
||||
Margin="5 0 0 0"
|
||||
HorizontalAlignment="Right"
|
||||
Cursor="Hand"
|
||||
DockPanel.Dock="Right"
|
||||
IsOn="{Binding GlobalSearch}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
OnContent="{DynamicResource enable}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
|||
|
|
@ -105,6 +105,23 @@ namespace Flow.Launcher.ViewModel
|
|||
public string Version => InternationalizationManager.Instance.GetTranslation("plugin_query_version") + " " + PluginPair.Metadata.Version;
|
||||
public string InitAndQueryTime => InternationalizationManager.Instance.GetTranslation("plugin_init_time") + " " + PluginPair.Metadata.InitTime + "ms, " + InternationalizationManager.Instance.GetTranslation("plugin_query_time") + " " + PluginPair.Metadata.AvgQueryTime + "ms";
|
||||
public string ActionKeywordsText => string.Join(Query.ActionKeywordSeparator, PluginPair.Metadata.ActionKeywords);
|
||||
public bool GlobalSearch
|
||||
{
|
||||
get => PluginPair.Metadata.ActionKeywords.Contains(Query.GlobalPluginWildcardSign);
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
App.API.AddActionKeyword(PluginPair.Metadata.ID, Query.GlobalPluginWildcardSign);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.API.RemoveActionKeyword(PluginPair.Metadata.ID, Query.GlobalPluginWildcardSign);
|
||||
}
|
||||
OnPropertyChanged();
|
||||
OnActionKeywordsChanged();
|
||||
}
|
||||
}
|
||||
public int Priority => PluginPair.Metadata.Priority;
|
||||
public Infrastructure.UserSettings.Plugin PluginSettingsObject { get; set; }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue