Skip to content

Commit

Permalink
Merge pull request #1 from microsoft/master
Browse files Browse the repository at this point in the history
merge from master
  • Loading branch information
TobiasSekan authored Sep 27, 2020
2 parents e135153 + de870c8 commit 3062a47
Show file tree
Hide file tree
Showing 546 changed files with 65,232 additions and 1,203 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Preview Pane is an existing feature in the File Explorer. To enable it, you jus

### Video Conference Mute (Experimental)

[<img align="left" src="https://aka.ms/powerToysVideoConferenceImageSmall" />](https://aka.ms/PowerToysOverview_VideoConference) [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) is a quick and easy way to do an global "mute" of both your microphone and webcam via <kbd>Win</kbd>+<kbd>N</kbd>. Just set your webcam in the target application to the PowerToys VideoConference camera.
[<img align="left" src="https://aka.ms/powerToysVideoConferenceImageSmall" />](https://aka.ms/PowerToysOverview_VideoConference) [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) is a quick and easy way to do a global "mute" of both your microphone and webcam via <kbd>Win</kbd>+<kbd>N</kbd>. Just set your webcam in the target application to the PowerToys VideoConference camera.

**Note:** This is only included in the [pre-release version of PowerToys installer][github-prerelease-link]. This PowerToy requires Windows 10 1903 (build 18362) or later.
<br/>
Expand Down
6 changes: 3 additions & 3 deletions installer/PowerToysSetup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -438,18 +438,18 @@
</RegistryKey>
<!-- Registry Key for Class Registration of Svg Thumbnail Provider -->
<RegistryKey Root="HKCR" Key="CLSID\{36B27788-A8BB-4698-A756-DF9F11F64F84}">
<RegistryValue Type="string" Value="SvgThumbnailProvider.SvgThumbnailProvider" />
<RegistryValue Type="string" Value="Microsoft.PowerToys.ThumbnailHandler.Svg.SvgThumbnailProvider" />
<RegistryValue Type="string" Name="DisplayName" Value="Svg Thumbnail Provider" />
<RegistryValue Type="string" Name="AppID" Value="{CF142243-F059-45AF-8842-DBBE9783DB14}" />
<RegistryValue Type="string" Key="Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value=""/>
<RegistryValue Type="string" Key="InprocServer32" Value="mscoree.dll" />
<RegistryValue Type="string" Key="InprocServer32" Name="Assembly" Value="SvgThumbnailProvider, Version=$(var.Version).0, Culture=neutral" />
<RegistryValue Type="string" Key="InprocServer32" Name="Class" Value="SvgThumbnailProvider.SvgThumbnailProvider" />
<RegistryValue Type="string" Key="InprocServer32" Name="Class" Value="Microsoft.PowerToys.ThumbnailHandler.Svg.SvgThumbnailProvider" />
<RegistryValue Type="string" Key="InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" />
<RegistryValue Type="string" Key="InprocServer32" Name="ThreadingModel" Value="Both" />
<RegistryValue Type="string" Key="InprocServer32" Name="CodeBase" Value="file:///[FileExplorerPreviewInstallFolder]SvgThumbnailProvider.dll" />
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Assembly" Value="SvgThumbnailProvider, Version=$(var.Version).0, Culture=neutral" />
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Class" Value="SvgThumbnailProvider.SvgThumbnailProvider" />
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="Class" Value="Microsoft.PowerToys.ThumbnailHandler.Svg.SvgThumbnailProvider" />
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="RuntimeVersion" Value="v4.0.30319" />
<RegistryValue Type="string" Key="InprocServer32\$(var.Version).0" Name="CodeBase" Value="file:///[FileExplorerPreviewInstallFolder]SvgThumbnailProvider.dll" />
</RegistryKey>
Expand Down
3 changes: 2 additions & 1 deletion src/action_runner/action_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
}
else
{
params = args[nextArg];
params += args[nextArg];
params += L' ';
nextArg++;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/common/interop/interop.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,10 @@ public
{
public:
literal int VK_WIN_BOTH = CommonSharedConstants::VK_WIN_BOTH;

static String^ PowerLauncherSharedEvent()
{
return gcnew String(CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT);
}
};
}
5 changes: 5 additions & 0 deletions src/common/settings_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ namespace PowerToysSettings
return m_json.GetNamedObject(L"properties").GetNamedObject(property_name).GetNamedObject(L"value");
}

json::JsonObject PowerToyValues::get_raw_json()
{
return m_json;
}

std::wstring PowerToyValues::serialize()
{
set_version();
Expand Down
1 change: 1 addition & 0 deletions src/common/settings_objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ namespace PowerToysSettings
std::optional<int> get_int_value(std::wstring_view property_name);
std::optional<std::wstring> get_string_value(std::wstring_view property_name);
std::optional<json::JsonObject> get_json(std::wstring_view property_name);
json::JsonObject get_raw_json();

std::wstring serialize();
void save_to_settings_file();
Expand Down
5 changes: 4 additions & 1 deletion src/common/shared_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ namespace CommonSharedConstants

// Fake key code to represent VK_WIN.
inline const DWORD VK_WIN_BOTH = 0x104;
}

// Path to the event used by PowerLauncher
const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab";
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.PowerToys.Settings.UI.Lib.Interface;

namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class ColorPickerSettings : BasePTModuleSettings
public class ColorPickerSettings : BasePTModuleSettings, ISettingsConfig
{
public const string ModuleName = "ColorPicker";

Expand All @@ -21,15 +22,26 @@ public ColorPickerSettings()
Name = ModuleName;
}

public virtual void Save()
public virtual void Save(ISettingsUtils settingsUtils)
{
// Save settings to file
var options = new JsonSerializerOptions
{
WriteIndented = true,
};

SettingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
}

public string GetModuleName()
{
return Name;
}

// This can be utilized in the future if the settings.json file is to be modified/deleted.
public bool UpgradeSettingsConfiguration()
{
return false;
}
}
}
20 changes: 17 additions & 3 deletions src/core/Microsoft.PowerToys.Settings.UI.Lib/FancyZonesSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,33 @@
// See the LICENSE file in the project root for more information.

using System.Text.Json.Serialization;
using Microsoft.PowerToys.Settings.UI.Lib.Interface;

namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class FancyZonesSettings : BasePTModuleSettings
public class FancyZonesSettings : BasePTModuleSettings, ISettingsConfig
{
public const string ModuleName = "FancyZones";

public FancyZonesSettings()
{
Version = string.Empty;
Name = string.Empty;
Version = "1.0";
Name = ModuleName;
Properties = new FZConfigProperties();
}

[JsonPropertyName("properties")]
public FZConfigProperties Properties { get; set; }

public string GetModuleName()
{
return Name;
}

// This can be utilized in the future if the settings.json file is to be modified/deleted.
public bool UpgradeSettingsConfiguration()
{
return false;
}
}
}
32 changes: 31 additions & 1 deletion src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
// 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.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.PowerToys.Settings.UI.Lib.Interface;
using Microsoft.PowerToys.Settings.UI.Lib.Utilities;

namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class GeneralSettings
public class GeneralSettings : ISettingsConfig
{
// Gets or sets a value indicating whether packaged.
[JsonPropertyName("packaged")]
Expand Down Expand Up @@ -82,5 +85,32 @@ private string DefaultPowertoysVersion()
{
return interop.CommonManaged.GetProductVersion();
}

// This function is to implement the ISettingsConfig interface.
// This interface helps in getting the settings configurations.
public string GetModuleName()
{
// The SettingsUtils functions access general settings when the module name is an empty string.
return string.Empty;
}

public bool UpgradeSettingsConfiguration()
{
try
{
if (Helper.CompareVersions(PowertoysVersion, Helper.GetProductVersion()) < 0)
{
// Update settings
PowertoysVersion = Helper.GetProductVersion();
return true;
}
}
catch (FormatException)
{
// If there is an issue with the version number format, don't migrate settings.
}

return false;
}
}
}
20 changes: 20 additions & 0 deletions src/core/Microsoft.PowerToys.Settings.UI.Lib/ISettingsUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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 Microsoft.PowerToys.Settings.UI.Lib.Interface;

namespace Microsoft.PowerToys.Settings.UI.Lib
{
public interface ISettingsUtils
{
T GetSettings<T>(string powertoy = "", string fileName = "settings.json")
where T : ISettingsConfig, new();

void SaveSettings(string jsonSettings, string powertoy = "", string fileName = "settings.json");

bool SettingsExists(string powertoy = "", string fileName = "settings.json");

void DeleteSettings(string powertoy = "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.PowerToys.Settings.UI.Lib.Interface;

namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class ImageResizerSettings : BasePTModuleSettings
public class ImageResizerSettings : BasePTModuleSettings, ISettingsConfig
{
public const string ModuleName = "Image Resizer";

Expand All @@ -29,5 +30,16 @@ public override string ToJsonString()
};
return JsonSerializer.Serialize(this, options);
}

public string GetModuleName()
{
return Name;
}

// This can be utilized in the future if the settings.json file is to be modified/deleted.
public bool UpgradeSettingsConfiguration()
{
return false;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 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.

namespace Microsoft.PowerToys.Settings.UI.Lib.Interface
{
// Common interface to be implemented by all the objects which get and store settings properties.
public interface ISettingsConfig
{
string ToJsonString();

string GetModuleName();

bool UpgradeSettingsConfiguration();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// 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.

namespace Microsoft.PowerToys.Settings.UI.Lib.Interface
{
public interface ISettingsRepository<T>
{
T SettingsConfig { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
// 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;
using System.Text.Json.Serialization;
using Microsoft.PowerToys.Settings.UI.Lib.Interface;

namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class KeyboardManagerProfile
public class KeyboardManagerProfile : ISettingsConfig
{
[JsonPropertyName("remapKeys")]
public RemapKeysDataModel RemapKeys { get; set; }
Expand All @@ -19,5 +21,21 @@ public KeyboardManagerProfile()
RemapKeys = new RemapKeysDataModel();
RemapShortcuts = new ShortcutsKeyDataModel();
}

public string ToJsonString()
{
return JsonSerializer.Serialize(this);
}

public string GetModuleName()
{
return KeyboardManagerSettings.ModuleName;
}

// This can be utilized in the future if the default.json file is to be modified/deleted.
public bool UpgradeSettingsConfiguration()
{
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,33 @@
// See the LICENSE file in the project root for more information.

using System.Text.Json.Serialization;
using Microsoft.PowerToys.Settings.UI.Lib.Interface;

namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class KeyboardManagerSettings : BasePTModuleSettings
public class KeyboardManagerSettings : BasePTModuleSettings, ISettingsConfig
{
public const string ModuleName = "Keyboard Manager";

[JsonPropertyName("properties")]
public KeyboardManagerProperties Properties { get; set; }

public KeyboardManagerSettings()
{
Properties = new KeyboardManagerProperties();
Version = "1";
Name = "_unset_";
Name = ModuleName;
}

public KeyboardManagerSettings(string ptName)
public string GetModuleName()
{
Properties = new KeyboardManagerProperties();
Version = "1";
Name = ptName;
return Name;
}

// This can be utilized in the future if the settings.json file is to be modified/deleted.
public bool UpgradeSettingsConfiguration()
{
return false;
}
}
}
6 changes: 6 additions & 0 deletions src/core/Microsoft.PowerToys.Settings.UI.Lib/KeysDataModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.PowerToys.Settings.UI.Lib.Utilities;

Expand Down Expand Up @@ -35,5 +36,10 @@ public List<string> GetNewRemapKeys()
{
return MapKeys(NewRemapKeys);
}

public string ToJsonString()
{
return JsonSerializer.Serialize(this);
}
}
}
Loading

0 comments on commit 3062a47

Please sign in to comment.