Add settings ui

This commit is contained in:
Jack251970 2025-03-15 22:35:51 +08:00
parent b1a46817f0
commit 3abcebd02b
5 changed files with 44 additions and 2 deletions

View file

@ -276,7 +276,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public bool HideWhenDeactivated { get; set; } = true;
public bool SearchQueryResultsWithDelay { get; set; } = false;
public int SearchInputDelay { get; set; } = 150;
public int SearchInputDelay { get; set; } = 120;
[JsonConverter(typeof(JsonStringEnumConverter))]
public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor;

View file

@ -94,6 +94,10 @@
<system:String x:Key="hideOnStartupToolTip">Flow Launcher search window is hidden in the tray after starting up.</system:String>
<system:String x:Key="hideNotifyIcon">Hide tray icon</system:String>
<system:String x:Key="hideNotifyIconToolTip">When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window.</system:String>
<system:String x:Key="searchDelay">Search Delay</system:String>
<system:String x:Key="searchDelayToolTip">Delay for a while to search when typing. This reduces interface jumpiness and result load.</system:String>
<system:String x:Key="searchDelayTime">Search Delay Time</system:String>
<system:String x:Key="searchDelayTimeToolTip">Delay time which search results appear when typing is stopped. Default is 120ms.</system:String>
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
<system:String x:Key="querySearchPrecisionToolTip">Changes minimum match score required for results.</system:String>
<system:String x:Key="SearchPrecisionNone">None</system:String>

View file

@ -865,7 +865,7 @@ namespace Flow.Launcher
private IDisposable _reactiveSubscription;
private void SetupSearchTextBoxReactiveness(bool showResultsWithDelay)
public void SetupSearchTextBoxReactiveness(bool showResultsWithDelay)
{
if (_reactiveSubscription != null)
{

View file

@ -139,6 +139,22 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
}
}
public bool SearchQueryResultsWithDelay
{
get => Settings.SearchQueryResultsWithDelay;
set
{
Settings.SearchQueryResultsWithDelay = value;
((MainWindow)System.Windows.Application.Current.MainWindow).SetupSearchTextBoxReactiveness(value);
}
}
public IEnumerable<int> SearchInputDelayRange => new List<int>()
{
30, 60, 90, 120, 150, 180, 210, 240, 270, 300
};
public List<LastQueryModeData> LastQueryModes { get; } =
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");

View file

@ -172,6 +172,28 @@
OnContent="{DynamicResource enable}" />
</cc:Card>
<cc:CardGroup Margin="0 14 0 0">
<cc:Card
Title="{DynamicResource searchDelay}"
Icon="&#xE961;"
Sub="{DynamicResource searchDelayToolTip}">
<ui:ToggleSwitch
IsOn="{Binding SearchQueryResultsWithDelay}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</cc:Card>
<cc:Card
Title="{DynamicResource searchDelayTime}"
Icon="&#xE916;"
Sub="{DynamicResource searchDelayTimeToolTip}">
<ComboBox
Width="100"
ItemsSource="{Binding SearchInputDelayRange}"
SelectedItem="{Binding Settings.SearchInputDelay}" />
</cc:Card>
</cc:CardGroup>
<cc:CardGroup Margin="0 14 0 0">
<cc:Card Title="{DynamicResource querySearchPrecision}" Sub="{DynamicResource querySearchPrecisionToolTip}">
<ComboBox