mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
https://github.com/Wox-launcher/Wox/issues/1050 https://github.com/Wox-launcher/Wox/issues/1141
This commit is contained in:
@@ -22,6 +22,10 @@
|
||||
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
|
||||
<system:String x:Key="rememberLastLocation">Remember last launch location</system:String>
|
||||
<system:String x:Key="language">Language</system:String>
|
||||
<system:String x:Key="lastQueryMode">Last Query Style</system:String>
|
||||
<system:String x:Key="LastQueryPreserved">Preserve Last Query</system:String>
|
||||
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
|
||||
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
|
||||
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python Directory</system:String>
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
<system:String x:Key="dontPromptUpdateMsg">不显示新版本提示</system:String>
|
||||
<system:String x:Key="rememberLastLocation">记住上次启动位置</system:String>
|
||||
<system:String x:Key="language">语言</system:String>
|
||||
<system:String x:Key="lastQueryMode">上次搜索关键字模式</system:String>
|
||||
<system:String x:Key="LastQueryPreserved">保留上次搜索关键字</system:String>
|
||||
<system:String x:Key="LastQuerySelected">全选上次搜索关键字</system:String>
|
||||
<system:String x:Key="LastQueryEmpty">清空上次搜索关键字</system:String>
|
||||
<system:String x:Key="maxShowResults">最大结果显示个数</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">全屏模式下忽略热键</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python 路径</system:String>
|
||||
|
||||
@@ -68,10 +68,10 @@ namespace Wox
|
||||
QueryTextBox.Focus();
|
||||
SetWindowPosition();
|
||||
_settings.ActivateTimes++;
|
||||
if (_viewModel.QueryTextSelected)
|
||||
if (!_viewModel.LastQuerySelected)
|
||||
{
|
||||
QueryTextBox.SelectAll();
|
||||
_viewModel.QueryTextSelected = false;
|
||||
_viewModel.LastQuerySelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
Checked="OnAutoStartupChecked" Unchecked="OnAutoStartupUncheck">
|
||||
<TextBlock Text="{DynamicResource autoUpdates}" />
|
||||
</CheckBox>
|
||||
<StackPanel Margin="10" Orientation="Horizontal">
|
||||
<TextBlock Text="{DynamicResource lastQueryMode}" />
|
||||
<ComboBox Margin="10 0 0 0" Width="120"
|
||||
ItemsSource="{Binding LastQueryModes}" SelectedValue="{Binding Settings.LastQueryMode}"
|
||||
DisplayMemberPath="Display" SelectedValuePath="Value" />
|
||||
</StackPanel>
|
||||
<StackPanel Margin="10" Orientation="Horizontal">
|
||||
<TextBlock Text="{DynamicResource language}" />
|
||||
<ComboBox Margin="10 0 0 0" Width="120" SelectionChanged="OnLanguageChanged"
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace Wox.ViewModel
|
||||
QueryTextCursorMovedToEnd = true;
|
||||
QueryText = queryText;
|
||||
}
|
||||
public bool QueryTextSelected { get; set; }
|
||||
public bool LastQuerySelected { get; set; }
|
||||
public bool QueryTextCursorMovedToEnd { get; set; }
|
||||
|
||||
private ResultsViewModel _selectedResults;
|
||||
@@ -566,10 +566,29 @@ namespace Wox.ViewModel
|
||||
|
||||
private void OnHotkey(object sender, HotkeyEventArgs e)
|
||||
{
|
||||
if (ShouldIgnoreHotkeys()) return;
|
||||
QueryTextSelected = true;
|
||||
ToggleWox();
|
||||
e.Handled = true;
|
||||
if (!ShouldIgnoreHotkeys())
|
||||
{
|
||||
|
||||
if (_settings.LastQueryMode == LastQueryMode.Empty)
|
||||
{
|
||||
ChangeQueryText(string.Empty);
|
||||
}
|
||||
else if (_settings.LastQueryMode == LastQueryMode.Preserved)
|
||||
{
|
||||
LastQuerySelected = true;
|
||||
}
|
||||
else if (_settings.LastQueryMode == LastQueryMode.Selected)
|
||||
{
|
||||
LastQuerySelected = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>");
|
||||
}
|
||||
|
||||
ToggleWox();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleWox()
|
||||
|
||||
@@ -50,8 +50,30 @@ namespace Wox.ViewModel
|
||||
|
||||
#region general
|
||||
|
||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
public class LastQueryMode
|
||||
{
|
||||
public string Display { get; set; }
|
||||
public Infrastructure.UserSettings.LastQueryMode Value { get; set; }
|
||||
}
|
||||
public List<LastQueryMode> LastQueryModes
|
||||
{
|
||||
get
|
||||
{
|
||||
List<LastQueryMode> modes = new List<LastQueryMode>();
|
||||
var enums = (Infrastructure.UserSettings.LastQueryMode[])Enum.GetValues(typeof(Infrastructure.UserSettings.LastQueryMode));
|
||||
foreach (var e in enums)
|
||||
{
|
||||
var key = $"LastQuery{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new LastQueryMode { Display = display, Value = e, };
|
||||
modes.Add(m);
|
||||
}
|
||||
return modes;
|
||||
}
|
||||
}
|
||||
|
||||
private Internationalization _translater => InternationalizationManager.Instance;
|
||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user