From 6c830ec62e00d833fa048ff07d235d26121ea153 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Wed, 26 Nov 2025 11:53:31 +0100 Subject: [PATCH] Updates --- .../Assets/Settings/Icons/AssistiveTools.png | Bin 0 -> 680 bytes .../Settings.UI/PowerToys.Settings.csproj | 1 + .../ShortcutControl/ShortcutControl.xaml.cs | 18 +- .../Views/AssistiveToolsPage.xaml | 374 ++++++++++++++++++ .../Views/AssistiveToolsPage.xaml.cs | 46 +++ .../SettingsXAML/Views/ShellPage.xaml | 5 + 6 files changed, 437 insertions(+), 7 deletions(-) create mode 100644 src/settings-ui/Settings.UI/Assets/Settings/Icons/AssistiveTools.png create mode 100644 src/settings-ui/Settings.UI/SettingsXAML/Views/AssistiveToolsPage.xaml create mode 100644 src/settings-ui/Settings.UI/SettingsXAML/Views/AssistiveToolsPage.xaml.cs diff --git a/src/settings-ui/Settings.UI/Assets/Settings/Icons/AssistiveTools.png b/src/settings-ui/Settings.UI/Assets/Settings/Icons/AssistiveTools.png new file mode 100644 index 0000000000000000000000000000000000000000..872fbdaccae5cee6563ae7f8beabdcf9440e2da4 GIT binary patch literal 680 zcmV;Z0$2TsP)~0CK=lDN@w~%@Z__kUl|r;0j5ONFdCC4~a`64oHZq>KlYNFi!wI zRYFKkM8&aPiAYW3-I>m=<23z+@{UhLq{rwPO`u~`h2vpG1ywaKrjP|x%AROEt4=czHF-nG9#e%6xBtEoKmh^t zfXwc{XBC%P>EoY{9_yx6Xf$^5{aVZJ-}@ZZcxeJb4FTUCzF6*@1D3Z3eg1uv{xi4_ z211Rpb9nIojzCnmAKdhW#5$pDu#0EC5P=A3@2I_8J(sd1(IN=}5j-V+0STXgwuCT^ zyX6}Ldjd}%QG&H66YTnfE!|5gPnCX+)=9_~8rWcWA32U6K{x|JQ2g3uaXr;u39qc- z#c}^jWMNSPn5vnqrmEUceq9xp*=4jK1P6h$6k&v=qj@p&fg=u<;POpXriVa$B60(n z$Bmjvb)wX%b=I7~RE?`2m)a?uz_W&&Yl&koQN=KW4v3Rk&;>s?5QS(Y0KNwx6fcS< zP11n1+&~VlrvQPlDUI30GnLI;z|x2P8o68Hg8RdlE8+0PowerToys.Settings.pri + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs index ba053e1124..0046803e87 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs @@ -674,15 +674,19 @@ namespace Microsoft.PowerToys.Settings.UI.Controls private async void OpenDialogButton_Click(object sender, RoutedEventArgs e) { c.Keys = null; - c.Keys = HotkeySettings.GetKeysList(); - c.IgnoreConflict = IgnoreConflict; - c.HasConflict = hotkeySettings.HasConflict; - c.ConflictMessage = hotkeySettings.ConflictDescription; + if (HotkeySettings != null) + { + c.Keys = HotkeySettings.GetKeysList(); - // 92 means the Win key. The logic is: warning should be visible if the shortcut contains Alt AND contains Ctrl AND NOT contains Win. - // Additional key must be present, as this is a valid, previously used shortcut shown at dialog open. Check for presence of non-modifier-key is not necessary therefore - c.IsWarningAltGr = c.Keys.Contains("Ctrl") && c.Keys.Contains("Alt") && !c.Keys.Contains(92); + c.IgnoreConflict = IgnoreConflict; + c.HasConflict = hotkeySettings.HasConflict; + c.ConflictMessage = hotkeySettings.ConflictDescription; + + // 92 means the Win key. The logic is: warning should be visible if the shortcut contains Alt AND contains Ctrl AND NOT contains Win. + // Additional key must be present, as this is a valid, previously used shortcut shown at dialog open. Check for presence of non-modifier-key is not necessary therefore + c.IsWarningAltGr = c.Keys.Contains("Ctrl") && c.Keys.Contains("Alt") && !c.Keys.Contains(92); + } shortcutDialog.XamlRoot = this.XamlRoot; shortcutDialog.RequestedTheme = this.ActualTheme; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/AssistiveToolsPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/AssistiveToolsPage.xaml new file mode 100644 index 0000000000..0d9d877fc7 --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/AssistiveToolsPage.xaml @@ -0,0 +1,374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/AssistiveToolsPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/AssistiveToolsPage.xaml.cs new file mode 100644 index 0000000000..ca9059d94a --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/AssistiveToolsPage.xaml.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.PowerToys.Settings.UI.Helpers; +using Microsoft.PowerToys.Settings.UI.Library; +using Microsoft.PowerToys.Settings.UI.ViewModels; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; + +namespace Microsoft.PowerToys.Settings.UI.Views +{ + public sealed partial class AssistiveToolsPage : NavigablePage, IRefreshablePage + { + private NewPlusViewModel ViewModel { get; set; } + + public AssistiveToolsPage() + { + InitializeComponent(); + } + + public void RefreshEnabledState() + { + ViewModel.RefreshEnabledState(); + } + + private void ControlModeSelectionBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (ControlModeSelectionBox.SelectedIndex == 1) + { + ReducedLineSpeedCard.Visibility = Visibility.Visible; + InitialSpeedCard.Visibility = Visibility.Visible; + } + else + { + ReducedLineSpeedCard.Visibility = Visibility.Collapsed; + InitialSpeedCard.Visibility = Visibility.Collapsed; + } + } + + private void ControlModeSelectionBox_Loaded(object sender, RoutedEventArgs e) + { + ControlModeSelectionBox.SelectionChanged += ControlModeSelectionBox_SelectionChanged; + } + } +} diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml index aae80d05e7..0dc2848744 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml @@ -289,6 +289,11 @@ +