- Change combobox to numberbox

- Adjust Numberbox Style
- Add small change value(10)
- Adjust strings
This commit is contained in:
DB p 2025-04-07 22:47:39 +09:00
parent 65f48e3069
commit e955e47e5f
7 changed files with 49 additions and 56 deletions

View file

@ -321,10 +321,6 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public bool HideWhenDeactivated { get; set; } = true;
public bool SearchQueryResultsWithDelay { get; set; }
[JsonIgnore]
public IEnumerable<int> SearchDelayTimeRange = new List<int> { 50, 100, 150, 200, 250, 300, 350, 400, 450, 500 };
public int SearchDelayTime { get; set; } = 150;
[JsonConverter(typeof(JsonStringEnumConverter))]

View file

@ -108,14 +108,10 @@
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</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="searchDelayToolTip">Adds a short delay while typing to reduce UI flicker and result load. Recommended if your typing speed is average.</system:String>
<system:String x:Key="searchDelayTime">Default Search Delay Time</system:String>
<system:String x:Key="searchDelayTimeToolTip">Plugin default delay time after which search results appear when typing is stopped.</system:String>
<system:String x:Key="SearchDelayTimeVeryLong">Very long</system:String>
<system:String x:Key="SearchDelayTimeLong">Long</system:String>
<system:String x:Key="SearchDelayTimeNormal">Normal</system:String>
<system:String x:Key="SearchDelayTimeShort">Short</system:String>
<system:String x:Key="SearchDelayTimeVeryShort">Very short</system:String>
<system:String x:Key="searchDelayTimeToolTip">Wait time before showing results after typing stops. Higher values wait longer. (ms)</system:String>
<system:String x:Key="searchDelayPlaceHolder">Default</system:String>
<!-- Setting Plugin -->
<system:String x:Key="searchplugin">Search Plugin</system:String>

View file

@ -88,12 +88,15 @@
Text="{DynamicResource searchDelay}"
ToolTip="{DynamicResource searchDelayToolTip}" />
<ui:NumberBox
Width="160"
Margin="0 0 8 0"
Maximum="1000"
SmallChange="10"
Minimum="0"
SpinButtonPlacementMode="Inline"
SpinButtonPlacementMode="Compact" PlaceholderText="{DynamicResource searchDelayPlaceHolder}"
ToolTip="{DynamicResource searchDelayToolTip}"
Value="{Binding PluginSearchDelayTime, Mode=TwoWay}" />
Value="{Binding PluginSearchDelayTime, Mode=TwoWay}">
</ui:NumberBox>
</StackPanel>
<!-- Put OnOffControl after PriorityControl & SearchDelayControl so that it can display correctly -->

View file

@ -1503,7 +1503,7 @@
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="ui:ControlHelper.PlaceholderForeground" Value="{x:Null}">
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}" />
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource CustomContextDisabled}" />
</Trigger>
<Trigger Property="ui:TextBoxHelper.HasText" Value="True">
<Setter TargetName="PlaceholderTextContentPresenter" Property="Visibility" Value="Collapsed" />
@ -2689,10 +2689,20 @@
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
ui:ValidationHelper.IsTemplateValidationAdornerSite="True"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}" />
Background="{DynamicResource CustomTextBoxBG}"
BorderBrush="{DynamicResource CustomTextBoxOutline}"
BorderThickness="{DynamicResource CustomTextBoxOutlineThickness}"
CornerRadius="4">
<Border
x:Name="BorderElementInline"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
ui:ValidationHelper.IsTemplateValidationAdornerSite="True"
Background="{TemplateBinding Background}"
BorderBrush="{DynamicResource CustomTextBoxInline}"
BorderThickness="{DynamicResource CustomTextBoxInlineThickness}"
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}" />
</Border>
<ScrollViewer
x:Name="PART_ContentHost"
Grid.Row="1"
@ -2780,7 +2790,7 @@
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundDisabled}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="BorderElement" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushPointerOver}" />
<Setter TargetName="BorderElementInline" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushPointerOver}" />
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundPointerOver}" />
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundPointerOver}" />
@ -2788,8 +2798,10 @@
<Trigger Property="IsSelectionActive" Value="true">
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundFocused}" />
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
<Setter TargetName="BorderElement" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}" />
<Setter TargetName="BorderElement" Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThicknessFocused}" />
<Setter TargetName="BorderElementInline" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}" />
<Setter TargetName="BorderElementInline" Property="BorderThickness" Value="0 0 0 2" />
<Setter TargetName="BorderElement" Property="BorderBrush" Value="{DynamicResource CustomTextBoxOutline}" />
<Setter TargetName="BorderElement" Property="BorderThickness" Value="{DynamicResource 2 2 2 0}" />
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundFocused}" />
</Trigger>
<MultiTrigger>

View file

@ -32,25 +32,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
public class SearchWindowAlignData : DropdownDataGeneric<SearchWindowAligns> { }
public class SearchPrecisionData : DropdownDataGeneric<SearchPrecisionScore> { }
public class LastQueryModeData : DropdownDataGeneric<LastQueryMode> { }
public class SearchDelayTimeData
{
public string Display { get; set; }
public int Value { get; set; }
public static List<SearchDelayTimeData> GetValues()
{
var settings = Ioc.Default.GetRequiredService<Settings>();
var data = new List<SearchDelayTimeData>();
foreach (var value in settings.SearchDelayTimeRange)
{
var display = $"{value}ms";
data.Add(new SearchDelayTimeData { Display = display, Value = value });
}
return data;
}
}
public bool StartFlowLauncherOnSystemStartup
{
@ -163,21 +145,20 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
public List<LastQueryModeData> LastQueryModes { get; } =
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");
public List<SearchDelayTimeData> SearchDelayTimes { get; } = SearchDelayTimeData.GetValues();
public SearchDelayTimeData SearchDelayTime
public int SearchDelayTimeValue
{
get => SearchDelayTimes.FirstOrDefault(x => x.Value == Settings.SearchDelayTime);
get => Settings.SearchDelayTime;
set
{
if (value == null) return;
if (Settings.SearchDelayTime != value.Value)
if (Settings.SearchDelayTime != value)
{
Settings.SearchDelayTime = value.Value;
Settings.SearchDelayTime = value;
OnPropertyChanged();
OnPropertyChanged(nameof(SearchDelayTimeDisplay));
}
}
}
public string SearchDelayTimeDisplay => $"{SearchDelayTimeValue}ms";
private void UpdateEnumDropdownLocalizations()
{

View file

@ -122,7 +122,7 @@ public partial class SettingsPanePluginsViewModel : BaseModel
{
new TextBlock
{
Text = (string)Application.Current.Resources["changePriorityWindow"],
Text = (string)Application.Current.Resources["priority"],
FontSize = 18,
Margin = new Thickness(0, 0, 0, 10),
TextWrapping = TextWrapping.Wrap
@ -134,7 +134,7 @@ public partial class SettingsPanePluginsViewModel : BaseModel
},
new TextBlock
{
Text = (string)Application.Current.Resources["searchDelayTimeTitle"],
Text = (string)Application.Current.Resources["searchDelay"],
FontSize = 18,
Margin = new Thickness(0, 24, 0, 10),
TextWrapping = TextWrapping.Wrap

View file

@ -211,12 +211,17 @@
Title="{DynamicResource searchDelayTime}"
Sub="{DynamicResource searchDelayTimeToolTip}"
Type="InsideFit">
<ComboBox
MaxWidth="200"
DisplayMemberPath="Display"
ItemsSource="{Binding SearchDelayTimes}"
SelectedItem="{Binding SearchDelayTime}"
SelectedValuePath="Value" />
<StackPanel Orientation="Horizontal">
<ui:NumberBox
Width="120"
Margin="0 0 0 0"
Minimum="0"
Maximum="1000"
SmallChange="10"
SpinButtonPlacementMode="Compact"
Value="{Binding SearchDelayTimeValue}"
ValidationMode="InvalidInputOverwritten" />
</StackPanel>
</cc:Card>
</cc:ExCard>