From abe7c195472e9848064d73ec67e355884899c59f Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Mon, 23 May 2022 21:33:57 +0300 Subject: [PATCH] drop per dock/panel inConfigureAppletsMode --we now support a global value that can be used in order to provide inConfigureAppletsMode for all docks and panels at the same time. --- app/settings/universalsettings.cpp | 18 ++++++++++++++++++ app/settings/universalsettings.h | 6 ++++++ containment/package/contents/config/main.xml | 3 --- containment/package/contents/ui/main.qml | 2 +- .../configuration/CanvasConfiguration.qml | 4 ++-- .../configuration/LatteDockConfiguration.qml | 2 +- .../configuration/canvas/HeaderSettings.qml | 4 ++-- .../configuration/canvas/SettingsOverlay.qml | 2 +- 8 files changed, 31 insertions(+), 10 deletions(-) diff --git a/app/settings/universalsettings.cpp b/app/settings/universalsettings.cpp index 0ff0a42e2..c9e035a6d 100644 --- a/app/settings/universalsettings.cpp +++ b/app/settings/universalsettings.cpp @@ -46,6 +46,7 @@ UniversalSettings::UniversalSettings(KSharedConfig::Ptr config, QObject *parent) connect(this, &UniversalSettings::badges3DStyleChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::canDisableBordersChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::inAdvancedModeForEditSettingsChanged, this, &UniversalSettings::saveConfig); + connect(this, &UniversalSettings::inConfigureAppletsModeChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::isAvailableGeometryBroadcastedToPlasmaChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::launchersChanged, this, &UniversalSettings::saveConfig); connect(this, &UniversalSettings::layoutsMemoryUsageChanged, this, &UniversalSettings::saveConfig); @@ -133,6 +134,21 @@ void UniversalSettings::setInAdvancedModeForEditSettings(const bool &inAdvanced) emit inAdvancedModeForEditSettingsChanged(); } +bool UniversalSettings::inConfigureAppletsMode() const +{ + return m_inConfigureAppletsMode; +} + +void UniversalSettings::setInConfigureAppletsMode(const bool enabled) +{ + if (m_inConfigureAppletsMode == enabled) { + return; + } + + m_inConfigureAppletsMode = enabled; + emit inConfigureAppletsModeChanged(); +} + bool UniversalSettings::isAvailableGeometryBroadcastedToPlasma() const { return m_isAvailableGeometryBroadcastedToPlasma; @@ -555,6 +571,7 @@ void UniversalSettings::loadConfig() m_canDisableBorders = m_universalGroup.readEntry("canDisableBorders", false); m_contextMenuActionsAlwaysShown = m_universalGroup.readEntry("contextMenuActionsAlwaysShown", Latte::Data::ContextMenu::ACTIONSALWAYSVISIBLE); m_inAdvancedModeForEditSettings = m_universalGroup.readEntry("inAdvancedModeForEditSettings", false); + m_inConfigureAppletsMode = m_universalGroup.readEntry("inConfigureAppletsMode", false); m_isAvailableGeometryBroadcastedToPlasma = m_universalGroup.readEntry("isAvailableGeometryBroadcastedToPlasma", true); m_launchers = m_universalGroup.readEntry("launchers", QStringList()); m_metaPressAndHoldEnabled = m_universalGroup.readEntry("metaPressAndHoldEnabled", true); @@ -580,6 +597,7 @@ void UniversalSettings::saveConfig() m_universalGroup.writeEntry("canDisableBorders", m_canDisableBorders); m_universalGroup.writeEntry("contextMenuActionsAlwaysShown", m_contextMenuActionsAlwaysShown); m_universalGroup.writeEntry("inAdvancedModeForEditSettings", m_inAdvancedModeForEditSettings); + m_universalGroup.writeEntry("inConfigureAppletsMode", m_inConfigureAppletsMode); m_universalGroup.writeEntry("isAvailableGeometryBroadcastedToPlasma", m_isAvailableGeometryBroadcastedToPlasma); m_universalGroup.writeEntry("launchers", m_launchers); m_universalGroup.writeEntry("metaPressAndHoldEnabled", m_metaPressAndHoldEnabled); diff --git a/app/settings/universalsettings.h b/app/settings/universalsettings.h index eb5ac9589..7c7bde4a1 100644 --- a/app/settings/universalsettings.h +++ b/app/settings/universalsettings.h @@ -45,6 +45,7 @@ class UniversalSettings : public QObject Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged) Q_PROPERTY(bool badges3DStyle READ badges3DStyle WRITE setBadges3DStyle NOTIFY badges3DStyleChanged) Q_PROPERTY(bool inAdvancedModeForEditSettings READ inAdvancedModeForEditSettings WRITE setInAdvancedModeForEditSettings NOTIFY inAdvancedModeForEditSettingsChanged) + Q_PROPERTY(bool inConfigureAppletsMode READ inConfigureAppletsMode WRITE setInConfigureAppletsMode NOTIFY inConfigureAppletsModeChanged) Q_PROPERTY(bool colorsScriptIsPresent READ colorsScriptIsPresent NOTIFY colorsScriptIsPresentChanged) Q_PROPERTY(bool showInfoWindow READ showInfoWindow WRITE setShowInfoWindow NOTIFY showInfoWindowChanged) @@ -80,6 +81,9 @@ public: bool inAdvancedModeForEditSettings() const; void setInAdvancedModeForEditSettings(const bool &inAdvanced); + bool inConfigureAppletsMode() const; + void setInConfigureAppletsMode(const bool enabled); + bool isAvailableGeometryBroadcastedToPlasma() const; void setIsAvailableGeometryBroadcastedToPlasma(const bool &isBroadcasted); @@ -142,6 +146,7 @@ signals: void colorsScriptIsPresentChanged(); void downloadWindowSizeChanged(); void inAdvancedModeForEditSettingsChanged(); + void inConfigureAppletsModeChanged(); void layoutsColumnWidthsChanged(); void layoutsWindowSizeChanged(); void launchersChanged(); @@ -182,6 +187,7 @@ private: bool m_canDisableBorders{false}; bool m_colorsScriptIsPresent{false}; bool m_inAdvancedModeForEditSettings{false}; + bool m_inConfigureAppletsMode{false}; bool m_isAvailableGeometryBroadcastedToPlasma{true}; bool m_metaPressAndHoldEnabled{true}; bool m_showInfoWindow{true}; diff --git a/containment/package/contents/config/main.xml b/containment/package/contents/config/main.xml index 3bbda2f04..4d28d762e 100644 --- a/containment/package/contents/config/main.xml +++ b/containment/package/contents/config/main.xml @@ -87,9 +87,6 @@ false - - false - true diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index e3fd3d799..95777c44a 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -174,7 +174,7 @@ Item { readonly property bool hasUserSpecifiedBackground: (latteView && latteView.layout && latteView.layout.background.startsWith("/")) ? true : false - readonly property bool inConfigureAppletsMode: root.editMode && plasmoid.configuration.inConfigureAppletsMode + readonly property bool inConfigureAppletsMode: root.editMode && universalSettings && universalSettings.inConfigureAppletsMode property bool closeActiveWindowEnabled: plasmoid.configuration.closeActiveWindowEnabled property bool dragActiveWindowEnabled: plasmoid.configuration.dragActiveWindowEnabled diff --git a/shell/package/contents/configuration/CanvasConfiguration.qml b/shell/package/contents/configuration/CanvasConfiguration.qml index 4643bab77..3e37a5ab8 100644 --- a/shell/package/contents/configuration/CanvasConfiguration.qml +++ b/shell/package/contents/configuration/CanvasConfiguration.qml @@ -27,7 +27,7 @@ Loader { property int panelAlignment: plasmoid.configuration.alignment readonly property real appliedOpacity: imageTiler.opacity - readonly property real maxOpacity: plasmoid.configuration.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive ? + readonly property real maxOpacity: universalSettings.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive ? 1 : plasmoid.configuration.editBackgroundOpacity property real offset: { @@ -92,7 +92,7 @@ Loader { MouseArea { id: editBackMouseArea anchors.fill: imageTiler - visible: !plasmoid.configuration.inConfigureAppletsMode + visible: !universalSettings.inConfigureAppletsMode hoverEnabled: true property bool wheelIsBlocked: false; diff --git a/shell/package/contents/configuration/LatteDockConfiguration.qml b/shell/package/contents/configuration/LatteDockConfiguration.qml index 7d515e26d..7c24b661f 100644 --- a/shell/package/contents/configuration/LatteDockConfiguration.qml +++ b/shell/package/contents/configuration/LatteDockConfiguration.qml @@ -36,7 +36,7 @@ Loader { readonly property bool basicLevel: !advancedLevel readonly property bool advancedLevel: universalSettings.inAdvancedModeForEditSettings - readonly property bool inConfigureAppletsMode: plasmoid.configuration.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive + readonly property bool inConfigureAppletsMode: universalSettings.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive readonly property bool kirigamiLibraryIsFound: LatteCore.Environment.frameworksVersion >= LatteCore.Environment.makeVersion(5,69,0) diff --git a/shell/package/contents/configuration/canvas/HeaderSettings.qml b/shell/package/contents/configuration/canvas/HeaderSettings.qml index fbab10d03..44296d2e7 100644 --- a/shell/package/contents/configuration/canvas/HeaderSettings.qml +++ b/shell/package/contents/configuration/canvas/HeaderSettings.qml @@ -107,14 +107,14 @@ Item { text: i18n("Rearrange and configure your widgets") tooltip: i18n("Feel free to move around your widgets and configure them from their tooltips") - checked: plasmoid.configuration.inConfigureAppletsMode + checked: universalSettings.inConfigureAppletsMode iconPositionReversed: plasmoid.location === PlasmaCore.Types.RightEdge icon: SettingsControls.RearrangeIcon{} onPressedChanged: { if (pressed) { - plasmoid.configuration.inConfigureAppletsMode = !plasmoid.configuration.inConfigureAppletsMode; + universalSettings.inConfigureAppletsMode = !universalSettings.inConfigureAppletsMode; } } } diff --git a/shell/package/contents/configuration/canvas/SettingsOverlay.qml b/shell/package/contents/configuration/canvas/SettingsOverlay.qml index b3d19c872..effb63198 100644 --- a/shell/package/contents/configuration/canvas/SettingsOverlay.qml +++ b/shell/package/contents/configuration/canvas/SettingsOverlay.qml @@ -38,7 +38,7 @@ Item{ readonly property bool textColorIsDark: textColorBrightness < 127.5 readonly property color bestContrastedTextColor: { - if (imageTiler.opacity <= 0.4 && !plasmoid.configuration.inConfigureAppletsMode && themeExtended) { + if (imageTiler.opacity <= 0.4 && !universalSettings.inConfigureAppletsMode && themeExtended) { return latteView.colorizer.currentBackgroundBrightness > 127.5 ? themeExtended.lightTheme.textColor : themeExtended.darkTheme.textColor;