mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[PTRun]UI for turning on Pinyin on Settings (#24293)
* Conflict resolving Part 1 * Conflict resolving Part 2 * Conflict resolving Part 3 * Conflict resolving part 4 * fix usepinyin * Add test and fix setting * Fix whitespace * Fix prefix name * Add mention that it doesn't work for every plugin
This commit is contained in:
@@ -171,6 +171,11 @@ namespace PowerLauncher
|
||||
_settings.GenerateThumbnailsFromFiles = overloadSettings.Properties.GenerateThumbnailsFromFiles;
|
||||
}
|
||||
|
||||
if (_settings.ShouldUsePinyin != overloadSettings.Properties.UsePinyin)
|
||||
{
|
||||
_settings.ShouldUsePinyin = overloadSettings.Properties.UsePinyin;
|
||||
}
|
||||
|
||||
retry = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("search_wait_for_slow_results")]
|
||||
public bool SearchWaitForSlowResults { get; set; }
|
||||
|
||||
[JsonPropertyName("use_pinyin")]
|
||||
public bool UsePinyin { get; set; }
|
||||
|
||||
[JsonPropertyName("generate_thumbnails_from_files")]
|
||||
public bool GenerateThumbnailsFromFiles { get; set; }
|
||||
|
||||
@@ -103,6 +106,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
SearchQueryTuningEnabled = false;
|
||||
SearchWaitForSlowResults = false;
|
||||
GenerateThumbnailsFromFiles = true;
|
||||
UsePinyin = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace ViewModelTests
|
||||
Assert.AreEqual(originalSettings.Properties.SearchResultPreference, viewModel.SearchResultPreference);
|
||||
Assert.AreEqual(originalSettings.Properties.SearchTypePreference, viewModel.SearchTypePreference);
|
||||
Assert.AreEqual(originalSettings.Properties.GenerateThumbnailsFromFiles, viewModel.GenerateThumbnailsFromFiles);
|
||||
Assert.AreEqual(originalSettings.Properties.UsePinyin, viewModel.UsePinyin);
|
||||
|
||||
// Verify that the stub file was used
|
||||
var expectedCallCount = 2; // once via the view model, and once by the test (GetSettings<T>)
|
||||
|
||||
@@ -153,6 +153,14 @@
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.TabSelectsContextButtons, Mode=TwoWay}" />
|
||||
</controls:SettingsCard>
|
||||
|
||||
<controls:SettingsCard
|
||||
x:Uid="PowerLauncher_UsePinyin"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{x:Bind ViewModel.UsePinyin, Mode=TwoWay}" />
|
||||
</controls:SettingsCard>
|
||||
|
||||
<controls:SettingsCard x:Uid="PowerLauncher_GenerateThumbnailsFromFiles">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.GenerateThumbnailsFromFiles, Mode=TwoWay}" />
|
||||
</controls:SettingsCard>
|
||||
|
||||
@@ -736,6 +736,12 @@
|
||||
<data name="PowerLauncher_SearchResultPreference.Header" xml:space="preserve">
|
||||
<value>Search result preference</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_UsePinyin.Header" xml:space="preserve">
|
||||
<value>Use Pinyin</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_UsePinyin.Description" xml:space="preserve">
|
||||
<value>Experimental: Use Pinyin on the search query. May not work for every plugin.</value>
|
||||
</data>
|
||||
<data name="PowerLauncher_SearchResultPreference_MostRecentlyUsed" xml:space="preserve">
|
||||
<value>Most recently used</value>
|
||||
</data>
|
||||
|
||||
@@ -580,6 +580,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool UsePinyin
|
||||
{
|
||||
get
|
||||
{
|
||||
return settings.Properties.UsePinyin;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (settings.Properties.UsePinyin != value)
|
||||
{
|
||||
settings.Properties.UsePinyin = value;
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<PowerLauncherPluginViewModel> _plugins;
|
||||
|
||||
public ObservableCollection<PowerLauncherPluginViewModel> Plugins
|
||||
|
||||
Reference in New Issue
Block a user