dcontent: add panes
This commit is contained in:
parent
112b921245
commit
65eed8437a
4 changed files with 142 additions and 42 deletions
|
|
@ -1,7 +1,5 @@
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import qs.widgets
|
|
||||||
import qs.services
|
|
||||||
import qs.config
|
import qs.config
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import qs.config
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Effects
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -33,6 +32,17 @@ Item {
|
||||||
implicitWidth: navRail.implicitWidth
|
implicitWidth: navRail.implicitWidth
|
||||||
color: Colours.palette.m3surfaceContainer
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
|
||||||
|
CustomMouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
function onWheel(event: WheelEvent): void {
|
||||||
|
if (event.angleDelta.y < 0)
|
||||||
|
root.session.activeIndex = Math.min(root.session.activeIndex + 1, root.session.panes.length - 1);
|
||||||
|
else if (event.angleDelta.y > 0)
|
||||||
|
root.session.activeIndex = Math.max(root.session.activeIndex - 1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NavRail {
|
NavRail {
|
||||||
id: navRail
|
id: navRail
|
||||||
|
|
||||||
|
|
@ -40,48 +50,11 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Panes {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
StyledText {
|
session: root.session
|
||||||
anchors.centerIn: parent
|
|
||||||
text: qsTr("Work in progress")
|
|
||||||
color: Colours.palette.m3outline
|
|
||||||
font.pointSize: Appearance.font.size.extraLarge
|
|
||||||
font.weight: 500
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledRect {
|
|
||||||
anchors.fill: parent
|
|
||||||
color: Colours.palette.m3surfaceContainer
|
|
||||||
topRightRadius: Appearance.rounding.normal
|
|
||||||
bottomRightRadius: Appearance.rounding.normal
|
|
||||||
|
|
||||||
layer.enabled: true
|
|
||||||
layer.effect: MultiEffect {
|
|
||||||
maskSource: mask
|
|
||||||
maskEnabled: true
|
|
||||||
maskInverted: true
|
|
||||||
maskThresholdMin: 0.5
|
|
||||||
maskSpreadAtMin: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: mask
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
layer.enabled: true
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Appearance.padding.normal
|
|
||||||
anchors.leftMargin: 0
|
|
||||||
radius: Appearance.rounding.small
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
123
modules/detachedcontent/Panes.qml
Normal file
123
modules/detachedcontent/Panes.qml
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import qs.widgets
|
||||||
|
import qs.services
|
||||||
|
import qs.config
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
|
ClippingRectangle {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Session session
|
||||||
|
|
||||||
|
topRightRadius: Appearance.rounding.normal
|
||||||
|
bottomRightRadius: Appearance.rounding.normal
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: layout
|
||||||
|
|
||||||
|
spacing: 0
|
||||||
|
y: -root.session.activeIndex * root.height
|
||||||
|
|
||||||
|
Pane {
|
||||||
|
StyledText {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: qsTr("Work in progress")
|
||||||
|
color: Colours.palette.m3outline
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
font.weight: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pane {
|
||||||
|
StyledText {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: qsTr("Work in progress")
|
||||||
|
color: Colours.palette.m3outline
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
font.weight: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on y {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
|
||||||
|
layer.enabled: true
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
maskSource: mask
|
||||||
|
maskEnabled: true
|
||||||
|
maskInverted: true
|
||||||
|
maskThresholdMin: 0.5
|
||||||
|
maskSpreadAtMin: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: mask
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
layer.enabled: true
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
radius: Appearance.rounding.small
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Pane: Loader {
|
||||||
|
id: pane
|
||||||
|
|
||||||
|
default property Item child
|
||||||
|
|
||||||
|
asynchronous: true
|
||||||
|
active: {
|
||||||
|
const ly = -layout.y;
|
||||||
|
const ty = layout.children.indexOf(this) * root.height;
|
||||||
|
return ly + root.height > ty && ly < ty + root.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceComponent: Item {
|
||||||
|
implicitWidth: root.width
|
||||||
|
implicitHeight: root.height
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
|
||||||
|
children: [pane.child]
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Colours.palette.m3surfaceContainer
|
||||||
|
|
||||||
|
layer.enabled: true
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
maskSource: mask
|
||||||
|
maskEnabled: true
|
||||||
|
maskInverted: true
|
||||||
|
maskThresholdMin: 0.5
|
||||||
|
maskSpreadAtMin: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
readonly property list<string> panes: ["network", "bluetooth"]
|
||||||
|
|
||||||
property string active
|
property string active
|
||||||
|
property int activeIndex
|
||||||
|
|
||||||
|
onActiveChanged: activeIndex = panes.indexOf(active)
|
||||||
|
onActiveIndexChanged: active = panes[activeIndex]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue