feat(slint): HiFi wizard check step — stack health, distro/init override, sandbox (Slice 6)

Wires the check step on top of the Slice-0/2/6 backend: a health verdict
(success/warning WarningBanner — new `success` variant), a per-missing-piece
CommandBlock with copy, and TWO overridable dropdowns — distro (package
manager) and init system (service commands), which are orthogonal so a Gentoo
box on systemd vs OpenRC gets the right restart command.

New `src/dac_wizard.rs` controller: open() runs the probe off-thread
(spawn_blocking → upgrade_in_event_loop), caches it, and recompute() rebuilds
remediations from the cached probe + the current distro/init selections.
Init-aware restart_cmd (systemd/OpenRC/runit/s6/dinit). NixOS special-cased to
a declarative configuration.nix block.

Sandbox honesty: in Flatpak/Snap the host probes are blind, so the check step
shows an info banner + reference setup commands (full stack incl. pipewire-alsa
+ restart) for the chosen distro/init instead of a false health verdict.

main.rs wires on_open/on_set_distro/on_set_init/on_copy_command; the Audio
settings trigger calls DacWizardActions.open().

cc
This commit is contained in:
vicrodh committed 2026-06-15 21:04:23 -06:00
1 parent 2b52a3c01c
commit 9c5febdaa8
7 files changed
+449 -17

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ import { Toast } from "primitives/Toast.slint";
import { ShellState } from "state.slint";
// Re-export the state globals so the Rust layer can populate them.
export { HomeState, HomeActions, DiscoverState, DiscoverActions, SectionDescriptor, ConfigRow, DiscoverBrowseState, DiscoverBrowseActions, ForYouState, MixState, GenreFilterState, GenreFilterActions, AlbumState, ArtistState, NavState, ShellState, SessionState, SettingsState, AlbumActions, ArtistActions, ArtworkActions, NowPlayingState, QueueState, LyricsState, LyricsLineItem, SearchState, SearchActions, NetworkSidebarState, NetworkSidebarActions, MusicianState, MusicianActions, LabelState, LabelActions, LocationViewState, LocationViewActions, FavoritesState, FavoritesActions, PlaylistPickerState, PlaylistPickerActions, DuplicateConfirmState, DuplicateConfirmActions, PlaylistState, PlaylistActions, SidebarState, SidebarActions, SidebarFolderPopupState, CreatePlaylistState, CreatePlaylistActions, EditPlaylistState, EditPlaylistActions, CreateFolderState, CreateFolderActions, MyQbzCreateState, MyQbzCreateActions, DragState, DragActions, PlaylistManagerState, PlaylistManagerActions, OfflineManagerState, OfflineManagerActions, MyQbzState, MyQbzActions, MixtapeCardItem, MyQbzAddState, MyQbzAddActions, MyQbzAddRow, MyQbzDetailState, MyQbzDetailActions, MixtapeDetailItem, MyQbzEditState, MyQbzEditActions, MyQbzMixState, MyQbzMixActions, DiscoBuilderState, DiscoBuilderActions, DiscoGroup, DiscoCandidate, LocalLibraryState, LocalLibraryActions, LibraryFoldersState, LibFolderEditState, LibraryManageActions, LibraryScanState, LibAlbumFilterState, LocalAlbumState, LocalAlbumActions, TagEditorState, TagEditorActions, FolderEditState, FolderEditActions, ToastState, TextUtil, QconnectDevState, QconnectDevice, AppearanceState, MyQbzBrandingState, EphemeralPlayChoiceState, EphemeralPlayChoiceActions, PlexSettingsState, PlexAuthActions, PlexSectionItem, ScrobbleState, ScrobbleActions, OfflineState, OfflineModeActions, OfflineFavoritesState, OfflineFavoritesActions, ImportLogEntry, PlaylistImportState, PlaylistImportActions, DacWizardState, DacWizardActions, DacCandidateRow, InfoCreditRow, InfoCreditPair, AlbumCreditPerformer, AlbumCreditTrack, TrackInfoState, TrackInfoActions, AlbumInfoState, AlbumInfoActions, VisualizerState, ImmersiveState } from "state.slint";
export { HomeState, HomeActions, DiscoverState, DiscoverActions, SectionDescriptor, ConfigRow, DiscoverBrowseState, DiscoverBrowseActions, ForYouState, MixState, GenreFilterState, GenreFilterActions, AlbumState, ArtistState, NavState, ShellState, SessionState, SettingsState, AlbumActions, ArtistActions, ArtworkActions, NowPlayingState, QueueState, LyricsState, LyricsLineItem, SearchState, SearchActions, NetworkSidebarState, NetworkSidebarActions, MusicianState, MusicianActions, LabelState, LabelActions, LocationViewState, LocationViewActions, FavoritesState, FavoritesActions, PlaylistPickerState, PlaylistPickerActions, DuplicateConfirmState, DuplicateConfirmActions, PlaylistState, PlaylistActions, SidebarState, SidebarActions, SidebarFolderPopupState, CreatePlaylistState, CreatePlaylistActions, EditPlaylistState, EditPlaylistActions, CreateFolderState, CreateFolderActions, MyQbzCreateState, MyQbzCreateActions, DragState, DragActions, PlaylistManagerState, PlaylistManagerActions, OfflineManagerState, OfflineManagerActions, MyQbzState, MyQbzActions, MixtapeCardItem, MyQbzAddState, MyQbzAddActions, MyQbzAddRow, MyQbzDetailState, MyQbzDetailActions, MixtapeDetailItem, MyQbzEditState, MyQbzEditActions, MyQbzMixState, MyQbzMixActions, DiscoBuilderState, DiscoBuilderActions, DiscoGroup, DiscoCandidate, LocalLibraryState, LocalLibraryActions, LibraryFoldersState, LibFolderEditState, LibraryManageActions, LibraryScanState, LibAlbumFilterState, LocalAlbumState, LocalAlbumActions, TagEditorState, TagEditorActions, FolderEditState, FolderEditActions, ToastState, TextUtil, QconnectDevState, QconnectDevice, AppearanceState, MyQbzBrandingState, EphemeralPlayChoiceState, EphemeralPlayChoiceActions, PlexSettingsState, PlexAuthActions, PlexSectionItem, ScrobbleState, ScrobbleActions, OfflineState, OfflineModeActions, OfflineFavoritesState, OfflineFavoritesActions, ImportLogEntry, PlaylistImportState, PlaylistImportActions, DacWizardState, DacWizardActions, DacCandidateRow, RemediationRow, InfoCreditRow, InfoCreditPair, AlbumCreditPerformer, AlbumCreditTrack, TrackInfoState, TrackInfoActions, AlbumInfoState, AlbumInfoActions, VisualizerState, ImmersiveState } from "state.slint";
// Which top-level screen is shown. The app starts on `splash` while it
// restores a saved session, then resolves to `shell` or `login`.
@@ -11,11 +11,14 @@
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { DacWizardState } from "../state.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";
// Temporary titled placeholder for steps not yet built. Removed as each step
// lands (Slices 6/7/9/10).
@@ -206,9 +209,77 @@ export component DacWizardModal inherits Rectangle {
}
// ── Steps 1..5: placeholders (filled by later slices)
if DacWizardState.step == 1: StepPlaceholder {
title: @tr("Check Audio Stack");
note: @tr("Auto-probes PipeWire / WirePlumber and surfaces only the packages you are missing (Slice 6).");
// ── 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);
}
}
}
if DacWizardState.step == 2: StepPlaceholder {
title: @tr("Which DACs do you want to configure?");
@@ -11,19 +11,24 @@ import { QbzIcon } from "QbzIcon.slint";
export component WarningBanner inherits Rectangle {
in property <string> title: "";
in property <string> body: "";
in property <string> variant: "warning";
in property <string> variant: "warning"; // info | warning | error | success
property <color> tone: root.variant == "error" ? #ef4444
: (root.variant == "info" ? #3b82f6 : #eab308);
: (root.variant == "info" ? #3b82f6
: (root.variant == "success" ? #3fae6a : #eab308));
property <color> bg: root.variant == "error" ? #ef44441a
: (root.variant == "info" ? #3b82f61a : #eab3081a);
: (root.variant == "info" ? #3b82f61a
: (root.variant == "success" ? #3fae6a1a : #eab3081a));
property <color> brd: root.variant == "error" ? #ef44444d
: (root.variant == "info" ? #3b82f64d : #eab3084d);
: (root.variant == "info" ? #3b82f64d
: (root.variant == "success" ? #3fae6a4d : #eab3084d));
property <image> glyph: root.variant == "error"
? @image-url("../assets/icons/circle-alert.svg")
: (root.variant == "info"
? @image-url("../assets/icons/info.svg")
: @image-url("../assets/icons/triangle-alert.svg"));
: (root.variant == "success"
? @image-url("../assets/icons/circle-check-big.svg")
: @image-url("../assets/icons/triangle-alert.svg")));
border-radius: 8px;
background: root.bg;
@@ -6,7 +6,7 @@
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { SettingsState, DacWizardState } from "../state.slint";
import { SettingsState, DacWizardActions } from "../state.slint";
import { QbzToggle } from "../primitives/QbzToggle.slint";
import { QbzSelect } from "../primitives/QbzSelect.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
@@ -292,9 +292,7 @@ export component AudioSettings inherits VerticalLayout {
wizard-ta := TouchArea {
mouse-cursor: pointer;
clicked => {
DacWizardState.open = true;
DacWizardState.step = 0;
DacWizardState.welcome-confirmed = false;
DacWizardActions.open();
}
}
}
+20 -3
View File
@@ -3859,6 +3859,12 @@ export global PlaylistImportActions {
// auto-detects DACs (pw-dump, Slice 0), generates copy-paste config, and runs
// an in-app playback test reading the real negotiated rate (N6, Slice 8b).
// A "you're missing X" fix for the check step: a caption + a copy-paste command.
export struct RemediationRow {
caption: string,
command: string,
}
// One enumerated sink the user can pick to configure.
export struct DacCandidateRow {
id: string, // PipeWire node.name (the value the user used to paste)
@@ -3878,11 +3884,19 @@ export global DacWizardState {
// welcome
in-out property <bool> welcome-confirmed: false;
// check (Slice 6): distro auto-detected, override always visible (Decision 4)
// check (Slice 6): distro + init both auto-detected, both overridable
// (distro → package manager, init → service commands; they're orthogonal).
in-out property <[string]> distro-options: [];
in-out property <int> distro-index: 0;
in-out property <[string]> init-options: [];
in-out property <int> init-index: 0;
in-out property <bool> health-ok: false;
in-out property <string> health-summary: "";
in-out property <[RemediationRow]> remediations: [];
// In a Flatpak/Snap sandbox QBZ can't inspect the host stack, so it shows
// reference setup commands + an info notice instead of a health verdict.
in-out property <bool> sandboxed: false;
in-out property <string> sandbox-name: "";
// select-dacs (Slice 7)
in-out property <[DacCandidateRow]> candidates: [];
@@ -3898,8 +3912,11 @@ export global DacWizardState {
}
export global DacWizardActions {
// Wired in Rust from Slice 6 onward (crate::dac_wizard); navigation
// (open/close/next/back) is handled inline in the modal via state mutation.
// Wired in Rust (crate::dac_wizard); plain step nav (back/close) stays
// inline in the modal via state mutation.
callback open(); // open + detect distro/init + run health probe
callback set-distro(int); // recompute remediations for the chosen distro
callback set-init(int); // recompute service commands for the chosen init
callback copy-command(string); // → crate::share::copy_to_clipboard
callback run-detect(); // enumerate sinks → candidates (Slice 7)
callback query-caps(string); // probe one DAC's rates (Slice 7)