Files
qbz/crates/qbz-slint/Cargo.toml
T
vicrodh 3e1101ff64 feat(slint): cast service + transport gating for Chromecast/DLNA (Phase 2-3)
The Slint-side seam over the qbz-cast crate, modeled on qconnect_service.rs.

cast_service.rs (singleton):
- discovery (mDNS + SSDP) with a 2s device-refresh loop and 15s scan window;
- connect/disconnect: snapshot local playback, stop the local backend, suspend
  QConnect (remember + restore), connect, then re-cast the current track
  passing its REAL source (fixes the Tauri resume-source bug) + deferred seek;
- cast_track: source-routed (qobuz via the Phase-0 shared resolver at
  UltraHiRes; local via register_file streaming + rich MIME; plex = TODO),
  one shared lazy MediaServer, per-device source-IP URL, Chromecast auto-play
  vs DLNA two-step load->play;
- 1s position poll mirroring position/duration/elapsed to the bar + CastState,
  with the verbatim track-end heuristic (Chromecast ->IDLE, DLNA ->STOPPED/
  NO_MEDIA_PRESENT) driving auto-advance;
- delivered-quality (D3) pushed to CastState; shutdown() for logout/exit.

state.slint: CastState global + CastActions + CastDevice (tagged record with
DLNA capability flags); re-exported in app.slint.

main.rs: init + CastActions wiring (open/close/refresh/connect/disconnect) and
transport gating — play/pause/next/previous/seek/volume now route Cast >
QConnect > local.

Compiles clean (only stop_if_cast/shutdown unused pending the stop callback +
logout/exit wiring, next).

cc
2026-06-18 09:54:27 -06:00

140 lines
6.1 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-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-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"