Files
qbz/crates/qbz-slint/ui/shell/NowPlayingBar.slint
T
vicrodh 8fa03a8c03 feat(slint): NowPlayingBar Mode C "Small" + mode shell + floating album-art preview
- New mode shell ui/shell/NowPlayingBar.slint switches on ShellState.npb-mode
  (0/1 -> existing PlayerBar untouched except a mode-aware height, 2 -> new
  PlayerBarSmall). AppShell mounts it; npb_mode "small" persists in ui_prefs.
- PlayerBarSmall: one 42px row (the album art defines the height, no bump) — a
  3px full-width top seekbar (SeekBar gains a show-times prop) + a symmetric
  3-column controls row that mirrors PlayerBar's responsive side-frac so the
  transport is window-centred. Compact SongCard (art border + flush-left +
  text-center + smaller fonts), a tabular 2-row time column (monospace), an
  inline 2-row AudioStamp (no format icon), and the right cluster
  (ViewMode/Connect/Cast/Lyrics/Settings-flyout/Volume/Queue). Responsive
  volume: inline QbzSlider when wide, an upward QbzVerticalSlider flyout when
  narrow.
- New ui/primitives/QbzVerticalSlider.slint.
- Floating album-art hover preview (1:1 Tauri): NowPlayingState.artwork-large
  (300px, loaded via the same source-aware artwork funnel) + a global
  ArtPreviewState rendered by the new ArtPreviewOverlay (an overlay, NOT a
  PopupWindow, so it never steals hover -> no flicker). New/Classic/Small.
- Fix: settings.rs handle_bool now refreshes SettingsState on the non-cascade
  path so the bar's Normalization/Gapless toggles reflect their real state
  (shared path, also helps New/Classic). Protected audio backend untouched.
- Context icon turntable -> layers (Tauri parity, all now-playing modes).

cc
2026-06-12 13:18:54 -06:00

71 lines
2.8 KiB
Plaintext

// Now-playing bar SHELL — switches the bottom bar body on ShellState.npb-mode.
//
// This thin wrapper is the real "mode seam": it mounts the EXISTING PlayerBar
// (which itself handles New = 0 and Classic = 1 internally) for modes 0/1, and
// the new PlayerBarSmall (Mode C) for mode 2. Large (mode 3) will add a third
// branch later; until then it falls through to PlayerBar (Default).
//
// AppShell mounts THIS instead of PlayerBar directly, forwarding the same
// bindings; this component forwards them identically to whichever body is live.
import { Layout } from "../foundation/layout.slint";
import { ShellState } from "../state.slint";
import { PlayerBar } from "PlayerBar.slint";
import { PlayerBarSmall } from "PlayerBarSmall.slint";
export component NowPlayingBar inherits Rectangle {
callback open-album(string);
callback open-artist(string);
callback media-action(string, string, string);
callback settings-bool(string, bool);
// EXPLICIT mode-aware height on the wrapper itself. The bottom bar lives in
// AppShell's outer VerticalLayout slot, which sizes a plain Rectangle child
// to its CONTENT height — and a Rectangle does NOT auto-adopt a conditional
// child's explicit height, so without this the row could collapse (the
// layout-collapse footgun). Pinning the height here (mirrors the body's own
// `height:`) makes the slot deterministic; the live body fills 100%.
// Small (mode 2): a thin full-width top seekbar (3px) that doubles as the
// divider between the content area and the bar, plus the controls row that
// fills the rest — the whole bar is header-height tall (the large album art
// defines the visual height, no extra band bump).
height: ShellState.npb-mode == 2 ? Layout.header-height : Layout.player-bar-height;
// Mode 2 (Small): the compact one-row bar.
if ShellState.npb-mode == 2: PlayerBarSmall {
width: 100%;
height: 100%;
open-album(id) => {
root.open-album(id);
}
open-artist(id) => {
root.open-artist(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
settings-bool(k, v) => {
root.settings-bool(k, v);
}
}
// Modes 0/1 (New / Classic) — and any other mode as a safe fallback —
// keep the existing full PlayerBar untouched.
if ShellState.npb-mode != 2: PlayerBar {
width: 100%;
height: 100%;
open-album(id) => {
root.open-album(id);
}
open-artist(id) => {
root.open-artist(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
settings-bool(k, v) => {
root.settings-bool(k, v);
}
}
}