diff --git a/app/view/indicator.cpp b/app/view/indicator.cpp index a25e45ec9..a8ba83842 100644 --- a/app/view/indicator.cpp +++ b/app/view/indicator.cpp @@ -230,6 +230,21 @@ QStringList Indicator::customLocalPluginIds() const return m_corona->indicatorFactory()->customLocalPluginIds(); } +QQuickItem *Indicator::info() const +{ + return m_info; +} + +void Indicator::setIndicatorInfo(QQuickItem *info) +{ + if (m_info == info) { + return; + } + + m_info = info; + emit infoChanged(); +} + QQmlComponent *Indicator::component() const { return m_component; diff --git a/app/view/indicator.h b/app/view/indicator.h index 3e9551dc9..f4410df3f 100644 --- a/app/view/indicator.h +++ b/app/view/indicator.h @@ -66,6 +66,8 @@ class Indicator: public QObject Q_PROPERTY(QStringList customPluginNames READ customPluginNames NOTIFY customPluginsChanged) Q_PROPERTY(QStringList customLocalPluginIds READ customLocalPluginIds NOTIFY customPluginsChanged) + Q_PROPERTY(QQuickItem *info READ info NOTIFY infoChanged) + /** * Configuration object: each config key will be a writable property of this object. property bindings work. */ @@ -105,6 +107,8 @@ public: QStringList customPluginNames() const; QStringList customLocalPluginIds() const; + QQuickItem *info() const; + QObject *configuration() const; QQmlComponent *component() const; QQmlComponent *plasmaComponent() const; @@ -116,12 +120,14 @@ public slots: Q_INVOKABLE void addIndicator(); Q_INVOKABLE void downloadIndicator(); Q_INVOKABLE void removeIndicator(QString pluginId); + Q_INVOKABLE void setIndicatorInfo(QQuickItem *info); signals: void customPluginsChanged(); void enabledChanged(); void enabledForAppletsChanged(); void customPluginChanged(); + void infoChanged(); void latteTasksArePresentChanged(); void paddingChanged(); void plasmaComponentChanged(); @@ -165,6 +171,8 @@ private: KPluginMetaData m_metadata; + QPointer m_info; + QPointer m_configuration; QPointer m_lastCreatedConfigUi; }; diff --git a/containment/package/contents/ui/indicators/Manager.qml b/containment/package/contents/ui/indicators/Manager.qml index 4b78e826e..8dd009781 100644 --- a/containment/package/contents/ui/indicators/Manager.qml +++ b/containment/package/contents/ui/indicators/Manager.qml @@ -71,6 +71,15 @@ Item{ } } + Connections { + target: root + onLatteViewChanged: { + if (latteView) { + latteView.indicator.setIndicatorInfo(indicators.info) + } + } + } + //! Metrics and values provided from an invisible indicator Loader{ id: metricsLoader diff --git a/declarativeimports/components/Slider.qml b/declarativeimports/components/Slider.qml index e0401e94f..34bfdcaef 100644 --- a/declarativeimports/components/Slider.qml +++ b/declarativeimports/components/Slider.qml @@ -40,12 +40,42 @@ T.Slider { snapMode: T.Slider.SnapOnRelease + readonly property bool minimumInternalValueIsSet: (minimumInternalValue!==from && minimumInternalValue !== -10000) + property int minimumInternalValue: -10000 + PlasmaCore.Svg { id: grooveSvg imagePath: "widgets/slider" colorGroup: PlasmaCore.ColorScope.colorGroup } + PlasmaCore.FrameSvgItem { + id: minimumValueGroove + imagePath: "widgets/slider" + prefix: "groove-highlight" + x: limitedX - width/2 + y: parent.height/2 - height/2 + width: parent.height * 0.6 + height: 2 + rotation: 90 + visible: minimumInternalValueIsSet + + readonly property int limitedX: limitedPer * parent.width + readonly property real limitedPer: ((minimumInternalValue-from)/(to-from)) + + opacity: { + if (control.enabled && minimumInternalValueIsSet && value < minimumInternalValue) { + return 0.3 + } + + if (control.enabled) { + return 1; + } + + return 0.4; + } + } + handle: Item { property bool horizontal: control.orientation === Qt.Horizontal x: leftFixedPadding + (horizontal ? control.visualPosition * (control.availableWidth - width / 2) : (control.availableWidth - width) / 2) @@ -85,13 +115,24 @@ T.Slider { scale: horizontal && control.mirrored ? -1 : 1 PlasmaCore.FrameSvgItem { + id: grooveHighlight imagePath: "widgets/slider" prefix: "groove-highlight" x: parent.horizontal ? 0 : (parent.width - width) / 2 y: parent.horizontal ? (parent.height - height) / 2 : control.visualPosition * parent.height width: parent.horizontal ? control.position * parent.width + invisibleSpacer : parent.width height: parent.horizontal ? parent.height : control.position * parent.height + invisibleSpacer - opacity: control.enabled ? 1 : 0.4 + opacity: { + if (control.enabled && minimumInternalValueIsSet && value < minimumInternalValue) { + return 0.3 + } + + if (control.enabled) { + return 1; + } + + return 0.4; + } property int invisibleSpacer: control.position === 0 ? 4 : 0 } diff --git a/shell/package/contents/configuration/pages/AppearanceConfig.qml b/shell/package/contents/configuration/pages/AppearanceConfig.qml index a93a51692..56ab9a683 100644 --- a/shell/package/contents/configuration/pages/AppearanceConfig.qml +++ b/shell/package/contents/configuration/pages/AppearanceConfig.qml @@ -560,6 +560,7 @@ PlasmaComponents.Page { to: 40 stepSize: 1 wheelEnabled: false + minimumInternalValue: latteView.indicator.info.minThicknessPadding * 100 onPressedChanged: { if (!pressed) { @@ -569,10 +570,12 @@ PlasmaComponents.Page { } PlasmaComponents.Label { - text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(thickMarginSlider.value) + 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(thickMarginSlider.minimumInternalValue, thickMarginSlider.value) } } } diff --git a/shell/package/contents/configuration/pages/EffectsConfig.qml b/shell/package/contents/configuration/pages/EffectsConfig.qml index 565d5fffc..788fb803e 100644 --- a/shell/package/contents/configuration/pages/EffectsConfig.qml +++ b/shell/package/contents/configuration/pages/EffectsConfig.qml @@ -550,6 +550,7 @@ PlasmaComponents.Page { to: maxMargin stepSize: 1 wheelEnabled: false + minimumInternalValue: latteView.indicator.info.minLengthPadding * 100 readonly property int maxMargin: 25 @@ -561,10 +562,12 @@ PlasmaComponents.Page { } PlasmaComponents.Label { - text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(lengthIntMarginSlider.value) + 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) } }