feat(qbz-slint): wire theme persistence + Rust-driven palette apply
Connect the qbz-theme registry to the running app and persist the choice across restarts (owner hard requirement 2026-06-20). - `src/theme.rs`: Rgba->slint::Color conversion, `to_slint` building the generated `ThemeColors` (55 fields, exact name parity with the Slint struct), `apply_theme` (set_c + set_is_system), and slug<->index<->id mapping with slug as the source of truth. Unit tests cover the roundtrip + fallbacks. - `ui_prefs.rs`: new `theme: String` slug field, `#[serde(default)]` -> `qbz_theme::default_slug()` (OLED). Old profiles without the field restore to OLED. Tests assert the default. - `main.rs`: add the missing `"theme"` arm in `on_appearance_select` (was falling into the debug `other =>` arm) — maps dropdown index to id, persists the slug, hot-switches the palette. Startup restore seeds the dropdown list from the registry, derives the index from the persisted slug, syncs the legacy `ThemeState.mode`, and applies the theme before first paint. - `app.slint`: export `Theme`/`ThemeColors`/`ThemeState` so Rust can drive them. - `AppearanceSettings.slint`/`state.slint`: the theme list is now Rust-seeded; comments updated (index no longer drives colors; slug is source of truth). Headline acceptance: pick a theme, quit, relaunch -> same theme; fresh profile boots into OLED Dark. The 4 existing themes are unchanged (legacy alias values preserved in the registry). cc
This commit is contained in:
8 files changed
+245
-7
No files matched your search
@@ -59,6 +59,7 @@ serde_json = { workspace = true }
|
||||
dirs = "5"
|
||||
chrono = { workspace = true, features = ["unstable-locales"] }
|
||||
qbz-app = { path = "../qbz-app" }
|
||||
qbz-theme = { path = "../qbz-theme" }
|
||||
qbz-media-controls = { path = "../qbz-media-controls" }
|
||||
qbz-audio = { path = "../qbz-audio" }
|
||||
qbz-core = { path = "../qbz-core" }
|
||||
|
||||
Reference in new issue
Block a user