Skip to content

Commit 65eed84

Browse files
committed
dcontent: add panes
1 parent 112b921 commit 65eed84

4 files changed

Lines changed: 142 additions & 42 deletions

File tree

modules/dashboard/Content.qml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
pragma ComponentBehavior: Bound
22

3-
import qs.widgets
4-
import qs.services
53
import qs.config
64
import Quickshell
75
import Quickshell.Widgets

modules/detachedcontent/DetachedContent.qml

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import qs.config
66
import Quickshell
77
import QtQuick
88
import QtQuick.Layouts
9-
import QtQuick.Effects
109

1110
Item {
1211
id: root
@@ -33,55 +32,29 @@ Item {
3332
implicitWidth: navRail.implicitWidth
3433
color: Colours.palette.m3surfaceContainer
3534

35+
CustomMouseArea {
36+
anchors.fill: parent
37+
38+
function onWheel(event: WheelEvent): void {
39+
if (event.angleDelta.y < 0)
40+
root.session.activeIndex = Math.min(root.session.activeIndex + 1, root.session.panes.length - 1);
41+
else if (event.angleDelta.y > 0)
42+
root.session.activeIndex = Math.max(root.session.activeIndex - 1, 0);
43+
}
44+
}
45+
3646
NavRail {
3747
id: navRail
3848

3949
session: root.session
4050
}
4151
}
4252

43-
Item {
53+
Panes {
4454
Layout.fillWidth: true
4555
Layout.fillHeight: true
4656

47-
StyledText {
48-
anchors.centerIn: parent
49-
text: qsTr("Work in progress")
50-
color: Colours.palette.m3outline
51-
font.pointSize: Appearance.font.size.extraLarge
52-
font.weight: 500
53-
}
54-
55-
StyledRect {
56-
anchors.fill: parent
57-
color: Colours.palette.m3surfaceContainer
58-
topRightRadius: Appearance.rounding.normal
59-
bottomRightRadius: Appearance.rounding.normal
60-
61-
layer.enabled: true
62-
layer.effect: MultiEffect {
63-
maskSource: mask
64-
maskEnabled: true
65-
maskInverted: true
66-
maskThresholdMin: 0.5
67-
maskSpreadAtMin: 1
68-
}
69-
}
70-
71-
Item {
72-
id: mask
73-
74-
anchors.fill: parent
75-
layer.enabled: true
76-
visible: false
77-
78-
Rectangle {
79-
anchors.fill: parent
80-
anchors.margins: Appearance.padding.normal
81-
anchors.leftMargin: 0
82-
radius: Appearance.rounding.small
83-
}
84-
}
57+
session: root.session
8558
}
8659
}
8760
}

modules/detachedcontent/Panes.qml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import QtQuick
22

33
QtObject {
4+
readonly property list<string> panes: ["network", "bluetooth"]
5+
46
property string active
7+
property int activeIndex
8+
9+
onActiveChanged: activeIndex = panes.indexOf(active)
10+
onActiveIndexChanged: active = panes[activeIndex]
511
}

0 commit comments

Comments
 (0)