Skip to content

Commit

Permalink
[Settings V2] Upated Fancy Zone and Shortcut Guid default values. (#2786
Browse files Browse the repository at this point in the history
)

* upated Fancy Zone and Shortcut Guid default values.

* upated fz tests
  • Loading branch information
Lavius Motileng committed May 8, 2020
1 parent dad6599 commit 1ab0a51
Show file tree
Hide file tree
Showing 10 changed files with 425 additions and 32 deletions.
32 changes: 24 additions & 8 deletions src/core/Microsoft.PowerToys.Settings.UI.Lib/FZConfigProperties.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Microsoft.PowerToys.Settings.UI.Lib
Expand All @@ -9,23 +10,32 @@ public class FZConfigProperties
{
public FZConfigProperties()
{
this.FancyzonesShiftDrag = new BoolProperty();
this.FancyzonesMouseSwitch = new BoolProperty();
this.FancyzonesShiftDrag = new BoolProperty(true);
this.FancyzonesOverrideSnapHotkeys = new BoolProperty();
this.FancyzonesMouseSwitch = new BoolProperty();
this.FancyzonesMoveWindowsAcrossMonitors = new BoolProperty();
this.FancyzonesDisplayChangeMoveWindows = new BoolProperty();
this.FancyzonesZoneSetChangeMoveWindows = new BoolProperty();
this.FancyzonesVirtualDesktopChangeMoveWindows = new BoolProperty();
this.FancyzonesAppLastZoneMoveWindows = new BoolProperty();
this.UseCursorposEditorStartupscreen = new BoolProperty();
this.UseCursorposEditorStartupscreen = new BoolProperty(true);
this.FancyzonesShowOnAllMonitors = new BoolProperty();
this.FancyzonesZoneHighlightColor = new StringProperty("#F5FCFF");
this.FancyzonesHighlightOpacity = new IntProperty(50);
this.FancyzonesEditorHotkey = new KeyBoardKeysProperty(
new HotkeySettings()
{
Win = true,
Ctrl = false,
Alt = false,
Shift = false,
Key = "`",
Code = 192,
});
this.FancyzonesMakeDraggedWindowTransparent = new BoolProperty();
this.FancyzonesZoneHighlightColor = new StringProperty();
this.FancyzonesHighlightOpacity = new IntProperty();
this.FancyzonesEditorHotkey = new KeyBoardKeysProperty();
this.FancyzonesExcludedApps = new StringProperty();
this.FancyzonesInActiveColor = new StringProperty();
this.FancyzonesBorderColor = new StringProperty();
this.FancyzonesInActiveColor = new StringProperty("#F5FCFF");
this.FancyzonesBorderColor = new StringProperty("#F5FCFF");
}

[JsonPropertyName("fancyzones_shiftDrag")]
Expand Down Expand Up @@ -78,5 +88,11 @@ public FZConfigProperties()

[JsonPropertyName("fancyzones_zoneColor")]
public StringProperty FancyzonesInActiveColor { get; set; }

// converts the current to a json string.
public string ToJsonString()
{
return JsonSerializer.Serialize(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class FancyZonesSettingsIPCMessage
{
[JsonPropertyName("powertoys")]
public SndFancyZonesSettings Powertoys { get; set; }

public FancyZonesSettingsIPCMessage()
{
}

public FancyZonesSettingsIPCMessage(SndFancyZonesSettings settings)
{
this.Powertoys = settings;
}

public string ToJsonString()
{
return JsonSerializer.Serialize(this);
}
}
}
10 changes: 10 additions & 0 deletions src/core/Microsoft.PowerToys.Settings.UI.Lib/HotkeySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ public HotkeySettings()
this.Code = 0;
}

public HotkeySettings(bool win, bool ctrl, bool alt, bool shift, string key, int code)
{
Win = win;
Ctrl = ctrl;
Alt = alt;
Shift = shift;
Key = key;
Code = code;
}

[JsonPropertyName("win")]
public bool Win { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public KeyBoardKeysProperty()
this.Value = new HotkeySettings();
}

public KeyBoardKeysProperty(HotkeySettings hkSettings)
{
this.Value = hkSettings;
}

[JsonPropertyName("value")]
public HotkeySettings Value { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public class ShortcutGuideProperties
{
public ShortcutGuideProperties()
{
OverlayOpacity = new IntProperty();
PressTime = new IntProperty();
Theme = new StringProperty();
OverlayOpacity = new IntProperty(90);
PressTime = new IntProperty(900);
Theme = new StringProperty("light");
}

[JsonPropertyName("overlay_opacity")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public class SndFancyZonesSettings
{
public FancyZonesSettings FancyZones { get; set; }

public SndFancyZonesSettings()
{
}

public SndFancyZonesSettings(FancyZonesSettings settings)
{
this.FancyZones = settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public bool IsEnabled
OutGoingGeneralSettings snd = new OutGoingGeneralSettings(generalSettings);

ShellPage.DefaultSndMSGCallback(snd.ToString());
RaisePropertyChanged();
OnPropertyChanged("IsEnabled");
}
}
}
Expand Down Expand Up @@ -387,26 +387,6 @@ public int HighlightOpacity
}
}

/*
public int EditorHotkey
{
get
{
return _editorHotkey;
}
set
{
if (value != _editorHotkey)
{
_editorHotkey = value;
Settings.Properties.FancyzonesHighlightOpacity.Value = value;
RaisePropertyChanged();
}
}
}
*/

public HotkeySettings EditorHotkey
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
<SDKReference Include="TestPlatform.Universal, Version=$(UnitTestPlatformVersion)" />
</ItemGroup>
<ItemGroup>
<Compile Include="ViewModelTests\FancyZones.cs" />
<Compile Include="ViewModelTests\General.cs" />
<Compile Include="ModelsTests\HelperTest.cs" />
<Compile Include="ViewModelTests\ImageResizer.cs" />
Expand Down

0 comments on commit 1ab0a51

Please sign in to comment.