mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add plugin search delay settings panel
This commit is contained in:
parent
fc4b5c9e6c
commit
5dd9e8d963
9 changed files with 100 additions and 7 deletions
|
|
@ -51,6 +51,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
}
|
||||
metadata.Disabled = settings.Disabled;
|
||||
metadata.Priority = settings.Priority;
|
||||
metadata.SearchDelayTime = settings.SearchDelayTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -59,9 +60,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
ID = metadata.ID,
|
||||
Name = metadata.Name,
|
||||
Version = metadata.Version,
|
||||
ActionKeywords = metadata.ActionKeywords,
|
||||
ActionKeywords = metadata.ActionKeywords,
|
||||
Disabled = metadata.Disabled,
|
||||
Priority = metadata.Priority
|
||||
Priority = metadata.Priority,
|
||||
SearchDelayTime = metadata.SearchDelayTime,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -74,6 +76,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
public string Version { get; set; }
|
||||
public List<string> ActionKeywords { get; set; } // a reference of the action keywords from plugin manager
|
||||
public int Priority { get; set; }
|
||||
public int SearchDelayTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used only to save the state of the plugin in settings
|
||||
|
|
|
|||
|
|
@ -287,6 +287,18 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
}
|
||||
public int SearchInputDelay { get; set; } = 120;
|
||||
|
||||
[JsonIgnore]
|
||||
public List<int> SearchInputDelayRange { get; } = new()
|
||||
{
|
||||
30, 60, 90, 120, 150, 180, 210, 240, 270, 300
|
||||
};
|
||||
|
||||
[JsonIgnore]
|
||||
public List<int> PluginSearchInputDelayRange { get; } = new()
|
||||
{
|
||||
0, 30, 60, 90, 120, 150
|
||||
};
|
||||
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ namespace Flow.Launcher.Plugin
|
|||
|
||||
public List<string> ActionKeywords { get; set; }
|
||||
|
||||
public int SearchDelayTime { get; set; }
|
||||
|
||||
public string IcoPath { get; set;}
|
||||
|
||||
public override string ToString()
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@
|
|||
<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>
|
||||
<system:String x:Key="pluginSearchDelayTooltip">Change Seach Delay Time</system:String>
|
||||
<system:String x:Key="currentPriority">Current Priority</system:String>
|
||||
<system:String x:Key="newPriority">New Priority</system:String>
|
||||
<system:String x:Key="priority">Priority</system:String>
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@
|
|||
<StackPanel>
|
||||
<ContentControl Content="{Binding BottomPart1}" />
|
||||
|
||||
<ContentControl Content="{Binding BottomPart2}" />
|
||||
|
||||
<Border
|
||||
BorderThickness="0 1 0 0"
|
||||
BorderBrush="{DynamicResource Color03B}"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
<UserControl
|
||||
x:Class="Flow.Launcher.Resources.Controls.InstalledPluginSearchDelay"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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: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}">
|
||||
<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 searchDelayTime}" />
|
||||
<ComboBox
|
||||
Width="100"
|
||||
Height="34"
|
||||
Margin="5 0 0 0"
|
||||
HorizontalAlignment="Right"
|
||||
Cursor="Hand"
|
||||
DockPanel.Dock="Right"
|
||||
FontWeight="Bold"
|
||||
ItemsSource="{Binding PluginSearchInputDelayRange}"
|
||||
SelectedItem="{Binding PluginSearchDelayTime}"
|
||||
ToolTip="{DynamicResource pluginSearchDelayTooltip}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using System.Windows.Controls;
|
||||
|
||||
namespace Flow.Launcher.Resources.Controls;
|
||||
|
||||
public partial class InstalledPluginSearchDelay : UserControl
|
||||
{
|
||||
public InstalledPluginSearchDelay()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
|
@ -139,10 +139,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
}
|
||||
}
|
||||
|
||||
public IEnumerable<int> SearchInputDelayRange => new List<int>()
|
||||
{
|
||||
30, 60, 90, 120, 150, 180, 210, 240, 270, 300
|
||||
};
|
||||
public IEnumerable<int> SearchInputDelayRange => Settings.SearchInputDelayRange;
|
||||
|
||||
public List<LastQueryModeData> LastQueryModes { get; } =
|
||||
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ using System.Windows.Controls;
|
|||
using CommunityToolkit.Mvvm.Input;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
using Flow.Launcher.Resources.Controls;
|
||||
using System.Collections.Generic;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -81,6 +84,19 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public IEnumerable<int> PluginSearchInputDelayRange { get; } =
|
||||
Ioc.Default.GetRequiredService<Settings>().PluginSearchInputDelayRange;
|
||||
|
||||
public int PluginSearchDelayTime
|
||||
{
|
||||
get => PluginPair.Metadata.SearchDelayTime;
|
||||
set
|
||||
{
|
||||
PluginPair.Metadata.SearchDelayTime = value;
|
||||
PluginSettingsObject.SearchDelayTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Control _settingControl;
|
||||
private bool _isExpanded;
|
||||
|
||||
|
|
@ -88,7 +104,10 @@ namespace Flow.Launcher.ViewModel
|
|||
public Control BottomPart1 => IsExpanded ? _bottomPart1 ??= new InstalledPluginDisplayKeyword() : null;
|
||||
|
||||
private Control _bottomPart2;
|
||||
public Control BottomPart2 => IsExpanded ? _bottomPart2 ??= new InstalledPluginDisplayBottomData() : null;
|
||||
public Control BottomPart2 => IsExpanded ? _bottomPart2 ??= new InstalledPluginSearchDelay() : null;
|
||||
|
||||
private Control _bottomPart3;
|
||||
public Control BottomPart3 => IsExpanded ? _bottomPart3 ??= new InstalledPluginDisplayBottomData() : null;
|
||||
|
||||
public bool HasSettingControl => PluginPair.Plugin is ISettingProvider && (PluginPair.Plugin is not JsonRPCPluginBase jsonRPCPluginBase || jsonRPCPluginBase.NeedCreateSettingPanel());
|
||||
public Control SettingControl
|
||||
|
|
|
|||
Loading…
Reference in a new issue