From 551edf01fb7425f22f0be430717509c969a5fe81 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Mon, 26 Aug 2019 17:38:57 +0300 Subject: [PATCH] provide Progress information to indicators --as a test case, the Plasma indicator now supports the original plasma progress indicator of plasma taskmanagers --- .../contents/ui/applet/indicator/Bridge.qml | 3 ++ .../package/ui/BackLayer.qml | 24 +-------- .../org.kde.latte.plasma/package/ui/main.qml | 53 +++++++++++++++++++ .../package/contents/ui/task/IconItem.qml | 2 + plasmoid/package/contents/ui/task/Wrapper.qml | 3 ++ .../contents/ui/task/indicator/Bridge.qml | 3 ++ 6 files changed, 65 insertions(+), 23 deletions(-) diff --git a/containment/package/contents/ui/applet/indicator/Bridge.qml b/containment/package/contents/ui/applet/indicator/Bridge.qml index eccf1fc43..48435d3dd 100644 --- a/containment/package/contents/ui/applet/indicator/Bridge.qml +++ b/containment/package/contents/ui/applet/indicator/Bridge.qml @@ -66,6 +66,9 @@ Item{ readonly property bool animationsEnabled: root.animationsEnabled readonly property real durationTime: root.durationTime + readonly property bool progressVisible: false /*since 0.9.2*/ + readonly property real progress: 0 /*since 0.9.2*/ + readonly property bool usePlasmaTabsStyle: !indicators.enabledForApplets readonly property QtObject palette: colorizerManager.applyTheme diff --git a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml index 0f61c8340..e95964803 100644 --- a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml +++ b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml @@ -56,32 +56,10 @@ PlasmaCore.FrameSvgItem { return "south-active-tab"; } else { - return taskPrefix(basePrefix); + return root.taskPrefix(basePrefix); } } - function taskPrefix(prefix) { - var effectivePrefix; - - if (plasmoid.location === PlasmaCore.Types.LeftEdge) { - effectivePrefix = "west-" + prefix; - } - - if (plasmoid.location === PlasmaCore.Types.TopEdge) { - effectivePrefix = "north-" + prefix; - } - - if (plasmoid.location === PlasmaCore.Types.RightEdge) { - effectivePrefix = "east-" + prefix; - } - - if (plasmoid.location === PlasmaCore.Types.BottomEdge) { - effectivePrefix = "south-" + prefix; - } - - return [effectivePrefix, prefix]; - } - states: [ State { name: "launcher" diff --git a/indicators/org.kde.latte.plasma/package/ui/main.qml b/indicators/org.kde.latte.plasma/package/ui/main.qml index 54c70a7c9..170619dac 100644 --- a/indicators/org.kde.latte.plasma/package/ui/main.qml +++ b/indicators/org.kde.latte.plasma/package/ui/main.qml @@ -52,6 +52,37 @@ LatteComponents.IndicatorItem { sourceComponent: BackLayer{} } + /* progress overlay for BackLayer*/ + /* it is not added in the BackLayer because the BackLayer is rotated in some cases*/ + Loader { + anchors.fill: parent + asynchronous: true + active: level.isBackground && indicator.progressVisible + sourceComponent: Item { + id: background + + Item { + anchors { + top: parent.top + left: parent.left + bottom: parent.bottom + } + + width: parent.width * (Math.min(indicator.progress, 100) / 100) + clip: true + + PlasmaCore.FrameSvgItem { + id: progressFrame + width: background.width + height: background.height + + imagePath: "widgets/tasks" + prefix: root.taskPrefix("progress").concat(root.taskPrefix("hover")) + } + } + } + } + //! Foreground Layer to draw arrows Loader{ id: frontLayer @@ -61,4 +92,26 @@ LatteComponents.IndicatorItem { sourceComponent: FrontLayer{} } + + function taskPrefix(prefix) { + var effectivePrefix; + + if (plasmoid.location === PlasmaCore.Types.LeftEdge) { + effectivePrefix = "west-" + prefix; + } + + if (plasmoid.location === PlasmaCore.Types.TopEdge) { + effectivePrefix = "north-" + prefix; + } + + if (plasmoid.location === PlasmaCore.Types.RightEdge) { + effectivePrefix = "east-" + prefix; + } + + if (plasmoid.location === PlasmaCore.Types.BottomEdge) { + effectivePrefix = "south-" + prefix; + } + + return [effectivePrefix, prefix]; + } } diff --git a/plasmoid/package/contents/ui/task/IconItem.qml b/plasmoid/package/contents/ui/task/IconItem.qml index 9b24856ef..b6b64349b 100644 --- a/plasmoid/package/contents/ui/task/IconItem.qml +++ b/plasmoid/package/contents/ui/task/IconItem.qml @@ -67,6 +67,8 @@ Item{ readonly property color backgroundColor: iconImageBuffer.backgroundColor readonly property color glowColor: iconImageBuffer.glowColor + readonly property bool progressVisible: smartLauncherItem && smartLauncherItem.progressVisible + readonly property real progress: smartLauncherItem && smartLauncherItem.progress property QtObject buffers: null property QtObject smartLauncherItem: null diff --git a/plasmoid/package/contents/ui/task/Wrapper.qml b/plasmoid/package/contents/ui/task/Wrapper.qml index 02cca92be..e85936313 100644 --- a/plasmoid/package/contents/ui/task/Wrapper.qml +++ b/plasmoid/package/contents/ui/task/Wrapper.qml @@ -104,6 +104,9 @@ Item{ property color backgroundColor: taskIconItem.backgroundColor property color glowColor: taskIconItem.glowColor + property bool progressVisible: taskIconItem.progressVisible + property real progress: taskIconItem.progress + property Item visualIconItem: taskIconItem.visualIconItem property Item titleTooltipVisualParent: taskIconItem.titleTooltipVisualParent property Item previewsTooltipVisualParent: taskIconItem.previewsTootipVisualParent diff --git a/plasmoid/package/contents/ui/task/indicator/Bridge.qml b/plasmoid/package/contents/ui/task/indicator/Bridge.qml index f3993ee00..f92e11c6e 100644 --- a/plasmoid/package/contents/ui/task/indicator/Bridge.qml +++ b/plasmoid/package/contents/ui/task/indicator/Bridge.qml @@ -69,6 +69,9 @@ Item { readonly property bool animationsEnabled: root.animationsEnabled readonly property real durationTime: root.durationTime + readonly property bool progressVisible: wrapper.progressVisible /*since 0.9.2*/ + readonly property real progress: wrapper.progress /*since 0.9.2*/ + readonly property bool usePlasmaTabsStyle: false readonly property variant svgs: indicators ? indicators.svgs : []