From 2e078d7d0e319bf0c42553f1d6073ea9fc371c56 Mon Sep 17 00:00:00 2001 From: Ishmaeel Date: Sat, 3 Aug 2024 17:16:30 +1000 Subject: [PATCH 1/6] Pass MaxResult setting to EverythingApi --- .../Search/Everything/EverythingSearchManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs index 7186acff5b4..6c9155539fe 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs @@ -64,7 +64,11 @@ public async IAsyncEnumerable SearchAsync(string search, [Enumerat if (token.IsCancellationRequested) yield break; - var option = new EverythingSearchOption(search, Settings.SortOption, IsFullPathSearch: Settings.EverythingSearchFullPath, IsRunCounterEnabled: Settings.EverythingEnableRunCount); + var option = new EverythingSearchOption(search, + Settings.SortOption, + MaxCount: Settings.MaxResult, + IsFullPathSearch: Settings.EverythingSearchFullPath, + IsRunCounterEnabled: Settings.EverythingEnableRunCount); await foreach (var result in EverythingApi.SearchAsync(option, token)) yield return result; @@ -96,6 +100,7 @@ public async IAsyncEnumerable ContentSearchAsync(string plainSearc Settings.SortOption, IsContentSearch: true, ContentSearchKeyword: contentSearch, + MaxCount: Settings.MaxResult, IsFullPathSearch: Settings.EverythingSearchFullPath, IsRunCounterEnabled: Settings.EverythingEnableRunCount); @@ -116,6 +121,7 @@ public async IAsyncEnumerable EnumerateAsync(string path, string s Settings.SortOption, ParentPath: path, IsRecursive: recursive, + MaxCount: Settings.MaxResult, IsFullPathSearch: Settings.EverythingSearchFullPath, IsRunCounterEnabled: Settings.EverythingEnableRunCount); From 578b4cb6c53bdefd47ec4ab779ac397cd36daba6 Mon Sep 17 00:00:00 2001 From: Ishmaeel Date: Mon, 5 Aug 2024 23:34:24 +1000 Subject: [PATCH 2/6] Add UI for Explorer plugin's MaxResult setting --- .../Flow.Launcher.Plugin.Explorer.csproj | 3 ++- .../Languages/en.xaml | 2 ++ .../ViewModels/SettingsViewModel.cs | 10 +++++++++ .../Views/ExplorerSettings.xaml | 22 +++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj index 6d149732780..ec0c910930c 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj @@ -2,7 +2,7 @@ Library - net7.0-windows + net7.0-windows10.0.19041.0 true true true @@ -48,6 +48,7 @@ + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 18fc336758c..0bc9d443725 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -66,6 +66,8 @@ Open Windows Index Option Excluded File Types (comma seperated) For example: exe,jpg,png + Maximum results + The maximum number of results requested from active search engine Explorer diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 729e05ba0f4..1b8515107e5 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -525,6 +525,16 @@ public string ExcludedFileTypes } } + public int MaxResult + { + get => Settings.MaxResult; + set + { + Settings.MaxResult = Math.Clamp(value, 0, 10000); + OnPropertyChanged(); + } + } + #region Everything FastSortWarning diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index caad341c80b..fccbc011b36 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -282,6 +282,7 @@ + + + From b181e0f7a422fd8506601286c2f51e99be0ed16d Mon Sep 17 00:00:00 2001 From: Ishmaeel Date: Fri, 9 Aug 2024 00:06:57 +1000 Subject: [PATCH 3/6] Update min to 100, remove redundant minmax, add binding delay --- .../ViewModels/SettingsViewModel.cs | 2 +- .../Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 1b8515107e5..662425492aa 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -530,7 +530,7 @@ public int MaxResult get => Settings.MaxResult; set { - Settings.MaxResult = Math.Clamp(value, 0, 10000); + Settings.MaxResult = Math.Clamp(value, 100, 10000); OnPropertyChanged(); } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index fccbc011b36..2412df15e62 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -360,15 +360,13 @@ Grid.Row="4" Grid.Column="1" MinWidth="350" - Maximum="10000" - Minimum="0" Margin="0,9,0,6" HorizontalAlignment="Left" VerticalAlignment="Center" CornerRadius="4" SmallChange="10" SpinButtonPlacementMode="Inline" - Value="{Binding MaxResult}" + Value="{Binding MaxResult, Delay=100}" ToolTip="{DynamicResource plugin_explorer_Maximum_Results_Tooltip}"/> From df07a64661d5a0d1a225cbc750251710e74b4288 Mon Sep 17 00:00:00 2001 From: Ishmaeel Date: Sat, 10 Aug 2024 11:17:00 +1000 Subject: [PATCH 4/6] Convert MaxResult editor to TextBox --- .../Flow.Launcher.Plugin.Explorer.csproj | 3 +-- .../Views/ExplorerSettings.xaml | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj index ec0c910930c..6d149732780 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj @@ -2,7 +2,7 @@ Library - net7.0-windows10.0.19041.0 + net7.0-windows true true true @@ -48,7 +48,6 @@ - diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 2412df15e62..716ffebd9a4 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -356,17 +356,14 @@ VerticalAlignment="Center" Text="{DynamicResource plugin_explorer_Maximum_Results}" TextBlock.Foreground="{DynamicResource Color05B}" /> - From 9285b9c5f4863e9ac204f7306bd177d1c24a91e9 Mon Sep 17 00:00:00 2001 From: Ishmaeel Date: Sat, 10 Aug 2024 21:24:48 +1000 Subject: [PATCH 5/6] Add numeric input restriction --- .../ViewModels/SettingsViewModel.cs | 5 ++++- .../Views/ExplorerSettings.xaml | 1 + .../Views/ExplorerSettings.xaml.cs | 9 +++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 662425492aa..309f7a6f7ac 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -525,12 +525,15 @@ public string ExcludedFileTypes } } + public int MaxResultLowerLimit => 100; + public int MaxResultUpperLimit => 100000; + public int MaxResult { get => Settings.MaxResult; set { - Settings.MaxResult = Math.Clamp(value, 100, 10000); + Settings.MaxResult = Math.Clamp(value, MaxResultLowerLimit, MaxResultUpperLimit); OnPropertyChanged(); } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 716ffebd9a4..bb19fef6e05 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -363,6 +363,7 @@ Margin="0,9,0,6" HorizontalAlignment="Left" VerticalAlignment="Center" + PreviewTextInput="AllowOnlyNumericInput" Text="{Binding MaxResult}" ToolTip="{DynamicResource plugin_explorer_Maximum_Results_Tooltip}"/> diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index d0483ea8d44..b7f5efc3cc7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; +using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; using Flow.Launcher.Plugin.Explorer.ViewModels; using System.Collections.Generic; using System.ComponentModel; @@ -40,7 +40,7 @@ public ExplorerSettings(SettingsViewModel viewModel) } - + private void AccessLinkDragDrop(string containerName, DragEventArgs e) { var files = (string[])e.Data.GetData(DataFormats.FileDrop); @@ -94,5 +94,10 @@ private void LbxExcludedPaths_OnDrop(object sender, DragEventArgs e) { AccessLinkDragDrop("IndexSearchExcludedPath", e); } + + private void AllowOnlyNumericInput(object sender, System.Windows.Input.TextCompositionEventArgs e) + { + e.Handled = e.Text.ToCharArray().Any(c => !char.IsDigit(c)); + } } } From 785b3657e55b2b0eb0b368ed019502f1c5f326c9 Mon Sep 17 00:00:00 2001 From: Ishmaeel Date: Sat, 10 Aug 2024 21:50:22 +1000 Subject: [PATCH 6/6] Add maxlength --- .../Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index bb19fef6e05..001859caaf0 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -364,6 +364,7 @@ HorizontalAlignment="Left" VerticalAlignment="Center" PreviewTextInput="AllowOnlyNumericInput" + MaxLength="6" Text="{Binding MaxResult}" ToolTip="{DynamicResource plugin_explorer_Maximum_Results_Tooltip}"/>