Files
qbz/crates/qbz-slint/ui/shell/ArtPreviewOverlay.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

47 lines
1.8 KiB
Plaintext

// Global floating album-art preview — a 220x220 high-res cover that floats
// ABOVE the now-playing bar's small cover while the pointer hovers it (1:1 with
// Tauri). Mounted LAST in AppShell (on top of everything), fills the window and
// is NON-INTERACTIVE (no TouchArea → clicks pass through and, crucially, it
// never steals hover from the trigger — a PopupWindow did, causing flicker).
// Driven by ArtPreviewState (anchor + visibility); reads the cover straight
// from NowPlayingState.
import { Theme } from "../foundation/semantic-colors.slint";
import { ArtPreviewState, NowPlayingState } from "../state.slint";
export component ArtPreviewOverlay inherits Rectangle {
// root fills the window; transparent + non-interactive.
visible: ArtPreviewState.show && NowPlayingState.has-track;
property <length> card: 232px;
Rectangle {
width: root.card;
height: root.card;
// Centred on the art (clamped 8px inside the window), floating just
// above it (bottom ~8px above the art's top edge).
x: Math.clamp(ArtPreviewState.anchor-x - self.width / 2,
8px,
Math.max(8px, root.width - self.width - 8px));
y: ArtPreviewState.anchor-y - self.height - 8px;
border-radius: 8px;
background: Theme.surface-card;
border-width: 1px;
border-color: Theme.border-subtle;
drop-shadow-blur: 16px;
drop-shadow-color: #00000088;
clip: true;
Image {
width: 220px;
height: 220px;
x: 6px;
y: 6px;
image-fit: contain;
source: NowPlayingState.artwork-large.width > 0
? NowPlayingState.artwork-large
: NowPlayingState.artwork;
}
}
}