// HiFi Wizard (DAC setup) — QML port of // crates/qbz-ui/ui/primitives/DacWizardModal.slint. // // Six steps: Welcome · Check · DACs · Configure · Test · Done. The wizard is // READ-ONLY — it auto-detects DACs, shows the exact commands and config to // copy, and plays four test tracks so the user can watch their DAC switch // rates. It NEVER writes a system file. // // MODAL RECIPE, from the reference (:8-9): an overlay Item, NOT a window grab, // so playback keeps running underneath while the test step plays. The scrim, // the header X and the footer Close all just hide it; Rust's `close()` stops // nothing. // // MOUNTED AT THE SETTINGS VIEW ROOT, beside SettingsConfirmHost — the panels // are Columns inside a Flickable, so a modal mounted in one would be sized by // the scrolled content and ride the scroll. ADR-009: z >= 3000. // // ── WHAT THIS FILE OWNS AND WHAT RUST OWNS ──────────────────────────────── // Rust (dac_wizard_qt.rs) owns everything it COMPUTES — the probe verdict, the // candidate list AND its checkboxes, the manual node name's validity, the // generated configs and their accordion state, the read-back labels — plus // `open`, because the Settings row's click must reset and probe atomically. // // This file owns the pure NAVIGATION state: `step`, the welcome checkbox, the // three review progress checkboxes and the manual-entry disclosure. That is // the reference's own split — DacWizardModal.slint mutates those inline and // never calls Rust for them (:817 `step -= 1`, :853 `step += 1`). They reset // on `openSeq`, which Rust bumps on every open. // // The one field that is deliberately BOTH: the manual node.name. Rust stores // it (checked_dacs reads it) but this file keeps the TextInput's own text and // never writes the document back into it — republishing into a focused input // is how a cursor jumps to the end mid-word. import QtQuick import com.blitzfc.qbz import "../controls" import "../theme" import "../views/local" Item { id: root // An unopened overlay is an invisible, non-interactive Item and costs // nothing. `anchors.fill` + `enabled` live HERE, not at the mount site — // the sibling LibFolderEditModal.qml sets the same three, so a mount is // one line. anchors.fill: parent z: 3000 visible: doc.open === true enabled: root.visible readonly property var doc: JSON.parse(QbzDacWizard.wizardJson) readonly property var candidates: doc.candidates || [] readonly property var remediations: doc.remediations || [] readonly property var dacConfigs: doc.dacConfigs || [] readonly property var createdPaths: doc.createdPaths || [] readonly property var testTrackLines: doc.testTracks || [] // ---- QML-owned navigation state (see the header) ---------------------- // 0 welcome · 1 check · 2 select-dacs · 3 review · 4 test · 5 done property int step: 0 property bool welcomeConfirmed: false property bool reviewBackupDone: false property bool reviewConfigDone: false property bool reviewRestartDone: false // "Can't see your DAC?" is collapsed by default when enumeration found // devices; forced open when it found none. property bool showManual: false readonly property int openSeq: doc.openSeq || 0 onOpenSeqChanged: { root.step = 0 root.welcomeConfirmed = false root.reviewBackupDone = false root.reviewConfigDone = false root.reviewRestartDone = false root.showManual = false manualInput.text = "" } // Step labels for the header rail (index = step). readonly property var stepLabels: [ QbzSession.tr("Welcome", QbzSession.trRev), QbzSession.tr("Check", QbzSession.trRev), QbzSession.tr("DACs", QbzSession.trRev), QbzSession.tr("Configure", QbzSession.trRev), QbzSession.tr("Test", QbzSession.trRev), QbzSession.tr("Done", QbzSession.trRev) ] // The footer primary's gate, per step (reference :832-840): // 0 → the accept checkbox // 2 → at least one DAC checked, or a valid manual node.name // 3 → all three review checkboxes // else → always enabled readonly property bool primaryEnabled: { if (root.step === 0) return root.welcomeConfirmed if (root.step === 2) return (root.doc.anyDacSelected === true) || (root.doc.manualValid === true) if (root.step === 3) return root.reviewBackupDone && root.reviewConfigDone && root.reviewRestartDone return true } QbzTheme { id: theme } // A whole-row-clickable checkbox (HTML