Files
qbz/crates/qbz-slint/ui/primitives/PmCollage.slint
T
vicrodh 82129cff35 feat(slint): LocalLibrary ephemeral folders + Folders tree 1:1 port
Ephemeral folders: open / browse / play a folder without indexing it —
album-grouped pane, CUE seek fast-path (no full re-decode per virtual track),
folder-path persistence + rehydrate, "already playing" add-vs-replace choice
dialog (ephemeral-only), and now-playing / queue / menu gating so an ephemeral
track exposes no persistence actions.

Folders tree brought 1:1 with Tauri:
- Rail header: select-mode, collapse-all, open-ephemeral, tree search.
- Resizable rail (default ~20% narrower; drag handle, min 50% default /
  max 50% of the content area).
- Subfolder cover grid + grid/list toggle, recursive track count, name search;
  compact icon bulk bar (folder-check / play-next / queue / playlist / clear).
- Tree is the default mode; circular checkboxes homologated with TrackRow;
  compact rows (smaller type + icon, no ambiguous trailing count).
- Flat/Tree icon toggle (disc-album / folder-tree), floated right.

Per-source TrackRow context menu (logic, not a blanket trim): Qobuz/offline =
full; local = play/next/queue + add-to-playlist; plex/ephemeral = play/next/
queue only.

App-wide standard: Math.round pixel-snap on icon centering across the UI to
kill sub-pixel blur (CircleAction, header back/forward/collapse, and the rest).
NowPlayingBar context icon -> turntable (frees disc-album for the Folders
toggle). New assets: folder-check, folder-tree, turntable.

cc
2026-06-07 10:12:59 -06:00

82 lines
2.6 KiB
Plaintext

// Playlist Manager cover collage — a square thumbnail of a playlist's
// track covers, mirroring Tauri's PlaylistCollage:
// - 0 covers -> fallback list-music glyph
// - 1-3 covers -> a single full-bleed cover
// - 4+ covers -> a 2x2 grid (1px gap)
//
// The covers + decoded images live on the PmPlaylistItem (cover-count,
// cover1..cover4). This component only lays them out.
import { Theme } from "../foundation/semantic-colors.slint";
import { Radius } from "../foundation/radius.slint";
import { PmPlaylistItem } from "../state.slint";
import { QbzIcon } from "QbzIcon.slint";
export component PmCollage inherits Rectangle {
in property <PmPlaylistItem> item;
in property <length> size: 140px;
in property <length> radius: Radius.sm;
width: root.size;
height: root.size;
border-radius: root.radius;
clip: true;
background: Theme.surface-elevated;
property <int> n: root.item.cover-count;
property <length> gap: 1px;
// 0 covers -> fallback glyph.
if root.n == 0: QbzIcon {
source: @image-url("../assets/icons/list-music.svg");
width: root.size * 0.32;
height: root.size * 0.32;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: Theme.text-muted;
}
// 1-3 covers -> single full-bleed cover.
if root.n >= 1 && root.n < 4: Image {
width: 100%;
height: 100%;
source: root.item.cover1;
image-fit: cover;
}
// 4+ covers -> 2x2 grid.
if root.n >= 4: VerticalLayout {
spacing: root.gap;
HorizontalLayout {
spacing: root.gap;
Image {
source: root.item.cover1;
image-fit: cover;
width: (root.size - root.gap) / 2;
height: (root.size - root.gap) / 2;
}
Image {
source: root.item.cover2;
image-fit: cover;
width: (root.size - root.gap) / 2;
height: (root.size - root.gap) / 2;
}
}
HorizontalLayout {
spacing: root.gap;
Image {
source: root.item.cover3;
image-fit: cover;
width: (root.size - root.gap) / 2;
height: (root.size - root.gap) / 2;
}
Image {
source: root.item.cover4;
image-fit: cover;
width: (root.size - root.gap) / 2;
height: (root.size - root.gap) / 2;
}
}
}
}