feat(slint): immersive views polish — 50/50 split, no glass, sharp art, default-view

Split layout is a true 50/50 (explicit half-widths; the horizontal-stretch weights skewed it because the left's intrinsic content out-measured the right). Removed the glass backing plates from the split panel and the song-data metadata block — both sit directly on the atmosphere now.

Cover art no longer upscales blurry on large windows: the now-playing large cover decodes at 1000px (was 300, the hover-preview size) so the full Qobuz source resolution comes through, and the split / Static / Album-Reactive panels cap the art at its native size so it grows sharply instead of stretching.

New Settings > Appearance 'Immersive default view': 'Remember last' restores the last view, or pin Album Reactive / Static / Coverflow / Spectrum / Lyrics / Queue. Persisted via ui_prefs + ImmersiveActions opened/view-changed hooks.

cc
This commit is contained in:
vicrodh committed 2026-06-20 19:45:16 -06:00
1 parent d0deeb7044
commit 85b02417be
9 files changed
+244 -25

No files matched your search

+88
View File
@@ -4445,6 +4445,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
&crate::ui_prefs::load().immersive_search_action,
),
);
window.global::<AppearanceState>().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<dyn std::error::Error>> {
});
}
// ===================== 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::<ImmersiveActions>()
.on_opened(move || {
let Some(w) = weak.upgrade() else { return };
let prefs = crate::ui_prefs::load();
let im = w.global::<ImmersiveState>();
// 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::<ImmersiveActions>()
.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::<ImmersiveState>();
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<dyn std::error::Error>> {
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.
+11 -2
View File
@@ -1200,8 +1200,14 @@ fn load_now_playing_artwork_large(weak: slint::Weak<AppWindow>, 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 {
+61
View File
@@ -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(),