Renaming properties to C# styling to fix warnings (#5166)

* Renaming properties

* Update PowerLauncherProperties.cs

trying to kick CI

* PowerLauncher is way for naming.

Co-authored-by: Clint Rutkas <crutkas@microsoft.com>
This commit is contained in:
Clint Rutkas
2020-07-23 11:01:49 -07:00
committed by GitHub
parent f25d2b3a86
commit 2bd2ec7a2e
8 changed files with 107 additions and 98 deletions

View File

@@ -1,45 +1,60 @@
// Copyright (c) Microsoft Corporation
// 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;
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class PowerLauncherProperties
{
public string search_result_preference { get; set; }
[JsonPropertyName("search_result_preference")]
public string SearchResultPreference { get; set; }
public string search_type_preference { get; set; }
[JsonPropertyName("search_type_preference")]
public string SearchTypePreference { get; set; }
public int maximum_number_of_results { get; set; }
[JsonPropertyName("maximum_number_of_results")]
public int MaximumNumberOfResults { get; set; }
public HotkeySettings open_powerlauncher { get; set; }
[JsonPropertyName("open_powerlauncher")]
public HotkeySettings OpenPowerLauncher { get; set; }
public HotkeySettings open_file_location { get; set; }
[JsonPropertyName("open_file_location")]
public HotkeySettings OpenFileLocation { get; set; }
public HotkeySettings copy_path_location { get; set; }
[JsonPropertyName("copy_path_location")]
public HotkeySettings CopyPathLocation { get; set; }
public HotkeySettings open_console { get; set; }
[JsonPropertyName("open_console")]
public HotkeySettings OpenConsole { get; set; }
public bool override_win_r_key { get; set; }
[JsonPropertyName("override_win_r_key")]
public bool OverrideWinkeyR { get; set; }
public bool override_win_s_key { get; set; }
[JsonPropertyName("override_win_s_key")]
public bool OverrideWinkeyS { get; set; }
public bool ignore_hotkeys_in_fullscreen { get; set; }
[JsonPropertyName("ignore_hotkeys_in_fullscreen")]
public bool IgnoreHotkeysInFullscreen { get; set; }
public bool disable_drive_detection_warning { get; set; }
public bool clear_input_on_launch { get; set; }
[JsonPropertyName("disable_drive_detection_warning")]
public bool DisableDriveDetectionWarning { get; set; }
[JsonPropertyName("clear_input_on_launch")]
public bool ClearInputOnLaunch { get; set; }
public PowerLauncherProperties()
{
open_powerlauncher = new HotkeySettings();
open_file_location = new HotkeySettings();
copy_path_location = new HotkeySettings();
open_console = new HotkeySettings();
search_result_preference = "most_recently_used";
search_type_preference = "application_name";
ignore_hotkeys_in_fullscreen = false;
disable_drive_detection_warning = false;
clear_input_on_launch = false;
OpenPowerLauncher = new HotkeySettings();
OpenFileLocation = new HotkeySettings();
CopyPathLocation = new HotkeySettings();
OpenConsole = new HotkeySettings();
SearchResultPreference = "most_recently_used";
SearchTypePreference = "application_name";
IgnoreHotkeysInFullscreen = false;
DisableDriveDetectionWarning = false;
ClearInputOnLaunch = false;
}
}
}

View File

@@ -2,35 +2,29 @@
// 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.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class PowerPreviewSettings : BasePTModuleSettings
{
public PowerPreviewProperties properties { get; set; }
public const string ModuleName = "File Explorer";
[JsonPropertyName("Properties")]
public PowerPreviewProperties Properties { get; set; }
public PowerPreviewSettings()
{
properties = new PowerPreviewProperties();
Properties = new PowerPreviewProperties();
Version = "1";
Name = "File Explorer";
Name = ModuleName;
}
public PowerPreviewSettings(string ptName)
{
properties = new PowerPreviewProperties();
Properties = new PowerPreviewProperties();
Version = "1";
Name = ptName;
}
public override string ToJsonString()
{
return JsonSerializer.Serialize(this);
}
}
}

View File

@@ -34,9 +34,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
else
{
settings = new PowerLauncherSettings();
settings.Properties.open_powerlauncher.Alt = true;
settings.Properties.open_powerlauncher.Code = (int)Windows.System.VirtualKey.Space;
settings.Properties.maximum_number_of_results = 4;
settings.Properties.OpenPowerLauncher.Alt = true;
settings.Properties.OpenPowerLauncher.Code = (int)Windows.System.VirtualKey.Space;
settings.Properties.MaximumNumberOfResults = 4;
callback(settings);
}
@@ -87,14 +87,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.search_result_preference;
return settings.Properties.SearchResultPreference;
}
set
{
if (settings.Properties.search_result_preference != value)
if (settings.Properties.SearchResultPreference != value)
{
settings.Properties.search_result_preference = value;
settings.Properties.SearchResultPreference = value;
UpdateSettings();
}
}
@@ -104,14 +104,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.search_type_preference;
return settings.Properties.SearchTypePreference;
}
set
{
if (settings.Properties.search_type_preference != value)
if (settings.Properties.SearchTypePreference != value)
{
settings.Properties.search_type_preference = value;
settings.Properties.SearchTypePreference = value;
UpdateSettings();
}
}
@@ -121,14 +121,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.maximum_number_of_results;
return settings.Properties.MaximumNumberOfResults;
}
set
{
if (settings.Properties.maximum_number_of_results != value)
if (settings.Properties.MaximumNumberOfResults != value)
{
settings.Properties.maximum_number_of_results = value;
settings.Properties.MaximumNumberOfResults = value;
UpdateSettings();
}
}
@@ -138,14 +138,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.open_powerlauncher;
return settings.Properties.OpenPowerLauncher;
}
set
{
if (settings.Properties.open_powerlauncher != value)
if (settings.Properties.OpenPowerLauncher != value)
{
settings.Properties.open_powerlauncher = value;
settings.Properties.OpenPowerLauncher = value;
UpdateSettings();
}
}
@@ -155,14 +155,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.open_file_location;
return settings.Properties.OpenFileLocation;
}
set
{
if (settings.Properties.open_file_location != value)
if (settings.Properties.OpenFileLocation != value)
{
settings.Properties.open_file_location = value;
settings.Properties.OpenFileLocation = value;
UpdateSettings();
}
}
@@ -172,14 +172,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.copy_path_location;
return settings.Properties.CopyPathLocation;
}
set
{
if (settings.Properties.copy_path_location != value)
if (settings.Properties.CopyPathLocation != value)
{
settings.Properties.copy_path_location = value;
settings.Properties.CopyPathLocation = value;
UpdateSettings();
}
}
@@ -189,14 +189,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.override_win_r_key;
return settings.Properties.OverrideWinkeyR;
}
set
{
if (settings.Properties.override_win_r_key != value)
if (settings.Properties.OverrideWinkeyR != value)
{
settings.Properties.override_win_r_key = value;
settings.Properties.OverrideWinkeyR = value;
UpdateSettings();
}
}
@@ -206,14 +206,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.override_win_s_key;
return settings.Properties.OverrideWinkeyS;
}
set
{
if (settings.Properties.override_win_s_key != value)
if (settings.Properties.OverrideWinkeyS != value)
{
settings.Properties.override_win_s_key = value;
settings.Properties.OverrideWinkeyS = value;
UpdateSettings();
}
}
@@ -223,14 +223,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.ignore_hotkeys_in_fullscreen;
return settings.Properties.IgnoreHotkeysInFullscreen;
}
set
{
if (settings.Properties.ignore_hotkeys_in_fullscreen != value)
if (settings.Properties.IgnoreHotkeysInFullscreen != value)
{
settings.Properties.ignore_hotkeys_in_fullscreen = value;
settings.Properties.IgnoreHotkeysInFullscreen = value;
UpdateSettings();
}
}
@@ -240,14 +240,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.clear_input_on_launch;
return settings.Properties.ClearInputOnLaunch;
}
set
{
if (settings.Properties.clear_input_on_launch != value)
if (settings.Properties.ClearInputOnLaunch != value)
{
settings.Properties.clear_input_on_launch = value;
settings.Properties.ClearInputOnLaunch = value;
UpdateSettings();
}
}
@@ -257,14 +257,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
get
{
return settings.Properties.disable_drive_detection_warning;
return settings.Properties.DisableDriveDetectionWarning;
}
set
{
if (settings.Properties.disable_drive_detection_warning != value)
if (settings.Properties.DisableDriveDetectionWarning != value)
{
settings.Properties.disable_drive_detection_warning = value;
settings.Properties.DisableDriveDetectionWarning = value;
UpdateSettings();
}
}

View File

@@ -27,9 +27,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName);
}
this._svgRenderIsEnabled = Settings.properties.EnableSvgPreview;
this._svgThumbnailIsEnabled = Settings.properties.EnableSvgThumbnail;
this._mdRenderIsEnabled = Settings.properties.EnableMdPreview;
this._svgRenderIsEnabled = Settings.Properties.EnableSvgPreview;
this._svgThumbnailIsEnabled = Settings.Properties.EnableSvgThumbnail;
this._mdRenderIsEnabled = Settings.Properties.EnableMdPreview;
}
private bool _svgRenderIsEnabled = false;
@@ -48,7 +48,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
if (value != _svgRenderIsEnabled)
{
_svgRenderIsEnabled = value;
Settings.properties.EnableSvgPreview = value;
Settings.Properties.EnableSvgPreview = value;
RaisePropertyChanged();
}
}
@@ -66,7 +66,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
if (value != _svgThumbnailIsEnabled)
{
_svgThumbnailIsEnabled = value;
Settings.properties.EnableSvgThumbnail = value;
Settings.Properties.EnableSvgThumbnail = value;
RaisePropertyChanged();
}
}
@@ -84,7 +84,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
if (value != _mdRenderIsEnabled)
{
_mdRenderIsEnabled = value;
Settings.properties.EnableMdPreview = value;
Settings.Properties.EnableMdPreview = value;
RaisePropertyChanged();
}
}

View File

@@ -45,8 +45,8 @@ namespace ViewModelTests
viewModel.SearchTypePreference = "SearchOptionsAreNotValidated";
Assert.AreEqual(sendCallbackMock.TimesSent, 2);
Assert.IsTrue(mockSettings.Properties.search_result_preference == "SearchOptionsAreNotValidated");
Assert.IsTrue(mockSettings.Properties.search_type_preference == "SearchOptionsAreNotValidated");
Assert.IsTrue(mockSettings.Properties.SearchResultPreference == "SearchOptionsAreNotValidated");
Assert.IsTrue(mockSettings.Properties.SearchTypePreference == "SearchOptionsAreNotValidated");
}
public void AssertHotkeySettings(HotkeySettings setting, bool win, bool ctrl, bool alt, bool shift, int code)
@@ -85,7 +85,7 @@ namespace ViewModelTests
Assert.AreEqual(4, sendCallbackMock.TimesSent);
AssertHotkeySettings(
mockSettings.Properties.open_powerlauncher,
mockSettings.Properties.OpenPowerLauncher,
true,
false,
false,
@@ -93,7 +93,7 @@ namespace ViewModelTests
(int)Windows.System.VirtualKey.S
);
AssertHotkeySettings(
mockSettings.Properties.open_file_location,
mockSettings.Properties.OpenFileLocation,
false,
true,
false,
@@ -101,7 +101,7 @@ namespace ViewModelTests
(int)Windows.System.VirtualKey.A
);
AssertHotkeySettings(
mockSettings.Properties.open_console,
mockSettings.Properties.OpenConsole,
false,
false,
true,
@@ -109,7 +109,7 @@ namespace ViewModelTests
(int)Windows.System.VirtualKey.D
);
AssertHotkeySettings(
mockSettings.Properties.copy_path_location,
mockSettings.Properties.CopyPathLocation,
false,
false,
false,
@@ -127,8 +127,8 @@ namespace ViewModelTests
Assert.AreEqual(1, sendCallbackMock.TimesSent);
Assert.IsTrue(mockSettings.Properties.override_win_r_key);
Assert.IsFalse(mockSettings.Properties.override_win_s_key);
Assert.IsTrue(mockSettings.Properties.OverrideWinkeyR);
Assert.IsFalse(mockSettings.Properties.OverrideWinkeyS);
}
[TestMethod]
@@ -139,7 +139,7 @@ namespace ViewModelTests
// Assert
Assert.AreEqual(1, sendCallbackMock.TimesSent);
Assert.IsTrue(mockSettings.Properties.disable_drive_detection_warning);
Assert.IsTrue(mockSettings.Properties.DisableDriveDetectionWarning);
}
}
}

View File

@@ -59,7 +59,7 @@ namespace ViewModelTests
ShellPage.DefaultSndMSGCallback = msg =>
{
SndModuleSettings<SndPowerPreviewSettings> snd = JsonSerializer.Deserialize<SndModuleSettings<SndPowerPreviewSettings>>(msg);
Assert.IsTrue(snd.powertoys.FileExplorerPreviewSettings.properties.EnableSvgPreview);
Assert.IsTrue(snd.powertoys.FileExplorerPreviewSettings.Properties.EnableSvgPreview);
};
// act
@@ -76,7 +76,7 @@ namespace ViewModelTests
ShellPage.DefaultSndMSGCallback = msg =>
{
SndModuleSettings<SndPowerPreviewSettings> snd = JsonSerializer.Deserialize<SndModuleSettings<SndPowerPreviewSettings>>(msg);
Assert.IsTrue(snd.powertoys.FileExplorerPreviewSettings.properties.EnableSvgThumbnail);
Assert.IsTrue(snd.powertoys.FileExplorerPreviewSettings.Properties.EnableSvgThumbnail);
};
// act
@@ -93,7 +93,7 @@ namespace ViewModelTests
ShellPage.DefaultSndMSGCallback = msg =>
{
SndModuleSettings<SndPowerPreviewSettings> snd = JsonSerializer.Deserialize<SndModuleSettings<SndPowerPreviewSettings>>(msg);
Assert.IsTrue(snd.powertoys.FileExplorerPreviewSettings.properties.EnableMdPreview);
Assert.IsTrue(snd.powertoys.FileExplorerPreviewSettings.Properties.EnableMdPreview);
};
// act