Skip to content

Commit e955e47

Browse files
committed
- Change combobox to numberbox
- Adjust Numberbox Style - Add small change value(10) - Adjust strings
1 parent 65f48e3 commit e955e47

File tree

7 files changed

+49
-56
lines changed

7 files changed

+49
-56
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,6 @@ public bool HideNotifyIcon
321321
public bool HideWhenDeactivated { get; set; } = true;
322322

323323
public bool SearchQueryResultsWithDelay { get; set; }
324-
325-
[JsonIgnore]
326-
public IEnumerable<int> SearchDelayTimeRange = new List<int> { 50, 100, 150, 200, 250, 300, 350, 400, 450, 500 };
327-
328324
public int SearchDelayTime { get; set; } = 150;
329325

330326
[JsonConverter(typeof(JsonStringEnumConverter))]

Flow.Launcher/Languages/en.xaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,10 @@
108108
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
109109
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
110110
<system:String x:Key="searchDelay">Search Delay</system:String>
111-
<system:String x:Key="searchDelayToolTip">Delay for a while to search when typing. This reduces interface jumpiness and result load.</system:String>
111+
<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>
112112
<system:String x:Key="searchDelayTime">Default Search Delay Time</system:String>
113-
<system:String x:Key="searchDelayTimeToolTip">Plugin default delay time after which search results appear when typing is stopped.</system:String>
114-
<system:String x:Key="SearchDelayTimeVeryLong">Very long</system:String>
115-
<system:String x:Key="SearchDelayTimeLong">Long</system:String>
116-
<system:String x:Key="SearchDelayTimeNormal">Normal</system:String>
117-
<system:String x:Key="SearchDelayTimeShort">Short</system:String>
118-
<system:String x:Key="SearchDelayTimeVeryShort">Very short</system:String>
113+
<system:String x:Key="searchDelayTimeToolTip">Wait time before showing results after typing stops. Higher values wait longer. (ms)</system:String>
114+
<system:String x:Key="searchDelayPlaceHolder">Default</system:String>
119115

120116
<!-- Setting Plugin -->
121117
<system:String x:Key="searchplugin">Search Plugin</system:String>

Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,15 @@
8888
Text="{DynamicResource searchDelay}"
8989
ToolTip="{DynamicResource searchDelayToolTip}" />
9090
<ui:NumberBox
91+
Width="160"
9192
Margin="0 0 8 0"
9293
Maximum="1000"
94+
SmallChange="10"
9395
Minimum="0"
94-
SpinButtonPlacementMode="Inline"
96+
SpinButtonPlacementMode="Compact" PlaceholderText="{DynamicResource searchDelayPlaceHolder}"
9597
ToolTip="{DynamicResource searchDelayToolTip}"
96-
Value="{Binding PluginSearchDelayTime, Mode=TwoWay}" />
98+
Value="{Binding PluginSearchDelayTime, Mode=TwoWay}">
99+
</ui:NumberBox>
97100
</StackPanel>
98101

99102
<!-- Put OnOffControl after PriorityControl & SearchDelayControl so that it can display correctly -->

Flow.Launcher/Resources/CustomControlTemplate.xaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@
15031503
</Grid>
15041504
<ControlTemplate.Triggers>
15051505
<Trigger Property="ui:ControlHelper.PlaceholderForeground" Value="{x:Null}">
1506-
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}" />
1506+
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource CustomContextDisabled}" />
15071507
</Trigger>
15081508
<Trigger Property="ui:TextBoxHelper.HasText" Value="True">
15091509
<Setter TargetName="PlaceholderTextContentPresenter" Property="Visibility" Value="Collapsed" />
@@ -2689,10 +2689,20 @@
26892689
MinWidth="{TemplateBinding MinWidth}"
26902690
MinHeight="{TemplateBinding MinHeight}"
26912691
ui:ValidationHelper.IsTemplateValidationAdornerSite="True"
2692-
Background="{TemplateBinding Background}"
2693-
BorderBrush="{TemplateBinding BorderBrush}"
2694-
BorderThickness="{TemplateBinding BorderThickness}"
2695-
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}" />
2692+
Background="{DynamicResource CustomTextBoxBG}"
2693+
BorderBrush="{DynamicResource CustomTextBoxOutline}"
2694+
BorderThickness="{DynamicResource CustomTextBoxOutlineThickness}"
2695+
CornerRadius="4">
2696+
<Border
2697+
x:Name="BorderElementInline"
2698+
MinWidth="{TemplateBinding MinWidth}"
2699+
MinHeight="{TemplateBinding MinHeight}"
2700+
ui:ValidationHelper.IsTemplateValidationAdornerSite="True"
2701+
Background="{TemplateBinding Background}"
2702+
BorderBrush="{DynamicResource CustomTextBoxInline}"
2703+
BorderThickness="{DynamicResource CustomTextBoxInlineThickness}"
2704+
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}" />
2705+
</Border>
26962706
<ScrollViewer
26972707
x:Name="PART_ContentHost"
26982708
Grid.Row="1"
@@ -2780,16 +2790,18 @@
27802790
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundDisabled}" />
27812791
</Trigger>
27822792
<Trigger Property="IsMouseOver" Value="true">
2783-
<Setter TargetName="BorderElement" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushPointerOver}" />
2793+
<Setter TargetName="BorderElementInline" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushPointerOver}" />
27842794
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
27852795
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundPointerOver}" />
27862796
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundPointerOver}" />
27872797
</Trigger>
27882798
<Trigger Property="IsSelectionActive" Value="true">
27892799
<Setter TargetName="PlaceholderTextContentPresenter" Property="Foreground" Value="{DynamicResource TextControlPlaceholderForegroundFocused}" />
27902800
<Setter Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
2791-
<Setter TargetName="BorderElement" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}" />
2792-
<Setter TargetName="BorderElement" Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThicknessFocused}" />
2801+
<Setter TargetName="BorderElementInline" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}" />
2802+
<Setter TargetName="BorderElementInline" Property="BorderThickness" Value="0 0 0 2" />
2803+
<Setter TargetName="BorderElement" Property="BorderBrush" Value="{DynamicResource CustomTextBoxOutline}" />
2804+
<Setter TargetName="BorderElement" Property="BorderThickness" Value="{DynamicResource 2 2 2 0}" />
27932805
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundFocused}" />
27942806
</Trigger>
27952807
<MultiTrigger>

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,7 @@ public class SearchWindowScreenData : DropdownDataGeneric<SearchWindowScreens> {
3232
public class SearchWindowAlignData : DropdownDataGeneric<SearchWindowAligns> { }
3333
public class SearchPrecisionData : DropdownDataGeneric<SearchPrecisionScore> { }
3434
public class LastQueryModeData : DropdownDataGeneric<LastQueryMode> { }
35-
public class SearchDelayTimeData
36-
{
37-
public string Display { get; set; }
38-
public int Value { get; set; }
39-
40-
public static List<SearchDelayTimeData> GetValues()
41-
{
42-
var settings = Ioc.Default.GetRequiredService<Settings>();
43-
var data = new List<SearchDelayTimeData>();
44-
45-
foreach (var value in settings.SearchDelayTimeRange)
46-
{
47-
var display = $"{value}ms";
48-
data.Add(new SearchDelayTimeData { Display = display, Value = value });
49-
}
50-
51-
return data;
52-
}
53-
}
35+
5436

5537
public bool StartFlowLauncherOnSystemStartup
5638
{
@@ -163,21 +145,20 @@ public bool PortableMode
163145
public List<LastQueryModeData> LastQueryModes { get; } =
164146
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");
165147

166-
public List<SearchDelayTimeData> SearchDelayTimes { get; } = SearchDelayTimeData.GetValues();
167-
168-
public SearchDelayTimeData SearchDelayTime
148+
public int SearchDelayTimeValue
169149
{
170-
get => SearchDelayTimes.FirstOrDefault(x => x.Value == Settings.SearchDelayTime);
150+
get => Settings.SearchDelayTime;
171151
set
172152
{
173-
if (value == null) return;
174-
175-
if (Settings.SearchDelayTime != value.Value)
153+
if (Settings.SearchDelayTime != value)
176154
{
177-
Settings.SearchDelayTime = value.Value;
155+
Settings.SearchDelayTime = value;
156+
OnPropertyChanged();
157+
OnPropertyChanged(nameof(SearchDelayTimeDisplay));
178158
}
179159
}
180160
}
161+
public string SearchDelayTimeDisplay => $"{SearchDelayTimeValue}ms";
181162

182163
private void UpdateEnumDropdownLocalizations()
183164
{

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private async Task OpenHelperAsync()
122122
{
123123
new TextBlock
124124
{
125-
Text = (string)Application.Current.Resources["changePriorityWindow"],
125+
Text = (string)Application.Current.Resources["priority"],
126126
FontSize = 18,
127127
Margin = new Thickness(0, 0, 0, 10),
128128
TextWrapping = TextWrapping.Wrap
@@ -134,7 +134,7 @@ private async Task OpenHelperAsync()
134134
},
135135
new TextBlock
136136
{
137-
Text = (string)Application.Current.Resources["searchDelayTimeTitle"],
137+
Text = (string)Application.Current.Resources["searchDelay"],
138138
FontSize = 18,
139139
Margin = new Thickness(0, 24, 0, 10),
140140
TextWrapping = TextWrapping.Wrap

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,17 @@
211211
Title="{DynamicResource searchDelayTime}"
212212
Sub="{DynamicResource searchDelayTimeToolTip}"
213213
Type="InsideFit">
214-
<ComboBox
215-
MaxWidth="200"
216-
DisplayMemberPath="Display"
217-
ItemsSource="{Binding SearchDelayTimes}"
218-
SelectedItem="{Binding SearchDelayTime}"
219-
SelectedValuePath="Value" />
214+
<StackPanel Orientation="Horizontal">
215+
<ui:NumberBox
216+
Width="120"
217+
Margin="0 0 0 0"
218+
Minimum="0"
219+
Maximum="1000"
220+
SmallChange="10"
221+
SpinButtonPlacementMode="Compact"
222+
Value="{Binding SearchDelayTimeValue}"
223+
ValidationMode="InvalidInputOverwritten" />
224+
</StackPanel>
220225
</cc:Card>
221226
</cc:ExCard>
222227

0 commit comments

Comments
 (0)