From b774f5ced410be7bf09b8aad9c6de9f291a38ab0 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Sun, 12 Dec 2021 23:34:32 -0700 Subject: [PATCH] applets/taskmanager: New grouped task style for themes w/o SVGs for it BUG: 443235 FIXED-IN: 5.24 --- .../taskmanager/package/contents/ui/Task.qml | 45 ++++++++++++++++++- .../taskmanager/package/contents/ui/main.qml | 5 +++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/applets/taskmanager/package/contents/ui/Task.qml b/applets/taskmanager/package/contents/ui/Task.qml index 6347c8d55..f54c37bb2 100644 --- a/applets/taskmanager/package/contents/ui/Task.qml +++ b/applets/taskmanager/package/contents/ui/Task.qml @@ -5,6 +5,7 @@ */ import QtQuick 2.0 +import QtGraphicalEffects 1.12 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents @@ -415,13 +416,53 @@ MouseArea { PlasmaCore.IconItem { id: icon - anchors.fill: parent + anchors { + centerIn: parent + verticalCenterOffset: m.IsGroupParent === true && !taskSvg.hasExpanderGraphics ? Math.round(PlasmaCore.Units.smallSpacing/2) : 0 + horizontalCenterOffset: m.IsGroupParent === true && !taskSvg.hasExpanderGraphics ? -Math.round(PlasmaCore.Units.smallSpacing/2) : 0 + } + width: parent.width + height: parent.height active: task.highlighted enabled: true usesPlasmaTheme: false source: model.decoration + + // Shadow behind this icon when showing another copy behind it when + // using Plasma themes that don't have their own grouped task icon + layer.enabled: m.IsGroupParent === true && !taskSvg.hasExpanderGraphics + layer.effect: DropShadow { + cached: true + color: "dimgray" + samples: 7 // 2 fewer than default to reduce resource use + horizontalOffset: 1 + verticalOffset: -1 + } + } + + // Secondary icon behind the first one for grouped tasks when using + // Plasma themes that don't have their own grouped task icon + Loader { + anchors { + centerIn: parent + verticalCenterOffset: -Math.round(PlasmaCore.Units.smallSpacing/2) + horizontalCenterOffset: Math.round(PlasmaCore.Units.smallSpacing/2) + } + width: parent.width + height: parent.height + z: -1 + + active: m.IsGroupParent === true && !taskSvg.hasExpanderGraphics + sourceComponent: PlasmaCore.IconItem { + active: task.highlighted + enabled: true + opacity: 0.7 + usesPlasmaTheme: false + + source: model.decoration + } } Loader { @@ -562,7 +603,7 @@ MouseArea { ] Component.onCompleted: { - if (!inPopup && model.IsWindow === true) { + if (!inPopup && model.IsWindow === true && taskSvg.hasExpanderGraphics) { var component = Qt.createComponent("GroupExpanderOverlay.qml"); component.createObject(task); } diff --git a/applets/taskmanager/package/contents/ui/main.qml b/applets/taskmanager/package/contents/ui/main.qml index 7ae148ec8..cbb1f4bf1 100644 --- a/applets/taskmanager/package/contents/ui/main.qml +++ b/applets/taskmanager/package/contents/ui/main.qml @@ -378,6 +378,11 @@ MouseArea { PlasmaCore.Svg { id: taskSvg + readonly property bool hasExpanderGraphics: hasElement("group-expander-left") + && hasElement("group-expander-right") + && hasElement("group-expander-top") + && hasElement("group-expander-bottom") + imagePath: "widgets/tasks" } -- GitLab