mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[Mouse Jump] Customisable appearance - borders, margins, colours, etc - final part (#35521)
* [MouseJump] move Mouse Jump settings into separate control (#27511) * [MouseJump] added Mouse Jump style controls to Settings UI (#27511) * [MouseJump] added Mouse Jump style controls to Settings UI (#27511) * [MouseJump] removing unused MouseJumpUI code (#27511) * [MouseJump] whitespace (#27511) * [MouseJump] fix spellcheck (#27511) * [MouseJump] enabled "Copy to custom style" (#27511) * [MouseJump] fixing build (internal members -> public) (#27511) * [MouseJump] remove unused "using"s (#27511) * [MouseJump] use custom styles in preview image (#27511) * [MouseJump] fixing failing test (#27511) * [MouseJump] fixing failing test (#27511) * [MouseJump] fixing failing test (#27511) * [MouseJump] fixing failing test (#27511) * [MouseJump] delinting to trigger a build (#27511) * [MouseJump] updated settings preview image ("browser" header) (#27511) * [MouseJump] upgrade default "custom" style settings in config (#27511) * [MouseJump] fixed a glitch in settings upgrade (#27511) * [MouseJump] fixed spell checker (#27511) * [MouseJump] typo in resource strings (image -> images) (#27511) * Remove unused include
This commit is contained in:
@@ -14,10 +14,113 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x44);
|
||||
|
||||
[JsonPropertyName("activation_shortcut")]
|
||||
public HotkeySettings ActivationShortcut { get; set; }
|
||||
public HotkeySettings ActivationShortcut
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("thumbnail_size")]
|
||||
public MouseJumpThumbnailSize ThumbnailSize { get; set; }
|
||||
public MouseJumpThumbnailSize ThumbnailSize
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the preview type.
|
||||
/// Allowed values are "compact", "bezelled", "custom"
|
||||
/// </summary>
|
||||
[JsonPropertyName("preview_type")]
|
||||
public string PreviewType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("background_color_1")]
|
||||
public string BackgroundColor1
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("background_color_2")]
|
||||
public string BackgroundColor2
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("border_thickness")]
|
||||
public int BorderThickness
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("border_color")]
|
||||
public string BorderColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("border_3d_depth")]
|
||||
public int Border3dDepth
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("border_padding")]
|
||||
public int BorderPadding
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("bezel_thickness")]
|
||||
public int BezelThickness
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("bezel_color")]
|
||||
public string BezelColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("bezel_3d_depth")]
|
||||
public int Bezel3dDepth
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("screen_margin")]
|
||||
public int ScreenMargin
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("screen_color_1")]
|
||||
public string ScreenColor1
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("screen_color_2")]
|
||||
public string ScreenColor2
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public MouseJumpProperties()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,8 @@ using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using MouseJump.Common.Helpers;
|
||||
using MouseJump.Common.Models.Settings;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
@@ -26,7 +28,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
Name = ModuleName;
|
||||
Properties = new MouseJumpProperties();
|
||||
Version = "1.0";
|
||||
Version = "1.1";
|
||||
}
|
||||
|
||||
public void Save(ISettingsUtils settingsUtils)
|
||||
@@ -47,7 +49,74 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
// This can be utilized in the future if the settings.json file is to be modified/deleted.
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
{
|
||||
return false;
|
||||
/*
|
||||
v1.0 - initial version
|
||||
|
||||
* DefaultActivationShortcut
|
||||
* activation_shortcut
|
||||
* thumbnail_size
|
||||
* name
|
||||
* version
|
||||
*/
|
||||
var upgraded = false;
|
||||
|
||||
if (this.Version == "1.0")
|
||||
{
|
||||
/*
|
||||
v1.1 - added preview style settings
|
||||
|
||||
* preview_type
|
||||
* background_color_1
|
||||
* background_color_2
|
||||
* border_thickness
|
||||
* border_color
|
||||
* border_3d_depth
|
||||
* border_padding
|
||||
* bezel_thickness
|
||||
* bezel_color
|
||||
* bezel_3d_depth
|
||||
* screen_margin
|
||||
* screen_color_1
|
||||
* screen_color_2
|
||||
*/
|
||||
this.Version = "1.1";
|
||||
|
||||
// note - there's an issue where ITwoWayPipeMessageIPCManagedMethods.Send overwrites
|
||||
// the settings file version as "1.0" regardless of the actual version. as a result,
|
||||
// the UpgradeSettingsConfiguration can get triggered even if the config has already
|
||||
// been upgraded, so we need to do an additional check to make sure values haven't
|
||||
// already been upgraded before we overwrite them with default values.
|
||||
if (string.IsNullOrEmpty(this.Properties.PreviewType))
|
||||
{
|
||||
// set default values for custom preview style
|
||||
var previewStyle = StyleHelper.BezelledPreviewStyle;
|
||||
this.Properties.PreviewType = PreviewType.Bezelled.ToString();
|
||||
this.Properties.BackgroundColor1 = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(previewStyle.CanvasStyle.BackgroundStyle.Color1));
|
||||
this.Properties.BackgroundColor2 = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(previewStyle.CanvasStyle.BackgroundStyle.Color2));
|
||||
this.Properties.BorderThickness = (int)previewStyle.CanvasStyle.BorderStyle.Top;
|
||||
this.Properties.BorderColor = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(previewStyle.CanvasStyle.BorderStyle.Color));
|
||||
this.Properties.Border3dDepth = (int)previewStyle.CanvasStyle.BorderStyle.Depth;
|
||||
this.Properties.BorderPadding = (int)previewStyle.CanvasStyle.PaddingStyle.Top;
|
||||
this.Properties.BezelThickness = (int)previewStyle.ScreenStyle.BorderStyle.Top;
|
||||
this.Properties.BezelColor = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(previewStyle.ScreenStyle.BorderStyle.Color));
|
||||
this.Properties.Bezel3dDepth = (int)previewStyle.ScreenStyle.BorderStyle.Depth;
|
||||
this.Properties.ScreenMargin = (int)previewStyle.ScreenStyle.MarginStyle.Top;
|
||||
this.Properties.ScreenColor1 = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(previewStyle.ScreenStyle.BackgroundStyle.Color1));
|
||||
this.Properties.ScreenColor2 = ConfigHelper.SerializeToConfigColorString(
|
||||
ConfigHelper.ToUnnamedColor(previewStyle.ScreenStyle.BackgroundStyle.Color2));
|
||||
}
|
||||
|
||||
// we still need to flag the settings as "upgraded" so that the new version gets written
|
||||
// back to the config file, even if we didn't actually change and setting values
|
||||
upgraded = true;
|
||||
}
|
||||
|
||||
return upgraded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<ProjectReference Include="..\..\common\interop\PowerToys.Interop.vcxproj" />
|
||||
<ProjectReference Include="..\..\common\ManagedCommon\ManagedCommon.csproj" />
|
||||
<ProjectReference Include="..\..\common\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj" />
|
||||
<ProjectReference Include="..\..\modules\MouseUtils\MouseJump.Common\MouseJump.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user