mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[New PowerToy] PowerAccent (#19212)
* add poweraccent (draft) for PR * removing french text for Spell checking job * add 'poweraccent' to spell checker * add 'damienleroy' to spell checker file * adding RuntimeIdentifiers for PowerAccent project * duplicate image for settings * update commandline arguments for launch settings * Removing WndProc for testing with inter-process connection * add PowerAccent sources for PowerToys * fix spellcheck * fixing stylecop conventions * Remove StyleCop.Analyzers because of duplicate * fixing command line reference * Fixing CS8012 for PowerAccent. * ARM64 processor * - Modify PowerAccent fluenticon for dark mode - Try fix arm64 release * Remove taskbar * init Oobe view * - added POwerAccent to App.xaml.cs - change style to markdown in Oobe display * - fixing poweraccent crash - change Oobe LearnMore link * Installer and signing * Cleanup Add settings * Issue template * Add some more characters * Disabled by default * Proper ToUnicodeEx calling and remove hacks * Fix spellcheck * Remove CommandLine dependency and debug prints. Add logs * fix signing * Fix binary metadata with version * Fix the added space bug * Only type space if it was the trigger method * Take account of InputTime for displaying UI * Fix code styling * Remove the Trace WriteLine hack and add a delay instead * Reinstate logs * Better explanations * Add telemetry for showing the menu * Update src/settings-ui/Settings.UI/Strings/en-us/Resources.resw * Update src/settings-ui/Settings.UI/Strings/en-us/Resources.resw * Update src/modules/poweraccent/PowerAccent.Core/Tools/KeyboardListener.cs * Update src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs * Add accented characters for S * Default to both activation methods * Update src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs * Update src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs * Update src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs * Update src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs * Update src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs * Update src/modules/poweraccent/PowerAccent.Core/Services/SettingsService.cs Co-authored-by: Damien LEROY <dleroy@veepee.com>
This commit is contained in:
@@ -239,6 +239,22 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
}
|
||||
}
|
||||
|
||||
private bool powerAccent;
|
||||
|
||||
[JsonPropertyName("PowerAccent")]
|
||||
public bool PowerAccent
|
||||
{
|
||||
get => powerAccent;
|
||||
set
|
||||
{
|
||||
if (powerAccent != value)
|
||||
{
|
||||
LogTelemetryEvent(value);
|
||||
powerAccent = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool powerOCR = true;
|
||||
|
||||
[JsonPropertyName("PowerOCR")]
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// 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.
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.Enumerations
|
||||
{
|
||||
public enum PowerAccentActivationKey
|
||||
{
|
||||
LeftRightArrow,
|
||||
Space,
|
||||
Both,
|
||||
}
|
||||
}
|
||||
25
src/settings-ui/Settings.UI.Library/PowerAccentProperties.cs
Normal file
25
src/settings-ui/Settings.UI.Library/PowerAccentProperties.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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 System.Text.Json.Serialization;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class PowerAccentProperties
|
||||
{
|
||||
[JsonPropertyName("activation_key")]
|
||||
public PowerAccentActivationKey ActivationKey { get; set; }
|
||||
|
||||
[JsonPropertyName("toolbar_position")]
|
||||
public StringProperty ToolbarPosition { get; set; }
|
||||
|
||||
public PowerAccentProperties()
|
||||
{
|
||||
ActivationKey = PowerAccentActivationKey.Both;
|
||||
ToolbarPosition = "Top center";
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/settings-ui/Settings.UI.Library/PowerAccentSettings.cs
Normal file
35
src/settings-ui/Settings.UI.Library/PowerAccentSettings.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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 System.Text.Json.Serialization;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class PowerAccentSettings : BasePTModuleSettings, ISettingsConfig
|
||||
{
|
||||
public const string ModuleName = "PowerAccent";
|
||||
public const string ModuleVersion = "0.0.1";
|
||||
|
||||
[JsonPropertyName("properties")]
|
||||
public PowerAccentProperties Properties { get; set; }
|
||||
|
||||
public PowerAccentSettings()
|
||||
{
|
||||
Name = ModuleName;
|
||||
Version = ModuleVersion;
|
||||
Properties = new PowerAccentProperties();
|
||||
}
|
||||
|
||||
public string GetModuleName()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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 System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class SndPowerAccentSettings
|
||||
{
|
||||
[JsonPropertyName("PowerAccent")]
|
||||
public PowerAccentSettings PowerAccentSettings { get; set; }
|
||||
|
||||
public SndPowerAccentSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public SndPowerAccentSettings(PowerAccentSettings settings)
|
||||
{
|
||||
PowerAccentSettings = settings;
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
// 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 System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
{
|
||||
public class PowerAccentViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
private readonly PowerAccentSettings _powerAccentSettings;
|
||||
|
||||
private readonly ISettingsUtils _settingsUtils;
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
public PowerAccentViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
||||
{
|
||||
// To obtain the general settings configurations of PowerToys Settings.
|
||||
if (settingsRepository == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(settingsRepository));
|
||||
}
|
||||
|
||||
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||
|
||||
_isEnabled = GeneralSettingsConfig.Enabled.PowerAccent;
|
||||
if (_settingsUtils.SettingsExists(PowerAccentSettings.ModuleName))
|
||||
{
|
||||
_powerAccentSettings = _settingsUtils.GetSettingsOrDefault<PowerAccentSettings>(PowerAccentSettings.ModuleName);
|
||||
}
|
||||
else
|
||||
{
|
||||
_powerAccentSettings = new PowerAccentSettings();
|
||||
}
|
||||
|
||||
switch (_powerAccentSettings.Properties.ToolbarPosition.Value)
|
||||
{
|
||||
case "Top center":
|
||||
_toolbarPositionIndex = 0;
|
||||
break;
|
||||
case "Bottom center":
|
||||
_toolbarPositionIndex = 1;
|
||||
break;
|
||||
case "Left":
|
||||
_toolbarPositionIndex = 2;
|
||||
break;
|
||||
case "Right":
|
||||
_toolbarPositionIndex = 3;
|
||||
break;
|
||||
case "Top right corner":
|
||||
_toolbarPositionIndex = 4;
|
||||
break;
|
||||
case "Top left corner":
|
||||
_toolbarPositionIndex = 5;
|
||||
break;
|
||||
case "Bottom right corner":
|
||||
_toolbarPositionIndex = 6;
|
||||
break;
|
||||
case "Bottom left corner":
|
||||
_toolbarPositionIndex = 7;
|
||||
break;
|
||||
case "Center":
|
||||
_toolbarPositionIndex = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
// set the callback functions value to hangle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
}
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
set
|
||||
{
|
||||
if (_isEnabled != value)
|
||||
{
|
||||
_isEnabled = value;
|
||||
|
||||
GeneralSettingsConfig.Enabled.PowerAccent = value;
|
||||
OnPropertyChanged(nameof(IsEnabled));
|
||||
OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||
SendConfigMSG(outgoing.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ActivationKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)_powerAccentSettings.Properties.ActivationKey;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != (int)_powerAccentSettings.Properties.ActivationKey)
|
||||
{
|
||||
_powerAccentSettings.Properties.ActivationKey = (PowerAccentActivationKey)value;
|
||||
OnPropertyChanged(nameof(ActivationKey));
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int _toolbarPositionIndex;
|
||||
|
||||
public int ToolbarPositionIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _toolbarPositionIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_toolbarPositionIndex != value)
|
||||
{
|
||||
_toolbarPositionIndex = value;
|
||||
switch (_toolbarPositionIndex)
|
||||
{
|
||||
case 0:
|
||||
_powerAccentSettings.Properties.ToolbarPosition.Value = "Top center";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
_powerAccentSettings.Properties.ToolbarPosition.Value = "Bottom center";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
_powerAccentSettings.Properties.ToolbarPosition.Value = "Left";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
_powerAccentSettings.Properties.ToolbarPosition.Value = "Right";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
_powerAccentSettings.Properties.ToolbarPosition.Value = "Top right corner";
|
||||
break;
|
||||
|
||||
case 5:
|
||||
_powerAccentSettings.Properties.ToolbarPosition.Value = "Top left corner";
|
||||
break;
|
||||
|
||||
case 6:
|
||||
_powerAccentSettings.Properties.ToolbarPosition.Value = "Bottom right corner";
|
||||
break;
|
||||
|
||||
case 7:
|
||||
_powerAccentSettings.Properties.ToolbarPosition.Value = "Bottom left corner";
|
||||
break;
|
||||
|
||||
case 8:
|
||||
_powerAccentSettings.Properties.ToolbarPosition.Value = "Center";
|
||||
break;
|
||||
}
|
||||
|
||||
RaisePropertyChanged(nameof(ToolbarPositionIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
// Notify UI of property change
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
if (SendConfigMSG != null)
|
||||
{
|
||||
SndPowerAccentSettings snd = new SndPowerAccentSettings(_powerAccentSettings);
|
||||
SndModuleSettings<SndPowerAccentSettings> ipcMessage = new SndModuleSettings<SndPowerAccentSettings>(snd);
|
||||
SendConfigMSG(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isEnabled;
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,7 @@ namespace Microsoft.PowerToys.Settings.UI
|
||||
case "ImageResizer": StartupPage = typeof(Views.ImageResizerPage); break;
|
||||
case "KBM": StartupPage = typeof(Views.KeyboardManagerPage); break;
|
||||
case "MouseUtils": StartupPage = typeof(Views.MouseUtilsPage); break;
|
||||
case "PowerAccent": StartupPage = typeof(Views.PowerAccentPage); break;
|
||||
case "PowerOCR": StartupPage = typeof(Views.PowerOcrPage); break;
|
||||
case "PowerRename": StartupPage = typeof(Views.PowerRenamePage); break;
|
||||
case "FileExplorer": StartupPage = typeof(Views.PowerPreviewPage); break;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src/settings-ui/Settings.UI/Assets/Modules/OOBE/PowerAccent.gif
Normal file
BIN
src/settings-ui/Settings.UI/Assets/Modules/OOBE/PowerAccent.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 186 KiB |
BIN
src/settings-ui/Settings.UI/Assets/Modules/PowerAccent.png
Normal file
BIN
src/settings-ui/Settings.UI/Assets/Modules/PowerAccent.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 202 KiB |
@@ -0,0 +1,44 @@
|
||||
<UserControl
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Controls.PowerAccentShortcutControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:toolkitcontrols="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ItemsControl AutomationProperties.AccessibilityView="Raw"
|
||||
ItemsSource="{x:Bind Keys}"
|
||||
VerticalAlignment="Center"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual IsTabStop="False"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
VisualType="SmallOutline"
|
||||
VerticalAlignment="Center"
|
||||
Content="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<toolkitcontrols:MarkdownTextBlock Background="Transparent"
|
||||
Text="{x:Bind Text}"
|
||||
Margin="8,0,0,0"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,36 @@
|
||||
// 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 System.Collections.Generic;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
public sealed partial class PowerAccentShortcutControl : UserControl
|
||||
{
|
||||
public string Text
|
||||
{
|
||||
get { return (string)GetValue(TextProperty); }
|
||||
set { SetValue(TextProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(PowerAccentShortcutControl), new PropertyMetadata(default(string)));
|
||||
|
||||
#pragma warning disable CA2227 // Collection properties should be read only
|
||||
public List<object> Keys
|
||||
#pragma warning restore CA2227 // Collection properties should be read only
|
||||
{
|
||||
get { return (List<object>)GetValue(KeysProperty); }
|
||||
set { SetValue(KeysProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty KeysProperty = DependencyProperty.Register("Keys", typeof(List<object>), typeof(PowerAccentShortcutControl), new PropertyMetadata(default(string)));
|
||||
|
||||
public PowerAccentShortcutControl()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
|
||||
ImageResizer,
|
||||
KBM,
|
||||
MouseUtils,
|
||||
PowerAccent,
|
||||
PowerOCR,
|
||||
PowerRename,
|
||||
Run,
|
||||
|
||||
33
src/settings-ui/Settings.UI/OOBE/Views/OobePowerAccent.xaml
Normal file
33
src/settings-ui/Settings.UI/OOBE/Views/OobePowerAccent.xaml
Normal file
@@ -0,0 +1,33 @@
|
||||
<Page x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobePowerAccent"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:toolkitcontrols="using:CommunityToolkit.WinUI.UI.Controls">
|
||||
|
||||
<controls:OOBEPageControl x:Uid="Oobe_PowerAccent"
|
||||
HeroImage="ms-appx:///Assets/Modules/OOBE/PowerAccent.gif">
|
||||
|
||||
<controls:OOBEPageControl.PageContent>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock x:Uid="Oobe_HowToUse"
|
||||
Style="{ThemeResource OobeSubtitleStyle}" />
|
||||
|
||||
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_PowerAccent_HowToUse" />
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
|
||||
<Button x:Uid="OOBE_Settings"
|
||||
Click="SettingsLaunchButton_Click"/>
|
||||
<HyperlinkButton NavigateUri="https://github.com/damienleroy/PowerAccent/"
|
||||
Style="{StaticResource TextButtonStyle}">
|
||||
<TextBlock x:Uid="LearnMore_PowerAccent"
|
||||
TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</controls:OOBEPageControl.PageContent>
|
||||
</controls:OOBEPageControl>
|
||||
</Page>
|
||||
@@ -0,0 +1,44 @@
|
||||
// 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.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
public sealed partial class OobePowerAccent : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobePowerAccent()
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.PowerAccent]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(PowerAccentPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,14 @@
|
||||
</muxc:NavigationViewItem.Icon>
|
||||
</muxc:NavigationViewItem>
|
||||
|
||||
<muxc:NavigationViewItem x:Uid="Shell_PowerAccent"
|
||||
Tag="PowerAccent">
|
||||
<muxc:NavigationViewItem.Icon>
|
||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsPowerAccent.png"
|
||||
ShowAsMonochrome="False" />
|
||||
</muxc:NavigationViewItem.Icon>
|
||||
</muxc:NavigationViewItem>
|
||||
|
||||
<muxc:NavigationViewItem x:Uid="Shell_PowerOCR"
|
||||
Tag="PowerOCR">
|
||||
<muxc:NavigationViewItem.Icon>
|
||||
|
||||
@@ -102,11 +102,19 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
ModuleName = "MouseUtils",
|
||||
IsNew = true,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.PowerAccent, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "PowerAccent",
|
||||
IsNew = true,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.PowerOCR, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "PowerOCR",
|
||||
IsNew = true,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.PowerRename, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "PowerRename",
|
||||
@@ -174,6 +182,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
case "Run": NavigationFrame.Navigate(typeof(OobeRun)); break;
|
||||
case "ImageResizer": NavigationFrame.Navigate(typeof(OobeImageResizer)); break;
|
||||
case "KBM": NavigationFrame.Navigate(typeof(OobeKBM)); break;
|
||||
case "PowerAccent": NavigationFrame.Navigate(typeof(OobePowerAccent)); break;
|
||||
case "PowerRename": NavigationFrame.Navigate(typeof(OobePowerRename)); break;
|
||||
case "PowerOCR": NavigationFrame.Navigate(typeof(OobePowerOCR)); break;
|
||||
case "FileExplorer": NavigationFrame.Navigate(typeof(OobeFileExplorer)); break;
|
||||
|
||||
@@ -2164,6 +2164,89 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<data name="AlwaysOnTop_RoundCorners.Content" xml:space="preserve">
|
||||
<value>Enable round corners</value>
|
||||
</data>
|
||||
<data name="LearnMore_PowerAccent.Text" xml:space="preserve">
|
||||
<value>Learn more about PowerAccent</value>
|
||||
<comment>PowerAccent is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="PowerAccent_EnablePowerAccent.Header" xml:space="preserve">
|
||||
<value>Enable PowerAccent</value>
|
||||
</data>
|
||||
<data name="Shell_PowerAccent.Content" xml:space="preserve">
|
||||
<value>PowerAccent</value>
|
||||
</data>
|
||||
<data name="PowerAccent.ModuleDescription" xml:space="preserve">
|
||||
<value>PowerAccent is an alternative way to type accented characters, useful for when a keyboard doesn't support that specific accent. While holding the key for the character you want to add an accent to, press the Activation Key (space key or left and right arrow keys) and an overlay to select the accented character will appear.</value>
|
||||
<comment>key refers to a physical key on a keyboard</comment>
|
||||
</data>
|
||||
<data name="PowerAccent.ModuleTitle" xml:space="preserve">
|
||||
<value>PowerAccent</value>
|
||||
</data>
|
||||
<data name="PowerAccent.SecondaryLinksHeader" xml:space="preserve">
|
||||
<value>Attribution</value>
|
||||
</data>
|
||||
<data name="Oobe_PowerAccent.Description" xml:space="preserve">
|
||||
<value>PowerAccent is an easy way to write letters with accents, like on the phone or Mac.</value>
|
||||
</data>
|
||||
<data name="Oobe_PowerAccent.Title" xml:space="preserve">
|
||||
<value>PowerAccent</value>
|
||||
</data>
|
||||
<data name="Oobe_PowerAccent_HowToUse.Text" xml:space="preserve">
|
||||
<value>Open **PowerToys Settings** and enable PowerAccent. While holding the key for the character you want to add an accent to, press the Activation Key and an overlay to select the accented character will appear.</value>
|
||||
<comment>key refers to a physical key on a keyboard</comment>
|
||||
</data>
|
||||
<data name="PowerAccent_Activation_GroupSettings.Header" xml:space="preserve">
|
||||
<value>Activation</value>
|
||||
</data>
|
||||
<data name="PowerAccent_Activation_Shortcut.Header" xml:space="preserve">
|
||||
<value>Activation key</value>
|
||||
</data>
|
||||
<data name="PowerAccent_Activation_Shortcut.Description" xml:space="preserve">
|
||||
<value>Select the activation key to activate this module by holding down the letter and pressing the activation key</value>
|
||||
</data>
|
||||
<data name="PowerAccent_Activation_Key_Arrows.Content" xml:space="preserve">
|
||||
<value>Left/Right Arrow</value>
|
||||
<comment>Left/Right arrow keyboard keys.</comment>
|
||||
</data>
|
||||
<data name="PowerAccent_Activation_Key_Space.Content" xml:space="preserve">
|
||||
<value>Space</value>
|
||||
<comment>Space is the space keyboard key.</comment>
|
||||
</data>
|
||||
<data name="PowerAccent_Activation_Key_Both.Content" xml:space="preserve">
|
||||
<value>Both</value>
|
||||
</data>
|
||||
<data name="PowerAccent_Toolbar.Header" xml:space="preserve">
|
||||
<value>Toolbar</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition.Header" xml:space="preserve">
|
||||
<value>Toolbar position</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition_TopCenter.Content" xml:space="preserve">
|
||||
<value>Top center</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition_TopLeftCorner.Content" xml:space="preserve">
|
||||
<value>Top left corner</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition_TopRightCorner.Content" xml:space="preserve">
|
||||
<value>Top right corner</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition_BottomLeftCorner.Content" xml:space="preserve">
|
||||
<value>Bottom left corner</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition_BottomCenter.Content" xml:space="preserve">
|
||||
<value>Bottom center</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition_BottomRightCorner.Content" xml:space="preserve">
|
||||
<value>Bottom right corner</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition_Center.Content" xml:space="preserve">
|
||||
<value>Center</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition_Left.Content" xml:space="preserve">
|
||||
<value>Left</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ToolbarPosition_Right.Content" xml:space="preserve">
|
||||
<value>Right</value>
|
||||
</data>
|
||||
<data name="LearnMore_PowerOcr.Text" xml:space="preserve">
|
||||
<value>Learn more about PowerOCR</value>
|
||||
</data>
|
||||
|
||||
69
src/settings-ui/Settings.UI/Views/PowerAccentPage.xaml
Normal file
69
src/settings-ui/Settings.UI/Views/PowerAccentPage.xaml
Normal file
@@ -0,0 +1,69 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerAccentPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<controls:SettingsPageControl x:Uid="PowerAccent" IsTabStop="False"
|
||||
ModuleImageSource="ms-appx:///Assets/Modules/PowerAccent.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
<controls:Setting x:Uid="PowerAccent_EnablePowerAccent">
|
||||
<controls:Setting.Icon>
|
||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsPowerAccent.png" ShowAsMonochrome="False" />
|
||||
</controls:Setting.Icon>
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" x:Uid="ToggleSwitch" HorizontalAlignment="Right"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
|
||||
<controls:SettingsGroup x:Uid="PowerAccent_Activation_GroupSettings" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<controls:Setting x:Uid="PowerAccent_Activation_Shortcut" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
SelectedIndex="{x:Bind Path=ViewModel.ActivationKey, Mode=TwoWay}" >
|
||||
<ComboBoxItem x:Uid="PowerAccent_Activation_Key_Arrows"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_Activation_Key_Space"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_Activation_Key_Both"/>
|
||||
</ComboBox>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="PowerAccent_Toolbar" IsEnabled="{Binding Mode=OneWay, Path=IsEnabled}">
|
||||
<controls:Setting x:Uid="PowerAccent_ToolbarPosition" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
SelectedIndex="{x:Bind Path=ViewModel.ToolbarPositionIndex, Mode=TwoWay}" >
|
||||
<ComboBoxItem x:Uid="PowerAccent_ToolbarPosition_TopCenter"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_ToolbarPosition_BottomCenter"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_ToolbarPosition_Left"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_ToolbarPosition_Right"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_ToolbarPosition_TopRightCorner"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_ToolbarPosition_TopLeftCorner"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_ToolbarPosition_BottomRightCorner"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_ToolbarPosition_BottomLeftCorner"/>
|
||||
<ComboBoxItem x:Uid="PowerAccent_ToolbarPosition_Center"/>
|
||||
</ComboBox>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
<controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:PageLink x:Uid="LearnMore_PowerAccent" Link="https://aka.ms/PowerToysOverview_PowerAccent"/>
|
||||
</controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:SettingsPageControl.SecondaryLinks>
|
||||
<controls:PageLink Text="Damien Leroy's PowerAccent" Link="https://github.com/damienleroy"/>
|
||||
</controls:SettingsPageControl.SecondaryLinks>
|
||||
</controls:SettingsPageControl>
|
||||
</Page>
|
||||
23
src/settings-ui/Settings.UI/Views/PowerAccentPage.xaml.cs
Normal file
23
src/settings-ui/Settings.UI/Views/PowerAccentPage.xaml.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// 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.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class PowerAccentPage : Page
|
||||
{
|
||||
private PowerAccentViewModel ViewModel { get; set; }
|
||||
|
||||
public PowerAccentPage()
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new PowerAccentViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,6 +113,14 @@
|
||||
</muxc:NavigationViewItem.Icon>
|
||||
</muxc:NavigationViewItem>
|
||||
|
||||
<muxc:NavigationViewItem x:Uid="Shell_PowerAccent"
|
||||
helpers:NavHelper.NavigateTo="views:PowerAccentPage">
|
||||
<muxc:NavigationViewItem.Icon>
|
||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsPowerAccent.png"
|
||||
ShowAsMonochrome="False" />
|
||||
</muxc:NavigationViewItem.Icon>
|
||||
</muxc:NavigationViewItem>
|
||||
|
||||
<muxc:NavigationViewItem x:Uid="Shell_PowerRename"
|
||||
helpers:NavHelper.NavigateTo="views:PowerRenamePage">
|
||||
<muxc:NavigationViewItem.Icon>
|
||||
|
||||
Reference in New Issue
Block a user