From 35994f730803a34b67c741c3f21976c31da0e5cd Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 19 May 2025 21:03:34 +0800 Subject: dashboard: resources --- modules/bar/Bar.qml | 2 - modules/dashboard/Dash.qml | 28 +++++++----- modules/dashboard/dash/Media.qml | 4 +- modules/dashboard/dash/Resources.qml | 85 ++++++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 modules/dashboard/dash/Resources.qml (limited to 'modules') diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 6e61005..1fef083 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -1,5 +1,4 @@ import "root:/widgets" -import "root:/services" import "root:/config" import Quickshell import QtQuick @@ -27,7 +26,6 @@ Variants { win.anchors.bottom = true; else win.anchors.right = true; - console.log(Players.list); } Connections { diff --git a/modules/dashboard/Dash.qml b/modules/dashboard/Dash.qml index 1af0d70..31ece71 100644 --- a/modules/dashboard/Dash.qml +++ b/modules/dashboard/Dash.qml @@ -1,7 +1,7 @@ -import "root:/widgets" import "root:/services" import "root:/config" import "dash" +import QtQuick import QtQuick.Layouts GridLayout { @@ -17,7 +17,7 @@ GridLayout { } Rect { - text: "toggles" + // text: "toggles" Layout.column: 3 Layout.columnSpan: 2 @@ -32,7 +32,7 @@ GridLayout { } Rect { - text: "calendar" + // text: "calendar" Layout.row: 1 Layout.column: 1 @@ -42,12 +42,11 @@ GridLayout { } Rect { - text: "perf" - Layout.row: 1 Layout.column: 4 - Layout.preferredWidth: 120 Layout.fillHeight: true + + Resources {} } Rect { @@ -59,15 +58,22 @@ GridLayout { Media {} } - component Rect: StyledRect { - property string text + component Rect: Rectangle { + default property Item child + + children: [child] + implicitWidth: child.implicitWidth + implicitHeight: child.implicitHeight radius: Appearance.rounding.small color: Colours.palette.m3surfaceContainer - StyledText { - anchors.centerIn: parent - text: parent.text + Behavior on color { + ColorAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } } } } diff --git a/modules/dashboard/dash/Media.qml b/modules/dashboard/dash/Media.qml index 945b989..7894c59 100644 --- a/modules/dashboard/dash/Media.qml +++ b/modules/dashboard/dash/Media.qml @@ -13,11 +13,13 @@ Item { return active ? active.position / active.length : 0; } + anchors.top: parent.top + anchors.bottom: parent.bottom implicitWidth: DashboardConfig.sizes.mediaWidth Behavior on playerProgress { NumberAnimation { - duration: Appearance.anim.durations.normal + duration: Appearance.anim.durations.large easing.type: Easing.BezierSpline easing.bezierCurve: Appearance.anim.curves.standard } diff --git a/modules/dashboard/dash/Resources.qml b/modules/dashboard/dash/Resources.qml new file mode 100644 index 0000000..b22b2d1 --- /dev/null +++ b/modules/dashboard/dash/Resources.qml @@ -0,0 +1,85 @@ +import "root:/widgets" +import "root:/services" +import "root:/config" +import QtQuick +import QtQuick.Controls + +Row { + id: root + + anchors.top: parent.top + anchors.bottom: parent.bottom + + padding: Appearance.padding.large + spacing: Appearance.spacing.normal + + Resource { + icon: "memory" + value: SystemUsage.cpuPerc + colour: Colours.palette.m3primary + } + + Resource { + icon: "memory_alt" + value: SystemUsage.memPerc + colour: Colours.palette.m3secondary + } + + Resource { + icon: "hard_disk" + value: SystemUsage.storagePerc + colour: Colours.palette.m3tertiary + } + + component Resource: Item { + id: res + + required property string icon + required property real value + required property color colour + + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: Appearance.padding.large + implicitWidth: icon.implicitWidth + + StyledRect { + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.bottom: icon.top + anchors.bottomMargin: Appearance.spacing.small + + implicitWidth: DashboardConfig.sizes.resourceProgessThickness + + color: Colours.palette.m3surfaceContainerHigh + radius: Appearance.rounding.full + + StyledRect { + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + implicitHeight: res.value * parent.height + + color: res.colour + radius: Appearance.rounding.full + } + } + + MaterialIcon { + id: icon + + anchors.bottom: parent.bottom + + text: res.icon + color: res.colour + } + + Behavior on value { + NumberAnimation { + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } + } +} -- cgit v1.2.3-freya