feat(slint): HiFi wizard review-and-apply + done steps — config generation (Slice 10)
The review step generates the copy-paste config per selected DAC (read-only — QBZ never writes these files, Decision 2): an honest info banner, a backup CommandBlock first, then one collapsible accordion per DAC (Decision 5 multi-DAC) holding the three snippets ported 1:1 from the Tauri wizard — pipewire allowed-rates, per-app bit-perfect client rules, and the WirePlumber rule that pins node.name + rates + disables resample/channelmix — and finally an init-aware restart CommandBlock. Rates are re-probed at generation time (query_dac_capabilities); the filename slug is the description (fixes the old dacShortName regex that only kept two underscore tokens). The done step lists the config paths. Controller: checked_dacs -> gen_configs_blocking (off-thread re-probe + template build via line-join, no format!-brace escaping) -> apply_configs; toggle_config flips an accordion. gen-configs fires on the select-dacs -> review transition. 2 unit tests (slugify, wireplumber pins node+rates). DacConfigRow state + gen-configs/toggle-config actions. cc
This commit is contained in:
5 files changed
+404
-8
No files matched your search
@@ -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, RemediationRow, 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, DacConfigRow, 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`.
|
||||
|
||||
@@ -459,9 +459,100 @@ export component DacWizardModal inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
if DacWizardState.step == 3: StepPlaceholder {
|
||||
title: @tr("Review & Apply");
|
||||
note: @tr("Backup, per-DAC sample rates, and the copy-paste config files (Slice 10).");
|
||||
// ── 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);
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
// ── Step 4: self-service playback test ───────────
|
||||
if DacWizardState.step == 4: VerticalLayout {
|
||||
@@ -590,9 +681,48 @@ export component DacWizardModal inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
if DacWizardState.step == 5: StepPlaceholder {
|
||||
title: @tr("All set");
|
||||
note: @tr("Summary and the config paths you created (Slice 10).");
|
||||
// ── 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -638,6 +768,10 @@ export component DacWizardModal inherits Rectangle {
|
||||
if (DacWizardState.step == 1) {
|
||||
DacWizardActions.run-detect();
|
||||
}
|
||||
// Entering review generates the per-DAC config.
|
||||
if (DacWizardState.step == 2) {
|
||||
DacWizardActions.gen-configs();
|
||||
}
|
||||
DacWizardState.step += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3876,6 +3876,16 @@ export struct DacCandidateRow {
|
||||
rates-label: string, // pre-filled supported rates, e.g. "44.1 / 96 / 192 kHz"
|
||||
}
|
||||
|
||||
// One selected DAC's generated copy-paste config (Slice 10, read-only).
|
||||
export struct DacConfigRow {
|
||||
name: string,
|
||||
node-name: string,
|
||||
pipewire-conf: string,
|
||||
pulse-conf: string,
|
||||
wireplumber-conf: string,
|
||||
expanded: bool, // accordion state
|
||||
}
|
||||
|
||||
export global DacWizardState {
|
||||
in-out property <bool> open: false;
|
||||
// 0 welcome · 1 check · 2 select-dacs · 3 review · 4 test · 5 done
|
||||
@@ -3912,6 +3922,12 @@ export global DacWizardState {
|
||||
in-out property <string> test-negotiated-label: ""; // "DAC running at 96000 Hz" (N6)
|
||||
in-out property <bool> test-rate-matched: false;
|
||||
in-out property <bool> test-playing: false;
|
||||
|
||||
// review-and-apply (Slice 10): generated copy-paste config per selected DAC.
|
||||
in-out property <[DacConfigRow]> dac-configs: [];
|
||||
in-out property <string> backup-cmd: "";
|
||||
in-out property <string> restart-cmd: "";
|
||||
in-out property <[string]> created-paths: []; // done step
|
||||
}
|
||||
|
||||
export global DacWizardActions {
|
||||
@@ -3929,4 +3945,6 @@ export global DacWizardActions {
|
||||
callback poll-test(); // refresh the requested-vs-negotiated read-back
|
||||
callback test-play-index(int); // jump straight to one of the 4 test tracks
|
||||
callback stop-test();
|
||||
callback gen-configs(); // build the per-DAC copy-paste config (Slice 10)
|
||||
callback toggle-config(int); // collapse/expand one DAC's config accordion
|
||||
}
|
||||
Reference in new issue
Block a user