mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[VCM]Deprecate the Video Conference Mute utility (#36772)
* Remove all VideoConferenceMute related code and files * Clean up vcm driver registry keys * Also remove the Webcam report tool * Also clean out video conference on the installer * Fix spellcheck * Remove comment about video conf * Update gpo files revision * Revert removing the VCM policies * Deprecate VCM GPO policy * Change deprecation message to show first supported version * Tweak supported strings in the adml
This commit is contained in:
@@ -88,22 +88,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
}
|
||||
}
|
||||
|
||||
private bool videoConference; // defaulting to off https://github.com/microsoft/PowerToys/issues/14507
|
||||
|
||||
[JsonPropertyName("Video Conference")]
|
||||
public bool VideoConference
|
||||
{
|
||||
get => this.videoConference;
|
||||
set
|
||||
{
|
||||
if (this.videoConference != value)
|
||||
{
|
||||
LogTelemetryEvent(value);
|
||||
this.videoConference = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool powerRename = true;
|
||||
|
||||
public bool PowerRename
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
// 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;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class SndVideoConferenceSettings
|
||||
{
|
||||
[JsonPropertyName("Video Conference")]
|
||||
public VideoConferenceSettings VideoConference { get; set; }
|
||||
|
||||
public SndVideoConferenceSettings(VideoConferenceSettings settings)
|
||||
{
|
||||
VideoConference = settings;
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
// 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;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using Settings.UI.Library.Attributes;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class VideoConferenceConfigProperties
|
||||
{
|
||||
[CmdConfigureIgnoreAttribute]
|
||||
public HotkeySettings DefaultMuteCameraAndMicrophoneHotkey => new HotkeySettings()
|
||||
{
|
||||
Win = true,
|
||||
Ctrl = false,
|
||||
Alt = false,
|
||||
Shift = true,
|
||||
Key = "Q",
|
||||
Code = 81,
|
||||
};
|
||||
|
||||
[CmdConfigureIgnoreAttribute]
|
||||
public HotkeySettings DefaultMuteMicrophoneHotkey => new HotkeySettings()
|
||||
{
|
||||
Win = true,
|
||||
Ctrl = false,
|
||||
Alt = false,
|
||||
Shift = true,
|
||||
Key = "A",
|
||||
Code = 65,
|
||||
};
|
||||
|
||||
[CmdConfigureIgnoreAttribute]
|
||||
public HotkeySettings DefaultPushToTalkMicrophoneHotkey => new HotkeySettings()
|
||||
{
|
||||
Win = true,
|
||||
Ctrl = false,
|
||||
Alt = false,
|
||||
Shift = true,
|
||||
Key = "I",
|
||||
Code = 73,
|
||||
};
|
||||
|
||||
[CmdConfigureIgnoreAttribute]
|
||||
public HotkeySettings DefaultMuteCameraHotkey => new HotkeySettings()
|
||||
{
|
||||
Win = true,
|
||||
Ctrl = false,
|
||||
Alt = false,
|
||||
Shift = true,
|
||||
Key = "O",
|
||||
Code = 79,
|
||||
};
|
||||
|
||||
public VideoConferenceConfigProperties()
|
||||
{
|
||||
MuteCameraAndMicrophoneHotkey = new KeyboardKeysProperty(DefaultMuteCameraAndMicrophoneHotkey);
|
||||
MuteMicrophoneHotkey = new KeyboardKeysProperty(DefaultMuteMicrophoneHotkey);
|
||||
PushToTalkMicrophoneHotkey = new KeyboardKeysProperty(DefaultPushToTalkMicrophoneHotkey);
|
||||
MuteCameraHotkey = new KeyboardKeysProperty(DefaultMuteCameraHotkey);
|
||||
|
||||
PushToReverseEnabled = new BoolProperty(false);
|
||||
}
|
||||
|
||||
[JsonPropertyName("mute_camera_and_microphone_hotkey")]
|
||||
public KeyboardKeysProperty MuteCameraAndMicrophoneHotkey { get; set; }
|
||||
|
||||
[JsonPropertyName("mute_microphone_hotkey")]
|
||||
public KeyboardKeysProperty MuteMicrophoneHotkey { get; set; }
|
||||
|
||||
[JsonPropertyName("push_to_talk_microphone_hotkey")]
|
||||
public KeyboardKeysProperty PushToTalkMicrophoneHotkey { get; set; }
|
||||
|
||||
[JsonPropertyName("push_to_reverse_enabled")]
|
||||
public BoolProperty PushToReverseEnabled { get; set; }
|
||||
|
||||
[JsonPropertyName("mute_camera_hotkey")]
|
||||
public KeyboardKeysProperty MuteCameraHotkey { get; set; }
|
||||
|
||||
[JsonPropertyName("selected_camera")]
|
||||
public StringProperty SelectedCamera { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("selected_mic")]
|
||||
public StringProperty SelectedMicrophone { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("toolbar_position")]
|
||||
public StringProperty ToolbarPosition { get; set; } = "Top right corner";
|
||||
|
||||
[JsonPropertyName("toolbar_monitor")]
|
||||
public StringProperty ToolbarMonitor { get; set; } = "Main monitor";
|
||||
|
||||
[JsonPropertyName("camera_overlay_image_path")]
|
||||
public StringProperty CameraOverlayImagePath { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("theme")]
|
||||
public StringProperty Theme { get; set; }
|
||||
|
||||
[JsonPropertyName("toolbar_hide")]
|
||||
public StringProperty ToolbarHide { get; set; } = "When both camera and microphone are unmuted";
|
||||
|
||||
[JsonPropertyName("startup_action")]
|
||||
public StringProperty StartupAction { get; set; } = "Nothing";
|
||||
|
||||
// converts the current to a json string.
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
// 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;
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class VideoConferenceSettings : BasePTModuleSettings, ISettingsConfig
|
||||
{
|
||||
public const string ModuleName = "Video Conference";
|
||||
|
||||
public VideoConferenceSettings()
|
||||
{
|
||||
Version = "1";
|
||||
Name = ModuleName;
|
||||
Properties = new VideoConferenceConfigProperties();
|
||||
}
|
||||
|
||||
[JsonPropertyName("properties")]
|
||||
public VideoConferenceConfigProperties Properties { get; set; }
|
||||
|
||||
public string GetModuleName()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// 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;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class VideoConferenceSettingsIPCMessage
|
||||
{
|
||||
[JsonPropertyName("powertoys")]
|
||||
public SndVideoConferenceSettings Powertoys { get; set; }
|
||||
|
||||
public VideoConferenceSettingsIPCMessage()
|
||||
{
|
||||
}
|
||||
|
||||
public VideoConferenceSettingsIPCMessage(SndVideoConferenceSettings settings)
|
||||
{
|
||||
this.Powertoys = settings;
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 56 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 54 KiB |
@@ -27,7 +27,6 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
|
||||
QuickAccent,
|
||||
ShortcutGuide,
|
||||
TextExtractor,
|
||||
VideoConference,
|
||||
MeasureTool,
|
||||
Hosts,
|
||||
Workspaces,
|
||||
|
||||
@@ -440,7 +440,6 @@ namespace Microsoft.PowerToys.Settings.UI
|
||||
case "FileExplorer": return typeof(PowerPreviewPage);
|
||||
case "ShortcutGuide": return typeof(ShortcutGuidePage);
|
||||
case "PowerOcr": return typeof(PowerOcrPage);
|
||||
case "VideoConference": return typeof(VideoConferencePage);
|
||||
case "MeasureTool": return typeof(MeasureToolPage);
|
||||
case "Hosts": return typeof(HostsPage);
|
||||
case "RegistryPreview": return typeof(RegistryPreviewPage);
|
||||
|
||||
@@ -157,10 +157,6 @@
|
||||
x:Uid="Shell_TextExtractor"
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/TextExtractor.png}"
|
||||
Tag="TextExtractor" />
|
||||
<NavigationViewItem
|
||||
x:Uid="Shell_VideoConference"
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/VideoConferenceMute.png}"
|
||||
Tag="VideoConference" />
|
||||
<NavigationViewItem
|
||||
x:Uid="Shell_Workspaces"
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Workspaces.png}"
|
||||
|
||||
@@ -174,12 +174,6 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
IsNew = false,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.VideoConference, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "VideoConference",
|
||||
IsNew = false,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.MeasureTool, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "MeasureTool",
|
||||
@@ -286,7 +280,6 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
case "FileExplorer": NavigationFrame.Navigate(typeof(OobeFileExplorer)); break;
|
||||
case "ShortcutGuide": NavigationFrame.Navigate(typeof(OobeShortcutGuide)); break;
|
||||
case "TextExtractor": NavigationFrame.Navigate(typeof(OobePowerOCR)); break;
|
||||
case "VideoConference": NavigationFrame.Navigate(typeof(OobeVideoConference)); break;
|
||||
case "MouseUtils": NavigationFrame.Navigate(typeof(OobeMouseUtils)); break;
|
||||
case "MouseWithoutBorders": NavigationFrame.Navigate(typeof(OobeMouseWithoutBorders)); break;
|
||||
case "MeasureTool": NavigationFrame.Navigate(typeof(OobeMeasureTool)); break;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeVideoConference"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tk7controls="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<controls:OOBEPageControl x:Uid="Oobe_VideoConference" HeroImage="ms-appx:///Assets/Settings/Modules/OOBE/VideoConferenceMute.png">
|
||||
<controls:OOBEPageControl.PageContent>
|
||||
<StackPanel Orientation="Vertical" Spacing="12">
|
||||
<TextBlock x:Uid="Oobe_HowToLaunch" Style="{ThemeResource OobeSubtitleStyle}" />
|
||||
|
||||
<StackPanel>
|
||||
<controls:ShortcutWithTextLabelControl x:Name="HotkeyMicVidControl" x:Uid="Oobe_VideoConference_ToggleMicVid" />
|
||||
<controls:ShortcutWithTextLabelControl x:Name="HotkeyMicControl" x:Uid="Oobe_VideoConference_ToggleMic" />
|
||||
<controls:ShortcutWithTextLabelControl x:Name="HotkeyPushToTalkControl" x:Uid="Oobe_VideoConference_PushToTalkMic" />
|
||||
<controls:ShortcutWithTextLabelControl x:Name="HotkeyVidControl" x:Uid="Oobe_VideoConference_ToggleVid" />
|
||||
</StackPanel>
|
||||
|
||||
<tk7controls:MarkdownTextBlock x:Uid="Oobe_VideoConference_HowToLaunch" Background="Transparent" />
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
|
||||
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_VideoConference" Style="{StaticResource TextButtonStyle}">
|
||||
<TextBlock x:Uid="LearnMore_VCM" TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</controls:OOBEPageControl.PageContent>
|
||||
</controls:OOBEPageControl>
|
||||
</Page>
|
||||
@@ -1,52 +0,0 @@
|
||||
// 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.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeVideoConference : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeVideoConference()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.VideoConference]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(VideoConferencePage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
HotkeyMicVidControl.Keys = SettingsRepository<VideoConferenceSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.MuteCameraAndMicrophoneHotkey.Value.GetKeysList();
|
||||
HotkeyMicControl.Keys = SettingsRepository<VideoConferenceSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.MuteMicrophoneHotkey.Value.GetKeysList();
|
||||
HotkeyPushToTalkControl.Keys = SettingsRepository<VideoConferenceSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.PushToTalkMicrophoneHotkey.Value.GetKeysList();
|
||||
HotkeyVidControl.Keys = SettingsRepository<VideoConferenceSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.MuteCameraHotkey.Value.GetKeysList();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,12 +191,6 @@
|
||||
x:Uid="Shell_QuickAccent"
|
||||
helpers:NavHelper.NavigateTo="views:PowerAccentPage"
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/QuickAccent.png}" />
|
||||
<!-- Mouse pointer cross hair -->
|
||||
<NavigationViewItem
|
||||
x:Uid="Shell_VideoConference"
|
||||
helpers:NavHelper.NavigateTo="views:VideoConferencePage"
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/VideoConferenceMute.png}"
|
||||
IsEnabled="{x:Bind ViewModel.IsVideoConferenceBuild, Mode=OneWay}" />
|
||||
</NavigationViewItem.MenuItems>
|
||||
</NavigationViewItem>
|
||||
|
||||
|
||||
@@ -1,171 +0,0 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.VideoConferencePage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<tkconverters:StringVisibilityConverter
|
||||
x:Name="EmptyToCollapsedConverter"
|
||||
EmptyValue="Collapsed"
|
||||
NotEmptyValue="Visible" />
|
||||
<tkconverters:StringVisibilityConverter
|
||||
x:Name="EmptyToBoolConverter"
|
||||
EmptyValue="False"
|
||||
NotEmptyValue="True" />
|
||||
</Page.Resources>
|
||||
|
||||
<controls:SettingsPageControl x:Uid="VideoConference" ModuleImageSource="ms-appx:///Assets/Settings/Modules/VideoConference.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical">
|
||||
<InfoBar
|
||||
x:Uid="VideoConference_DeprecationWarning"
|
||||
IsClosable="False"
|
||||
IsOpen="True"
|
||||
IsTabStop="True"
|
||||
Severity="Informational">
|
||||
<InfoBar.ActionButton>
|
||||
<HyperlinkButton
|
||||
x:Uid="VideoConference_DeprecationWarningButton"
|
||||
HorizontalAlignment="Right"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/issues/21473"
|
||||
Style="{StaticResource TextButtonStyle}" />
|
||||
</InfoBar.ActionButton>
|
||||
</InfoBar>
|
||||
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="VideoConference_Enable"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/VideoConferenceMute.png}"
|
||||
IsEnabled="{x:Bind ViewModel.IsElevated, Mode=OneWay}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="VideoConference_RunAsAdminRequired"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.IsElevated, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
|
||||
IsTabStop="True"
|
||||
Severity="Informational" />
|
||||
<InfoBar
|
||||
x:Uid="GPO_SettingIsManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay}"
|
||||
IsTabStop="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay}"
|
||||
Severity="Informational" />
|
||||
<controls:SettingsGroup x:Uid="VideoConference_Shortcuts" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_CameraAndMicrophoneMuteHotkeyControl_Header">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind ViewModel.CameraAndMicrophoneMuteHotkey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_MicrophoneMuteHotkeyControl_Header">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind ViewModel.MicrophoneMuteHotkey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_MicrophonePushToTalkHotkeyControl_Header">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind ViewModel.MicrophonePushToTalkHotkey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_CameraMuteHotkeyControl_Header">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind ViewModel.CameraMuteHotkey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="VideoConference_Microphone" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_SelectedMicrophone" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
ItemsSource="{x:Bind ViewModel.MicrophoneNames, Mode=OneTime}"
|
||||
SelectedIndex="{x:Bind ViewModel.SelectedMicrophoneIndex, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_PushToReverse">
|
||||
<ToggleSwitch x:Uid="PushToReverseSwitch" IsOn="{x:Bind ViewModel.PushToReverseEnabled, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="VideoConference_Camera" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsExpander
|
||||
x:Uid="VideoConference_SelectedCamera"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsExpanded="True">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}"
|
||||
ItemsSource="{x:Bind ViewModel.CameraNames, Mode=OneTime}"
|
||||
SelectedIndex="{x:Bind ViewModel.SelectedCameraIndex, Mode=TwoWay}" />
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_CameraOverlayImagePathHeader">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Button x:Uid="VideoConference_CameraOverlayImageBrowse" Command="{x:Bind ViewModel.SelectOverlayImage, Mode=OneWay}" />
|
||||
<Button
|
||||
x:Uid="VideoConference_CameraOverlayImageClear"
|
||||
Command="{x:Bind ViewModel.ClearOverlayImage, Mode=OneWay}"
|
||||
IsEnabled="{x:Bind ViewModel.CameraImageOverlayPath, Mode=OneWay, Converter={StaticResource EmptyToBoolConverter}}" />
|
||||
</StackPanel>
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard Visibility="{x:Bind ViewModel.CameraImageOverlayPath, Mode=OneWay, Converter={StaticResource EmptyToCollapsedConverter}}">
|
||||
<Border
|
||||
MaxHeight="100"
|
||||
HorizontalAlignment="Right"
|
||||
CornerRadius="4">
|
||||
<Image
|
||||
x:Uid="VideoConference_CameraOverlayImageAlt"
|
||||
Source="{Binding Mode=OneWay, Path=CameraImageOverlayPath}"
|
||||
ToolTipService.ToolTip="{x:Bind ViewModel.CameraImageOverlayPath, Mode=OneWay}" />
|
||||
</Border>
|
||||
</tkcontrols:SettingsCard>
|
||||
</tkcontrols:SettingsExpander.Items>
|
||||
</tkcontrols:SettingsExpander>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="VideoConference_Toolbar" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsExpander x:Uid="VideoConference_ToolbarPosition" IsExpanded="True">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.ToolbarPositionIndex, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarPosition_TopLeftCorner" />
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarPosition_TopCenter" />
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarPosition_TopRightCorner" />
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarPosition_BottomLeftCorner" />
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarPosition_BottomCenter" />
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarPosition_BottomRightCorner" />
|
||||
</ComboBox>
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_ToolbarMonitor">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.ToolbarMonitorIndex, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarMonitor_Main" />
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarMonitor_All" />
|
||||
</ComboBox>
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_ToolbarHide">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.ToolbarHideIndex, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarHideNever" />
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarHideUnmuted" />
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarHideMuted" />
|
||||
<ComboBoxItem x:Uid="VideoConference_ToolbarHideTimeout" />
|
||||
</ComboBox>
|
||||
</tkcontrols:SettingsCard>
|
||||
</tkcontrols:SettingsExpander.Items>
|
||||
</tkcontrols:SettingsExpander>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="VideoConference_Behavior" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="VideoConference_StartupAction">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.StartupActionIndex, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="VideoConference_StartupActionNothing" />
|
||||
<ComboBoxItem x:Uid="VideoConference_StartupActionUnmute" />
|
||||
<ComboBoxItem x:Uid="VideoConference_StartupActionMute" />
|
||||
</ComboBox>
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
<controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:PageLink x:Uid="LearnMore_VCM" Link="https://aka.ms/PowerToysOverview_VideoConference" />
|
||||
</controls:SettingsPageControl.PrimaryLinks>
|
||||
</controls:SettingsPageControl>
|
||||
</Page>
|
||||
@@ -1,65 +0,0 @@
|
||||
// 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;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class VideoConferencePage : Page, IRefreshablePage
|
||||
{
|
||||
private VideoConferenceViewModel ViewModel { get; set; }
|
||||
|
||||
private static string PickFileDialog()
|
||||
{
|
||||
// this code was changed to solve the problem with WinUI3 that prevents to select a file
|
||||
// while running elevated, when the issue is solved in WinUI3 it should be changed back
|
||||
OpenFileName openFileName = new OpenFileName();
|
||||
openFileName.StructSize = Marshal.SizeOf(openFileName);
|
||||
openFileName.Filter = "Images(*.jpg,*.jpeg,*.png)\0*.jpg;*.jpeg;*.png\0";
|
||||
|
||||
// make buffer 65k bytes big as the MAX_PATH can be ~32k chars if long path is enable
|
||||
// and unicode uses 2 bytes per character
|
||||
openFileName.File = new string(new char[65000]);
|
||||
openFileName.MaxFile = openFileName.File.Length;
|
||||
openFileName.FileTitle = new string(new char[65000]);
|
||||
openFileName.MaxFileTitle = openFileName.FileTitle.Length;
|
||||
openFileName.InitialDir = null;
|
||||
openFileName.Title = string.Empty;
|
||||
openFileName.DefExt = null;
|
||||
|
||||
bool result = NativeMethods.GetOpenFileName(openFileName);
|
||||
if (result)
|
||||
{
|
||||
return openFileName.File;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public VideoConferencePage()
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new VideoConferenceViewModel(
|
||||
settingsUtils,
|
||||
SettingsRepository<GeneralSettings>.GetInstance(settingsUtils),
|
||||
SettingsRepository<VideoConferenceSettings>.GetInstance(settingsUtils),
|
||||
ShellPage.SendDefaultIPCMessage,
|
||||
PickFileDialog);
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void RefreshEnabledState()
|
||||
{
|
||||
ViewModel.RefreshEnabledState();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,10 +121,6 @@
|
||||
<value>Inspired by Rooler</value>
|
||||
<comment>Rooler is a name of the tool.</comment>
|
||||
</data>
|
||||
<data name="Shell_VideoConference.Content" xml:space="preserve">
|
||||
<value>Video Conference Mute</value>
|
||||
<comment>Navigation view item name for Video Conference</comment>
|
||||
</data>
|
||||
<data name="Shell_MeasureTool.Content" xml:space="preserve">
|
||||
<value>Screen Ruler</value>
|
||||
<comment>Product name: Navigation view item name for Screen Ruler</comment>
|
||||
@@ -483,132 +479,6 @@
|
||||
<value>Ctrl three times</value>
|
||||
<comment>This is the Ctrl keyboard key</comment>
|
||||
</data>
|
||||
<data name="VideoConference_Enable.Header" xml:space="preserve">
|
||||
<value>Enable Video Conference Mute</value>
|
||||
</data>
|
||||
<data name="VideoConference.ModuleDescription" xml:space="preserve">
|
||||
<value>Video Conference Mute is a quick and easy way to do a global "mute" of both your microphone and webcam. Disabling this module or closing PowerToys will unmute the microphone and camera.</value>
|
||||
</data>
|
||||
<data name="VideoConference_CameraAndMicrophoneMuteHotkeyControl_Header.Header" xml:space="preserve">
|
||||
<value>Mute camera & microphone</value>
|
||||
</data>
|
||||
<data name="VideoConference_MicrophoneMuteHotkeyControl_Header.Header" xml:space="preserve">
|
||||
<value>Mute microphone</value>
|
||||
</data>
|
||||
<data name="VideoConference_MicrophonePushToTalkHotkeyControl_Header.Header" xml:space="preserve">
|
||||
<value>Push to talk</value>
|
||||
</data>
|
||||
<data name="VideoConference_CameraMuteHotkeyControl_Header.Header" xml:space="preserve">
|
||||
<value>Mute camera</value>
|
||||
</data>
|
||||
<data name="VideoConference_SelectedCamera.Header" xml:space="preserve">
|
||||
<value>Selected camera</value>
|
||||
</data>
|
||||
<data name="VideoConference_SelectedMicrophone.Header" xml:space="preserve">
|
||||
<value>Selected microphone</value>
|
||||
</data>
|
||||
<data name="VideoConference_PushToReverse.Header" xml:space="preserve">
|
||||
<value>Push to reverse</value>
|
||||
</data>
|
||||
<data name="VideoConference_PushToReverse.Description" xml:space="preserve">
|
||||
<value>If enabled, allows both push to talk and push to mute, depending on microphone state</value>
|
||||
</data>
|
||||
<data name="VideoConference_CameraOverlayImagePathHeader.Header" xml:space="preserve">
|
||||
<value>Image displayed when camera is muted</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarPosition.Header" xml:space="preserve">
|
||||
<value>Toolbar position</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarPosition_TopCenter.Content" xml:space="preserve">
|
||||
<value>Top center</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarPosition_TopLeftCorner.Content" xml:space="preserve">
|
||||
<value>Top left corner</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarPosition_TopRightCorner.Content" xml:space="preserve">
|
||||
<value>Top right corner</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarPosition_BottomLeftCorner.Content" xml:space="preserve">
|
||||
<value>Bottom left corner</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarPosition_BottomCenter.Content" xml:space="preserve">
|
||||
<value>Bottom center</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarPosition_BottomRightCorner.Content" xml:space="preserve">
|
||||
<value>Bottom right corner</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarMonitor.Header" xml:space="preserve">
|
||||
<value>Show toolbar on</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarMonitor_Main.Content" xml:space="preserve">
|
||||
<value>Main monitor</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarMonitor_UnderCursor.Content" xml:space="preserve">
|
||||
<value>Monitor under cursor</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarMonitor_ActiveWindow.Content" xml:space="preserve">
|
||||
<value>Active window monitor</value>
|
||||
</data>
|
||||
<data name="VideoConference_ToolbarMonitor_All.Content" xml:space="preserve">
|
||||
<value>All monitors</value>
|
||||
</data>
|
||||
<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_ToolbarHideTimeout.Content" xml:space="preserve">
|
||||
<value>After timeout</value>
|
||||
</data>
|
||||
<data name="VideoConference.ModuleTitle" xml:space="preserve">
|
||||
<value>Video Conference Mute</value>
|
||||
</data>
|
||||
<data name="VideoConference_Camera.Header" xml:space="preserve">
|
||||
<value>Camera</value>
|
||||
</data>
|
||||
<data name="VideoConference_Camera.Description" xml:space="preserve">
|
||||
<value>To use this feature, make sure to select PowerToys VideoConference Mute as your camera source in your apps.</value>
|
||||
</data>
|
||||
<data name="VideoConference_Microphone.Header" xml:space="preserve">
|
||||
<value>Microphone</value>
|
||||
</data>
|
||||
<data name="VideoConference_Toolbar.Header" xml:space="preserve">
|
||||
<value>Toolbar</value>
|
||||
</data>
|
||||
<data name="VideoConference_Behavior.Header" xml:space="preserve">
|
||||
<value>Behavior</value>
|
||||
</data>
|
||||
<data name="VideoConference_StartupAction.Header" xml:space="preserve">
|
||||
<value>Startup action</value>
|
||||
</data>
|
||||
<data name="VideoConference_StartupActionNothing.Content" xml:space="preserve">
|
||||
<value>Nothing</value>
|
||||
</data>
|
||||
<data name="VideoConference_StartupActionUnmute.Content" xml:space="preserve">
|
||||
<value>Unmute</value>
|
||||
</data>
|
||||
<data name="VideoConference_StartupActionMute.Content" xml:space="preserve">
|
||||
<value>Mute</value>
|
||||
</data>
|
||||
<data name="VideoConference_Shortcuts.Header" xml:space="preserve">
|
||||
<value>Shortcuts</value>
|
||||
</data>
|
||||
<data name="VideoConference_CameraOverlayImageAlt.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Camera overlay image preview</value>
|
||||
</data>
|
||||
<data name="VideoConference_CameraOverlayImageBrowse.Content" xml:space="preserve">
|
||||
<value>Browse</value>
|
||||
</data>
|
||||
<data name="VideoConference_CameraOverlayImageClear.Content" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
<data name="Shell_General.Content" xml:space="preserve">
|
||||
<value>General</value>
|
||||
<comment>Navigation view item name for General</comment>
|
||||
@@ -2128,9 +1998,6 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
|
||||
<data name="Oobe_ShortcutGuide.Description" xml:space="preserve">
|
||||
<value>Shortcut Guide presents the user with a listing of available shortcuts for the current state of the desktop.</value>
|
||||
</data>
|
||||
<data name="Oobe_VideoConference.Description" xml:space="preserve">
|
||||
<value>Video Conference Mute allows users to quickly mute the microphone and turn off the camera while on a conference call with a single keystroke, regardless of what application has focus on your computer.</value>
|
||||
</data>
|
||||
<data name="Oobe_MouseUtils.Description" xml:space="preserve">
|
||||
<value>A collection of utilities to enhance your mouse.</value>
|
||||
<comment>Mouse as in the hardware peripheral</comment>
|
||||
@@ -2275,18 +2142,6 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<data name="Oobe_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>Tips & tricks</value>
|
||||
</data>
|
||||
<data name="Oobe_VideoConference_ToggleMicVid.Text" xml:space="preserve">
|
||||
<value>to toggle both your microphone and video</value>
|
||||
</data>
|
||||
<data name="Oobe_VideoConference_ToggleMic.Text" xml:space="preserve">
|
||||
<value>to toggle your microphone</value>
|
||||
</data>
|
||||
<data name="Oobe_VideoConference_PushToTalkMic.Text" xml:space="preserve">
|
||||
<value>to toggle your microphone until key release</value>
|
||||
</data>
|
||||
<data name="Oobe_VideoConference_ToggleVid.Text" xml:space="preserve">
|
||||
<value>to toggle your video</value>
|
||||
</data>
|
||||
<data name="Oobe_MeasureTool_Activation.Text" xml:space="preserve">
|
||||
<value>to bring up the Screen Ruler command bar.</value>
|
||||
</data>
|
||||
@@ -2336,10 +2191,6 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<value>Shortcut Guide</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_VideoConference.Title" xml:space="preserve">
|
||||
<value>Video Conference Mute</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_Overview.Title" xml:space="preserve">
|
||||
<value>Welcome</value>
|
||||
</data>
|
||||
@@ -2611,10 +2462,6 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<value>Learn more about Shortcut Guide</value>
|
||||
<comment>Shortcut Guide is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="LearnMore_VCM.Text" xml:space="preserve">
|
||||
<value>Learn more about Video Conference Mute</value>
|
||||
<comment>Video Conference Mute is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="Oobe_FileExplorer.Title" xml:space="preserve">
|
||||
<value>File Explorer add-ons</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
@@ -2954,18 +2801,9 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<data name="FancyZones_Zone_Appearance.Header" xml:space="preserve">
|
||||
<value>Zone appearance</value>
|
||||
</data>
|
||||
<data name="VideoConference_DeprecationWarning.Title" xml:space="preserve">
|
||||
<value>VCM is moving into legacy mode (maintenance only).</value>
|
||||
</data>
|
||||
<data name="VideoConference_DeprecationWarningButton.Content" xml:space="preserve">
|
||||
<value>Learn more</value>
|
||||
</data>
|
||||
<data name="LearnMore.Content" xml:space="preserve">
|
||||
<value>Learn more</value>
|
||||
</data>
|
||||
<data name="VideoConference_RunAsAdminRequired.Title" xml:space="preserve">
|
||||
<value>You need to run as administrator to modify these settings.</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Thumbnail_GCODE.Header" xml:space="preserve">
|
||||
<value>Geometric Code</value>
|
||||
<comment>File type, do not translate</comment>
|
||||
|
||||
@@ -39,21 +39,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
set { Set(ref isBackEnabled, value); }
|
||||
}
|
||||
|
||||
public bool IsVideoConferenceBuild
|
||||
{
|
||||
get
|
||||
{
|
||||
var mfHandle = NativeMethods.LoadLibrary("mf.dll");
|
||||
bool mfAvailable = mfHandle != IntPtr.Zero;
|
||||
if (mfAvailable)
|
||||
{
|
||||
NativeMethods.FreeLibrary(mfHandle);
|
||||
}
|
||||
|
||||
return this != null && File.Exists("PowerToys.VideoConferenceModule.dll") && mfAvailable;
|
||||
}
|
||||
}
|
||||
|
||||
public NavigationViewItem Selected
|
||||
{
|
||||
get { return selected; }
|
||||
|
||||
@@ -1,586 +0,0 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using global::PowerToys.GPOWrapper;
|
||||
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
|
||||
{
|
||||
public class VideoConferenceViewModel : Observable
|
||||
{
|
||||
private readonly ISettingsUtils _settingsUtils;
|
||||
|
||||
private VideoConferenceSettings Settings { get; set; }
|
||||
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
private const string ModuleName = "Video Conference";
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
private Func<string> PickFileDialog { get; }
|
||||
|
||||
private string _settingsConfigFileFolder = string.Empty;
|
||||
|
||||
public VideoConferenceViewModel(
|
||||
ISettingsUtils settingsUtils,
|
||||
ISettingsRepository<GeneralSettings> settingsRepository,
|
||||
ISettingsRepository<VideoConferenceSettings> videoConferenceSettingsRepository,
|
||||
Func<string, int> ipcMSGCallBackFunc,
|
||||
Func<string> pickFileDialog,
|
||||
string configFileSubfolder = "")
|
||||
{
|
||||
PickFileDialog = pickFileDialog;
|
||||
|
||||
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||
|
||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||
|
||||
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
|
||||
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
|
||||
_settingsConfigFileFolder = configFileSubfolder;
|
||||
|
||||
ArgumentNullException.ThrowIfNull(videoConferenceSettingsRepository);
|
||||
|
||||
Settings = videoConferenceSettingsRepository.SettingsConfig;
|
||||
|
||||
CameraNames = global::PowerToys.Interop.CommonManaged.GetAllVideoCaptureDeviceNames().ToList();
|
||||
MicrophoneNames = global::PowerToys.Interop.CommonManaged.GetAllActiveMicrophoneDeviceNames().ToList();
|
||||
MicrophoneNames.Insert(0, "[All]");
|
||||
|
||||
var shouldSaveSettings = false;
|
||||
|
||||
if (string.IsNullOrEmpty(Settings.Properties.SelectedCamera.Value) && CameraNames.Count != 0)
|
||||
{
|
||||
_selectedCameraIndex = 0;
|
||||
Settings.Properties.SelectedCamera.Value = CameraNames[0];
|
||||
shouldSaveSettings = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedCameraIndex = CameraNames.FindIndex(name => name == Settings.Properties.SelectedCamera.Value);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Settings.Properties.SelectedMicrophone.Value))
|
||||
{
|
||||
_selectedMicrophoneIndex = 0;
|
||||
Settings.Properties.SelectedMicrophone.Value = MicrophoneNames[0];
|
||||
shouldSaveSettings = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedMicrophoneIndex = MicrophoneNames.FindIndex(name => name == Settings.Properties.SelectedMicrophone.Value);
|
||||
}
|
||||
|
||||
InitializeEnabledValue();
|
||||
|
||||
_cameraAndMicrophoneMuteHotkey = Settings.Properties.MuteCameraAndMicrophoneHotkey.Value;
|
||||
_microphoneMuteHotkey = Settings.Properties.MuteMicrophoneHotkey.Value;
|
||||
_microphonePushToTalkHotkey = Settings.Properties.PushToTalkMicrophoneHotkey.Value;
|
||||
_pushToReverseEnabled = Settings.Properties.PushToReverseEnabled.Value;
|
||||
_cameraMuteHotkey = Settings.Properties.MuteCameraHotkey.Value;
|
||||
CameraImageOverlayPath = Settings.Properties.CameraOverlayImagePath.Value;
|
||||
SelectOverlayImage = new ButtonClickCommand(SelectOverlayImageAction);
|
||||
ClearOverlayImage = new ButtonClickCommand(ClearOverlayImageAction);
|
||||
|
||||
switch (Settings.Properties.ToolbarPosition.Value)
|
||||
{
|
||||
case "Top left corner":
|
||||
_toolbarPositionIndex = 0;
|
||||
break;
|
||||
case "Top center":
|
||||
_toolbarPositionIndex = 1;
|
||||
break;
|
||||
case "Top right corner":
|
||||
_toolbarPositionIndex = 2;
|
||||
break;
|
||||
case "Bottom left corner":
|
||||
_toolbarPositionIndex = 3;
|
||||
break;
|
||||
case "Bottom center":
|
||||
_toolbarPositionIndex = 4;
|
||||
break;
|
||||
case "Bottom right corner":
|
||||
_toolbarPositionIndex = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (Settings.Properties.ToolbarMonitor.Value)
|
||||
{
|
||||
case "Main monitor":
|
||||
_toolbarMonitorIndex = 0;
|
||||
break;
|
||||
|
||||
case "All monitors":
|
||||
_toolbarMonitorIndex = 1;
|
||||
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;
|
||||
case "After timeout":
|
||||
_toolbarHideIndex = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (Settings.Properties.StartupAction.Value)
|
||||
{
|
||||
case "Nothing":
|
||||
_startupActionIndex = 0;
|
||||
break;
|
||||
case "Unmute":
|
||||
_startupActionIndex = 1;
|
||||
break;
|
||||
case "Mute":
|
||||
_startupActionIndex = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (shouldSaveSettings)
|
||||
{
|
||||
_settingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName);
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeEnabledValue()
|
||||
{
|
||||
_enabledGpoRuleConfiguration = GPOWrapper.GetConfiguredVideoConferenceMuteEnabledValue();
|
||||
if (_enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
// Get the enabled state from GPO.
|
||||
_enabledStateIsGPOConfigured = true;
|
||||
_isEnabled = _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isEnabled = GeneralSettingsConfig.Enabled.VideoConference;
|
||||
}
|
||||
}
|
||||
|
||||
private GpoRuleConfigured _enabledGpoRuleConfiguration;
|
||||
private bool _enabledStateIsGPOConfigured;
|
||||
private bool _isEnabled;
|
||||
private int _toolbarPositionIndex;
|
||||
private int _toolbarMonitorIndex;
|
||||
private int _toolbarHideIndex;
|
||||
private int _startupActionIndex;
|
||||
private HotkeySettings _cameraAndMicrophoneMuteHotkey;
|
||||
private HotkeySettings _microphoneMuteHotkey;
|
||||
private HotkeySettings _microphonePushToTalkHotkey;
|
||||
private HotkeySettings _cameraMuteHotkey;
|
||||
private bool _pushToReverseEnabled;
|
||||
private int _selectedCameraIndex = -1;
|
||||
private int _selectedMicrophoneIndex;
|
||||
|
||||
public List<string> CameraNames { get; }
|
||||
|
||||
public List<string> MicrophoneNames { get; }
|
||||
|
||||
public string CameraImageOverlayPath { get; set; }
|
||||
|
||||
public ButtonClickCommand SelectOverlayImage { get; set; }
|
||||
|
||||
public ButtonClickCommand ClearOverlayImage { get; set; }
|
||||
|
||||
private void ClearOverlayImageAction()
|
||||
{
|
||||
CameraImageOverlayPath = string.Empty;
|
||||
Settings.Properties.CameraOverlayImagePath = string.Empty;
|
||||
RaisePropertyChanged(nameof(CameraImageOverlayPath));
|
||||
}
|
||||
|
||||
private void SelectOverlayImageAction()
|
||||
{
|
||||
try
|
||||
{
|
||||
string pickedImage = PickFileDialog();
|
||||
if (pickedImage != null)
|
||||
{
|
||||
CameraImageOverlayPath = pickedImage;
|
||||
Settings.Properties.CameraOverlayImagePath = pickedImage;
|
||||
RaisePropertyChanged(nameof(CameraImageOverlayPath));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public int SelectedCameraIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedCameraIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_selectedCameraIndex != value)
|
||||
{
|
||||
_selectedCameraIndex = value;
|
||||
if (_selectedCameraIndex >= 0 && _selectedCameraIndex < CameraNames.Count)
|
||||
{
|
||||
Settings.Properties.SelectedCamera.Value = CameraNames[_selectedCameraIndex];
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int SelectedMicrophoneIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedMicrophoneIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_selectedMicrophoneIndex != value)
|
||||
{
|
||||
_selectedMicrophoneIndex = value;
|
||||
if (_selectedMicrophoneIndex >= 0 && _selectedMicrophoneIndex < MicrophoneNames.Count)
|
||||
{
|
||||
Settings.Properties.SelectedMicrophone.Value = MicrophoneNames[_selectedMicrophoneIndex];
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_enabledStateIsGPOConfigured)
|
||||
{
|
||||
// If it's GPO configured, shouldn't be able to change this state.
|
||||
return;
|
||||
}
|
||||
|
||||
if (value != _isEnabled)
|
||||
{
|
||||
_isEnabled = value;
|
||||
GeneralSettingsConfig.Enabled.VideoConference = value;
|
||||
OutGoingGeneralSettings snd = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||
|
||||
SendConfigMSG(snd.ToString());
|
||||
OnPropertyChanged(nameof(IsEnabled));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnabledGpoConfigured
|
||||
{
|
||||
get => _enabledStateIsGPOConfigured;
|
||||
}
|
||||
|
||||
public bool CanUserChangeEnabledState
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsElevated && !IsEnabledGpoConfigured;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsElevated
|
||||
{
|
||||
get
|
||||
{
|
||||
return GeneralSettingsConfig.IsElevated;
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings CameraAndMicrophoneMuteHotkey
|
||||
{
|
||||
get
|
||||
{
|
||||
return _cameraAndMicrophoneMuteHotkey;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _cameraAndMicrophoneMuteHotkey)
|
||||
{
|
||||
var hotkey = value ?? Settings.Properties.DefaultMuteCameraAndMicrophoneHotkey;
|
||||
_cameraAndMicrophoneMuteHotkey = hotkey;
|
||||
Settings.Properties.MuteCameraAndMicrophoneHotkey.Value = hotkey;
|
||||
RaisePropertyChanged(nameof(CameraAndMicrophoneMuteHotkey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings MicrophoneMuteHotkey
|
||||
{
|
||||
get
|
||||
{
|
||||
return _microphoneMuteHotkey;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _microphoneMuteHotkey)
|
||||
{
|
||||
var hotkey = value ?? Settings.Properties.DefaultMuteMicrophoneHotkey;
|
||||
_microphoneMuteHotkey = hotkey;
|
||||
Settings.Properties.MuteMicrophoneHotkey.Value = hotkey;
|
||||
RaisePropertyChanged(nameof(MicrophoneMuteHotkey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings MicrophonePushToTalkHotkey
|
||||
{
|
||||
get
|
||||
{
|
||||
return _microphonePushToTalkHotkey;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _microphonePushToTalkHotkey)
|
||||
{
|
||||
var hotkey = value ?? Settings.Properties.DefaultMuteMicrophoneHotkey;
|
||||
_microphonePushToTalkHotkey = hotkey;
|
||||
Settings.Properties.PushToTalkMicrophoneHotkey.Value = hotkey;
|
||||
RaisePropertyChanged(nameof(MicrophonePushToTalkHotkey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool PushToReverseEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _pushToReverseEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _pushToReverseEnabled)
|
||||
{
|
||||
_pushToReverseEnabled = value;
|
||||
Settings.Properties.PushToReverseEnabled.Value = value;
|
||||
RaisePropertyChanged(nameof(PushToReverseEnabled));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings CameraMuteHotkey
|
||||
{
|
||||
get
|
||||
{
|
||||
return _cameraMuteHotkey;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _cameraMuteHotkey)
|
||||
{
|
||||
var hotkey = value ?? Settings.Properties.DefaultMuteCameraHotkey;
|
||||
_cameraMuteHotkey = hotkey;
|
||||
Settings.Properties.MuteCameraHotkey.Value = hotkey;
|
||||
RaisePropertyChanged(nameof(CameraMuteHotkey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ToolbarPositionIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _toolbarPositionIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_toolbarPositionIndex != value)
|
||||
{
|
||||
_toolbarPositionIndex = value;
|
||||
switch (_toolbarPositionIndex)
|
||||
{
|
||||
case 0:
|
||||
Settings.Properties.ToolbarPosition.Value = "Top left corner";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Settings.Properties.ToolbarPosition.Value = "Top center";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Settings.Properties.ToolbarPosition.Value = "Top right corner";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Settings.Properties.ToolbarPosition.Value = "Bottom left corner";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Settings.Properties.ToolbarPosition.Value = "Bottom center";
|
||||
break;
|
||||
|
||||
case 5:
|
||||
Settings.Properties.ToolbarPosition.Value = "Bottom right corner";
|
||||
break;
|
||||
}
|
||||
|
||||
RaisePropertyChanged(nameof(ToolbarPositionIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ToolbarMonitorIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _toolbarMonitorIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_toolbarMonitorIndex != value)
|
||||
{
|
||||
_toolbarMonitorIndex = value;
|
||||
switch (_toolbarMonitorIndex)
|
||||
{
|
||||
case 0:
|
||||
Settings.Properties.ToolbarMonitor.Value = "Main monitor";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Settings.Properties.ToolbarMonitor.Value = "All monitors";
|
||||
break;
|
||||
}
|
||||
|
||||
RaisePropertyChanged(nameof(ToolbarMonitorIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ToolbarHideIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _toolbarHideIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _toolbarHideIndex)
|
||||
{
|
||||
_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;
|
||||
case 3:
|
||||
Settings.Properties.ToolbarHide.Value = "After timeout";
|
||||
break;
|
||||
}
|
||||
|
||||
RaisePropertyChanged(nameof(ToolbarHideIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int StartupActionIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _startupActionIndex;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _startupActionIndex)
|
||||
{
|
||||
_startupActionIndex = value;
|
||||
switch (_startupActionIndex)
|
||||
{
|
||||
case 0:
|
||||
Settings.Properties.StartupAction.Value = "Nothing";
|
||||
break;
|
||||
case 1:
|
||||
Settings.Properties.StartupAction.Value = "Unmute";
|
||||
break;
|
||||
case 2:
|
||||
Settings.Properties.StartupAction.Value = "Mute";
|
||||
break;
|
||||
}
|
||||
|
||||
RaisePropertyChanged(nameof(_startupActionIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetSettingsSubPath()
|
||||
{
|
||||
return _settingsConfigFileFolder + (string.IsNullOrEmpty(_settingsConfigFileFolder) ? string.Empty : "\\") + ModuleName;
|
||||
}
|
||||
|
||||
public void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
_settingsUtils.SaveSettings(Settings.ToJsonString(), GetSettingsSubPath());
|
||||
|
||||
SendConfigMSG(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
ModuleName,
|
||||
JsonSerializer.Serialize(Settings)));
|
||||
}
|
||||
|
||||
public void RefreshEnabledState()
|
||||
{
|
||||
InitializeEnabledValue();
|
||||
OnPropertyChanged(nameof(IsEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
[ComImport]
|
||||
[Guid("3E68D4BD-7135-4D10-8018-9FB6D9F33FA1")]
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
public interface IInitializeWithWindow
|
||||
{
|
||||
void Initialize(IntPtr hwnd);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user