|
| 1 | +pragma ComponentBehavior: Bound |
| 2 | + |
| 3 | +import qs.widgets |
| 4 | +import qs.services |
| 5 | +import qs.config |
| 6 | +import Quickshell.Widgets |
| 7 | +import QtQuick |
| 8 | +import QtQuick.Layouts |
| 9 | +import QtQuick.Effects |
| 10 | + |
| 11 | +ClippingRectangle { |
| 12 | + id: root |
| 13 | + |
| 14 | + required property Session session |
| 15 | + |
| 16 | + topRightRadius: Appearance.rounding.normal |
| 17 | + bottomRightRadius: Appearance.rounding.normal |
| 18 | + color: "transparent" |
| 19 | + |
| 20 | + ColumnLayout { |
| 21 | + id: layout |
| 22 | + |
| 23 | + spacing: 0 |
| 24 | + y: -root.session.activeIndex * root.height |
| 25 | + |
| 26 | + Pane { |
| 27 | + StyledText { |
| 28 | + anchors.centerIn: parent |
| 29 | + text: qsTr("Work in progress") |
| 30 | + color: Colours.palette.m3outline |
| 31 | + font.pointSize: Appearance.font.size.extraLarge |
| 32 | + font.weight: 500 |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + Pane { |
| 37 | + StyledText { |
| 38 | + anchors.centerIn: parent |
| 39 | + text: qsTr("Work in progress") |
| 40 | + color: Colours.palette.m3outline |
| 41 | + font.pointSize: Appearance.font.size.extraLarge |
| 42 | + font.weight: 500 |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + Behavior on y { |
| 47 | + NumberAnimation { |
| 48 | + duration: Appearance.anim.durations.normal |
| 49 | + easing.type: Easing.BezierSpline |
| 50 | + easing.bezierCurve: Appearance.anim.curves.standard |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + StyledRect { |
| 56 | + anchors.fill: parent |
| 57 | + color: Colours.palette.m3surfaceContainer |
| 58 | + |
| 59 | + layer.enabled: true |
| 60 | + layer.effect: MultiEffect { |
| 61 | + maskSource: mask |
| 62 | + maskEnabled: true |
| 63 | + maskInverted: true |
| 64 | + maskThresholdMin: 0.5 |
| 65 | + maskSpreadAtMin: 1 |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + Item { |
| 70 | + id: mask |
| 71 | + |
| 72 | + anchors.fill: parent |
| 73 | + layer.enabled: true |
| 74 | + visible: false |
| 75 | + |
| 76 | + Rectangle { |
| 77 | + anchors.fill: parent |
| 78 | + anchors.margins: Appearance.padding.normal |
| 79 | + anchors.leftMargin: 0 |
| 80 | + radius: Appearance.rounding.small |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + component Pane: Loader { |
| 85 | + id: pane |
| 86 | + |
| 87 | + default property Item child |
| 88 | + |
| 89 | + asynchronous: true |
| 90 | + active: { |
| 91 | + const ly = -layout.y; |
| 92 | + const ty = layout.children.indexOf(this) * root.height; |
| 93 | + return ly + root.height > ty && ly < ty + root.height; |
| 94 | + } |
| 95 | + |
| 96 | + sourceComponent: Item { |
| 97 | + implicitWidth: root.width |
| 98 | + implicitHeight: root.height |
| 99 | + |
| 100 | + Item { |
| 101 | + anchors.fill: parent |
| 102 | + anchors.margins: Appearance.padding.normal |
| 103 | + anchors.leftMargin: 0 |
| 104 | + |
| 105 | + children: [pane.child] |
| 106 | + } |
| 107 | + |
| 108 | + StyledRect { |
| 109 | + anchors.fill: parent |
| 110 | + color: Colours.palette.m3surfaceContainer |
| 111 | + |
| 112 | + layer.enabled: true |
| 113 | + layer.effect: MultiEffect { |
| 114 | + maskSource: mask |
| 115 | + maskEnabled: true |
| 116 | + maskInverted: true |
| 117 | + maskThresholdMin: 0.5 |
| 118 | + maskSpreadAtMin: 1 |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + } |
| 123 | +} |
0 commit comments