From owner feedback: - The body Flickable now has a visible ListScrollbar (wrapped in a Rectangle so it can overlay) — the review step with multiple DAC accordions can be tall. - Configure step gains Tauri-style progress checkboxes (backup / config files / restart) so the user can track what they ran; Next is gated on all three. - The trigger moves to the end of the BIT-PERFECT group (the wizard's whole point is bit-perfect) and now wears the FLACDalf (gandalf) icon, which also replaces the modal header icon. gandalf.svg copied into the Slint icon assets. cc
812 lines
44 KiB
Plaintext
812 lines
44 KiB
Plaintext
// 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";
|
|
import { ListScrollbar } from "ListScrollbar.slint";
|
|
|
|
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 <bool> show-manual: false;
|
|
|
|
// The four owner-curated test tracks (display only; resolution is Rust-side).
|
|
property <[string]> test-tracks: [
|
|
@tr("16-bit / 44.1 kHz — George Harrison · My Sweet Lord"),
|
|
@tr("24-bit / 44.1 kHz — Billie Eilish · LUNCH"),
|
|
@tr("24-bit / 96 kHz — Iron Maiden · Stratego"),
|
|
@tr("24-bit / 192 kHz — Toto · Africa"),
|
|
];
|
|
|
|
// 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/gandalf.svg");
|
|
width: 26px;
|
|
height: 26px;
|
|
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, with a visible
|
|
// scrollbar. Wrapped in a Rectangle so the scrollbar can overlay.
|
|
Rectangle {
|
|
vertical-stretch: 1;
|
|
body-flick := Flickable {
|
|
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 <ID> | grep node.name";
|
|
copy => {
|
|
DacWizardActions.copy-command("wpctl inspect <ID> | 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;
|
|
}
|
|
}
|
|
}
|
|
// ── Step 3: review & apply (copy-paste config) ───
|
|
if DacWizardState.step == 3: VerticalLayout {
|
|
spacing: 14px;
|
|
Text {
|
|
text: @tr("Review & Apply");
|
|
color: Theme.text-primary;
|
|
font-size: Typography.heading;
|
|
font-weight: Typography.semibold;
|
|
}
|
|
WarningBanner {
|
|
variant: "info";
|
|
title: @tr("QBZ never writes these files");
|
|
body: @tr("QBZ already pins rate, sink and exclusive mode at runtime. These files only change system-wide behavior — copy and run them yourself if you want them. Back up first.");
|
|
}
|
|
// 1. Backup.
|
|
CommandBlock {
|
|
caption: @tr("1. Back up your current PipeWire/WirePlumber config");
|
|
command: DacWizardState.backup-cmd;
|
|
copy => {
|
|
DacWizardActions.copy-command(DacWizardState.backup-cmd);
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
spacing: 10px;
|
|
alignment: start;
|
|
QbzCheckbox { checked <=> DacWizardState.review-backup-done; }
|
|
Text {
|
|
text: @tr("I created a backup");
|
|
color: Theme.text-secondary;
|
|
font-size: Typography.legal;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
// 2. Per-DAC config — collapsible accordions.
|
|
for cfg[i] in DacWizardState.dac-configs: VerticalLayout {
|
|
spacing: 8px;
|
|
Rectangle {
|
|
height: 40px;
|
|
border-radius: Radius.sm;
|
|
background: chead.has-hover ? Theme.surface-hover : Theme.surface-elevated;
|
|
border-width: 1px;
|
|
border-color: Theme.border-subtle;
|
|
HorizontalLayout {
|
|
padding-left: 12px;
|
|
padding-right: 12px;
|
|
spacing: 8px;
|
|
QbzIcon {
|
|
width: 16px;
|
|
height: 16px;
|
|
y: (parent.height - self.height) / 2;
|
|
source: cfg.expanded
|
|
? @image-url("../assets/icons/chevron-down.svg")
|
|
: @image-url("../assets/icons/chevron-right.svg");
|
|
tint: Theme.text-muted;
|
|
}
|
|
Text {
|
|
text: cfg.name;
|
|
color: Theme.text-primary;
|
|
font-size: Typography.body;
|
|
font-weight: Typography.medium;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
horizontal-stretch: 1;
|
|
}
|
|
}
|
|
chead := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
DacWizardActions.toggle-config(i);
|
|
}
|
|
}
|
|
}
|
|
if cfg.expanded: VerticalLayout {
|
|
spacing: 8px;
|
|
CommandBlock {
|
|
caption: @tr("Sample-rate switching (PipeWire)");
|
|
command: cfg.pipewire-conf;
|
|
copy => {
|
|
DacWizardActions.copy-command(cfg.pipewire-conf);
|
|
}
|
|
}
|
|
CommandBlock {
|
|
caption: @tr("Per-app bit-perfect (PipeWire client)");
|
|
command: cfg.pulse-conf;
|
|
copy => {
|
|
DacWizardActions.copy-command(cfg.pulse-conf);
|
|
}
|
|
}
|
|
CommandBlock {
|
|
caption: @tr("Pin the DAC + rates (WirePlumber)");
|
|
command: cfg.wireplumber-conf;
|
|
copy => {
|
|
DacWizardActions.copy-command(cfg.wireplumber-conf);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
spacing: 10px;
|
|
alignment: start;
|
|
QbzCheckbox { checked <=> DacWizardState.review-config-done; }
|
|
Text {
|
|
text: @tr("I created the configuration files");
|
|
color: Theme.text-secondary;
|
|
font-size: Typography.legal;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
// 3. Restart (init-aware).
|
|
CommandBlock {
|
|
caption: @tr("3. Restart the audio services to load the config");
|
|
command: DacWizardState.restart-cmd;
|
|
copy => {
|
|
DacWizardActions.copy-command(DacWizardState.restart-cmd);
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
spacing: 10px;
|
|
alignment: start;
|
|
QbzCheckbox { checked <=> DacWizardState.review-restart-done; }
|
|
Text {
|
|
text: @tr("I restarted the audio services");
|
|
color: Theme.text-secondary;
|
|
font-size: Typography.legal;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
// ── Step 4: self-service playback test ───────────
|
|
if DacWizardState.step == 4: VerticalLayout {
|
|
spacing: 14px;
|
|
Text {
|
|
text: @tr("Test Playback");
|
|
color: Theme.text-primary;
|
|
font-size: Typography.heading;
|
|
font-weight: Typography.semibold;
|
|
}
|
|
Text {
|
|
text: @tr("Plays four tracks at different bit-depths and sample rates through the selected DAC. Watch your DAC's display switch rates — and confirm it below.");
|
|
color: Theme.text-secondary;
|
|
font-size: Typography.body;
|
|
wrap: word-wrap;
|
|
}
|
|
// The four tracks — click one to jump straight to it
|
|
// while testing (no need to wait for each to finish).
|
|
VerticalLayout {
|
|
spacing: 4px;
|
|
for line[idx] in root.test-tracks: Rectangle {
|
|
height: 26px;
|
|
border-radius: Radius.sm;
|
|
background: (trow.has-hover && DacWizardState.test-playing)
|
|
? Theme.surface-hover : transparent;
|
|
HorizontalLayout {
|
|
padding-left: 6px;
|
|
padding-right: 6px;
|
|
spacing: 8px;
|
|
alignment: start;
|
|
// Fixed glyph slot (width + height) so the
|
|
// ♪→▶ hover swap can never reflow the row.
|
|
Text {
|
|
width: 14px;
|
|
height: 26px;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
text: (trow.has-hover && DacWizardState.test-playing) ? "▶" : "♪";
|
|
color: (trow.has-hover && DacWizardState.test-playing)
|
|
? Theme.accent : Theme.text-muted;
|
|
font-size: Typography.legal;
|
|
}
|
|
Text {
|
|
text: line;
|
|
color: Theme.text-secondary;
|
|
font-size: Typography.legal;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
horizontal-stretch: 1;
|
|
}
|
|
}
|
|
trow := TouchArea {
|
|
mouse-cursor: DacWizardState.test-playing ? pointer : default;
|
|
clicked => {
|
|
if (DacWizardState.test-playing) {
|
|
DacWizardActions.test-play-index(idx);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Play / Stop + the "use my own music" escape.
|
|
HorizontalLayout {
|
|
alignment: start;
|
|
spacing: 10px;
|
|
QbzPrimaryButton {
|
|
height: 34px;
|
|
label: DacWizardState.test-playing ? @tr("Stop") : @tr("Play test");
|
|
clicked => {
|
|
if (DacWizardState.test-playing) {
|
|
DacWizardActions.stop-test();
|
|
} else {
|
|
DacWizardActions.start-test();
|
|
}
|
|
}
|
|
}
|
|
// For users who'd rather verify with their own
|
|
// queue than the curated tracks.
|
|
if !DacWizardState.test-playing: SecondaryButton {
|
|
label: @tr("Use my own music");
|
|
clicked => {
|
|
DacWizardActions.verify-own();
|
|
}
|
|
}
|
|
}
|
|
// Live read-back: requested (honest) + DAC negotiated (N6).
|
|
if DacWizardState.test-playing || DacWizardState.test-requested-label != "": Rectangle {
|
|
border-radius: Radius.sm;
|
|
background: Theme.surface-elevated;
|
|
border-width: 1px;
|
|
border-color: Theme.border-subtle;
|
|
height: readout.preferred-height;
|
|
readout := VerticalLayout {
|
|
padding: 12px;
|
|
spacing: 6px;
|
|
Text {
|
|
text: DacWizardState.test-requested-label;
|
|
color: Theme.text-primary;
|
|
font-size: Typography.body;
|
|
font-weight: Typography.medium;
|
|
}
|
|
HorizontalLayout {
|
|
spacing: 8px;
|
|
alignment: start;
|
|
if DacWizardState.test-rate-matched: Text {
|
|
text: "✓";
|
|
color: #3fae6a;
|
|
font-size: Typography.body;
|
|
font-weight: Typography.bold;
|
|
}
|
|
Text {
|
|
text: DacWizardState.test-negotiated-label;
|
|
color: DacWizardState.test-rate-matched ? #3fae6a : Theme.text-secondary;
|
|
font-size: Typography.body;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Drives the read-back while the test plays.
|
|
Timer {
|
|
interval: 1.5s;
|
|
running: DacWizardState.test-playing;
|
|
triggered => {
|
|
DacWizardActions.poll-test();
|
|
}
|
|
}
|
|
}
|
|
// ── Step 5: done ─────────────────────────────────
|
|
if DacWizardState.step == 5: VerticalLayout {
|
|
spacing: 14px;
|
|
HorizontalLayout {
|
|
spacing: 10px;
|
|
alignment: start;
|
|
QbzIcon {
|
|
width: 24px;
|
|
height: 24px;
|
|
source: @image-url("../assets/icons/circle-check-big.svg");
|
|
tint: #3fae6a;
|
|
}
|
|
Text {
|
|
text: @tr("All set");
|
|
color: Theme.text-primary;
|
|
font-size: Typography.heading;
|
|
font-weight: Typography.semibold;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
Text {
|
|
text: @tr("Your DAC is ready for bit-perfect playback. If you applied the config files, restart the audio services (or log out and back in) for them to take effect.");
|
|
color: Theme.text-secondary;
|
|
font-size: Typography.body;
|
|
wrap: word-wrap;
|
|
}
|
|
if DacWizardState.created-paths.length > 0: VerticalLayout {
|
|
spacing: 6px;
|
|
Text {
|
|
text: @tr("Config files you can create:");
|
|
color: Theme.text-secondary;
|
|
font-size: Typography.legal;
|
|
font-weight: Typography.medium;
|
|
}
|
|
for p in DacWizardState.created-paths: Text {
|
|
text: p;
|
|
color: Theme.text-muted;
|
|
font-size: Typography.legal;
|
|
font-family: "monospace";
|
|
overflow: elide;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ListScrollbar {
|
|
x: parent.width - self.width - 2px;
|
|
width: 12px;
|
|
height: 100%;
|
|
viewport-height: body-flick.viewport-height;
|
|
visible-height: body-flick.height;
|
|
viewport-y <=> body-flick.viewport-y;
|
|
}
|
|
}
|
|
|
|
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)
|
|
: (DacWizardState.step == 3
|
|
? (DacWizardState.review-backup-done
|
|
&& DacWizardState.review-config-done
|
|
&& DacWizardState.review-restart-done)
|
|
: true));
|
|
clicked => {
|
|
if (DacWizardState.step == 5) {
|
|
DacWizardState.open = false;
|
|
} else {
|
|
// Entering the DACs step kicks off enumeration.
|
|
if (DacWizardState.step == 1) {
|
|
DacWizardActions.run-detect();
|
|
}
|
|
// Entering review generates the per-DAC config.
|
|
if (DacWizardState.step == 2) {
|
|
DacWizardActions.gen-configs();
|
|
}
|
|
DacWizardState.step += 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|