Files
qbz/crates/qbz-slint/Cargo.toml
T
vicrodh 69d85f1932 i18n: init language at startup + persist + locale-aware dates
Add a persisted `language` UiPrefs field (default "auto") with index<->key
helpers matching the existing appearance-prefs pattern. At startup, before
the AppWindow is created, resolve "auto" via qbz_i18n::resolve_auto(), call
qbz_i18n::set_language() and slint::select_bundled_translation() so the first
paint uses the right translations. Map dates::current_locale() from the active
runtime language so month tokens localize with the rest of the UI.

cc
2026-06-23 14:01:57 -06:00

148 lines
6.5 KiB
TOML

[package]
name = "qbz-slint"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
description = "Slint functional MVP shell for QBZ (private branch only)"
[[bin]]
name = "qbz-slint"
path = "src/main.rs"
[dependencies]
# WGPU UNDERLAY SPIKE (feature/wgpu-underlay-spike): we render WGSL fragment
# shaders into a wgpu texture composited under ImmersiveView (`unstable-wgpu-28`
# + the BackendSelector in main.rs). The RENDERER is chosen PER-PLATFORM in the
# target tables below — NOT here — because femtovg-wgpu has a high per-frame CPU
# cost on macOS/Metal (slint #8693) that pegs CPU on any continuously-animating
# view (ImmersiveView atmosphere, Discover): ~60-120% on a Mac mini M2 vs
# 0.5-4% for the identical view on Linux. Skia is Slint's mature Metal renderer
# and does not have this cost. So: Linux/Windows keep femtovg-wgpu (cheap there +
# the femtovg text fixes #5177/#11335); macOS (BOTH Intel and Apple Silicon —
# `cfg(target_os="macos")` covers both, CICD x86_64-apple-darwin included) uses
# Skia. Both keep `unstable-wgpu-28`, and skia-wgpu shares the same wgpu device
# as femtovg-wgpu, so the shader underlay works unchanged on both renderers.
# Pinned =1.16.1 because the wgpu_28 / GraphicsAPI::WGPU28 / require_wgpu_28 API
# is behind an `unstable-*` flag that may change on a minor bump.
# A/B vs the GL build: `git checkout slint-mvp`.
slint = { version = "=1.16.1", default-features = false, features = [
"std",
"backend-winit",
"renderer-software",
"accessibility",
"compat-1-2",
"unstable-wgpu-28",
# Borderless-at-creation for the miniplayer window via
# BackendSelector::with_winit_window_attributes_hook (decorations can't be
# reliably dropped post-creation on Wayland/KDE).
"unstable-winit-030",
] }
# Direct access to the winit backend for the system tray: WinitWindowAccessor
# (hide/show the OS window without quitting the event loop) and, later, the
# CustomApplicationHandler (tray event pump + close-to-tray intercept). MUST be
# pinned to the exact version Slint resolves (1.16.1) — i-slint-backend-winit
# does not follow semver, and a mismatch makes with_winit_window() return None.
i-slint-backend-winit = "=1.16.1"
log = { workspace = true }
env_logger = "0.11"
tokio = { workspace = true }
async-trait = { workspace = true }
reqwest = { workspace = true }
image = { version = "0.25", default-features = false, features = ["jpeg", "png"] }
urlencoding = "2"
open = "5"
arboard = "3"
rfd = { version = "0.15", default-features = false, features = ["xdg-portal", "tokio"] }
serde = { workspace = true }
serde_json = { workspace = true }
dirs = "5"
chrono = { workspace = true, features = ["unstable-locales"] }
qbz-app = { path = "../qbz-app" }
qbz-i18n = { path = "../qbz-i18n" }
qbz-theme = { path = "../qbz-theme" }
qbz-media-controls = { path = "../qbz-media-controls" }
qbz-audio = { path = "../qbz-audio" }
qbz-core = { path = "../qbz-core" }
qbz-player = { path = "../qbz-player" }
qbz-cast = { path = "../qbz-cast" }
qconnect-app = { path = "../qconnect-app" }
qconnect-transport-ws = { path = "../qconnect-transport-ws" }
futures-util = { workspace = true }
uuid = { version = "1", features = ["v4"] }
qbz-library = { path = "../qbz-library" }
qbz-plex = { path = "../qbz-plex" }
qbz-offline-cache = { path = "../qbz-offline-cache" }
qbz-models = { path = "../qbz-models" }
qbz-mixtape = { path = "../qbz-mixtape" }
qbz-playlist-import = { path = "../qbz-playlist-import" }
qbz-qobuz = { path = "../qbz-qobuz" }
qbz-lyrics = { path = "../qbz-lyrics" }
qbz-booklet = { path = "../qbz-booklet" }
# Karaoke highlight per-visual-line measurement (lyrics_measure.rs): swash is
# the SAME shaper femtovg uses to raster glyphs, so an advance pass at the same
# font + ppem + wght axis + letter-spacing matches the rendered wrap. Already in
# the workspace lock (pulled transitively via femtovg) — no new external dep.
swash = "0.2"
qbz-integrations = { path = "../qbz-integrations" }
rusqlite = { version = "0.31", features = ["bundled"] }
# DJ-mix sampler thread RNG (rand::rng()), confined to a sync scope — the
# same crate qbz-mixtape::shuffle is generic over (spec 40 §6).
rand = { workspace = true }
qbz-cache = { path = "../qbz-cache" }
qbz-credentials = { path = "../qbz-credentials" }
# PER-PLATFORM RENDERER (see the slint comment in [dependencies]). Linux/Windows:
# femtovg-wgpu (cheap per-frame + the femtovg text fixes). macOS: Skia (femtovg-
# wgpu pegs CPU on Metal for animated views). Both resolve to a *-wgpu renderer
# (require_wgpu_28 in main.rs), so the shader underlay works on both. Features
# merge with the base `slint` dep above for the matching target.
[target.'cfg(not(target_os = "macos"))'.dependencies]
slint = { version = "=1.16.1", features = ["renderer-femtovg-wgpu"] }
# Linux system tray via StatusNotifierItem. Same crate + rationale as the
# Tauri build (src-tauri/Cargo.toml): libayatana-appindicator never dispatches
# primary-activate (left-click), so we use ksni's pure-Rust SNI which exposes
# Activate / SecondaryActivate / Scroll. macOS/Windows use `tray-icon` instead
# (added with the CustomApplicationHandler slice).
[target.'cfg(target_os = "linux")'.dependencies]
ksni = { version = "0.3", features = ["blocking"] }
# macOS menu-bar tray (NSStatusItem), hand-rolled directly on objc2 0.5 /
# app-kit 0.2 — the SAME objc2 generation winit 0.30 uses — so the NSMenu lives
# in winit's NSApplication runtime and `[NSApp sendAction:]` dispatches the menu
# item target-action. A second `muda` (from tray-icon) registers a duplicate
# `MudaMenuItem` objc class and either silently fails to dispatch (objc2 0.6) or
# panics at startup (objc2 0.5), so tray-icon/muda is dropped on macOS. Windows
# has no tray for now (untested/unshipped).
[target.'cfg(target_os = "macos")'.dependencies]
# macOS renderer: Skia (femtovg-wgpu pegs CPU on Metal — see [dependencies]).
# Covers BOTH Apple Silicon and Intel (x86_64-apple-darwin / CICD). skia-wgpu
# still serves the shader underlay via require_wgpu_28.
slint = { version = "=1.16.1", features = ["renderer-skia"] }
objc2 = "0.5"
objc2-foundation = { version = "0.2", default-features = false, features = [
"std",
"NSData",
"NSString",
] }
objc2-app-kit = { version = "0.2", default-features = false, features = [
"std",
"NSApplication",
"NSResponder",
"NSRunningApplication",
"NSStatusBar",
"NSStatusItem",
"NSStatusBarButton",
"NSMenu",
"NSMenuItem",
"NSImage",
"NSButton",
"NSControl",
"NSView",
"NSEvent",
] }
[build-dependencies]
slint-build = "1.16"