Files
qbz/crates/qbz-slint/ui/shell/QueueSidebar.slint
T
vicrodh 7e6e548598 feat(slint): minimal playback wiring + Queue, plus detail/Settings fixes
Playback (minimal, album-focused):
- playback.rs controller: play an album (set queue + start audio),
  play a single track, enqueue, play a queue index, transport
  (play/pause, next, previous, seek, volume)
- the audible step uses Player::play_track (fetch -> download -> play);
  the protected audio backend is untouched
- a 450ms poll loop pushes position/progress/times/playing onto
  NowPlayingState and auto-advances at end of track
- NowPlayingState / QueueState globals; NowPlayingBar bound to real
  state (song card, seek bar, transport, volume); QueueSidebar lists
  the queue and rows play on click
- a played track is recorded into the recently-played store

Detail views:
- album description and artist biography stay with the metadata,
  filling the width to the right of the artwork (not below the header)
- header nav tabs gained a dropdown caret and 2px side padding

Settings > Playback defaults are now opt-out: show context icon,
restore session, resume position and stream-uncached default on;
streaming-only stays opt-in; initial buffer defaults to 2s.

Known gaps: queue/now-playing artwork not yet threaded (Image is not
Send); autoplay-mode preference not consulted by auto-advance; buffer
progress line stays at 0.

cc
2026-05-18 22:16:13 -06:00

178 lines
5.2 KiB
Plaintext

// Right-side Queue panel.
//
// Rendered as a layout sibling of the content area (see AppShell), so it
// shrinks the content rather than overlaying it. Closing sets
// ShellState.right-panel = 0. The body is a structural placeholder;
// queue contents are wired in a later milestone.
import { Theme } from "../foundation/semantic-colors.slint";
import { Spacing } from "../foundation/spacing.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { ShellState, QueueState } from "../state.slint";
component CloseButton inherits Rectangle {
callback clicked();
width: 28px;
height: 28px;
border-radius: Radius.sm;
background: ta.has-hover ? Theme.surface-hover : transparent;
QbzIcon {
source: @image-url("../assets/icons/x.svg");
width: 15px;
height: 15px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: ta.has-hover ? Theme.text-primary : Theme.text-secondary;
}
ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.clicked();
}
}
}
// One queue entry row — thumbnail, title, artist, playing indicator.
component QueueRow inherits Rectangle {
in property <string> title;
in property <string> artist;
in property <image> artwork;
in property <bool> playing: false;
callback clicked();
height: 56px;
background: ta.has-hover ? Theme.surface-hover : transparent;
HorizontalLayout {
padding-left: Spacing.md;
padding-right: Spacing.md;
padding-top: 6px;
padding-bottom: 6px;
spacing: 10px;
// Small album thumbnail.
Rectangle {
width: 44px;
height: 44px;
border-radius: 4px;
background: Theme.surface-elevated;
clip: true;
if root.artwork.width > 0: Image {
source: root.artwork;
width: 100%;
height: 100%;
image-fit: cover;
}
}
// Title + artist.
VerticalLayout {
horizontal-stretch: 1;
alignment: center;
spacing: 2px;
Text {
text: root.title;
color: root.playing ? Theme.accent : Theme.text-primary;
font-size: Typography.body;
font-weight: root.playing ? Typography.semibold : Typography.regular;
overflow: elide;
}
Text {
text: root.artist;
color: Theme.text-muted;
font-size: 11px;
overflow: elide;
}
}
// Now-playing indicator.
VerticalLayout {
alignment: center;
if root.playing: QbzIcon {
source: @image-url("../assets/icons/audio-lines.svg");
width: 15px;
height: 15px;
tint: Theme.accent;
}
}
}
ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.clicked();
}
}
}
export component QueueSidebar inherits Rectangle {
width: 320px;
background: Theme.surface-card;
VerticalLayout {
spacing: 0px;
// Header row — title + close button.
HorizontalLayout {
padding-left: Spacing.md;
padding-right: Spacing.sm;
padding-top: Spacing.sm;
padding-bottom: Spacing.sm;
height: 44px;
Text {
text: @tr("Queue");
color: Theme.text-primary;
font-size: Typography.heading;
font-weight: Typography.semibold;
vertical-alignment: center;
horizontal-stretch: 1;
}
VerticalLayout {
alignment: center;
CloseButton {
clicked => {
ShellState.right-panel = 0;
}
}
}
}
Rectangle {
height: 1px;
background: Theme.border-subtle;
}
// Body — the live queue, or an empty-state placeholder.
Rectangle {
vertical-stretch: 1;
if QueueState.items.length == 0: Text {
text: @tr("Nothing queued");
color: Theme.text-muted;
font-size: Typography.body;
}
if QueueState.items.length > 0: Flickable {
viewport-width: self.width;
viewport-height: rows.preferred-height;
rows := VerticalLayout {
spacing: 0px;
for item[idx] in QueueState.items: QueueRow {
title: item.title;
artist: item.artist;
artwork: item.artwork;
playing: item.playing;
clicked => {
QueueState.play-index(idx);
}
}
}
}
}
}
}