Add services/Demand.qml, which holds one count on a service's demand counter while active. It replaces 13 hand-written consumer counters across the bar, Control Center, dashboard, media and desktop widgets. The desktop Cava widget now releases Cava while its desktop is covered. Add components/JumpValue.qml for the "animate only visible jumps" rule shared by the dashboard gauge and resource bars. Move the Settings sidebar (search and navigation) into settings/SettingsSidebar.qml and the drag handle into settings/controls/SettingsDragArea.qml, halving Settings.qml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
64 lines
2.1 KiB
QML
64 lines
2.1 KiB
QML
import QtQuick
|
||
import "../components"
|
||
import "../theme"
|
||
|
||
// Ring gauge (0–100) with a centred label; null values draw an empty ring.
|
||
Item {
|
||
id: root
|
||
property var value: null
|
||
property int size: 92
|
||
property real thickness: 8
|
||
property color color: Theme.accentVivid
|
||
property string label: value === null || value === undefined || !Number.isFinite(value) ? "—" : Math.round(value) + "%"
|
||
property string caption: ""
|
||
implicitWidth: size
|
||
implicitHeight: size
|
||
JumpValue {
|
||
id: level
|
||
target: Number.isFinite(root.value) ? Math.max(0, Math.min(100, root.value)) : 0
|
||
}
|
||
readonly property real shown: level.value
|
||
onShownChanged: canvas.requestPaint()
|
||
onColorChanged: canvas.requestPaint()
|
||
Canvas {
|
||
id: canvas
|
||
anchors.fill: parent
|
||
onPaint: {
|
||
const c = getContext("2d"), r = (width - root.thickness) / 2, start = Math.PI * 0.75, sweep = Math.PI * 1.5;
|
||
c.reset();
|
||
c.lineCap = "round";
|
||
c.lineWidth = root.thickness;
|
||
c.strokeStyle = Qt.alpha(Theme.text, 0.1);
|
||
c.beginPath();
|
||
c.arc(width / 2, height / 2, r, start, start + sweep);
|
||
c.stroke();
|
||
if (root.shown > 0) {
|
||
c.strokeStyle = root.color;
|
||
c.beginPath();
|
||
c.arc(width / 2, height / 2, r, start, start + sweep * root.shown / 100);
|
||
c.stroke();
|
||
}
|
||
}
|
||
}
|
||
Column {
|
||
anchors.centerIn: parent
|
||
Text {
|
||
anchors.horizontalCenter: parent.horizontalCenter
|
||
text: root.label
|
||
color: Theme.text
|
||
font.pixelSize: Math.round(root.size * 0.21)
|
||
font.weight: Font.DemiBold
|
||
font.features: {
|
||
"tnum": 1
|
||
}
|
||
}
|
||
Text {
|
||
anchors.horizontalCenter: parent.horizontalCenter
|
||
visible: text !== ""
|
||
text: root.caption
|
||
color: Theme.textSecondary
|
||
font.pixelSize: Math.max(9, Math.round(root.size * 0.11))
|
||
}
|
||
}
|
||
}
|