diff --git a/crates/qbz-slint/src/main.rs b/crates/qbz-slint/src/main.rs index 5642d6423..861bf93ae 100644 --- a/crates/qbz-slint/src/main.rs +++ b/crates/qbz-slint/src/main.rs @@ -4445,6 +4445,11 @@ fn main() -> Result<(), Box> { &crate::ui_prefs::load().immersive_search_action, ), ); + window.global::().set_immersive_default_view_index( + crate::ui_prefs::immersive_default_view_index( + &crate::ui_prefs::load().immersive_default_view, + ), + ); // Theme: seed the dropdown list from the Rust registry, then restore the // persisted theme (slug is the source of truth; the dropdown index is @@ -5594,6 +5599,81 @@ fn main() -> Result<(), Box> { }); } + // ===================== Immersive default view ======================= + // The ImmersiveView is conditionally mounted, so its `init` fires `opened()` + // exactly when the overlay opens. We apply the configured default view here: + // - "remember": restore the persisted last view (view-mode/mode/split-panel). + // - pinned view: force FOCUS (view-mode 0) + the matching `mode`. + // While the overlay is open, `view-changed()` persists the current view so a + // "remember" default restores it next time (a pinned default never persists — + // the pin always wins on the next open). + { + let weak = window.as_weak(); + window + .global::() + .on_opened(move || { + let Some(w) = weak.upgrade() else { return }; + let prefs = crate::ui_prefs::load(); + let im = w.global::(); + // A pinned/restored view must not be hidden behind a shader scene. + im.set_shader_mode(0); + match prefs.immersive_default_view.as_str() { + "remember" => { + im.set_view_mode(prefs.immersive_last_view_mode); + im.set_mode(prefs.immersive_last_mode); + im.set_split_panel(prefs.immersive_last_split_panel); + } + // Pinned FOCUS views: view-mode 0 + the matching `mode`. + // reactive=0, static=1, coverflow=2, spectrum=3, lyrics=4, + // queue=5 (FOCUS-mode panel enum in ImmersiveState). + "reactive" => { + im.set_view_mode(0); + im.set_mode(0); + } + "static" => { + im.set_view_mode(0); + im.set_mode(1); + } + "coverflow" => { + im.set_view_mode(0); + im.set_mode(2); + } + "spectrum" => { + im.set_view_mode(0); + im.set_mode(3); + } + "lyrics" => { + im.set_view_mode(0); + im.set_mode(4); + } + "queue" => { + im.set_view_mode(0); + im.set_mode(5); + } + _ => {} + } + }); + } + { + let weak = window.as_weak(); + window + .global::() + .on_view_changed(move || { + let Some(w) = weak.upgrade() else { return }; + // Only persist for the "remember last" default; a pinned default + // always wins on the next open, so do not overwrite it. + let mut prefs = crate::ui_prefs::load(); + if prefs.immersive_default_view != "remember" { + return; + } + let im = w.global::(); + prefs.immersive_last_view_mode = im.get_view_mode(); + prefs.immersive_last_mode = im.get_mode(); + prefs.immersive_last_split_panel = im.get_split_panel(); + crate::ui_prefs::save(&prefs); + }); + } + // ===================== Immersive in-view search ===================== // The in-immersive search dropdown mirrors the main header cortinilla but // (1) targets ImmersiveState/ImmersiveSearchActions, (2) loads ONLY @@ -6203,6 +6283,14 @@ fn main() -> Result<(), Box> { crate::ui_prefs::immersive_search_action_for_index(index).to_string(); crate::ui_prefs::save(&prefs); } + "immersive-default-view" => { + // 0 = Remember last, 1-6 = pinned FOCUS views (reactive / static / + // coverflow / spectrum / lyrics / queue). + let mut prefs = crate::ui_prefs::load(); + prefs.immersive_default_view = + crate::ui_prefs::immersive_default_view_for_index(index).to_string(); + crate::ui_prefs::save(&prefs); + } "theme" => { // Slug is the source of truth: map the dropdown index -> stable // id, persist the slug, then hot-switch the live palette. diff --git a/crates/qbz-slint/src/playback.rs b/crates/qbz-slint/src/playback.rs index b164f4a24..63fd4343e 100644 --- a/crates/qbz-slint/src/playback.rs +++ b/crates/qbz-slint/src/playback.rs @@ -1200,8 +1200,14 @@ fn load_now_playing_artwork_large(weak: slint::Weak, art: qbz_models: return; }; tokio::spawn(async move { + // Decode at high resolution (was 300 — the hover-preview size). The + // IMMERSIVE view grows this cover to 600-800px, so a 300px decode was + // upscaled and looked blurry on large windows. Decoding up to 1000px lets + // the FULL source resolution through (Qobuz typically serves ~600); the + // immersive's native-size cap then grows the art sharply up to that real + // resolution instead of upscaling a tiny decode. let Some((pixels, w, h)) = - crate::artwork::fetch_and_decode_ref(&art, &cache, 300).await + crate::artwork::fetch_and_decode_ref(&art, &cache, 1000).await else { return; }; @@ -1345,7 +1351,10 @@ pub(crate) async fn refresh_now_playing_meta(runtime: &Runtime, weak: &slint::We // Higher-res cover for the hover preview that floats above the bar art. Same // source-aware funnel; a ~300px server-side transcode so the ~220px popup is // crisp without paying for the full original. One extra fetch per track. - let preview_artwork = track.artwork_ref_with_plex(&plex.base_url, &plex.token, Some(300)); + // Immersive-grade size: Plex covers transcode at 1000px (the immersive grows + // the cover large). Qobuz ignores the hint (its URL is fixed) — the high-res + // comes from the larger decode in load_now_playing_artwork_large. + let preview_artwork = track.artwork_ref_with_plex(&plex.base_url, &plex.token, Some(1000)); // Quality badge: tier from bit depth (24-bit+ = Hi-Res), exact detail line // reused from the shared formatter so it matches the track-row badges. let quality_tier = match track.bit_depth { diff --git a/crates/qbz-slint/src/ui_prefs.rs b/crates/qbz-slint/src/ui_prefs.rs index 568cebc37..0762317e8 100644 --- a/crates/qbz-slint/src/ui_prefs.rs +++ b/crates/qbz-slint/src/ui_prefs.rs @@ -74,6 +74,42 @@ pub fn immersive_search_action_index(key: &str) -> i32 { } } +/// Default immersive default-view. `"remember"` restores whatever immersive view +/// was open last time; the other keys PIN a fixed FOCUS-mode foreground. +pub const DEFAULT_IMMERSIVE_DEFAULT_VIEW: &str = "remember"; + +/// Map an immersive-default-view select index to its persisted key. The +/// on-screen order is Remember last / Album Reactive / Static / Coverflow / +/// Spectrum / Lyrics / Queue (0-6); any unknown index falls back to the +/// default (`"remember"`). +pub fn immersive_default_view_for_index(index: i32) -> &'static str { + match index { + 0 => "remember", + 1 => "reactive", + 2 => "static", + 3 => "coverflow", + 4 => "spectrum", + 5 => "lyrics", + 6 => "queue", + _ => DEFAULT_IMMERSIVE_DEFAULT_VIEW, + } +} + +/// Inverse of [`immersive_default_view_for_index`]: the select index for a +/// persisted key, falling back to the default's index (0 = "remember"). +pub fn immersive_default_view_index(key: &str) -> i32 { + match key { + "remember" => 0, + "reactive" => 1, + "static" => 2, + "coverflow" => 3, + "spectrum" => 4, + "lyrics" => 5, + "queue" => 6, + _ => 0, + } +} + /// Persisted UI preferences. New fields must default sanely so an older /// file (missing the field) still deserializes. #[derive(Debug, Clone, Serialize, Deserialize)] @@ -96,6 +132,23 @@ pub struct UiPrefs { /// inert). See [`DEFAULT_IMMERSIVE_SEARCH_ACTION`]. #[serde(default = "default_immersive_search_action")] pub immersive_search_action: String, + /// Immersive default-view key: `"remember"` restores the last view, else one + /// of `"reactive"` | `"static"` | `"coverflow"` | `"spectrum"` | `"lyrics"` | + /// `"queue"` pins a fixed FOCUS view. See [`DEFAULT_IMMERSIVE_DEFAULT_VIEW`]. + #[serde(default = "default_immersive_default_view")] + pub immersive_default_view: String, + /// Last immersive view-mode (0 FOCUS / 1 SPLIT), persisted only while the + /// default is `"remember"`; restored on the next overlay open. + #[serde(default)] + pub immersive_last_view_mode: i32, + /// Last immersive FOCUS panel (read when last view-mode == 0). Same + /// remember-last persistence as [`Self::immersive_last_view_mode`]. + #[serde(default)] + pub immersive_last_mode: i32, + /// Last immersive SPLIT panel (read when last view-mode == 1). Same + /// remember-last persistence as [`Self::immersive_last_view_mode`]. + #[serde(default)] + pub immersive_last_split_panel: i32, /// Active theme — a stable `qbz_theme::ThemeId` slug ("oled", "dark", /// "tokyo-night", "system", ...). Stored as a slug (not an index) so it is /// order-independent and stable across releases. Owner default: OLED Dark. @@ -152,6 +205,10 @@ fn default_immersive_search_action() -> String { DEFAULT_IMMERSIVE_SEARCH_ACTION.to_string() } +fn default_immersive_default_view() -> String { + DEFAULT_IMMERSIVE_DEFAULT_VIEW.to_string() +} + /// Default theme slug. Owner decision 2026-06-20: OLED Dark is the default for /// fresh installs and any profile without a persisted theme. Sourced from the /// `qbz-theme` registry so the default stays single-sourced. @@ -167,6 +224,10 @@ impl Default for UiPrefs { album_header_gradient: default_album_header_gradient(), intelligent_search: default_intelligent_search(), immersive_search_action: default_immersive_search_action(), + immersive_default_view: default_immersive_default_view(), + immersive_last_view_mode: 0, + immersive_last_mode: 0, + immersive_last_split_panel: 0, theme: default_theme(), mini_surface: default_mini_surface(), mini_width: default_mini_width(), diff --git a/crates/qbz-slint/ui/app.slint b/crates/qbz-slint/ui/app.slint index 4a286391c..8d228aa15 100644 --- a/crates/qbz-slint/ui/app.slint +++ b/crates/qbz-slint/ui/app.slint @@ -26,7 +26,7 @@ export { Theme, ThemeColors } from "foundation/semantic-colors.slint"; export { ThemeState } from "foundation/theme-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, AwardState, AwardActions, AwardEntry, 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, BlacklistState, BlacklistActions, BlacklistedArtistItem, 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, CastState, CastDevice, CastActions, 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, SuggestionsState, SuggestionsActions, SuggestionCard, VisualizerState, ImmersiveState, ImmersiveSearchActions, MiniPlayerState, WindowControlActions } 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, AwardState, AwardActions, AwardEntry, 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, BlacklistState, BlacklistActions, BlacklistedArtistItem, 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, CastState, CastDevice, CastActions, 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, SuggestionsState, SuggestionsActions, SuggestionCard, VisualizerState, ImmersiveState, ImmersiveSearchActions, ImmersiveActions, MiniPlayerState, WindowControlActions } 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`. diff --git a/crates/qbz-slint/ui/immersive/AlbumReactivePanel.slint b/crates/qbz-slint/ui/immersive/AlbumReactivePanel.slint index 017d3e119..84d63da51 100644 --- a/crates/qbz-slint/ui/immersive/AlbumReactivePanel.slint +++ b/crates/qbz-slint/ui/immersive/AlbumReactivePanel.slint @@ -77,8 +77,16 @@ export component AlbumReactivePanel inherits Rectangle { // window; we raise the hard cap from 460 -> 660px and the width fraction // 0.55 -> 0.62 so the art keeps growing on a big screen instead of stalling. // The 180px floor keeps small windows safe (small was confirmed good). + // Native source resolution — cap the RESTING art so it is never upscaled + // beyond its own size on a large window (owner: oversized blurry art looked + // nefasto). The audio breathing (art-scale) still grows it momentarily — that + // is the intended reactive effect, not the static oversizing being fixed. + property src-native: + (NowPlayingState.artwork-large.width > 0 + ? NowPlayingState.artwork-large.width + : NowPlayingState.artwork.width) * 1px; property base-art: Math.max(180px, - Math.min(Math.min((root.viewport-height - 384px) / 1.25, root.viewport-width * 0.62), 660px)); + Math.min(Math.min(Math.min((root.viewport-height - 384px) / 1.25, root.viewport-width * 0.62), 660px), root.src-native)); // Reactive size = base * artScale. The glow layer and the art share this // exact size/position so the halo stays glued to the art edge (per risk). property art-size: root.base-art * root.art-scale; diff --git a/crates/qbz-slint/ui/immersive/ImmersiveView.slint b/crates/qbz-slint/ui/immersive/ImmersiveView.slint index a6f334c11..e31cb8680 100644 --- a/crates/qbz-slint/ui/immersive/ImmersiveView.slint +++ b/crates/qbz-slint/ui/immersive/ImmersiveView.slint @@ -5,7 +5,7 @@ import { Radius } from "../foundation/radius.slint"; import { Typography } from "../foundation/typography.slint"; import { QbzIcon } from "../primitives/QbzIcon.slint"; -import { NowPlayingState, VisualizerState, ImmersiveState, ImmersiveSearchActions, SettingsState, LyricsState, QueueState, TrackInfoActions, SuggestionsActions, WindowControlActions, ShellState } from "../state.slint"; +import { NowPlayingState, VisualizerState, ImmersiveState, ImmersiveSearchActions, ImmersiveActions, SettingsState, LyricsState, QueueState, TrackInfoActions, SuggestionsActions, WindowControlActions, ShellState } from "../state.slint"; import { ImmersiveSearchCortinilla } from "ImmersiveSearchCortinilla.slint"; import { ImmersiveAtmosphere } from "ImmersiveAtmosphere.slint"; import { AlbumReactivePanel } from "AlbumReactivePanel.slint"; @@ -1089,6 +1089,18 @@ export component ImmersiveView inherits Rectangle { background: #0a0a0b; clip: true; + // The component is conditionally mounted (it exists only while the overlay is + // OPEN), so init == the overlay opening. Rust applies the configured default + // view here (pinned view, or restore-last). Per the precedent this is the + // only `init` on the root. + init => { ImmersiveActions.opened(); } + + // Fingerprint of the active view (view-mode * 100 + mode * 10 + split-panel). + // Any change while the overlay is open fires `view-changed()` so Rust can + // persist the current view for the "Remember last" default. + property view-sig: ImmersiveState.view-mode * 100 + ImmersiveState.mode * 10 + ImmersiveState.split-panel; + changed view-sig => { ImmersiveActions.view-changed(); } + function wake() { root.chrome-visible = true; hide-timer.running = false; @@ -1271,11 +1283,13 @@ export component ImmersiveView inherits Rectangle { padding-right: 56px; spacing: 48px; - // LEFT (~55%): artwork + shared metadata block, centered in its half. - // horizontal-stretch 11 (vs the right's 9) yields the 55/45 ratio. + // LEFT (50%): artwork + shared metadata block, centered in its half. + // EXPLICIT half-width (root.width minus the 56+56 padding and 48 spacing, + // halved) gives a true 50/50 — horizontal-stretch weights did not, because + // the left's intrinsic content out-measured the right and skewed the split. left-col := VerticalLayout { property col-h: parent.col-h; - horizontal-stretch: 11; + width: (root.width - 160px) / 2; alignment: center; spacing: 28px; @@ -1285,9 +1299,17 @@ export component ImmersiveView inherits Rectangle { // `self.width` is the layout-resolved column width; it only drives // `height`, never the column's own width, so there's no loop. left-art := Rectangle { + // Native source resolution (physical px) of the active cover, so + // the art is never UPSCALED beyond its own size on a large window + // (the cause of the blurry oversized cover when the window leaves + // the responsive/constrained range). + property src-native: + (NowPlayingState.artwork-large.width > 0 + ? NowPlayingState.artwork-large.width + : NowPlayingState.artwork.width) * 1px; property art-size: Math.max(240px, - Math.min(self.width, left-col.col-h - 200px)); + Math.min(self.width, left-col.col-h - 200px, self.src-native)); height: self.art-size; horizontal-stretch: 1; art-inner := Rectangle { @@ -1317,10 +1339,9 @@ export component ImmersiveView inherits Rectangle { // plate is full column width with 22px side gutters so the elided // Text rows have a real width to truncate against. meta-plate := Rectangle { - background: #00000059; - border-radius: 14px; - border-width: 1px; - border-color: #ffffff14; + // Glass plate removed (owner: looked bad) — the metadata sits + // directly on the atmosphere; ImmersiveTrackInfo carries its own + // text shadows for legibility. horizontal-stretch: 1; height: meta-block.preferred-height + 28px; meta-block := VerticalLayout { @@ -1345,19 +1366,13 @@ export component ImmersiveView inherits Rectangle { // via viewport-width/viewport-height so it never overflows the corners. // horizontal-stretch 9 (vs the left's 11) yields the 45% share. right-plate := Rectangle { - // The backing's inner padding. The mounted panel's content box + // The panel's inner padding. The mounted panel's content box // (`right-inner`) subtracts this on both axes so nothing tucks under - // the rounded corners. + // the edges. property pad: 20px; - horizontal-stretch: 9; - // The dark legibility plate. - background: #00000094; - border-radius: 16px; - border-width: 1px; - border-color: #ffffff1a; - drop-shadow-blur: 36px; - drop-shadow-color: #00000080; - drop-shadow-offset-y: 10px; + width: (root.width - 160px) / 2; + // Glass legibility backing removed (owner: looked bad) — the split + // panel sits directly on the atmosphere. clip: true; // Inner content box, inset by the backing padding on all sides. diff --git a/crates/qbz-slint/ui/immersive/StaticPanel.slint b/crates/qbz-slint/ui/immersive/StaticPanel.slint index f7535c7df..7524aa904 100644 --- a/crates/qbz-slint/ui/immersive/StaticPanel.slint +++ b/crates/qbz-slint/ui/immersive/StaticPanel.slint @@ -41,8 +41,14 @@ export component StaticPanel inherits Rectangle { // scales, and we raise the hard cap 460 -> 640px and the width fraction // 0.55 -> 0.62 so a big window is filled. The 180px floor keeps small windows // safe (small was confirmed good). + // Native source resolution — cap so the cover is never UPSCALED beyond its + // own size on a large window (owner: oversized blurry art looked nefasto). + property src-native: + (NowPlayingState.artwork-large.width > 0 + ? NowPlayingState.artwork-large.width + : NowPlayingState.artwork.width) * 1px; property base-art: Math.max(180px, - Math.min(Math.min(root.viewport-height - 364px, root.viewport-width * 0.62), 640px)); + Math.min(Math.min(Math.min(root.viewport-height - 364px, root.viewport-width * 0.62), 640px), root.src-native)); // Fixed size — no art-scale. property art-size: root.base-art; diff --git a/crates/qbz-slint/ui/settings/AppearanceSettings.slint b/crates/qbz-slint/ui/settings/AppearanceSettings.slint index 584ccfc7a..8e170f3b4 100644 --- a/crates/qbz-slint/ui/settings/AppearanceSettings.slint +++ b/crates/qbz-slint/ui/settings/AppearanceSettings.slint @@ -305,6 +305,20 @@ export component AppearanceSettings inherits VerticalLayout { } } + SettingRow { + label: @tr("Immersive default view"); + description: @tr("Which immersive view opens by default. 'Remember last' restores your last view."); + QbzSelect { + menu-width: 200px; + options: AppearanceState.immersive-default-views; + current-index: AppearanceState.immersive-default-view-index; + selected(i) => { + AppearanceState.immersive-default-view-index = i; + AppearanceState.appearance-select("immersive-default-view", i); + } + } + } + Rectangle { height: 12px; } Divider { } Rectangle { height: 12px; } diff --git a/crates/qbz-slint/ui/state.slint b/crates/qbz-slint/ui/state.slint index 563c32bd7..f5cb083df 100644 --- a/crates/qbz-slint/ui/state.slint +++ b/crates/qbz-slint/ui/state.slint @@ -2606,6 +2606,14 @@ export global AppearanceState { in-out property <[string]> immersive-search-actions: ["Disabled", "Replace current queue", "Play next", "Add to queue"]; in-out property immersive-search-action-index: 1; + // Immersive default view — which immersive view opens by default. + // 0 = Remember last (restore the last view that was open), + // 1 = Album Reactive, 2 = Static, 3 = Coverflow, 4 = Spectrum, + // 5 = Lyrics, 6 = Queue (all 1-6 pin a FOCUS view-mode foreground). + // Persisted via appearance-select("immersive-default-view"). + in-out property <[string]> immersive-default-views: ["Remember last", "Album Reactive", "Static", "Coverflow", "Spectrum", "Lyrics", "Queue"]; + in-out property immersive-default-view-index: 0; + // --- VISUAL EXTRAS ----------------------------------------------------- // sidebar-playlist-collage is wired to SidebarState.playlist-collage in // the panel (the only already-functional flag here). @@ -3389,6 +3397,16 @@ export global ImmersiveSearchActions { callback dismiss(); } +// Lifecycle hooks for the immersive overlay, wired in main.rs. The ImmersiveView +// component is conditionally mounted (it exists only while the overlay is OPEN), +// so its `init` == the overlay opening. `opened()` lets Rust apply the configured +// default view (pinned, or restore-last); `view-changed()` lets Rust persist the +// current view when the configured default is "remember last". +export global ImmersiveActions { + callback opened(); + callback view-changed(); +} + // Native window-control actions for the MAIN AppWindow, exposed to the // immersive overlay header cluster. The AppWindow uses native OS decorations, // so the only seam to manipulate it is the winit backend (see