From 2f12ce4c0e55edc5dc249a76ef7a0419ef55c03b Mon Sep 17 00:00:00 2001 From: smith Date: Sat, 31 Oct 2020 20:05:13 -0500 Subject: [PATCH] add task indicator #18 --- packages/shell/Components/Pointer.qml | 37 ++++++++++ packages/shell/Components/TaskIndicator.qml | 80 +++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 packages/shell/Components/Pointer.qml create mode 100644 packages/shell/Components/TaskIndicator.qml diff --git a/packages/shell/Components/Pointer.qml b/packages/shell/Components/Pointer.qml new file mode 100644 index 0000000..07754ae --- /dev/null +++ b/packages/shell/Components/Pointer.qml @@ -0,0 +1,37 @@ +import QtQuick 2.14 +import QtGraphicalEffects 1.14 + +Item { + id: pointer + width: 5 + height: 5 + + property color color: '#000000' + property bool glow: false + + RectangularGlow { + id: effect + anchors.fill: rect + glowRadius: 8 + spread: 0.1 + color: rect.color + cornerRadius: rect.radius + glowRadius + + visible: scale > 0 + scale: glow ? 1 : 0 + Behavior on scale { + NumberAnimation { + target: effect + property: 'scale' + duration: store.state.animation.duration + } + } + } + + Rectangle { + id: rect + anchors.fill: parent + radius: width + color: pointer.color + } +} \ No newline at end of file diff --git a/packages/shell/Components/TaskIndicator.qml b/packages/shell/Components/TaskIndicator.qml new file mode 100644 index 0000000..4c1d3eb --- /dev/null +++ b/packages/shell/Components/TaskIndicator.qml @@ -0,0 +1,80 @@ +import QtQuick 2.14 +import org.muelle.extra 1.0 as Muelle + +Flow { + id: indicator + + flow: $layout.isHorizontal ? Flow.LeftToRight : Flow.TopToBottom + spacing: 2 + padding: 2 + + property bool isActive: false + property bool isGroupParent: false + property bool isLauncher: false + property bool isDemandingAttention: false + + visible: !isLauncher + + readonly property color colorNormal: '#828282' + readonly property color colorAttention: '#F2994A' + readonly property color colorActive: '#2D9CDB' + + readonly property color color: + isDemandingAttention + ? colorAttention + : isActive + ? colorActive + : colorNormal + + Pointer { + color: indicator.color + glow: isActive || isDemandingAttention + } + Pointer { + visible: isGroupParent + color: indicator.color + glow: isActive || isDemandingAttention + } + + StateLayoutEdge { + reset: AnchorChanges { + target: indicator + anchors { + top: undefined + right: undefined + bottom: undefined + left: undefined + verticalCenter: undefined + horizontalCenter: undefined + } + } + top: AnchorChanges { + target: indicator + anchors { + top: parent.top + horizontalCenter: parent.horizontalCenter + } + } + right: AnchorChanges { + target: indicator + anchors { + right: parent.right + verticalCenter: parent.verticalCenter + } + } + bottom: AnchorChanges { + target: indicator + anchors { + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + } + } + left: AnchorChanges { + target: indicator + anchors { + left: parent.left + verticalCenter: parent.verticalCenter + } + } + } +} \ No newline at end of file