aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/status/StatusRow.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/status/StatusRow.qml')
-rw-r--r--desktop/modules/status/StatusRow.qml61
1 files changed, 61 insertions, 0 deletions
diff --git a/desktop/modules/status/StatusRow.qml b/desktop/modules/status/StatusRow.qml
new file mode 100644
index 0000000..c9e78c0
--- /dev/null
+++ b/desktop/modules/status/StatusRow.qml
@@ -0,0 +1,61 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+import "../.."
+
+// One mode: a label, a line saying what it does, and a switch.
+Item {
+ id: row
+
+ required property string mode
+ required property string label
+ required property string description
+ required property bool value
+
+ implicitHeight: Math.max(texts.implicitHeight, sw.implicitHeight) + 16
+
+ Column {
+ id: texts
+ anchors {
+ left: parent.left
+ right: sw.left; rightMargin: 12
+ verticalCenter: parent.verticalCenter
+ }
+ spacing: 2
+
+ Text {
+ text: row.label
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
+ color: Theme.text
+ }
+
+ Text {
+ width: parent.width
+ wrapMode: Text.WordWrap
+ text: row.description
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ color: Theme.subtext
+ }
+ }
+
+ Switch {
+ id: sw
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ checked: row.value
+ onToggled: Status.toggleMode(row.mode)
+ }
+
+ // The shared Switch's click handler writes `checked` directly, which drops
+ // the declarative binding above. Resync on any value change so an external
+ // write (statusctl, waybar) moves the switch back into agreement.
+ onValueChanged: sw.checked = row.value
+}