phoebus_os/installer/live/desktop/common/PhoebusField.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

173 lines
5.6 KiB
Bash

import QtQuick
// A labelled single-line input with an inline error and optional secret echo.
//
// It forwards the arrow/Escape keys as signals so a wrapping combo box can
// implement keyboard selection without the field knowing about suggestions.
Column {
id: field
property string label: ""
property string placeholder: ""
property string error: ""
property bool secret: false
property bool showSecret: false
// When true, an Escape key is consumed here (used to close a suggestion
// list). Otherwise it bubbles so the window can react to it.
property bool escapeConsumed: false
// When true, Return/Enter is consumed here (used to select a highlighted
// suggestion). Otherwise it bubbles so the page can advance.
property bool returnConsumed: false
property alias text: input.text
property alias inputItem: input
property int maxLength: 256
signal edited(string value)
signal accepted
signal keyUp
signal keyDown
signal keyEscape
width: parent ? parent.width : implicitWidth
spacing: 6
function forceFocus() {
input.forceActiveFocus();
}
Text {
width: parent.width
text: field.label
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: Theme.fontSmall
font.weight: Font.DemiBold
visible: field.label.length > 0
}
Rectangle {
width: parent.width
height: Theme.controlHeight
radius: Theme.radiusSmall
color: Theme.charcoal
border.width: input.activeFocus ? 2 : 1
border.color: field.error.length > 0 ? Theme.danger
: input.activeFocus ? Theme.focusRing
: Theme.border
TextInput {
id: input
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: field.secret ? 52 : 12
verticalAlignment: TextInput.AlignVCenter
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: Theme.fontBody
selectionColor: Theme.amberDeep
selectedTextColor: Theme.warmWhite
echoMode: (field.secret && !field.showSecret) ? TextInput.Password : TextInput.Normal
passwordCharacter: "\u2022"
selectByMouse: true
activeFocusOnTab: true
maximumLength: field.maxLength
clip: true
Accessible.role: Accessible.EditableText
Accessible.name: field.label.length > 0 ? field.label : field.placeholder
Accessible.description: field.error
onTextEdited: field.edited(text)
Keys.onReturnPressed: event => {
const consumed = field.returnConsumed;
field.accepted();
event.accepted = consumed;
}
Keys.onEnterPressed: event => {
const consumed = field.returnConsumed;
field.accepted();
event.accepted = consumed;
}
Keys.onUpPressed: event => {
event.accepted = true;
field.keyUp();
}
Keys.onDownPressed: event => {
event.accepted = true;
field.keyDown();
}
Keys.onEscapePressed: event => {
const consumed = field.escapeConsumed;
field.keyEscape();
event.accepted = consumed;
}
Text {
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
text: field.placeholder
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontBody
visible: input.text.length === 0 && !input.activeFocus
}
}
// The show/hide control is a real focus stop, reachable with Tab and
// operable with Space/Enter, so revealing a password never requires a
// mouse.
Item {
id: reveal
anchors.right: parent.right
anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
width: 40
height: 26
visible: field.secret
activeFocusOnTab: field.secret
Accessible.role: Accessible.Button
Accessible.name: field.showSecret ? "Hide " + field.label : "Show " + field.label
Accessible.onPressAction: reveal.toggle()
function toggle() {
field.showSecret = !field.showSecret;
}
Keys.onReturnPressed: reveal.toggle()
Keys.onEnterPressed: reveal.toggle()
Keys.onSpacePressed: reveal.toggle()
Rectangle {
anchors.fill: parent
radius: Theme.radiusSmall
color: "transparent"
border.width: 2
border.color: Theme.focusRing
visible: reveal.activeFocus
}
Text {
anchors.centerIn: parent
text: field.showSecret ? "hide" : "show"
color: Theme.amber
font.family: Theme.family
font.pixelSize: Theme.fontSmall
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: reveal.toggle()
}
}
}
Text {
width: parent.width
text: field.error
color: Theme.danger
font.family: Theme.family
font.pixelSize: Theme.fontSmall
wrapMode: Text.WordWrap
visible: field.error.length > 0
}
}