mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[VCM]disable by default and admin warning (#14686)
* Adding in InfoBar warning when not running as admin * small newline text shift * rolling out a text fix i didn't mean to commit * defaulting to off, there are other spots is seems like * [Runner] introduce is_enabled_by_default method and keep VCM disabled by default * getting file back in good state Co-authored-by: yuyoyuppe <a.yuyoyuppe@gmail.com>
This commit is contained in:
@@ -98,7 +98,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool on_hotkey(size_t hotkeyId) { return false; }
|
virtual bool on_hotkey(size_t hotkeyId) { return false; }
|
||||||
|
|
||||||
/* These are for enabling the legacy behavior of showing the shortcut guide after pressing the win key.
|
/* These are for enabling the legacy behavior of showing the shortcut guide after pressing the win key.
|
||||||
* keep_track_of_pressed_win_key returns true if the module wants to keep track of the win key being pressed.
|
* keep_track_of_pressed_win_key returns true if the module wants to keep track of the win key being pressed.
|
||||||
* milliseconds_win_key_must_be_pressed returns the number of milliseconds the win key should be pressed before triggering the module.
|
* milliseconds_win_key_must_be_pressed returns the number of milliseconds the win key should be pressed before triggering the module.
|
||||||
* Don't use these for new modules.
|
* Don't use these for new modules.
|
||||||
@@ -110,6 +110,8 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool is_enabled_by_default() const { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HANDLE CreateDefaultEvent(const wchar_t* eventName)
|
HANDLE CreateDefaultEvent(const wchar_t* eventName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -527,6 +527,11 @@ void VideoConferenceModule::destroy()
|
|||||||
instance = nullptr;
|
instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VideoConferenceModule::is_enabled_by_default() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void VideoConferenceModule::sendSourceCameraNameUpdate()
|
void VideoConferenceModule::sendSourceCameraNameUpdate()
|
||||||
{
|
{
|
||||||
if (!_settingsUpdateChannel.has_value() || settings.selectedCamera.empty())
|
if (!_settingsUpdateChannel.has_value() || settings.selectedCamera.empty())
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public:
|
|||||||
virtual void disable() override;
|
virtual void disable() override;
|
||||||
virtual bool is_enabled() override;
|
virtual bool is_enabled() override;
|
||||||
virtual void destroy() override;
|
virtual void destroy() override;
|
||||||
|
virtual bool is_enabled_by_default() const override;
|
||||||
|
|
||||||
virtual const wchar_t * get_key() override;
|
virtual const wchar_t * get_key() override;
|
||||||
|
|
||||||
|
|||||||
@@ -179,9 +179,15 @@ void apply_general_settings(const json::JsonObject& general_configs, bool save)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void start_initial_powertoys()
|
void start_enabled_powertoys()
|
||||||
{
|
{
|
||||||
std::unordered_set<std::wstring> powertoys_to_disable;
|
std::unordered_set<std::wstring> powertoys_to_disable;
|
||||||
|
// Take into account default values supplied by modules themselves
|
||||||
|
for (auto& [name, powertoy] : modules())
|
||||||
|
{
|
||||||
|
if (!powertoy->is_enabled_by_default())
|
||||||
|
powertoys_to_disable.emplace(name);
|
||||||
|
}
|
||||||
|
|
||||||
json::JsonObject general_settings;
|
json::JsonObject general_settings;
|
||||||
try
|
try
|
||||||
@@ -192,9 +198,16 @@ void start_initial_powertoys()
|
|||||||
json::JsonObject enabled = general_settings.GetNamedObject(L"enabled");
|
json::JsonObject enabled = general_settings.GetNamedObject(L"enabled");
|
||||||
for (const auto& disabled_element : enabled)
|
for (const auto& disabled_element : enabled)
|
||||||
{
|
{
|
||||||
|
std::wstring disable_module_name{ static_cast<std::wstring_view>(disabled_element.Key()) };
|
||||||
|
// Disable explicitly disabled modules
|
||||||
if (!disabled_element.Value().GetBoolean())
|
if (!disabled_element.Value().GetBoolean())
|
||||||
{
|
{
|
||||||
powertoys_to_disable.emplace(disabled_element.Key());
|
powertoys_to_disable.emplace(std::move(disable_module_name));
|
||||||
|
}
|
||||||
|
// If module was scheduled for disable, but it's enabled in the settings - override default value
|
||||||
|
else if (auto it = powertoys_to_disable.find(disable_module_name); it != end(powertoys_to_disable))
|
||||||
|
{
|
||||||
|
powertoys_to_disable.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,21 +216,11 @@ void start_initial_powertoys()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
if (powertoys_to_disable.empty())
|
for (auto& [name, powertoy] : modules())
|
||||||
{
|
{
|
||||||
for (auto& [name, powertoy] : modules())
|
if (!powertoys_to_disable.contains(name))
|
||||||
{
|
{
|
||||||
powertoy->enable();
|
powertoy->enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
for (auto& [name, powertoy] : modules())
|
|
||||||
{
|
|
||||||
if (powertoys_to_disable.find(name) == powertoys_to_disable.end())
|
|
||||||
{
|
|
||||||
powertoy->enable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,4 @@ struct GeneralSettings
|
|||||||
json::JsonObject load_general_settings();
|
json::JsonObject load_general_settings();
|
||||||
GeneralSettings get_general_settings();
|
GeneralSettings get_general_settings();
|
||||||
void apply_general_settings(const json::JsonObject& general_configs, bool save = true);
|
void apply_general_settings(const json::JsonObject& general_configs, bool save = true);
|
||||||
void start_initial_powertoys();
|
void start_enabled_powertoys();
|
||||||
@@ -177,7 +177,7 @@ int runner(bool isProcessElevated, bool openSettings, std::string settingsWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Start initial powertoys
|
// Start initial powertoys
|
||||||
start_initial_powertoys();
|
start_enabled_powertoys();
|
||||||
|
|
||||||
Trace::EventLaunch(get_product_version(), isProcessElevated);
|
Trace::EventLaunch(get_product_version(), isProcessElevated);
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool videoConference = true;
|
private bool videoConference; // defaulting to off https://github.com/microsoft/PowerToys/issues/14507
|
||||||
|
|
||||||
[JsonPropertyName("Video Conference")]
|
[JsonPropertyName("Video Conference")]
|
||||||
public bool VideoConference
|
public bool VideoConference
|
||||||
|
|||||||
@@ -1825,4 +1825,7 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
|
|||||||
<data name="FancyZones_Zone_Appearance.Header" xml:space="preserve">
|
<data name="FancyZones_Zone_Appearance.Header" xml:space="preserve">
|
||||||
<value>Zone appearance</value>
|
<value>Zone appearance</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="VideoConference_RunAsAdminRequired.Title" xml:space="preserve">
|
||||||
|
<value>You need to run as administrator to modify these settings.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -6,10 +6,12 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||||
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
|
xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
|
||||||
|
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Page.Resources>
|
<Page.Resources>
|
||||||
<converters:StringVisibilityConverter x:Name="EmptyToCollapsedConverter" EmptyValue="Collapsed" NotEmptyValue="Visible"/>
|
<converters:StringVisibilityConverter x:Name="EmptyToCollapsedConverter" EmptyValue="Collapsed" NotEmptyValue="Visible"/>
|
||||||
|
<converters:BoolToObjectConverter x:Key="BoolToVisibilityConverter" TrueValue="Collapsed" FalseValue="Visible"/>
|
||||||
</Page.Resources>
|
</Page.Resources>
|
||||||
|
|
||||||
<controls:SettingsPageControl x:Uid="VideoConference"
|
<controls:SettingsPageControl x:Uid="VideoConference"
|
||||||
@@ -17,7 +19,13 @@
|
|||||||
<controls:SettingsPageControl.ModuleContent>
|
<controls:SettingsPageControl.ModuleContent>
|
||||||
|
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
|
<muxc:InfoBar
|
||||||
|
Severity="Warning"
|
||||||
|
x:Uid="VideoConference_RunAsAdminRequired"
|
||||||
|
IsOpen="True"
|
||||||
|
IsTabStop="True"
|
||||||
|
IsClosable="False"
|
||||||
|
Visibility="{Binding Mode=OneWay, Path=IsElevated, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||||
<controls:Setting x:Uid="VideoConference_Enable" IsEnabled="{ Binding Mode=OneWay, Path=IsElevated }">
|
<controls:Setting x:Uid="VideoConference_Enable" IsEnabled="{ Binding Mode=OneWay, Path=IsElevated }">
|
||||||
<controls:Setting.Icon>
|
<controls:Setting.Icon>
|
||||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsVideoConferenceMute.png" ShowAsMonochrome="False" />
|
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsVideoConferenceMute.png" ShowAsMonochrome="False" />
|
||||||
|
|||||||
Reference in New Issue
Block a user