Draw idle as one timeline, and let the power button answer to its owner
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -5,22 +5,50 @@
|
||||
// ones and falls apart at four with sentences under them -- and on this page
|
||||
// two cards sit side by side, so a row has half the width it used to.
|
||||
//
|
||||
// Not schema-bound. Some of these choices are Panama settings and some are
|
||||
// display state that has to go through a keep-or-revert transaction, so the
|
||||
// caller says what to do with the value rather than this writing it.
|
||||
// Schema-bound when you name a key, hand-fed when you do not:
|
||||
//
|
||||
// OptionPickerRow { setting: "powerButtonAction" }
|
||||
//
|
||||
// gets its label, explanation, option list and current value from
|
||||
// PreferenceSchema and commits the pick for you, exactly as ToggleRow and
|
||||
// ChoiceRow do. Leaving `setting` empty keeps the original behavior, which is
|
||||
// what the display rows need: some of these choices are not preferences at all
|
||||
// but compositor state going through a keep-or-revert transaction, so the
|
||||
// caller says what a pick means rather than this writing it.
|
||||
|
||||
import QtQuick
|
||||
import qs.config
|
||||
import qs.services
|
||||
|
||||
PickerRow {
|
||||
id: root
|
||||
|
||||
// Empty means "not a stored preference"; see above.
|
||||
property string setting: ""
|
||||
|
||||
readonly property var spec:
|
||||
root.setting === "" ? null : PreferenceSchema.spec(root.setting)
|
||||
|
||||
// [{ value, label, detail }]
|
||||
property var options: []
|
||||
property var current: null
|
||||
property var options: root.spec && root.spec.options ? root.spec.options : []
|
||||
property var current: root.setting === "" ? null : DesktopPreferences.get(root.setting)
|
||||
|
||||
label: root.spec ? root.spec.label : ""
|
||||
detail: root.spec ? root.spec.detail : ""
|
||||
|
||||
signal picked(var value)
|
||||
|
||||
// Connected rather than handled inline: a caller that declares its own
|
||||
// `onPicked` replaces a handler written in this file, and a schema-bound
|
||||
// row that silently stopped writing would be a bad way to find that out.
|
||||
Connections {
|
||||
target: root
|
||||
function onPicked(value: var): void {
|
||||
if (root.setting !== "")
|
||||
SystemSettings.commitPreference(root.setting, value);
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var currentOption:
|
||||
root.options.find(option => option.value === root.current) ?? null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user