Files
qbz/crates/qbz-slint/ui/miniplayer/MiniQueueSurface.slint
T
vicrodh c974b8a973 feat(slint): miniplayer — second borderless window with five surfaces
Port the Tauri MiniPlayer to a second Slint MiniPlayerWindow (not an
AppWindow morph). Borderless via the native no-frame property (Slint's
winit adapter re-applies decorations from no-frame on every realization,
so the attributes hook alone was undone); the vendored renderer gives the
transparent rounded floating card. First QBZ surface with no system
titlebar.

State is mirror-driven with no second poll loop: the existing 450ms
playback poll and the 30Hz lyrics tick each fan out one mirror call into
the mini's per-window globals (REQ-1), gating the expensive copies
(artwork / queue / lyric lines) on track-id change. The queue surface owns
a self-contained navigable model (current + full upcoming, not the 40-row
sidebar page), and per-row play routes remote-first and bails before
mutating local (REQ-2). Transport callbacks delegate to the main window's
already-wired remote-first handlers (zero duplication).

Surfaces: micro / compact / artwork / queue / lyrics (reuses
LyricsLinesView + LyricsState). Footer with pending-seek state, transport,
volume popover, and the hover-expand controls capsule (surface tabs +
background-blur toggle + move-drag + close). Optional static
artwork-derived background-blur backdrop. Lifecycle in src/miniplayer.rs
(create-once / enter / exit / close / per-surface geometry persistence /
winit hooks). Menu entry enabled in PlayerBar + PlayerBarSmall.

cc
2026-06-17 18:35:28 -06:00

140 lines
5.4 KiB
Plaintext

// Miniplayer QUEUE surface — a NAVIGABLE list of current + full upcoming
// (NOT capped at 20). Per-row play routes remote-first via
// MiniPlayerState.queue-play (REQ-2). Rows mirror the MAIN queue sidebar's
// UP NEXT rows for coherence: a position NUMBER (no per-row album art — the
// main only shows art on the now-playing/history rows), title/artist, explicit
// badge, and a trailing duration. The mini must not have MORE than the main.
import { Theme } from "../foundation/semantic-colors.slint";
import { MiniPlayerState } from "../state.slint";
import { ListScrollbar } from "../primitives/ListScrollbar.slint";
import { ExplicitBadge } from "MiniBits.slint";
export component MiniQueueSurface inherits Rectangle {
// Empty state.
if MiniPlayerState.queue-tracks.length == 0: Text {
width: 100%;
height: 100%;
text: @tr("Queue is empty");
color: Theme.text-muted;
font-size: 13px;
horizontal-alignment: center;
vertical-alignment: center;
}
// Scrollable list.
if MiniPlayerState.queue-tracks.length > 0: Rectangle {
width: 100%;
height: 100%;
flick := Flickable {
width: 100%;
height: 100%;
viewport-width: self.width;
viewport-height: list.preferred-height;
list := VerticalLayout {
width: parent.width;
padding-top: 6px;
padding-bottom: 8px;
for item[idx] in MiniPlayerState.queue-tracks: row := Rectangle {
property <bool> active: item.id != "" && item.id == MiniPlayerState.current-track-id;
height: 44px;
border-radius: 4px;
background: rta.has-hover
? Theme.surface-hover
: (row.active ? Theme.accent.with-alpha(0.10) : transparent);
// Hover + click to play (row has no other TouchArea; declared
// first so the content renders on top, matching the main row).
rta := TouchArea {
mouse-cursor: pointer;
clicked => {
MiniPlayerState.queue-play(idx);
}
}
if row.active: Rectangle {
x: 0;
y: 4px;
width: 3px;
height: parent.height - 8px;
border-radius: 3px;
background: Theme.accent;
}
HorizontalLayout {
width: 100%;
height: 100%;
padding-left: 12px;
padding-right: 12px;
padding-top: 4px;
padding-bottom: 4px;
spacing: 9px;
// Position number (no album art — main parity).
VerticalLayout {
alignment: center;
width: 22px;
Text {
text: idx + 1;
color: row.active ? Theme.accent : Theme.text-muted;
font-size: 12px;
horizontal-alignment: center;
}
}
VerticalLayout {
horizontal-stretch: 1;
alignment: center;
spacing: 2px;
HorizontalLayout {
spacing: 5px;
Text {
horizontal-stretch: 1;
text: item.title;
color: row.active ? Theme.text-primary : Theme.text-secondary;
font-size: 12px;
font-weight: 600;
overflow: elide;
}
if item.explicit: VerticalLayout {
alignment: center;
ExplicitBadge { }
}
}
if item.artist != "": Text {
text: item.artist;
color: Theme.text-muted;
font-size: 10px;
overflow: elide;
}
}
// Duration (the main UP NEXT rows show this too).
VerticalLayout {
alignment: center;
Text {
text: item.duration;
color: Theme.text-muted;
font-size: 11px;
}
}
}
}
}
}
ListScrollbar {
x: parent.width - self.width;
y: 0;
height: parent.height;
viewport-height: flick.viewport-height;
visible-height: flick.height;
viewport-y <=> flick.viewport-y;
auto-hide: true;
}
}
}