mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add max suggestions setting for web search plugins
Introduced a MaxSuggestions property (min 1, max 10) to control the number of autocomplete suggestions shown in web search plugins. Updated the UI to allow user configuration and added localized labels for the new setting in all supported languages. Suggestions in results are now limited according to this setting.
This commit is contained in:
parent
83883c4b05
commit
2176553b26
8 changed files with 36 additions and 2 deletions
|
|
@ -19,6 +19,7 @@
|
|||
<system:String x:Key="flowlauncher_plugin_websearch_url">URL</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_search">Suche</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion">Autovervollständigung von Suchanfragen verwenden</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_max_suggestions">Max. Vorschläge:</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion_provider">Autovervollständigung der Daten aus:</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_pls_select_web_search">Bitte wählen Sie eine Websuche aus</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_delete_warning">Sind Sie sicher, dass Sie {0} löschen wollen?</system:String>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
<system:String x:Key="flowlauncher_plugin_websearch_url">URL</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_search">Search</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion">Use Search Query Autocomplete</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_max_suggestions">Max Suggestions:</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion_provider">Autocomplete Data from:</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_pls_select_web_search">Please select a web search</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_delete_warning">Are you sure you want to delete {0}?</system:String>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
<system:String x:Key="flowlauncher_plugin_websearch_url">URL</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_search">Busca en</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion">Usar autocompletado en consultas de búsqueda</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_max_suggestions">Max sugerencias:</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion_provider">Autocompletar datos desde:</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_pls_select_web_search">Por favor, seleccione una búsqueda web</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_delete_warning">¿Está seguro de que desea eliminar {0}?</system:String>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
<system:String x:Key="flowlauncher_plugin_websearch_url">URL</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_search">Rechercher sur</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion">Utiliser la fonction d'auto-complétion des requêtes de recherche</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_max_suggestions">Max suggestions :</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion_provider">Saisir automatiquement les données à partir de :</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_pls_select_web_search">Veuillez sélectionner une recherche web</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_delete_warning">Êtes-vous sûr de vouloir supprimer {0} ?</system:String>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
<system:String x:Key="flowlauncher_plugin_websearch_url">URL</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_search">Search</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion">Use Search Query Autocomplete</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_max_suggestions">Qtd Sugestões:</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion_provider">Autocomplete Data from:</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_pls_select_web_search">Please select a web search</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_websearch_delete_warning">Are you sure you want to delete {0}?</system:String>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -91,6 +91,7 @@ namespace Flow.Launcher.Plugin.WebSearch
|
|||
|
||||
if (token.IsCancellationRequested)
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
return results;
|
||||
|
|
@ -126,7 +127,7 @@ namespace Flow.Launcher.Plugin.WebSearch
|
|||
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
var resultsFromSuggestion = suggestions?.Select(o => new Result
|
||||
var resultsFromSuggestion = suggestions?.Take(_settings.MaxSuggestions).Select(o => new Result
|
||||
{
|
||||
Title = o,
|
||||
SubTitle = subtitle,
|
||||
|
|
|
|||
|
|
@ -205,6 +205,20 @@ namespace Flow.Launcher.Plugin.WebSearch
|
|||
}
|
||||
}
|
||||
|
||||
private int maxSuggestions = 1;
|
||||
public int MaxSuggestions
|
||||
{
|
||||
get => maxSuggestions;
|
||||
set
|
||||
{
|
||||
if (maxSuggestions != value)
|
||||
{
|
||||
maxSuggestions = Math.Max(1, Math.Min(value, 10));
|
||||
OnPropertyChanged(nameof(MaxSuggestions));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public SuggestionSource[] Suggestions { get; set; } = {
|
||||
new Google(),
|
||||
|
|
|
|||
|
|
@ -154,6 +154,20 @@
|
|||
<Label
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="{DynamicResource flowlauncher_plugin_websearch_max_suggestions}" />
|
||||
<TextBox
|
||||
Width="40"
|
||||
Height="30"
|
||||
Margin="{StaticResource SettingPanelItemLeftMargin}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
FontSize="11"
|
||||
Text="{Binding Settings.MaxSuggestions, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Label
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Margin="{StaticResource SettingPanelItemLeftMargin}"
|
||||
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion_provider}" />
|
||||
<ComboBox
|
||||
Height="30"
|
||||
|
|
|
|||
Loading…
Reference in a new issue