Skip to content

Commit

Permalink
Added new features.
Browse files Browse the repository at this point in the history
  • Loading branch information
oddbear committed Sep 25, 2022
1 parent 327d927 commit 7cca7fb
Show file tree
Hide file tree
Showing 20 changed files with 466 additions and 4 deletions.
48 changes: 48 additions & 0 deletions PowerToysPlugin/Commands/MeasureTool/MeasureToolCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Loupedeck.PowerToysPlugin.Models.MeasureTool;
using Loupedeck.PowerToysPlugin.Services;

namespace Loupedeck.PowerToysPlugin.Commands.MeasureTool
{
//TODO: Icons
class MeasureToolCommand : PluginDynamicCommand
{
private PowerToysPlugin _plugin;
private MeasureToolService _service;
private MeasureToolSettings _currentSettings;

public MeasureToolCommand()
: base("Enable Screen Ruler",
"Enable Screen Ruler",
"MeasureTool")
{
//
}

protected override bool OnLoad()
{
_plugin = base.Plugin as PowerToysPlugin;
if (_plugin is null)
return false;

_service = _plugin.MeasureToolService;
if (_service is null)
return false;

_currentSettings = _service.GetSettings();
_service.SettingsUpdated += ServiceOnSettingsUpdated;

return true;
}

private void ServiceOnSettingsUpdated(object sender, MeasureToolSettings e)
{
_currentSettings = e;
base.ActionImageChanged();
}

protected override void RunCommand(string actionParameter)
{
_service.Activate();
}
}
}
48 changes: 48 additions & 0 deletions PowerToysPlugin/Commands/TextExtractor/TextExtractorCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Loupedeck.PowerToysPlugin.Models.TextExtractor;
using Loupedeck.PowerToysPlugin.Services;

namespace Loupedeck.PowerToysPlugin.Commands.TextExtractor
{
//TODO: Icons
class TextExtractorCommand : PluginDynamicCommand
{
private PowerToysPlugin _plugin;
private TextExtractorService _service;
private TextExtractorSettings _currentSettings;

public TextExtractorCommand()
: base("Enable Text Extractor",
"Enable Text Extractor",
"TextExtractor")
{
//
}

protected override bool OnLoad()
{
_plugin = base.Plugin as PowerToysPlugin;
if (_plugin is null)
return false;

_service = _plugin.TextExtractorService;
if (_service is null)
return false;

_currentSettings = _service.GetSettings();
_service.SettingsUpdated += ServiceOnSettingsUpdated;

return true;
}

private void ServiceOnSettingsUpdated(object sender, TextExtractorSettings e)
{
_currentSettings = e;
base.ActionImageChanged();
}

protected override void RunCommand(string actionParameter)
{
_service.Activate();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Loupedeck.PowerToysPlugin.Models.VideoConference;
using Loupedeck.PowerToysPlugin.Services;

namespace Loupedeck.PowerToysPlugin.Commands.VideoConference
{
//TODO: Icons
//TODO: Does not work
class MuteCameraAndMicrophoneCommand : PluginDynamicCommand
{
private PowerToysPlugin _plugin;
private VideoConferenceService _service;
private VideoConferenceSettings _currentSettings;

public MuteCameraAndMicrophoneCommand()
: base("Toggle Mute Camera & Microphone",
"Toggles Mute Camera & Microphone",
"VideoConference")
{
//
}

protected override bool OnLoad()
{
_plugin = base.Plugin as PowerToysPlugin;
if (_plugin is null)
return false;

_service = _plugin.VideoConferenceService;
if (_service is null)
return false;

_currentSettings = _service.GetSettings();
_service.SettingsUpdated += ServiceOnSettingsUpdated;

return true;
}

private void ServiceOnSettingsUpdated(object sender, VideoConferenceSettings e)
{
_currentSettings = e;
base.ActionImageChanged();
}

protected override void RunCommand(string actionParameter)
{
_service.Activate(MuteOptions.CameraMicrophone);
}
}
}
49 changes: 49 additions & 0 deletions PowerToysPlugin/Commands/VideoConference/MuteCameraCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Loupedeck.PowerToysPlugin.Models.VideoConference;
using Loupedeck.PowerToysPlugin.Services;

namespace Loupedeck.PowerToysPlugin.Commands.VideoConference
{
//TODO: Icons
//TODO: Does not work
class MuteCameraCommand : PluginDynamicCommand
{
private PowerToysPlugin _plugin;
private VideoConferenceService _service;
private VideoConferenceSettings _currentSettings;

public MuteCameraCommand()
: base("Toggle Mute Camera",
"Toggles Mute Camera",
"VideoConference")
{
//
}

protected override bool OnLoad()
{
_plugin = base.Plugin as PowerToysPlugin;
if (_plugin is null)
return false;

_service = _plugin.VideoConferenceService;
if (_service is null)
return false;

_currentSettings = _service.GetSettings();
_service.SettingsUpdated += ServiceOnSettingsUpdated;

return true;
}

private void ServiceOnSettingsUpdated(object sender, VideoConferenceSettings e)
{
_currentSettings = e;
base.ActionImageChanged();
}

protected override void RunCommand(string actionParameter)
{
_service.Activate(MuteOptions.Camera);
}
}
}
48 changes: 48 additions & 0 deletions PowerToysPlugin/Commands/VideoConference/MuteMicrophoneCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Loupedeck.PowerToysPlugin.Models.VideoConference;
using Loupedeck.PowerToysPlugin.Services;

namespace Loupedeck.PowerToysPlugin.Commands.VideoConference
{
//TODO: Icons
class MuteMicrophoneCommand : PluginDynamicCommand
{
private PowerToysPlugin _plugin;
private VideoConferenceService _service;
private VideoConferenceSettings _currentSettings;

public MuteMicrophoneCommand()
: base("Toggle Mute Microphone",
"Toggles Mute Microphone",
"VideoConference")
{
//
}

protected override bool OnLoad()
{
_plugin = base.Plugin as PowerToysPlugin;
if (_plugin is null)
return false;

_service = _plugin.VideoConferenceService;
if (_service is null)
return false;

_currentSettings = _service.GetSettings();
_service.SettingsUpdated += ServiceOnSettingsUpdated;

return true;
}

private void ServiceOnSettingsUpdated(object sender, VideoConferenceSettings e)
{
_currentSettings = e;
base.ActionImageChanged();
}

protected override void RunCommand(string actionParameter)
{
_service.Activate(MuteOptions.Microphone);
}
}
}
2 changes: 0 additions & 2 deletions PowerToysPlugin/Models/Awake/AwakeSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ public class AwakeSettings
[JsonProperty("version")]
public string Version { get; set; }
}


}
25 changes: 25 additions & 0 deletions PowerToysPlugin/Models/MeasureTool/ActivationShortcut.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Newtonsoft.Json;

namespace Loupedeck.PowerToysPlugin.Models.MeasureTool
{
public class ActivationShortcut : IKeyboardShortcut
{
[JsonProperty("win")]
public bool Win { get; set; }

[JsonProperty("ctrl")]
public bool Ctrl { get; set; }

[JsonProperty("alt")]
public bool Alt { get; set; }

[JsonProperty("shift")]
public bool Shift { get; set; }

[JsonProperty("code")]
public int Code { get; set; }

[JsonProperty("key")]
public string Key { get; set; }
}
}
10 changes: 10 additions & 0 deletions PowerToysPlugin/Models/MeasureTool/BoolValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace Loupedeck.PowerToysPlugin.Models.MeasureTool
{
public class BoolValue
{
[JsonProperty("value")]
public bool Value { get; set; }
}
}
10 changes: 10 additions & 0 deletions PowerToysPlugin/Models/MeasureTool/IntValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace Loupedeck.PowerToysPlugin.Models.MeasureTool
{
public class IntValue
{
[JsonProperty("value")]
public int Value { get; set; }
}
}
16 changes: 16 additions & 0 deletions PowerToysPlugin/Models/MeasureTool/MeasureToolSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Newtonsoft.Json;

namespace Loupedeck.PowerToysPlugin.Models.MeasureTool
{
public class MeasureToolSettings
{
[JsonProperty("properties")]
public Properties Properties { get; set; }

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("version")]
public string Version { get; set; }
}
}
28 changes: 28 additions & 0 deletions PowerToysPlugin/Models/MeasureTool/Properties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Newtonsoft.Json;

namespace Loupedeck.PowerToysPlugin.Models.MeasureTool
{
public class Properties
{
[JsonProperty("ActivationShortcut")]
public ActivationShortcut ActivationShortcut { get; set; }

[JsonProperty("ContinuousCapture")]
public BoolValue ContinuousCapture { get; set; }

[JsonProperty("DrawFeetOnCross")]
public BoolValue DrawFeetOnCross { get; set; }

[JsonProperty("PerColorChannelEdgeDetection")]
public BoolValue PerColorChannelEdgeDetection { get; set; }

[JsonProperty("UnitsOfMeasure")]
public IntValue UnitsOfMeasure { get; set; }

[JsonProperty("PixelTolerance")]
public IntValue PixelTolerance { get; set; }

[JsonProperty("MeasureCrossColor")]
public StringValue MeasureCrossColor { get; set; }
}
}
10 changes: 10 additions & 0 deletions PowerToysPlugin/Models/MeasureTool/StringValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace Loupedeck.PowerToysPlugin.Models.MeasureTool
{
public class StringValue
{
[JsonProperty("value")]
public string Value { get; set; }
}
}
25 changes: 25 additions & 0 deletions PowerToysPlugin/Models/TextExtractor/ActivationShortcut.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Newtonsoft.Json;

namespace Loupedeck.PowerToysPlugin.Models.TextExtractor
{
public class ActivationShortcut : IKeyboardShortcut
{
[JsonProperty("win")]
public bool Win { get; set; }

[JsonProperty("ctrl")]
public bool Ctrl { get; set; }

[JsonProperty("alt")]
public bool Alt { get; set; }

[JsonProperty("shift")]
public bool Shift { get; set; }

[JsonProperty("code")]
public int Code { get; set; }

[JsonProperty("key")]
public string Key { get; set; }
}
}
Loading

0 comments on commit 7cca7fb

Please sign in to comment.