mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Setting v2: added power preview settings (#1702)
* added power preview settings * Added link to module oververview * create settings file if one is not found * removed run oon start up speficic callback * Update src/core/Microsoft.PowerToys.Settings.UI.Lib/ModuleSettings.cs Co-Authored-By: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com> * fixed merge conflicts Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>
This commit is contained in:
12
src/core/Microsoft.PowerToys.Settings.UI.Lib/Contributor.cs
Normal file
12
src/core/Microsoft.PowerToys.Settings.UI.Lib/Contributor.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class Contributor
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Link { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// This class models the settings for the PowerPreview class.
|
||||
/// Eaxmple JSON:
|
||||
/// {
|
||||
/// "name": "File Explorer Preview",
|
||||
/// "properties": {
|
||||
/// "IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL": { "value": true },
|
||||
/// "PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID": { "value": true }
|
||||
/// },
|
||||
/// "version": "1.0"
|
||||
/// }
|
||||
|
||||
/// </summary>
|
||||
public class PowerPreviewSettings
|
||||
{
|
||||
public string name { get; set; }
|
||||
public Properties properties { get; set; }
|
||||
public string version { get; set; }
|
||||
|
||||
public PowerPreviewSettings()
|
||||
{
|
||||
this.properties = new Properties();
|
||||
this.version = "1";
|
||||
this.name = "_unset_";
|
||||
}
|
||||
|
||||
public PowerPreviewSettings(string ptName)
|
||||
{
|
||||
this.properties = new Properties();
|
||||
this.version = "1";
|
||||
this.name = ptName;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "{\"" + this.name + "\":" + JsonSerializer.Serialize(this) + "}";
|
||||
}
|
||||
}
|
||||
|
||||
public class Property
|
||||
{
|
||||
public bool value { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
|
||||
public class Properties
|
||||
{
|
||||
public Property IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL { get; set; }
|
||||
public Property PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID { get; set; }
|
||||
|
||||
public Properties()
|
||||
{
|
||||
this.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL = new Property();
|
||||
this.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID = new Property();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// PowerToys runner expects a json text that contains one of the following attributes: refresh, general and powertoys.
|
||||
/// The one for general settings is placed in the General settings model. This class represents the json text that starts with the "powertoys" attribute.
|
||||
/// this will tell the runner that we are sending settings for a powertoy module and not for general settings.
|
||||
/// </summary>
|
||||
/// <typeparam name="M">M stands for the Model of PT Module Settings to be sent.</typeparam>
|
||||
public class SndModuleSettings<M>
|
||||
{
|
||||
public M powertoys { get; set; }
|
||||
|
||||
public SndModuleSettings(M ptModuleSettings)
|
||||
{
|
||||
this.powertoys = ptModuleSettings;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "{\"powertoys\":" + this.powertoys.ToString() + "}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user