refactor(slint): extract toast into qbz-slint-common crate
New shared crate qbz-slint-common (will also host the artwork primitives via a dependency-inversion pass). toast.rs is a clean leaf over qbz-ui: only Slint types (AppWindow, ToastKind, ToastState) + slint core (Timer/Weak). Moved verbatim; the only edit is the import (`crate::` -> `qbz_ui::`). Bin re-exports via `pub use qbz_slint_common::toast;` so all 154 call sites across 21 files are unchanged. slint dep is `default-features = false` (adversarial review: a default-features slint here would turn on the default renderer for the whole build via feature unification). `cargo check -p qbz` green. cc
This commit is contained in:
7 files changed
+27
-2
No files matched your search
Generated
+9
@@ -5545,6 +5545,7 @@ dependencies = [
|
|||||||
"qbz-playlist-import",
|
"qbz-playlist-import",
|
||||||
"qbz-plex",
|
"qbz-plex",
|
||||||
"qbz-qobuz",
|
"qbz-qobuz",
|
||||||
|
"qbz-slint-common",
|
||||||
"qbz-text-utils",
|
"qbz-text-utils",
|
||||||
"qbz-theme",
|
"qbz-theme",
|
||||||
"qbz-ui",
|
"qbz-ui",
|
||||||
@@ -5953,6 +5954,14 @@ dependencies = [
|
|||||||
"uuid 1.22.0",
|
"uuid 1.22.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "qbz-slint-common"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"qbz-ui",
|
||||||
|
"slint",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "qbz-text-utils"
|
name = "qbz-text-utils"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ members = [
|
|||||||
"qbz-ui",
|
"qbz-ui",
|
||||||
"qbz-dac-wizard",
|
"qbz-dac-wizard",
|
||||||
"qbz-text-utils",
|
"qbz-text-utils",
|
||||||
|
"qbz-slint-common",
|
||||||
"qbz",
|
"qbz",
|
||||||
"qbz-credentials",
|
"qbz-credentials",
|
||||||
"qbz-media-controls",
|
"qbz-media-controls",
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "qbz-slint-common"
|
||||||
|
version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
description = "Shared Slint-coupled frontend helpers for the qbz app (toast; artwork primitives later)."
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
qbz-ui = { path = "../qbz-ui" }
|
||||||
|
slint = { version = "=1.16.1", default-features = false, features = ["std", "compat-1-2"] }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
//! Shared Slint-coupled helpers extracted from the qbz binary. Depends on
|
||||||
|
//! qbz-ui for the generated types (AppWindow, the globals, structs).
|
||||||
|
pub mod toast;
|
||||||
@@ -16,7 +16,7 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use slint::{ComponentHandle, Timer, TimerMode, Weak};
|
use slint::{ComponentHandle, Timer, TimerMode, Weak};
|
||||||
|
|
||||||
use crate::{AppWindow, ToastKind, ToastState};
|
use qbz_ui::{AppWindow, ToastKind, ToastState};
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
// Single reusable auto-hide timer. Reused (stop + start) so a fresh
|
// Single reusable auto-hide timer. Reused (stop + start) so a fresh
|
||||||
@@ -48,6 +48,7 @@ qbz-music-link = { path = "../qbz-music-link" }
|
|||||||
qbz-ui = { path = "../qbz-ui" }
|
qbz-ui = { path = "../qbz-ui" }
|
||||||
qbz-dac-wizard = { path = "../qbz-dac-wizard" }
|
qbz-dac-wizard = { path = "../qbz-dac-wizard" }
|
||||||
qbz-text-utils = { path = "../qbz-text-utils" }
|
qbz-text-utils = { path = "../qbz-text-utils" }
|
||||||
|
qbz-slint-common = { path = "../qbz-slint-common" }
|
||||||
log = { workspace = true }
|
log = { workspace = true }
|
||||||
env_logger = "0.11"
|
env_logger = "0.11"
|
||||||
tokio = { workspace = true }
|
tokio = { workspace = true }
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ mod share;
|
|||||||
mod sidebar;
|
mod sidebar;
|
||||||
mod suggestions;
|
mod suggestions;
|
||||||
mod theme;
|
mod theme;
|
||||||
mod toast;
|
pub use qbz_slint_common::toast;
|
||||||
mod tray;
|
mod tray;
|
||||||
mod tray_settings;
|
mod tray_settings;
|
||||||
mod ui_prefs;
|
mod ui_prefs;
|
||||||
|
|||||||
Reference in new issue
Block a user