mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
[QuickAccent]Add a setting for the menu delay time (#20221)
This commit is contained in:
@@ -48,6 +48,7 @@ public class SettingsService
|
||||
if (settings != null)
|
||||
{
|
||||
ActivationKey = settings.Properties.ActivationKey;
|
||||
InputTime = settings.Properties.InputTime.Value;
|
||||
switch (settings.Properties.ToolbarPosition.Value)
|
||||
{
|
||||
case "Top center":
|
||||
|
||||
@@ -16,10 +16,14 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("toolbar_position")]
|
||||
public StringProperty ToolbarPosition { get; set; }
|
||||
|
||||
[JsonPropertyName("input_time_ms")]
|
||||
public IntProperty InputTime { get; set; }
|
||||
|
||||
public PowerAccentProperties()
|
||||
{
|
||||
ActivationKey = PowerAccentActivationKey.Both;
|
||||
ToolbarPosition = "Top center";
|
||||
InputTime = new IntProperty(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
_powerAccentSettings = new PowerAccentSettings();
|
||||
}
|
||||
|
||||
_inputTimeMs = _powerAccentSettings.Properties.InputTime.Value;
|
||||
|
||||
switch (_powerAccentSettings.Properties.ToolbarPosition.Value)
|
||||
{
|
||||
case "Top center":
|
||||
@@ -111,6 +113,27 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private int _inputTimeMs = 200;
|
||||
|
||||
public int InputTimeMs
|
||||
{
|
||||
get
|
||||
{
|
||||
return _inputTimeMs;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _inputTimeMs)
|
||||
{
|
||||
_inputTimeMs = value;
|
||||
_powerAccentSettings.Properties.InputTime.Value = value;
|
||||
OnPropertyChanged(nameof(InputTimeMs));
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int _toolbarPositionIndex;
|
||||
|
||||
public int ToolbarPositionIndex
|
||||
|
||||
@@ -2328,7 +2328,17 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="QuickAccent_ToolbarPosition_Right.Content" xml:space="preserve">
|
||||
<value>Right</value>
|
||||
</data>
|
||||
<data name="LearnMore_TextExtractor.Text" xml:space="preserve">
|
||||
<data name="QuickAccent_Behavior.Header" xml:space="preserve">
|
||||
<value>Behavior</value>
|
||||
</data>
|
||||
<data name="QuickAccent_InputTimeMs.Header" xml:space="preserve">
|
||||
<value>Input delay (ms)</value>
|
||||
<comment>ms = milliseconds</comment>
|
||||
</data>
|
||||
<data name="QuickAccent_InputTimeMs.Description" xml:space="preserve">
|
||||
<value>Hold the key for this long to make the accent menu appear (ms)</value>
|
||||
<comment>ms = milliseconds</comment>
|
||||
</data> <data name="LearnMore_TextExtractor.Text" xml:space="preserve">
|
||||
<value>Learn more about Text Extractor</value>
|
||||
</data>
|
||||
<data name="TextExtractor.ModuleDescription" xml:space="preserve">
|
||||
|
||||
@@ -55,7 +55,19 @@
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="QuickAccent_Behavior" IsEnabled="{Binding Mode=OneWay, Path=IsEnabled}">
|
||||
<controls:Setting x:Uid="QuickAccent_InputTimeMs" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<muxc:NumberBox Minimum="100"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.InputTimeMs}"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
SmallChange="10"
|
||||
LargeChange="100"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</controls:SettingsGroup>
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user