From ba73bc7d50ebc47e3022776d33c5249b953e197d Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Fri, 25 Mar 2022 21:01:09 +0000 Subject: [PATCH] [Installer]Don't enable pdf preview by default (#17274) * [Installer]Don't enable pdf preview by default * Change settings UI when there's no settings as well * clear analyzer errors --- .../PowerToysSetupCustomActions/CustomAction.cpp | 2 +- src/common/utils/modulesRegistry.h | 12 ++++++++++++ .../Settings.UI.Library/PowerPreviewProperties.cs | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/installer/PowerToysSetupCustomActions/CustomAction.cpp b/installer/PowerToysSetupCustomActions/CustomAction.cpp index ece9d8da2a0..a23cfc2f6ca 100644 --- a/installer/PowerToysSetupCustomActions/CustomAction.cpp +++ b/installer/PowerToysSetupCustomActions/CustomAction.cpp @@ -75,7 +75,7 @@ UINT __stdcall ApplyModulesRegistryChangeSetsCA(MSIHANDLE hInstall) hr = getInstallFolder(hInstall, installationFolder); ExitOnFailure(hr, "Failed to get installFolder."); - for (const auto& changeSet : getAllModulesChangeSets(installationFolder)) + for (const auto& changeSet : getAllOnByDefaultModulesChangeSets(installationFolder)) { if (!changeSet.apply()) { diff --git a/src/common/utils/modulesRegistry.h b/src/common/utils/modulesRegistry.h index 06c4869f64d..7f8631ea094 100644 --- a/src/common/utils/modulesRegistry.h +++ b/src/common/utils/modulesRegistry.h @@ -201,6 +201,18 @@ inline registry::ChangeSet getStlThumbnailHandlerChangeSet(const std::wstring in NonLocalizable::ExtSTL); } +inline std::vector getAllOnByDefaultModulesChangeSets(const std::wstring installationDir) +{ + constexpr bool PER_USER = true; + return { getSvgPreviewHandlerChangeSet(installationDir, PER_USER), + getMdPreviewHandlerChangeSet(installationDir, PER_USER), + getMonacoPreviewHandlerChangeSet(installationDir, PER_USER), + getGcodePreviewHandlerChangeSet(installationDir, PER_USER), + getSvgThumbnailHandlerChangeSet(installationDir, PER_USER), + getGcodeThumbnailHandlerChangeSet(installationDir, PER_USER), + getStlThumbnailHandlerChangeSet(installationDir, PER_USER) }; +} + inline std::vector getAllModulesChangeSets(const std::wstring installationDir) { constexpr bool PER_USER = true; diff --git a/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs b/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs index adcac598c8d..004c34af035 100644 --- a/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs @@ -97,7 +97,7 @@ public bool EnableMonacoPreviewWordWrap } } - private bool enablePdfPreview = true; + private bool enablePdfPreview; [JsonPropertyName("pdf-previewer-toggle-setting")] [JsonConverter(typeof(BoolPropertyJsonConverter))] @@ -114,7 +114,7 @@ public bool EnablePdfPreview } } - private bool enablePdfThumbnail = true; + private bool enablePdfThumbnail; [JsonPropertyName("pdf-thumbnail-toggle-setting")] [JsonConverter(typeof(BoolPropertyJsonConverter))]