phoebus_os/installer/live/desktop/common/PhoebusToggle.qml
Phoebus 34c12d3dd8 feat(installer): rebuild the graphical journey and fix interaction defects
Rework the graphical installer into a fixed first-time-user sequence
(Welcome, Language and keyboard, Internet and readiness, AI connection,
Destination disk, Account and encryption, Review and confirmation,
Installation, Completion) with configuration, validation, plans, approval
and execution still authoritative in Rust.

Fix the audited interaction defects: readiness `Re-check` is a read-only
probe that no longer resets the step or clears the disk; model catalogs are
fetched after syncing the edited settings and credentials and stale replies
are ignored; editing a connection field invalidates the validated state;
suggestion lists support arrow/Enter/Escape with a visible highlight and
accessibility; the keyboard step labels the live-session limitation
truthfully; readiness separates the local link from reachable install
services; and busy states always clear, with the bridge failing outstanding
requests when the backend exits.

Add human-readable language/keyboard names, an explicit AI change review
(Accept/Discard), backend-fact review with edit links, real stage progress
with elapsed time and activity, and clearer failure and completion guidance.

Extend the VM harness with a `gui-install` mode that drives the whole
journey through the visible controls, plus regressions for readiness
refresh, disk survival, keyboard suggestion selection and AI invalidation.
Add Rust tests for readiness, the network probe, error kinds and labels.
2026-09-22 08:17:03 -07:00

90 lines
2.5 KiB
Bash

import QtQuick
// A label + switch. Clickable and keyboard-operable (Space/Enter).
Item {
id: toggle
property string label: ""
property string description: ""
property bool checked: false
signal toggled(bool value)
implicitHeight: description.length > 0 ? 52 : 36
width: parent ? parent.width : implicitWidth
activeFocusOnTab: true
Accessible.role: Accessible.CheckBox
Accessible.name: label
Accessible.checked: checked
Keys.onPressed: event => {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter
|| event.key === Qt.Key_Space) {
toggle.checked = !toggle.checked;
toggle.toggled(toggle.checked);
event.accepted = true;
}
}
function toggleValue() {
toggle.checked = !toggle.checked;
toggle.toggled(toggle.checked);
}
Column {
anchors.left: parent.left
anchors.right: switchBox.left
anchors.rightMargin: 16
anchors.verticalCenter: parent.verticalCenter
spacing: 2
Text {
width: parent.width
text: toggle.label
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: Theme.fontBody
}
Text {
width: parent.width
text: toggle.description
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontSmall
wrapMode: Text.WordWrap
visible: toggle.description.length > 0
}
}
Rectangle {
id: switchBox
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
width: 44
height: 24
radius: 12
color: toggle.checked ? Theme.amberDeep : Theme.border
border.width: toggle.activeFocus ? 2 : 0
border.color: Theme.focusRing
Rectangle {
width: 18
height: 18
radius: 9
y: 3
x: toggle.checked ? parent.width - width - 3 : 3
color: toggle.checked ? Theme.warmWhite : Theme.muted
Behavior on x {
NumberAnimation { duration: 90 }
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
toggle.forceActiveFocus();
toggle.checked = !toggle.checked;
toggle.toggled(toggle.checked);
}
}
}
}