mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[Settings]Rework update settings in the general tab (#31078)
* changes * fixes * improve dev build checks * improve dev build checks 2 * improve dev build checks 2 fix * fix Resources.resw * use itemsheader * make var bool like before the changes
This commit is contained in:
@@ -59,11 +59,11 @@ If enabled, per-user installation is not allowed.
|
||||
|
||||
If disabled or not configured, per-user installation is allowed.
|
||||
</string>
|
||||
<string id="DisableAutomaticUpdateDownloadDescription">This policy configures whether automatic downloads of available updates are disabled or not. (On metered connections updates are never downloaded.)
|
||||
<string id="DisableAutomaticUpdateDownloadDescription">This policy configures whether the automatic download and installation of available updates is disabled or not. (On metered connections updates are never downloaded.)
|
||||
|
||||
If enabled, automatic downloads are disabled.
|
||||
If enabled, automatic download and installation is disabled.
|
||||
|
||||
If disabled or not configured, the user is in control of automatic downloads setting.
|
||||
If disabled or not configured, the user can control this in the settings.
|
||||
</string>
|
||||
<string id="SuspendNewUpdateToastDescription">This policy configures whether the action center notification for new updates is suspended for 2 minor releases. (Example: if the installed version is v0.60.0, then the next notification is shown for the v0.63.* release.)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<controls:SettingsPageControl x:Uid="General" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PT.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical">
|
||||
<controls:SettingsGroup x:Uid="General_Version" Margin="0,-32,0,0">
|
||||
<controls:SettingsGroup x:Uid="General_VersionAndUpdate" Margin="0,-32,0,0">
|
||||
<tkcontrols:SettingsCard Header="{x:Bind ViewModel.PowerToysVersion, Mode=OneWay}" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<tkcontrols:SettingsCard.Description>
|
||||
<StackPanel Orientation="Vertical">
|
||||
@@ -175,42 +175,34 @@
|
||||
</InfoBar.ActionButton>
|
||||
</InfoBar>
|
||||
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="GeneralPage_ToggleSwitch_AutoDownloadUpdates"
|
||||
<tkcontrols:SettingsExpander
|
||||
x:Uid="General_UpdateSettings"
|
||||
Margin="0,-6,0,0"
|
||||
IsEnabled="{x:Bind ViewModel.IsAutoDownloadUpdatesCardEnabled, Mode=OneWay}"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsExpanded="True">
|
||||
<tkcontrols:SettingsExpander.ItemsHeader>
|
||||
<InfoBar
|
||||
x:Uid="GPO_SomeSettingsAreManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.SomeUpdateSettingsAreGpoManaged, Mode=OneWay}"
|
||||
IsTabStop="{x:Bind ViewModel.SomeUpdateSettingsAreGpoManaged, Mode=OneWay}"
|
||||
Severity="Informational" />
|
||||
</tkcontrols:SettingsExpander.ItemsHeader>
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsShowNewUpdatesToastNotificationCardEnabled}">
|
||||
<controls:CheckBoxWithDescriptionControl x:Uid="GeneralPage_ShowNewUpdatesToast" IsChecked="{Binding Mode=TwoWay, Path=ShowNewUpdatesToastNotification}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard
|
||||
ContentAlignment="Left"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsAutoDownloadUpdatesCardEnabled}"
|
||||
Visibility="{x:Bind ViewModel.IsAdmin, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.AutoDownloadUpdates, Mode=TwoWay}" />
|
||||
<controls:CheckBoxWithDescriptionControl x:Uid="GeneralPage_AutoDownloadAndInstallUpdates" IsChecked="{Binding Mode=TwoWay, Path=AutoDownloadUpdates}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_SettingIsManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.ShowAutoDownloadUpdatesGpoInformation, Mode=OneWay}"
|
||||
IsTabStop="{x:Bind ViewModel.ShowAutoDownloadUpdatesGpoInformation, Mode=OneWay}"
|
||||
Severity="Informational" />
|
||||
|
||||
<tkcontrols:SettingsCard x:Uid="GeneralPage_ToggleSwitch_ShowWhatsNewAfterUpdates" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.ShowWhatsNewAfterUpdatesIsGpoDisabled, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{Binding Mode=TwoWay, Path=ShowWhatsNewAfterUpdates}" />
|
||||
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsShowWhatsNewAfterUpdatesCardEnabled}">
|
||||
<controls:CheckBoxWithDescriptionControl x:Uid="GeneralPage_ShowWhatsNewAfterUpdates" IsChecked="{Binding Mode=TwoWay, Path=ShowWhatsNewAfterUpdates}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_SettingIsManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.ShowWhatsNewAfterUpdatesIsGpoDisabled}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.ShowWhatsNewAfterUpdatesIsGpoDisabled}"
|
||||
Severity="Informational" />
|
||||
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="GeneralPage_ToggleSwitch_ShowNewUpdatesToast"
|
||||
Margin="0,-6,0,0"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsNewUpdatesToastDisabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{Binding Mode=TwoWay, Path=ShowNewUpdatesToastNotification}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_SettingIsManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsNewUpdatesToastDisabledGpoConfigured}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsNewUpdatesToastDisabledGpoConfigured}"
|
||||
Severity="Informational" />
|
||||
</tkcontrols:SettingsExpander.Items>
|
||||
</tkcontrols:SettingsExpander>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="Admin_Mode">
|
||||
|
||||
@@ -1386,10 +1386,10 @@
|
||||
<data name="GeneralPage_ToggleSwitch_AlwaysRunElevated_Link.Content" xml:space="preserve">
|
||||
<value>Learn more about administrator mode</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_AutoDownloadUpdates.Header" xml:space="preserve">
|
||||
<value>Download updates automatically</value>
|
||||
<data name="GeneralPage_AutoDownloadAndInstallUpdates.Header" xml:space="preserve">
|
||||
<value>Download and install updates automatically</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_AutoDownloadUpdates.Description" xml:space="preserve">
|
||||
<data name="GeneralPage_AutoDownloadAndInstallUpdates.Description" xml:space="preserve">
|
||||
<value>Except on metered connections</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_RunningAsAdminNote.Text" xml:space="preserve">
|
||||
@@ -1449,8 +1449,8 @@
|
||||
<data name="General_Repository.Text" xml:space="preserve">
|
||||
<value>GitHub repository</value>
|
||||
</data>
|
||||
<data name="General_Version.Header" xml:space="preserve">
|
||||
<value>Version</value>
|
||||
<data name="General_VersionAndUpdate.Header" xml:space="preserve">
|
||||
<value>Version & updates</value>
|
||||
</data>
|
||||
<data name="General_VersionLastChecked.Text" xml:space="preserve">
|
||||
<value>Last checked: </value>
|
||||
@@ -1467,8 +1467,8 @@
|
||||
<data name="General_SettingsBackupInfo_StatusHeader.Text" xml:space="preserve">
|
||||
<value>Status:</value>
|
||||
</data>
|
||||
<data name="General_Version.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Version</value>
|
||||
<data name="General_VersionAndUpdate.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Version and updates</value>
|
||||
</data>
|
||||
<data name="Admin_mode.Header" xml:space="preserve">
|
||||
<value>Administrator mode</value>
|
||||
@@ -3960,9 +3960,6 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="Shell_Dashboard.Content" xml:space="preserve">
|
||||
<value>Dashboard</value>
|
||||
</data>
|
||||
<data name="GPO_SomeSettingsAreManaged.Title" xml:space="preserve">
|
||||
<value>Some settings are managed by your organization.</value>
|
||||
</data>
|
||||
<data name="DisabledModules.Text" xml:space="preserve">
|
||||
<value>Disabled modules</value>
|
||||
</data>
|
||||
@@ -4005,7 +4002,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="PowerLauncher_TextFontSizeSlider.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Text size of result titles</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_ShowWhatsNewAfterUpdates.Header" xml:space="preserve">
|
||||
<data name="GeneralPage_ShowWhatsNewAfterUpdates.Header" xml:space="preserve">
|
||||
<value>Show the release notes after updates</value>
|
||||
</data>
|
||||
<data name="CmdNotFound_Arm64ArchBar.Title" xml:space="preserve">
|
||||
@@ -4015,12 +4012,18 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Do not activate when Game Mode is on</value>
|
||||
<comment>"Game mode" is the Windows feature to prevent notification when playing a game.</comment>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_ShowNewUpdatesToast.Description" xml:space="preserve">
|
||||
<data name="GeneralPage_ShowNewUpdatesToast.Description" xml:space="preserve">
|
||||
<value>Notifications in the settings and the tray flyout are always shown</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_ShowNewUpdatesToast.Header" xml:space="preserve">
|
||||
<data name="GeneralPage_ShowNewUpdatesToast.Header" xml:space="preserve">
|
||||
<value>Show notifications for new updates</value>
|
||||
</data>
|
||||
<data name="General_UpdateSettings.Header" xml:space="preserve">
|
||||
<value>Update settings</value>
|
||||
</data>
|
||||
<data name="GPO_SomeSettingsAreManaged.Title" xml:space="preserve">
|
||||
<value>Some settings are managed by your organization.</value>
|
||||
</data>
|
||||
<data name="GPO_SettingIsManaged_ToolTip.Text" xml:space="preserve">
|
||||
<value>This setting is managed by your organization.</value>
|
||||
</data>
|
||||
|
||||
@@ -120,6 +120,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
break;
|
||||
}
|
||||
|
||||
_isDevBuild = Helper.GetProductVersion() == "v0.0.1";
|
||||
|
||||
_startup = GeneralSettingsConfig.Startup;
|
||||
_showNewUpdatesToastNotification = GeneralSettingsConfig.ShowNewUpdatesToastNotification;
|
||||
_autoDownloadUpdates = GeneralSettingsConfig.AutoDownloadUpdates;
|
||||
@@ -151,6 +153,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private static bool _isDevBuild;
|
||||
private bool _startup;
|
||||
private bool _isElevated;
|
||||
private bool _runElevated;
|
||||
@@ -298,12 +301,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
// Are we running a dev build? (Please note that we verify this in the code that gets the newest version from GitHub too.)
|
||||
public static bool AutoUpdatesDisabledOnDevBuild
|
||||
public bool SomeUpdateSettingsAreGpoManaged
|
||||
{
|
||||
get
|
||||
{
|
||||
return Helper.GetProductVersion() == "v0.0.1";
|
||||
return _newUpdatesToastIsGpoDisabled ||
|
||||
(_isAdmin && _autoDownloadUpdatesIsGpoDisabled) ||
|
||||
_showWhatsNewAfterUpdatesIsGpoDisabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,9 +329,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsNewUpdatesToastDisabledGpoConfigured
|
||||
public bool IsShowNewUpdatesToastNotificationCardEnabled
|
||||
{
|
||||
get => _newUpdatesToastIsGpoDisabled;
|
||||
get => !_isDevBuild && !_newUpdatesToastIsGpoDisabled;
|
||||
}
|
||||
|
||||
public bool AutoDownloadUpdates
|
||||
@@ -350,14 +354,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
public bool IsAutoDownloadUpdatesCardEnabled
|
||||
{
|
||||
get => !AutoUpdatesDisabledOnDevBuild && !_autoDownloadUpdatesIsGpoDisabled;
|
||||
}
|
||||
|
||||
// The settings card is hidden for users who are not a member of the Administrators group and in this case the GPO info should be hidden too.
|
||||
// We hide it, because we don't want a normal user to enable the setting. He can't install the updates.
|
||||
public bool ShowAutoDownloadUpdatesGpoInformation
|
||||
{
|
||||
get => _isAdmin && _autoDownloadUpdatesIsGpoDisabled;
|
||||
get => !_isDevBuild && !_autoDownloadUpdatesIsGpoDisabled;
|
||||
}
|
||||
|
||||
public bool ShowWhatsNewAfterUpdates
|
||||
@@ -378,9 +375,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowWhatsNewAfterUpdatesIsGpoDisabled
|
||||
public bool IsShowWhatsNewAfterUpdatesCardEnabled
|
||||
{
|
||||
get => _showWhatsNewAfterUpdatesIsGpoDisabled;
|
||||
get => !_isDevBuild && !_showWhatsNewAfterUpdatesIsGpoDisabled;
|
||||
}
|
||||
|
||||
public bool EnableExperimentation
|
||||
@@ -744,7 +741,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return !AutoUpdatesDisabledOnDevBuild && !IsNewVersionDownloading;
|
||||
return !_isDevBuild && !IsNewVersionDownloading;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user