Port the Playlist Manager: header/toolbar (search/filter/sort/folder-flat toggle/view-mode/new-folder/counter), FOLDERS card grid (accent icon, count, edit), PLAYLISTS grid/list/tree, folder CRUD (FolderEditModal), move-to- folder, per-card actions, and arrow-button reorder (custom sort). Reached from the sidebar "Manage playlists" item; backend 100% reused via QbzCore/library.db (no new commands). Pointer-event drag-and-drop and gradient folder colors are deferred follow-ups. This commit also carries the cross-cutting wiring the session's features all share — state.slint globals/structs, NavEntry variants, main.rs dispatch + action wiring, artwork targets, app.slint exports, AppShell mounts — so HEAD is the verified-green tree (cargo check + release build clean). cc
82 lines
2.5 KiB
Plaintext
82 lines
2.5 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: (parent.width - self.width) / 2;
|
|
y: (parent.height - self.height) / 2;
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|