Share demand counting and jump easing; split Settings sidebar
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>
This commit is contained in:
1 parent
99e64a7713
commit
bf0ef09cec
18 files changed
+595
-570
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import QtQuick
|
||||
import "../components"
|
||||
import "../theme"
|
||||
|
||||
// Ring gauge (0–100) with a centred label; null values draw an empty ring.
|
||||
@@ -12,23 +13,11 @@ Item {
|
||||
property string caption: ""
|
||||
implicitWidth: size
|
||||
implicitHeight: size
|
||||
readonly property real target: Number.isFinite(value) ? Math.max(0, Math.min(100, value)) : 0
|
||||
// Only visible jumps animate: easing every small sample change kept the
|
||||
// window rendering at the display's refresh rate.
|
||||
property real shown
|
||||
property bool easeJump: false
|
||||
Component.onCompleted: shown = target
|
||||
onTargetChanged: {
|
||||
easeJump = Math.abs(target - shown) >= 2;
|
||||
shown = target;
|
||||
}
|
||||
Behavior on shown {
|
||||
enabled: root.easeJump
|
||||
NumberAnimation {
|
||||
duration: Theme.duration * 2
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
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 {
|
||||
|
||||
@@ -18,21 +18,19 @@ Item {
|
||||
readonly property var player: MediaService.player
|
||||
// Streams report no length or absurd ones; show them as live.
|
||||
readonly property bool live: MediaService.length <= 0 || MediaService.length > 7 * 86400
|
||||
property bool subscribed: false
|
||||
onCurrentChanged: sync()
|
||||
Component.onCompleted: sync()
|
||||
Component.onDestruction: if (subscribed) {
|
||||
MediaService.progressConsumers--;
|
||||
CavaService.widgetConsumers--;
|
||||
onCurrentChanged: if (current)
|
||||
EasyEffectsService.refresh()
|
||||
Component.onCompleted: if (current)
|
||||
EasyEffectsService.refresh()
|
||||
Demand {
|
||||
service: MediaService
|
||||
counter: "progressConsumers"
|
||||
active: root.current
|
||||
}
|
||||
function sync() {
|
||||
if (current === subscribed)
|
||||
return;
|
||||
MediaService.progressConsumers += current ? 1 : -1;
|
||||
CavaService.widgetConsumers += current ? 1 : -1;
|
||||
subscribed = current;
|
||||
if (current)
|
||||
EasyEffectsService.refresh();
|
||||
Demand {
|
||||
service: CavaService
|
||||
counter: "widgetConsumers"
|
||||
active: root.current
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
||||
@@ -5,6 +5,7 @@ import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import ".."
|
||||
import "../../widgets/faces" as Faces
|
||||
import "../../components"
|
||||
import "../../services"
|
||||
import "../../theme"
|
||||
|
||||
@@ -16,19 +17,14 @@ Item {
|
||||
implicitHeight: row.implicitHeight
|
||||
// Collectors only run while this tab is on screen.
|
||||
readonly property bool live: current
|
||||
property bool subscribed: false
|
||||
onLiveChanged: sync()
|
||||
Component.onCompleted: sync()
|
||||
Component.onDestruction: if (subscribed) {
|
||||
MetricsService.consumers--;
|
||||
MediaService.progressConsumers--;
|
||||
Demand {
|
||||
service: MetricsService
|
||||
active: root.live
|
||||
}
|
||||
function sync() {
|
||||
if (live === subscribed)
|
||||
return;
|
||||
MetricsService.consumers += live ? 1 : -1;
|
||||
MediaService.progressConsumers += live ? 1 : -1;
|
||||
subscribed = live;
|
||||
Demand {
|
||||
service: MediaService
|
||||
counter: "progressConsumers"
|
||||
active: root.live
|
||||
}
|
||||
readonly property var disk: (MetricsService.snapshot.storage || []).find(s => s.available) || ({})
|
||||
|
||||
@@ -215,14 +211,9 @@ Item {
|
||||
property string fallback
|
||||
property string label
|
||||
spacing: 8
|
||||
readonly property real target: Number.isFinite(value) ? Math.max(0, Math.min(100, value)) : 0
|
||||
// Only visible jumps animate (see Gauge).
|
||||
property real shown
|
||||
property bool easeJump: false
|
||||
Component.onCompleted: shown = target
|
||||
onTargetChanged: {
|
||||
easeJump = Math.abs(target - shown) >= 2;
|
||||
shown = target;
|
||||
JumpValue {
|
||||
id: level
|
||||
target: Number.isFinite(bar.value) ? Math.max(0, Math.min(100, bar.value)) : 0
|
||||
}
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -242,16 +233,9 @@ Item {
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
height: Math.max(parent.width, parent.height * bar.shown / 100)
|
||||
height: Math.max(parent.width, parent.height * level.value / 100)
|
||||
radius: 5
|
||||
color: bar.shown > 85 ? Theme.urgent : Theme.accentVivid
|
||||
Behavior on height {
|
||||
enabled: bar.easeJump
|
||||
NumberAnimation {
|
||||
duration: Theme.duration * 2
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
color: level.target > 85 ? Theme.urgent : Theme.accentVivid
|
||||
}
|
||||
}
|
||||
Text {
|
||||
|
||||
@@ -11,16 +11,9 @@ Item {
|
||||
property bool current: false
|
||||
implicitWidth: grid.implicitWidth
|
||||
implicitHeight: grid.implicitHeight
|
||||
property bool subscribed: false
|
||||
onCurrentChanged: sync()
|
||||
Component.onCompleted: sync()
|
||||
Component.onDestruction: if (subscribed)
|
||||
MetricsService.consumers--
|
||||
function sync() {
|
||||
if (current === subscribed)
|
||||
return;
|
||||
MetricsService.consumers += current ? 1 : -1;
|
||||
subscribed = current;
|
||||
Demand {
|
||||
service: MetricsService
|
||||
active: root.current
|
||||
}
|
||||
readonly property var gpu: MetricsService.gpu
|
||||
readonly property bool hasGpu: gpu.percent !== undefined && gpu.percent !== null
|
||||
|
||||
Reference in new issue
Block a user