// HiFi Wizard (DAC setup) — Slint shell. Slice 5: the 6-step modal skeleton // (scrim + card + stepper + footer nav). Navigation is handled inline by // mutating DacWizardState (open/close/next/back need no Rust). Step bodies are // filled by later slices: welcome (here) · check (S6) · select-dacs (S7) · // review (S10) · test (S9) · done (S10). The wizard stays READ-ONLY — it never // writes a system audio file. // // Modal recipe mirrors PlaylistImportModal: overlay Rectangle (not a window // grab), so playback keeps running underneath while the test step plays. import { Theme } from "../foundation/semantic-colors.slint"; import { Typography } from "../foundation/typography.slint"; import { Radius } from "../foundation/radius.slint"; import { DacWizardState, DacWizardActions } from "../state.slint"; import { QbzIcon } from "QbzIcon.slint"; import { QbzPrimaryButton } from "QbzPrimaryButton.slint"; import { SecondaryButton } from "SecondaryButton.slint"; import { QbzCheckbox } from "QbzCheckbox.slint"; import { QbzSelect } from "QbzSelect.slint"; import { CommandBlock } from "CommandBlock.slint"; import { WarningBanner } from "WarningBanner.slint"; import { SelectionCheckbox } from "SelectionCheckbox.slint"; // Temporary titled placeholder for steps not yet built. Removed as each step // lands (Slices 6/7/9/10). component StepPlaceholder inherits VerticalLayout { in property title; in property note; spacing: 10px; Text { text: root.title; color: Theme.text-primary; font-size: Typography.heading; font-weight: Typography.semibold; wrap: word-wrap; } Text { text: root.note; color: Theme.text-muted; font-size: Typography.body; wrap: word-wrap; } } export component DacWizardModal inherits Rectangle { visible: DacWizardState.open; // "Can't see your DAC?" manual escape hatch is collapsed by default when // enumeration found devices; forced open when it found none. property show-manual: false; // Step labels for the header rail (index = DacWizardState.step). property <[string]> steps: [ @tr("Welcome"), @tr("Check"), @tr("DACs"), @tr("Configure"), @tr("Test"), @tr("Done"), ]; if DacWizardState.open: Rectangle { background: #000000bf; // Scrim — click outside closes. TouchArea { mouse-cursor: default; clicked => { DacWizardState.open = false; } } card := Rectangle { width: Math.min(root.width - 80px, 620px); height: Math.min(Math.max(500px, body.preferred-height + 210px), root.height * 0.9); x: Math.round((parent.width - self.width) / 2 / 1px) * 1px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; border-radius: Radius.lg; background: Theme.surface-card; border-width: 1px; border-color: Theme.border-subtle; drop-shadow-blur: 32px; drop-shadow-color: #00000080; // Swallow clicks so they never reach the scrim. TouchArea { } VerticalLayout { padding: 0px; spacing: 0px; // Header: wand icon + title + close-x. HorizontalLayout { padding-left: 24px; padding-right: 24px; padding-top: 20px; padding-bottom: 20px; spacing: 10px; VerticalLayout { alignment: center; QbzIcon { source: @image-url("../assets/icons/circle-check-big.svg"); width: 24px; height: 24px; tint: #3fae6a; } } Text { text: @tr("HiFi Wizard — DAC Setup"); color: Theme.text-primary; font-size: Typography.section; font-weight: Typography.semibold; horizontal-stretch: 1; vertical-alignment: center; } close-x := TouchArea { width: 28px; height: 28px; mouse-cursor: pointer; clicked => { DacWizardState.open = false; } QbzIcon { source: @image-url("../assets/icons/x.svg"); width: 17px; height: 17px; x: Math.round((parent.width - self.width) / 2 / 1px) * 1px; y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted; } } } Rectangle { height: 1px; background: Theme.border-subtle; } // Stepper rail — dots + labels, colored by progress. HorizontalLayout { padding-left: 24px; padding-right: 24px; padding-top: 14px; padding-bottom: 14px; spacing: 6px; for label[idx] in root.steps: HorizontalLayout { spacing: 6px; horizontal-stretch: 1; VerticalLayout { alignment: center; Rectangle { width: 10px; height: 10px; border-radius: 5px; background: idx <= DacWizardState.step ? #3fae6a : Theme.border-muted; } } Text { text: label; color: idx == DacWizardState.step ? Theme.text-primary : (idx < DacWizardState.step ? Theme.text-secondary : Theme.text-muted); font-size: Typography.legal; font-weight: idx == DacWizardState.step ? Typography.semibold : Typography.regular; vertical-alignment: center; overflow: elide; horizontal-stretch: 1; } } } Rectangle { height: 1px; background: Theme.border-subtle; } // Body — scrolls when a step outgrows the card. Flickable { vertical-stretch: 1; viewport-width: self.width; viewport-height: body.preferred-height; body := VerticalLayout { padding: 24px; spacing: 16px; alignment: start; // ── Step 0: welcome ────────────────────────────── if DacWizardState.step == 0: VerticalLayout { spacing: 14px; Text { text: @tr("Guided DAC Setup"); color: Theme.text-primary; font-size: Typography.heading; font-weight: Typography.semibold; } Text { text: @tr("This wizard helps you configure your DAC for bit-perfect playback on Linux. QBZ never changes your system automatically — it auto-detects your DACs, shows you the exact commands and config to copy, and lets you test playback right here."); color: Theme.text-secondary; font-size: Typography.body; wrap: word-wrap; } Text { text: @tr("You are responsible for your own backups. This is a helper, not a system recovery tool."); color: Theme.text-muted; font-size: Typography.legal; wrap: word-wrap; } HorizontalLayout { spacing: 10px; alignment: start; // QbzCheckbox self-flips `checked` and emits // toggled(); the two-way bind syncs the state, so // no toggled handler (it would double-flip). QbzCheckbox { checked <=> DacWizardState.welcome-confirmed; } Text { text: @tr("I understand and accept these terms"); color: Theme.text-secondary; font-size: Typography.body; vertical-alignment: center; } } } // ── Steps 1..5: placeholders (filled by later slices) // ── Step 1: check audio stack ──────────────────── if DacWizardState.step == 1: VerticalLayout { spacing: 14px; Text { text: @tr("Check Audio Stack"); color: Theme.text-primary; font-size: Typography.heading; font-weight: Typography.semibold; } // Sandboxed (Flatpak/Snap): can't probe the host — // show an info notice + reference commands instead. if DacWizardState.sandboxed: WarningBanner { variant: "info"; title: @tr("Sandboxed — host check unavailable"); body: @tr("QBZ is packaged as Flatpak/Snap and can't inspect your host audio stack. If playback already works, you're set. Pick your distribution and init system below for the right setup commands."); } if !DacWizardState.sandboxed && DacWizardState.health-ok: WarningBanner { variant: "success"; title: @tr("Audio stack ready"); body: DacWizardState.health-summary; } if !DacWizardState.sandboxed && !DacWizardState.health-ok: WarningBanner { variant: "warning"; title: @tr("Some packages are missing"); body: DacWizardState.health-summary; } // Distro — auto-detected, always overridable (Decision 4). VerticalLayout { spacing: 8px; Text { text: @tr("Your distribution"); color: Theme.text-secondary; font-size: Typography.legal; font-weight: Typography.medium; } QbzSelect { options: DacWizardState.distro-options; current-index: DacWizardState.distro-index; menu-width: 360px; selected(i) => { DacWizardActions.set-distro(i); } } } // Init system — auto-detected at runtime; override to // generate service commands for another machine. VerticalLayout { spacing: 8px; Text { text: @tr("Init system (service commands)"); color: Theme.text-secondary; font-size: Typography.legal; font-weight: Typography.medium; } QbzSelect { options: DacWizardState.init-options; current-index: DacWizardState.init-index; menu-width: 240px; selected(i) => { DacWizardActions.set-init(i); } } } // One copy-paste fix per missing piece (empty when ready). for r in DacWizardState.remediations: CommandBlock { caption: r.caption; command: r.command; copy => { DacWizardActions.copy-command(r.command); } } } // ── Step 2: select DACs (auto-detect + escape hatch) ── if DacWizardState.step == 2: VerticalLayout { spacing: 14px; Text { text: @tr("Which DACs do you want to configure?"); color: Theme.text-primary; font-size: Typography.heading; font-weight: Typography.semibold; wrap: word-wrap; } if DacWizardState.detecting: Text { text: @tr("Detecting your DACs…"); color: Theme.text-muted; font-size: Typography.body; } // Enumerated candidates — circular multi-select. for c[i] in DacWizardState.candidates: Rectangle { height: cand-row.preferred-height; border-radius: Radius.sm; background: c.checked ? Theme.surface-hover : transparent; cand-row := HorizontalLayout { padding: 8px; spacing: 12px; VerticalLayout { alignment: center; SelectionCheckbox { checked: c.checked; toggled => { DacWizardActions.toggle-dac(i); } } } VerticalLayout { spacing: 4px; horizontal-stretch: 1; Text { text: c.description; color: Theme.text-primary; font-size: Typography.body; font-weight: Typography.medium; overflow: elide; } HorizontalLayout { spacing: 8px; alignment: start; // Bus label — bordered box, NOT a pill (ADR-008). if c.bus != "": Rectangle { border-radius: Radius.sm; border-width: 1px; border-color: Theme.border-subtle; background: Theme.surface-elevated; height: 18px; HorizontalLayout { padding-left: 6px; padding-right: 6px; Text { text: c.bus; color: Theme.text-muted; font-size: 10px; font-weight: Typography.semibold; vertical-alignment: center; } } } if c.is-default: Text { text: @tr("default"); color: #3fae6a; font-size: Typography.legal; vertical-alignment: center; } if c.rates-label != "": Text { text: c.rates-label; color: Theme.text-muted; font-size: Typography.legal; vertical-alignment: center; overflow: elide; } } } } } // Escape-hatch toggle (only when enumeration found devices; // otherwise the manual block shows unconditionally). if DacWizardState.has-enumeration: TouchArea { height: 22px; mouse-cursor: pointer; clicked => { root.show-manual = !root.show-manual; } Text { text: root.show-manual ? @tr("Hide manual entry") : @tr("Can't see your DAC?"); color: Theme.accent; font-size: Typography.legal; vertical-alignment: center; } } // Manual node.name entry (escape hatch). if root.show-manual || !DacWizardState.has-enumeration: VerticalLayout { spacing: 10px; Text { text: @tr("Find your DAC's PipeWire node name and paste it here:"); color: Theme.text-secondary; font-size: Typography.legal; wrap: word-wrap; } CommandBlock { caption: @tr("1. Find your DAC under 'Audio > Sinks' and note its number"); command: "wpctl status"; copy => { DacWizardActions.copy-command("wpctl status"); } } CommandBlock { caption: @tr("2. Run with that number to read the node.name"); command: "wpctl inspect | grep node.name"; copy => { DacWizardActions.copy-command("wpctl inspect | grep node.name"); } } Rectangle { height: 43px; border-radius: Radius.sm; background: Theme.surface-card; border-width: 1px; border-color: node-input.has-focus ? Theme.accent : Theme.border-subtle; HorizontalLayout { padding-left: 12px; padding-right: 12px; Rectangle { horizontal-stretch: 1; clip: true; node-input := TextInput { width: 100%; height: 100%; color: Theme.text-primary; font-size: Typography.link; vertical-alignment: center; single-line: true; text <=> DacWizardState.manual-node-name; edited => { DacWizardActions.validate-manual(self.text); } } Text { visible: node-input.text == ""; text: "alsa_output.usb-..."; color: Theme.text-muted; font-size: Typography.link; vertical-alignment: center; } } } } if DacWizardState.manual-node-name != "": Text { text: DacWizardState.manual-valid ? @tr("Valid node name") : @tr("Invalid — should contain alsa_output or alsa_input"); color: DacWizardState.manual-valid ? #3fae6a : #e0564f; font-size: Typography.legal; } } } if DacWizardState.step == 3: StepPlaceholder { title: @tr("Review & Apply"); note: @tr("Backup, per-DAC sample rates, and the copy-paste config files (Slice 10)."); } if DacWizardState.step == 4: StepPlaceholder { title: @tr("Test Playback"); note: @tr("Plays tracks at 16/44.1, 24/44.1, 24/96 and 24/192 and reads the DAC's real negotiated rate (Slice 9)."); } if DacWizardState.step == 5: StepPlaceholder { title: @tr("All set"); note: @tr("Summary and the config paths you created (Slice 10)."); } } } Rectangle { height: 1px; background: Theme.border-subtle; } // Footer: Back · Close · primary (Start/Next/Finish). HorizontalLayout { padding-left: 24px; padding-right: 24px; padding-top: 16px; padding-bottom: 20px; spacing: 12px; // Back — hidden on the first step. if DacWizardState.step > 0: SecondaryButton { label: @tr("Back"); clicked => { DacWizardState.step -= 1; } } Rectangle { horizontal-stretch: 1; } SecondaryButton { label: @tr("Close"); clicked => { DacWizardState.open = false; } } QbzPrimaryButton { height: 34px; label: DacWizardState.step == 0 ? @tr("Start") : (DacWizardState.step == 5 ? @tr("Finish") : @tr("Next")); // step 0: accept checkbox · step 2: ≥1 DAC or a valid manual node.name. enabled: DacWizardState.step == 0 ? DacWizardState.welcome-confirmed : (DacWizardState.step == 2 ? (DacWizardState.any-dac-selected || DacWizardState.manual-valid) : true); clicked => { if (DacWizardState.step == 5) { DacWizardState.open = false; } else { // Entering the DACs step kicks off enumeration. if (DacWizardState.step == 1) { DacWizardActions.run-detect(); } DacWizardState.step += 1; } } } } } } } }