Slint cannot split the .slint compilation across crates, but a Slint LIBRARY crate exposes its generated Rust types to dependent crates (verified with a minimal proof). So: - NEW crate `qbz-ui` (lib): owns the whole .slint tree + build.rs + bundled translations; `slint::include_modules!()` + the generated types (AppWindow, MiniPlayerWindow, all globals/structs) are re-exported. Translation domain is now `qbz-ui` (the .po files renamed accordingly). - `qbz-slint` (bin) -> renamed to `qbz` (package + `[[bin]] name = "qbz"`), reclaiming the binary name from the retired Tauri app. It depends on `qbz-ui` and does `pub use qbz_ui::*;` so existing `crate::AppWindow` / `crate::*State` references resolve unchanged. This splits the single ~20 GB rustc into two crates (UI/codegen vs the 75k LOC of logic) — the foundation for lower build peak, incremental caching, and the upcoming per-feature crate extraction. Also fixed for the move: qbz-i18n bundled-.po include paths, the font/WGSL `include_bytes!`/`include_str!` paths (-> ../../qbz-ui/ui/), workspace members, dev scripts (`-p qbz`), and the CI workflows. `cargo check -p qbz` is green. cc
862 lines
47 KiB
Plaintext
862 lines
47 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, NowPlayingState, UiFocusState } 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";
|
|
|
|
// A whole-row-clickable checkbox (HTML <label> behavior — clicking the text
|
|
// toggles it, not just the box). The row TouchArea sits on top of the checkbox,
|
|
// so QbzCheckbox is display-only here (its internal toggle is shadowed).
|
|
component CheckRow inherits Rectangle {
|
|
in-out property <bool> checked;
|
|
in property <string> label;
|
|
height: 28px;
|
|
HorizontalLayout {
|
|
spacing: 10px;
|
|
alignment: start;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
QbzCheckbox { checked: root.checked; }
|
|
}
|
|
Text {
|
|
text: root.label;
|
|
color: Theme.text-secondary;
|
|
font-size: Typography.body;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
horizontal-stretch: 1;
|
|
}
|
|
}
|
|
TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
root.checked = !root.checked;
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
WarningBanner {
|
|
variant: "info";
|
|
title: @tr("What to test with");
|
|
body: @tr("The built-in test plays four tracks spanning different bit-depths and sample rates (16/44.1, 24/44.1, 24/96, 24/192) so you can see your DAC switch. If you'd rather use your own queue, add one track of each kind first so every rate is exercised.");
|
|
}
|
|
CheckRow {
|
|
checked <=> DacWizardState.welcome-confirmed;
|
|
label: @tr("I understand and accept these terms");
|
|
}
|
|
}
|
|
|
|
// ── 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;
|
|
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
|
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);
|
|
}
|
|
}
|
|
CheckRow {
|
|
checked <=> DacWizardState.review-backup-done;
|
|
label: @tr("I created a backup");
|
|
}
|
|
// 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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
CheckRow {
|
|
checked <=> DacWizardState.review-config-done;
|
|
label: @tr("I created the configuration files");
|
|
}
|
|
// 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);
|
|
}
|
|
}
|
|
CheckRow {
|
|
checked <=> DacWizardState.review-restart-done;
|
|
label: @tr("I restarted the audio services");
|
|
}
|
|
}
|
|
// ── 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 · Prev / Next · use-my-queue.
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
// Explicit Prev / Next — work on whatever queue is
|
|
// playing (the 4 test tracks or the user's own).
|
|
if DacWizardState.test-playing: prev-btn := Rectangle {
|
|
width: 34px;
|
|
height: 34px;
|
|
border-radius: Radius.sm;
|
|
border-width: 1px;
|
|
border-color: Theme.border-subtle;
|
|
background: prev-ta.has-hover ? Theme.surface-hover : Theme.surface-elevated;
|
|
QbzIcon {
|
|
width: 16px;
|
|
height: 16px;
|
|
x: (parent.width - self.width) / 2;
|
|
y: (parent.height - self.height) / 2;
|
|
source: @image-url("../assets/icons/skip-back.svg");
|
|
tint: prev-ta.has-hover ? Theme.text-primary : Theme.text-secondary;
|
|
}
|
|
prev-ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
NowPlayingState.previous();
|
|
}
|
|
}
|
|
}
|
|
if DacWizardState.test-playing: next-btn := Rectangle {
|
|
width: 34px;
|
|
height: 34px;
|
|
border-radius: Radius.sm;
|
|
border-width: 1px;
|
|
border-color: Theme.border-subtle;
|
|
background: next-ta.has-hover ? Theme.surface-hover : Theme.surface-elevated;
|
|
QbzIcon {
|
|
width: 16px;
|
|
height: 16px;
|
|
x: (parent.width - self.width) / 2;
|
|
y: (parent.height - self.height) / 2;
|
|
source: @image-url("../assets/icons/skip-forward.svg");
|
|
tint: next-ta.has-hover ? Theme.text-primary : Theme.text-secondary;
|
|
}
|
|
next-ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
NowPlayingState.next();
|
|
}
|
|
}
|
|
}
|
|
// Verify with the user's current queue instead of
|
|
// the curated tracks.
|
|
if !DacWizardState.test-playing: SecondaryButton {
|
|
label: @tr("Use my current queue");
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|