diff --git a/app/view/indicator/indicator.cpp b/app/view/indicator/indicator.cpp index defedde74..67051f02c 100644 --- a/app/view/indicator/indicator.cpp +++ b/app/view/indicator/indicator.cpp @@ -48,8 +48,6 @@ Indicator::Indicator(Latte::View *parent) loadConfig(); connect(this, &Indicator::enabledChanged, this, &Indicator::saveConfig); - connect(this, &Indicator::enabledForAppletsChanged, this, &Indicator::saveConfig); - connect(this, &Indicator::paddingChanged, this, &Indicator::saveConfig); connect(this, &Indicator::pluginChanged, this, &Indicator::saveConfig); connect(m_view, &Latte::View::latteTasksArePresentChanged, this, &Indicator::latteTasksArePresentChanged); @@ -144,21 +142,6 @@ void Indicator::setProvidesConfigUi(bool provides) emit providesConfigUiChanged(); } -float Indicator::padding() const -{ - return m_padding; -} - -void Indicator::setPadding(float padding) -{ - if (m_padding == padding) { - return; - } - - m_padding = padding; - emit paddingChanged(); -} - bool Indicator::pluginIsReady() { return m_pluginIsReady; @@ -439,8 +422,6 @@ void Indicator::loadConfig() auto config = m_view->containment()->config().group("Indicator"); m_customType = config.readEntry("customType", QString()); m_enabled = config.readEntry("enabled", true); - m_enabledForApplets = config.readEntry("enabledForApplets", true); - m_padding = config.readEntry("padding", (float)0.08); m_type = config.readEntry("type", "org.kde.latte.default"); } @@ -449,8 +430,6 @@ void Indicator::saveConfig() auto config = m_view->containment()->config().group("Indicator"); config.writeEntry("customType", m_customType); config.writeEntry("enabled", m_enabled); - config.writeEntry("enabledForApplets", m_enabledForApplets); - config.writeEntry("padding", m_padding); config.writeEntry("type", m_type); config.sync(); diff --git a/app/view/indicator/indicator.h b/app/view/indicator/indicator.h index 64b9d3ff9..c15a15c29 100644 --- a/app/view/indicator/indicator.h +++ b/app/view/indicator/indicator.h @@ -58,8 +58,6 @@ class Indicator: public QObject Q_PROPERTY(bool pluginIsReady READ pluginIsReady NOTIFY pluginIsReadyChanged) Q_PROPERTY(bool providesConfigUi READ providesConfigUi NOTIFY providesConfigUiChanged) - Q_PROPERTY(float padding READ padding WRITE setPadding NOTIFY paddingChanged) - Q_PROPERTY(QString type READ type WRITE setType NOTIFY pluginChanged) Q_PROPERTY(QString customType READ customType NOTIFY customPluginChanged) @@ -103,9 +101,6 @@ public: bool pluginIsReady(); - float padding() const; - void setPadding(float padding); - QString type() const; void setType(QString type); @@ -141,7 +136,6 @@ signals: void customPluginChanged(); void infoChanged(); void latteTasksArePresentChanged(); - void paddingChanged(); void plasmaComponentChanged(); void pluginChanged(); void pluginIsReadyChanged(); @@ -167,8 +161,6 @@ private: bool m_pluginIsReady{false}; bool m_providesConfigUi{true}; - float m_padding{0.08}; - QString m_pluginPath; QString m_type{"org.kde.latte.default"}; QString m_customType; diff --git a/containment/package/contents/ui/applet/indicator/Bridge.qml b/containment/package/contents/ui/applet/indicator/Bridge.qml index 9e52538cf..b6f4d80ac 100644 --- a/containment/package/contents/ui/applet/indicator/Bridge.qml +++ b/containment/package/contents/ui/applet/indicator/Bridge.qml @@ -30,8 +30,8 @@ Item{ readonly property bool active: appletIsValid && ((indicators.isEnabled && appletItem.communicatorAlias.activeIndicatorEnabled - && indicators.enabledForApplets) - || (!indicators.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive)) + && indicators.info.enabledForApplets) + || (!indicators.info.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive)) /* Indicators Properties in order use them*/ readonly property bool isTask: false @@ -72,8 +72,6 @@ Item{ readonly property int screenEdgeMargin: root.localScreenEdgeMargin /*since 0.10*/ - readonly property bool usePlasmaTabsStyle: !indicators.enabledForApplets - readonly property QtObject palette: colorizerManager.applyTheme //!icon colors diff --git a/containment/package/contents/ui/applet/indicator/Loader.qml b/containment/package/contents/ui/applet/indicator/Loader.qml index cb745c0d9..2a727c6a7 100644 --- a/containment/package/contents/ui/applet/indicator/Loader.qml +++ b/containment/package/contents/ui/applet/indicator/Loader.qml @@ -35,7 +35,7 @@ Loader { active: level.bridge && level.bridge.active && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer)) sourceComponent: { - if (!indicators.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive) { + if (!indicators.info.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive) { return indicators.plasmaStyleComponent; } diff --git a/containment/package/contents/ui/indicators/Manager.qml b/containment/package/contents/ui/indicators/Manager.qml index 07a081807..87b5a7c6a 100644 --- a/containment/package/contents/ui/indicators/Manager.qml +++ b/containment/package/contents/ui/indicators/Manager.qml @@ -33,8 +33,7 @@ Item{ readonly property QtObject resources: latteView && latteView.indicator ? latteView.indicator.resources : null readonly property bool isEnabled: latteView && latteView.indicator ? (latteView.indicator.enabled && latteView.indicator.pluginIsReady) : false - readonly property bool enabledForApplets: latteView && latteView.indicator ? latteView.indicator.enabledForApplets : true - readonly property real padding: Math.max(info.minLengthPadding, latteView && latteView.indicator ? latteView.indicator.padding : 0.08) + readonly property real padding: Math.max(info.minLengthPadding, info.lengthPadding) readonly property string type: latteView && latteView.indicator ? latteView.indicator.type : "org.kde.latte.default" readonly property bool infoLoaded: metricsLoader.active && metricsLoader.item @@ -43,6 +42,9 @@ Item{ readonly property Component indicatorComponent: latteView && latteView.indicator ? latteView.indicator.component : null readonly property Item info: Item{ + readonly property bool enabledForApplets: infoLoaded && metricsLoader.item.hasOwnProperty("enabledForApplets") + && metricsLoader.item.enabledForApplets + readonly property bool needsIconColors: infoLoaded && metricsLoader.item.hasOwnProperty("needsIconColors") && metricsLoader.item.needsIconColors @@ -82,6 +84,14 @@ Item{ return 0; } + readonly property real lengthPadding: { + if (infoLoaded && metricsLoader.item.hasOwnProperty("lengthPadding")) { + return metricsLoader.item.lengthPadding; + } + + return 0.08; + } + readonly property real appletLengthPadding: { if (infoLoaded && metricsLoader.item.hasOwnProperty("appletLengthPadding")) { return metricsLoader.item.appletLengthPadding; @@ -113,7 +123,15 @@ Item{ sourceComponent: managerIndicator.indicatorComponent } - //! Bindings in order to inform View::Indicator::Info + //! Bindings in order to inform View::Indicator + Binding{ + target: latteView && latteView.indicator ? latteView.indicator : null + property:"enabledForApplets" + when: latteView && latteView.indicator + value: managerIndicator.info.enabledForApplets + } + + //! Bindings in order to inform View::Indicator::Info Binding{ target: latteView && latteView.indicator ? latteView.indicator.info : null property:"needsIconColors" diff --git a/containment/package/contents/ui/layouts/indicator/Bridge.qml b/containment/package/contents/ui/layouts/indicator/Bridge.qml index 06351d7ef..68d426b37 100644 --- a/containment/package/contents/ui/layouts/indicator/Bridge.qml +++ b/containment/package/contents/ui/layouts/indicator/Bridge.qml @@ -66,8 +66,6 @@ Item{ readonly property int screenEdgeMargin: 0 /*since 0.10*/ - readonly property bool usePlasmaTabsStyle: !indicators.enabledForApplets - readonly property QtObject palette: colorizerManager.applyTheme //!icon colors diff --git a/declarativeimports/components/IndicatorItem.qml b/declarativeimports/components/IndicatorItem.qml index 511bb435e..14d7b6632 100644 --- a/declarativeimports/components/IndicatorItem.qml +++ b/declarativeimports/components/IndicatorItem.qml @@ -36,6 +36,10 @@ Item { //! any clicked animation in that case property bool providesClickedAnimation: false + //! this indicator will draw its own indicators for applets + //! [since v0.10.0] + property bool enabledForApplets: true + //! this indicator visuals go out of the regular mask thickness and this variable sets //! the pixels needed outside of the mask thickness e.g. a glow property int extraMaskThickness: 0 @@ -50,11 +54,19 @@ Item { property real minLengthPadding: 0 //! this indicator specifies a different padding value for applets. This value is a percentage, - //! -1, means disabled and the regular padding is used + //! -1, means disabled and the regular length padding is used //! 0.06 -> 6% //! [since v0.9.2] property real appletLengthPadding: -1 + //! this indicator specifies how much is going to be the items regular length padding + //! as long as other more specialized paddings such as appletLengthPadding are not + //! applied. This value is a percentage, + //! e.g 0.06 -> 6% + //! [since v0.10.0] + property real lengthPadding: 0.08 + + //! svg image paths either from plasma theme or local files relevant to indicator "ui" directory //! in order to reduce resources usage property var svgImagePaths: [] diff --git a/indicators/default/package/config/config.qml b/indicators/default/package/config/config.qml index 808782c22..b12f3e0ff 100644 --- a/indicators/default/package/config/config.qml +++ b/indicators/default/package/config/config.qml @@ -190,6 +190,48 @@ ColumnLayout { } } + LatteComponents.SubHeader { + text: i18n("Padding") + } + + RowLayout { + Layout.fillWidth: true + spacing: units.smallSpacing + + PlasmaComponents.Label { + text: i18n("Length") + horizontalAlignment: Text.AlignLeft + } + + LatteComponents.Slider { + id: lengthIntMarginSlider + Layout.fillWidth: true + + value: Math.round(indicator.configuration.lengthPadding * 100) + from: 0 + to: maxMargin + stepSize: 1 + wheelEnabled: false + + readonly property int maxMargin: 80 + + onPressedChanged: { + if (!pressed) { + indicator.configuration.lengthPadding = value / 100; + } + } + } + + PlasmaComponents.Label { + text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(currentValue) + horizontalAlignment: Text.AlignRight + Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 + Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 + + readonly property int currentValue: lengthIntMarginSlider.value + } + } + ColumnLayout { spacing: 0 visible: indicator.latteTasksArePresent @@ -229,6 +271,17 @@ ColumnLayout { text: i18n("Options") } + LatteComponents.CheckBox { + Layout.maximumWidth: dialog.optionsWidth + text: i18n("Show indicators for applets") + checked: indicator.configuration.enabledForApplets + tooltip: i18n("Indicators are shown for applets") + + onClicked: { + indicator.configuration.enabledForApplets = !indicator.configuration.enabledForApplets; + } + } + LatteComponents.CheckBox { Layout.maximumWidth: dialog.optionsWidth text: i18n("Reverse indicator style") diff --git a/indicators/default/package/config/main.xml b/indicators/default/package/config/main.xml index f792cf4ce..13e79ad6d 100644 --- a/indicators/default/package/config/main.xml +++ b/indicators/default/package/config/main.xml @@ -22,6 +22,9 @@ false + + true + @@ -37,6 +40,9 @@ 0.35 + + 0.08 + false diff --git a/indicators/default/package/ui/main.qml b/indicators/default/package/ui/main.qml index 99dbbba31..dc5c8949e 100644 --- a/indicators/default/package/ui/main.qml +++ b/indicators/default/package/ui/main.qml @@ -32,6 +32,9 @@ LatteComponents.IndicatorItem{ id: root extraMaskThickness: reversedEnabled && glowEnabled ? 1.7 * (factor * indicator.maxIconSize) : 0 + enabledForApplets: indicator && indicator.configuration ? indicator.configuration.enabledForApplets : true + lengthPadding: indicator && indicator.configuration ? indicator.configuration.lengthPadding : 0.08 + readonly property real factor: 0.08 readonly property int size: factor * indicator.currentIconSize diff --git a/indicators/org.kde.latte.plasma/package/config/config.qml b/indicators/org.kde.latte.plasma/package/config/config.qml index a43fad452..ef0af8eba 100644 --- a/indicators/org.kde.latte.plasma/package/config/config.qml +++ b/indicators/org.kde.latte.plasma/package/config/config.qml @@ -23,6 +23,7 @@ import QtQuick.Layouts 1.3 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.latte 0.2 as Latte import org.kde.latte.components 1.0 as LatteComponents @@ -31,6 +32,52 @@ ColumnLayout { id: root Layout.fillWidth: true + LatteComponents.SubHeader { + text: i18n("Padding") + } + + RowLayout { + Layout.fillWidth: true + spacing: units.smallSpacing + + PlasmaComponents.Label { + text: i18n("Length") + horizontalAlignment: Text.AlignLeft + } + + LatteComponents.Slider { + id: lengthIntMarginSlider + Layout.fillWidth: true + + value: Math.round(indicator.configuration.lengthPadding * 100) + from: 0 + to: maxMargin + stepSize: 1 + wheelEnabled: false + + readonly property int maxMargin: 80 + + onPressedChanged: { + if (!pressed) { + indicator.configuration.lengthPadding = value / 100; + } + } + } + + PlasmaComponents.Label { + text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(currentValue) + horizontalAlignment: Text.AlignRight + Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 + Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 + + readonly property int currentValue: lengthIntMarginSlider.value + } + } + + LatteComponents.SubHeader { + text: i18n("Options") + } + LatteComponents.CheckBoxesColumn { Layout.topMargin: 1.5 * units.smallSpacing @@ -53,5 +100,16 @@ ColumnLayout { indicator.configuration.clickedAnimationEnabled = !indicator.configuration.clickedAnimationEnabled; } } + + LatteComponents.CheckBox { + Layout.maximumWidth: dialog.optionsWidth + text: i18n("Show indicators for applets") + checked: indicator.configuration.enabledForApplets + tooltip: i18n("Indicators are shown for applets") + + onClicked: { + indicator.configuration.enabledForApplets = !indicator.configuration.enabledForApplets; + } + } } } diff --git a/indicators/org.kde.latte.plasma/package/config/main.xml b/indicators/org.kde.latte.plasma/package/config/main.xml index 8b88f0245..22eb5c57a 100644 --- a/indicators/org.kde.latte.plasma/package/config/main.xml +++ b/indicators/org.kde.latte.plasma/package/config/main.xml @@ -10,7 +10,13 @@ false - + + + true + + + 0.08 + diff --git a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml index e95964803..462ad1a07 100644 --- a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml +++ b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml @@ -27,13 +27,13 @@ PlasmaCore.FrameSvgItem { id: frame property string basePrefix: "normal" - imagePath: indicator.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks" + imagePath: root.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks" rotation: root.reversedEnabled ? 180 : 0 opacity: 1 //state === "hovered" ? 0.9 : 1 prefix: { - if (indicator.usePlasmaTabsStyle) { + if (root.usePlasmaTabsStyle) { if (!indicator.isActive) { return ""; } diff --git a/indicators/org.kde.latte.plasma/package/ui/main.qml b/indicators/org.kde.latte.plasma/package/ui/main.qml index c43e9bb23..af46f1ad2 100644 --- a/indicators/org.kde.latte.plasma/package/ui/main.qml +++ b/indicators/org.kde.latte.plasma/package/ui/main.qml @@ -33,16 +33,24 @@ LatteComponents.IndicatorItem { providesFrontLayer: true svgImagePaths: ["widgets/tasks"] + enabledForApplets: configurationIsReady && indicator.configuration.clickedAnimationEnabled !== undefined ? + indicator.configuration.enabledForApplets : true + lengthPadding: configurationIsReady && indicator.configuration.clickedAnimationEnabled !== undefined ? + indicator.configuration.lengthPadding : 0.08 + //! config options - readonly property bool clickedAnimationEnabled: indicator && indicator.configuration + readonly property bool clickedAnimationEnabled: configurationIsReady && indicator.configuration.clickedAnimationEnabled !== undefined && indicator.configuration.clickedAnimationEnabled - readonly property bool reversedEnabled: indicator && indicator.configuration + readonly property bool reversedEnabled: configurationIsReady && indicator.configuration.reversed !== undefined && indicator.configuration.reversed + readonly property bool usePlasmaTabsStyle: false + readonly property bool configurationIsReady: indicator && indicator.configuration + //! Background Layer Loader{ id: backLayer diff --git a/plasmoid/package/contents/ui/indicators/Manager.qml b/plasmoid/package/contents/ui/indicators/Manager.qml index 1362ce2b1..91bca1748 100644 --- a/plasmoid/package/contents/ui/indicators/Manager.qml +++ b/plasmoid/package/contents/ui/indicators/Manager.qml @@ -47,6 +47,7 @@ Item{ readonly property bool providesHoveredAnimation: false readonly property bool providesClickedAnimation: false readonly property int extraMaskThickness: 0 + readonly property real lengthPadding: 0.08 readonly property real minThicknessPadding: 0 readonly property real minLengthPadding:0 } diff --git a/plasmoid/package/contents/ui/task/indicator/Bridge.qml b/plasmoid/package/contents/ui/task/indicator/Bridge.qml index 9507a89a1..2c8b0cc33 100644 --- a/plasmoid/package/contents/ui/task/indicator/Bridge.qml +++ b/plasmoid/package/contents/ui/task/indicator/Bridge.qml @@ -75,8 +75,6 @@ Item { readonly property int screenEdgeMargin: root.screenEdgeMargin /*since 0.10*/ - readonly property bool usePlasmaTabsStyle: false - readonly property variant svgs: indicators ? indicators.svgs : [] readonly property QtObject palette: enforceLattePalette ? latteBridge.palette.applyTheme : theme diff --git a/shell/package/contents/configuration/pages/EffectsConfig.qml b/shell/package/contents/configuration/pages/EffectsConfig.qml index 4fee1b7d2..993bfa2c9 100644 --- a/shell/package/contents/configuration/pages/EffectsConfig.qml +++ b/shell/package/contents/configuration/pages/EffectsConfig.qml @@ -470,103 +470,29 @@ PlasmaComponents.Page { } } - LatteComponents.SubHeader { - Layout.topMargin: units.smallSpacing - isFirstSubCategory: true - text: i18n("Paddings") - } - - RowLayout { + //! BEGIN: Indicator specific sub-options + ColumnLayout { + id: indicatorSpecificOptions Layout.fillWidth: true - spacing: units.smallSpacing - - PlasmaComponents.Label { - text: i18n("Length") - horizontalAlignment: Text.AlignLeft - } - - LatteComponents.Slider { - id: lengthIntMarginSlider - Layout.fillWidth: true - - value: Math.round(latteView.indicator.padding * 100) - from: 0 - to: maxMargin - stepSize: 1 - wheelEnabled: false - minimumInternalValue: latteView.indicator.info.minLengthPadding * 100 + Layout.topMargin: units.smallSpacing * 2 + spacing: 0 + visible: latteView.indicator.providesConfigUi + enabled: latteView.indicator.enabled - readonly property int maxMargin: 80 + readonly property int optionsWidth: dialog.optionsWidth - onPressedChanged: { - if (!pressed) { - latteView.indicator.padding = value / 100; - } - } + Component.onCompleted: { + latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions); } - PlasmaComponents.Label { - text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(currentValue) - horizontalAlignment: Text.AlignRight - Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 - Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 - - readonly property int currentValue: Math.max(lengthIntMarginSlider.minimumInternalValue, lengthIntMarginSlider.value) + Connections { + target: latteView.indicator + onPluginChanged: latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions); } } - - LatteComponents.SubHeader { - Layout.topMargin: units.smallSpacing - isFirstSubCategory: true - text: i18n("Options") - } - - LatteComponents.CheckBoxesColumn { - LatteComponents.CheckBox { - Layout.maximumWidth: dialog.optionsWidth - text: i18n("Show indicators for applets") - checked: latteView.indicator.enabledForApplets - tooltip: i18n("Indicators are shown for applets") - - onClicked: { - latteView.indicator.enabledForApplets = !latteView.indicator.enabledForApplets; - } - } - } - } - } - //! END: Active Indicator General Settings - - //! BEGIN: Indicator specific sub-options - ColumnLayout { - Layout.fillWidth: true - Layout.topMargin: units.smallSpacing - spacing: units.smallSpacing - visible: latteView.indicator.providesConfigUi - enabled: latteView.indicator.enabled - - LatteComponents.Header { - text: i18n("%0 Indicator Options").arg(indicatorStyleGroup.current === customIndicator.button ? customIndicator.buttonText : indicatorStyleGroup.current.text) - } - - ColumnLayout { - id: indicatorSpecificOptions - Layout.fillWidth: true - Layout.leftMargin: units.smallSpacing * 2 - Layout.rightMargin: units.smallSpacing * 2 - spacing: 0 - readonly property int optionsWidth: dialog.optionsWidth - - Component.onCompleted: { - latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions); - } - - Connections { - target: latteView.indicator - onPluginChanged: latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions); - } + //! END: Indicator specific sub-options } } - //! END: Indicator specific sub-options + //! END: Active Indicator General Settings } }