[Settings] Reset Activation Key to Default Value (#26449)

* Add Default Value field to all controls

* Add reset button to Control field

* Improve button
Improve appearance
Add ToolTipService
Add AutomationProperties

* Move Reset button to Shortcut Dialog

* Fix Video Conferencing crash

* Change `Use Default` to `Reset`
This commit is contained in:
Sven
2023-06-20 15:42:04 +02:00
committed by GitHub
parent a883dcc283
commit 46ed52eab6
23 changed files with 127 additions and 78 deletions

View File

@@ -12,9 +12,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class ColorPickerProperties
{
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x43);
public ColorPickerProperties()
{
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x43);
ActivationShortcut = DefaultActivationShortcut;
ChangeCursor = false;
ColorHistoryLimit = 20;
VisibleColorFormats = new Dictionary<string, KeyValuePair<bool, string>>();

View File

@@ -11,9 +11,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class ColorPickerPropertiesVersion1
{
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x43);
public ColorPickerPropertiesVersion1()
{
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x43);
ActivationShortcut = DefaultActivationShortcut;
ChangeCursor = false;
ColorHistory = new List<string>();
ColorHistoryLimit = 20;

View File

@@ -10,9 +10,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class MeasureToolProperties
{
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x4D);
public MeasureToolProperties()
{
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x4D);
ActivationShortcut = DefaultActivationShortcut;
UnitsOfMeasure = new IntProperty(0);
PixelTolerance = new IntProperty(30);
ContinuousCapture = false;

View File

@@ -8,6 +8,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class MouseHighlighterProperties
{
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x48);
[JsonPropertyName("activation_shortcut")]
public HotkeySettings ActivationShortcut { get; set; }
@@ -31,7 +33,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public MouseHighlighterProperties()
{
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x48);
ActivationShortcut = DefaultActivationShortcut;
LeftButtonClickColor = new StringProperty("#FFFF00");
RightButtonClickColor = new StringProperty("#0000FF");
HighlightOpacity = new IntProperty(65);

View File

@@ -8,6 +8,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class MouseJumpProperties
{
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x44);
[JsonPropertyName("activation_shortcut")]
public HotkeySettings ActivationShortcut { get; set; }
@@ -16,7 +18,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public MouseJumpProperties()
{
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x44);
ActivationShortcut = DefaultActivationShortcut;
ThumbnailSize = new MouseJumpThumbnailSize();
}
}

View File

@@ -8,6 +8,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class MousePointerCrosshairsProperties
{
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, true, false, 0x50); // Win + Alt + P
[JsonPropertyName("activation_shortcut")]
public HotkeySettings ActivationShortcut { get; set; }
@@ -31,7 +33,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public MousePointerCrosshairsProperties()
{
ActivationShortcut = new HotkeySettings(true, false, true, false, 0x50); // Win + Alt + P
ActivationShortcut = DefaultActivationShortcut;
CrosshairsColor = new StringProperty("#FF0000");
CrosshairsOpacity = new IntProperty(75);
CrosshairsRadius = new IntProperty(20);

View File

@@ -8,9 +8,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class PastePlainProperties
{
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, true, true, false, 0x56); // Ctrl+Win+Alt+V
public PastePlainProperties()
{
ActivationShortcut = new HotkeySettings(true, true, true, false, 0x56); // Ctrl+Win+Alt+V
ActivationShortcut = DefaultActivationShortcut;
}
public HotkeySettings ActivationShortcut { get; set; }

View File

@@ -8,9 +8,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class PeekProperties
{
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(false, true, false, false, 0x20);
public PeekProperties()
{
ActivationShortcut = new HotkeySettings(false, true, false, false, 0x20);
ActivationShortcut = DefaultActivationShortcut;
AlwaysRunNotElevated = new BoolProperty(true);
CloseAfterLosingFocus = new BoolProperty(false);
}

View File

@@ -75,11 +75,17 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("generate_thumbnails_from_files")]
public bool GenerateThumbnailsFromFiles { get; set; }
public HotkeySettings DefaultOpenPowerLauncher => new HotkeySettings(false, false, true, false, 32);
public HotkeySettings DefaultOpenFileLocation => new HotkeySettings();
public HotkeySettings DefaultCopyPathLocation => new HotkeySettings();
public PowerLauncherProperties()
{
OpenPowerLauncher = new HotkeySettings(false, false, true, false, 32);
OpenFileLocation = new HotkeySettings();
CopyPathLocation = new HotkeySettings();
OpenPowerLauncher = DefaultOpenPowerLauncher;
OpenFileLocation = DefaultOpenFileLocation;
CopyPathLocation = DefaultCopyPathLocation;
OpenConsole = new HotkeySettings();
SearchResultPreference = "most_recently_used";
SearchTypePreference = "application_name";

View File

@@ -8,9 +8,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class PowerOcrProperties
{
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x54); // Win+Shift+T
public PowerOcrProperties()
{
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x54); // Win+Shift+T
ActivationShortcut = DefaultActivationShortcut;
PreferredLanguage = string.Empty;
}

View File

@@ -8,6 +8,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class ShortcutGuideProperties
{
public HotkeySettings DefaultOpenShortcutGuide => new HotkeySettings(true, false, false, true, 0xBF);
public ShortcutGuideProperties()
{
OverlayOpacity = new IntProperty(90);
@@ -16,7 +18,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
PressTimeForTaskbarIconShortcuts = new IntProperty(900);
Theme = new StringProperty("system");
DisabledApps = new StringProperty();
OpenShortcutGuide = new HotkeySettings(true, false, false, true, 0xBF);
OpenShortcutGuide = DefaultOpenShortcutGuide;
}
[JsonPropertyName("open_shortcutguide")]

View File

@@ -9,53 +9,54 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class VideoConferenceConfigProperties
{
public HotkeySettings DefaultMuteCameraAndMicrophoneHotkey => new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = true,
Key = "Q",
Code = 81,
};
public HotkeySettings DefaultMuteMicrophoneHotkey => new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = true,
Key = "A",
Code = 65,
};
public HotkeySettings DefaultPushToTalkMicrophoneHotkey => new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = true,
Key = "I",
Code = 73,
};
public HotkeySettings DefaultMuteCameraHotkey => new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = true,
Key = "O",
Code = 79,
};
public VideoConferenceConfigProperties()
{
this.MuteCameraAndMicrophoneHotkey = new KeyboardKeysProperty(
new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = true,
Key = "Q",
Code = 81,
});
MuteCameraAndMicrophoneHotkey = new KeyboardKeysProperty(DefaultMuteCameraAndMicrophoneHotkey);
MuteMicrophoneHotkey = new KeyboardKeysProperty(DefaultMuteMicrophoneHotkey);
PushToTalkMicrophoneHotkey = new KeyboardKeysProperty(DefaultPushToTalkMicrophoneHotkey);
MuteCameraHotkey = new KeyboardKeysProperty(DefaultMuteCameraHotkey);
this.MuteMicrophoneHotkey = new KeyboardKeysProperty(
new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = true,
Key = "A",
Code = 65,
});
this.PushToTalkMicrophoneHotkey = new KeyboardKeysProperty(
new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = true,
Key = "I",
Code = 73,
});
this.MuteCameraHotkey = new KeyboardKeysProperty(
new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = true,
Key = "O",
Code = 79,
});
this.PushToReverseEnabled = new BoolProperty(false);
PushToReverseEnabled = new BoolProperty(false);
}
[JsonPropertyName("mute_camera_and_microphone_hotkey")]