Hide Video Conferencing when muted (#19175)

This commit is contained in:
akabhirav
2022-10-19 14:48:58 +05:30
committed by GitHub
parent 16c28c788d
commit 1cfce6182d
9 changed files with 134 additions and 32 deletions

View File

@@ -43,8 +43,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Key = "O",
Code = 79,
});
this.HideToolbarWhenUnmuted = new BoolProperty(true);
}
[JsonPropertyName("mute_camera_and_microphone_hotkey")]
@@ -74,8 +72,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("theme")]
public StringProperty Theme { get; set; }
[JsonPropertyName("hide_toolbar_when_unmuted")]
public BoolProperty HideToolbarWhenUnmuted { get; set; }
[JsonPropertyName("toolbar_hide")]
public StringProperty ToolbarHide { get; set; } = "Never";
// converts the current to a json string.
public string ToJsonString()

View File

@@ -12,6 +12,7 @@ using System.Threading.Tasks;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
namespace Microsoft.PowerToys.Settings.UI.ViewModels
@@ -98,8 +99,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
SelectOverlayImage = new ButtonClickCommand(SelectOverlayImageAction);
ClearOverlayImage = new ButtonClickCommand(ClearOverlayImageAction);
_hideToolbarWhenUnmuted = Settings.Properties.HideToolbarWhenUnmuted.Value;
switch (Settings.Properties.ToolbarPosition.Value)
{
case "Top left corner":
@@ -133,6 +132,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
break;
}
switch (Settings.Properties.ToolbarHide.Value)
{
case "Never":
_toolbarHideIndex = 0;
break;
case "When both camera and microphone are unmuted":
_toolbarHideIndex = 1;
break;
case "When both camera and microphone are muted":
_toolbarHideIndex = 2;
break;
}
if (shouldSaveSettings)
{
_settingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName);
@@ -142,12 +154,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private bool _isEnabled;
private int _toolbarPositionIndex;
private int _toolbarMonitorIndex;
private int _toolbarHideIndex;
private HotkeySettings _cameraAndMicrophoneMuteHotkey;
private HotkeySettings _microphoneMuteHotkey;
private HotkeySettings _cameraMuteHotkey;
private int _selectedCameraIndex = -1;
private int _selectedMicrophoneIndex;
private bool _hideToolbarWhenUnmuted;
public List<string> CameraNames { get; }
@@ -380,20 +392,32 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool HideToolbarWhenUnmuted
public int ToolbarHideIndex
{
get
{
return _hideToolbarWhenUnmuted;
return _toolbarHideIndex;
}
set
{
if (value != _hideToolbarWhenUnmuted)
if (value != _toolbarHideIndex)
{
_hideToolbarWhenUnmuted = value;
Settings.Properties.HideToolbarWhenUnmuted.Value = value;
RaisePropertyChanged(nameof(HideToolbarWhenUnmuted));
_toolbarHideIndex = value;
switch (_toolbarHideIndex)
{
case 0:
Settings.Properties.ToolbarHide.Value = "Never";
break;
case 1:
Settings.Properties.ToolbarHide.Value = "When both camera and microphone are unmuted";
break;
case 2:
Settings.Properties.ToolbarHide.Value = "When both camera and microphone are muted";
break;
}
RaisePropertyChanged(nameof(ToolbarHideIndex));
}
}
}

View File

@@ -1 +1,42 @@
{"version":"1.0","name":"Video Conference","properties":{"mute_camera_and_microphone_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":73,"key":""}},"mute_microphone_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":68,"key":""}},"mute_camera_hotkey":{"value":{"win":false,"ctrl":false,"alt":false,"shift":true,"code":86,"key":""}},"selected_camera":{"value":"USB Video Device"},"toolbar_position":{"value":"Bottom center"},"toolbar_monitor":{"value":"All monitors"},"camera_overlay_image_path":{"value":""},"theme":{"value":"light"},"hide_toolbar_when_unmuted":{"value":false}}}
{
"version": "1.0",
"name": "Video Conference",
"properties": {
"camera_overlay_image_path": { "value": "" },
"toolbar_hide": { "value": "Never" },
"mute_camera_and_microphone_hotkey": {
"value": {
"win": false,
"ctrl": false,
"alt": false,
"shift": true,
"code": 73,
"key": ""
}
},
"mute_camera_hotkey": {
"value": {
"win": false,
"ctrl": false,
"alt": false,
"shift": true,
"code": 86,
"key": ""
}
},
"mute_microphone_hotkey": {
"value": {
"win": false,
"ctrl": false,
"alt": false,
"shift": true,
"code": 68,
"key": ""
}
},
"selected_camera": { "value": "USB Video Device" },
"theme": { "value": "light" },
"toolbar_monitor": { "value": "All monitors" },
"toolbar_position": { "value": "Bottom center" }
}
}

View File

@@ -255,8 +255,17 @@
<data name="VideoConference_ToolbarMonitor_All.Content" xml:space="preserve">
<value>All monitors</value>
</data>
<data name="VideoConference_HideToolbarWhenUnmuted.Content" xml:space="preserve">
<value>Hide toolbar when both camera and microphone are unmuted</value>
<data name="VideoConference_ToolbarHide.Header" xml:space="preserve">
<value>Hide toolbar</value>
</data>
<data name="VideoConference_ToolbarHideMuted.Content" xml:space="preserve">
<value>When both camera and microphone are muted</value>
</data>
<data name="VideoConference_ToolbarHideNever.Content" xml:space="preserve">
<value>Never</value>
</data>
<data name="VideoConference_ToolbarHideUnmuted.Content" xml:space="preserve">
<value>When both camera and microphone are unmuted</value>
</data>
<data name="VideoConference.ModuleTitle" xml:space="preserve">
<value>Video Conference Mute</value>

View File

@@ -145,8 +145,15 @@
</controls:Setting.ActionContent>
</controls:Setting>
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<CheckBox x:Uid="VideoConference_HideToolbarWhenUnmuted" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.HideToolbarWhenUnmuted}" Margin="{StaticResource ExpanderSettingMargin}" />
<controls:Setting x:Uid="VideoConference_ToolbarHide" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{ Binding Mode=TwoWay, Path=ToolbarHideIndex}">
<ComboBoxItem x:Uid="VideoConference_ToolbarHideNever"/>
<ComboBoxItem x:Uid="VideoConference_ToolbarHideUnmuted"/>
<ComboBoxItem x:Uid="VideoConference_ToolbarHideMuted"/>
</ComboBox>
</controls:Setting.ActionContent>
</controls:Setting>
</StackPanel>
</controls:SettingExpander.Content>
</controls:SettingExpander>