Files
qbz/crates/qbz-slint/ui/discover/PlaylistCollage.slint
T
vicrodh c7129de096 fix(slint): follow chip, playlist card size, track row hover, dedupe
- Follow button on the artist card is no longer a pill — Radius.sm
  rounded rectangle, matching the rest of the app (new ADR-008).
- PlaylistCard sized identically to AlbumCard (220x266) with the same
  220px artwork area; collage and the grid/carousel updated to match.
- Track row play overlay now appears anywhere over the row, not only
  when the pointer is directly over the cell. Slint does not propagate
  has-hover to ancestor TouchAreas, so each row OR-s its own ta with
  every nested TouchArea (play-cell, fav/dl/more) into row-hovered.
- EqualizerBars sit on a fixed 16px baseline so the animation stays
  perfectly centered while the bar heights oscillate.
- TrackPlayCell exposes out hovered so rows can OR it cleanly.
- Search dedupes a top-result artist that is also the first carousel
  entry, removing the redundant duplicate.

cc
2026-05-19 19:53:15 -06:00

115 lines
3.5 KiB
Plaintext

// Playlist cover collage. Qobuz returns up to four cover images per
// playlist; the layout is chosen by how many are available — single,
// dual (side by side), triple (one large + two stacked), or quad (three
// stacked left + one large right). Ported from the Tauri PlaylistCollage.
import { Theme } from "../foundation/semantic-colors.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { SearchPlaylistItem } from "../state.slint";
export component PlaylistCollage inherits Rectangle {
in property <SearchPlaylistItem> playlist;
in property <length> size: 220px;
width: root.size;
height: root.size;
clip: true;
background: Theme.surface-elevated;
property <length> gap: 2px;
property <int> n: root.playlist.cover-count;
// 0 covers — placeholder 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 — full bleed.
if root.n == 1: Image {
width: 100%;
height: 100%;
source: root.playlist.cover1;
image-fit: cover;
}
// 2 — side by side halves.
if root.n == 2: HorizontalLayout {
spacing: root.gap;
Image {
source: root.playlist.cover1;
image-fit: cover;
width: (root.size - root.gap) / 2;
height: root.size;
}
Image {
source: root.playlist.cover2;
image-fit: cover;
width: (root.size - root.gap) / 2;
height: root.size;
}
}
// 3 — one large left, two stacked right.
if root.n == 3: HorizontalLayout {
spacing: root.gap;
Image {
source: root.playlist.cover1;
image-fit: cover;
width: (root.size - root.gap) * 0.62;
height: root.size;
}
VerticalLayout {
spacing: root.gap;
Image {
source: root.playlist.cover2;
image-fit: cover;
width: (root.size - root.gap) * 0.38;
height: (root.size - root.gap) / 2;
}
Image {
source: root.playlist.cover3;
image-fit: cover;
width: (root.size - root.gap) * 0.38;
height: (root.size - root.gap) / 2;
}
}
}
// 4+ — three stacked left, one large right.
if root.n >= 4: HorizontalLayout {
spacing: root.gap;
VerticalLayout {
spacing: root.gap;
Image {
source: root.playlist.cover1;
image-fit: cover;
width: (root.size - root.gap) * 0.34;
height: (root.size - 2 * root.gap) / 3;
}
Image {
source: root.playlist.cover2;
image-fit: cover;
width: (root.size - root.gap) * 0.34;
height: (root.size - 2 * root.gap) / 3;
}
Image {
source: root.playlist.cover3;
image-fit: cover;
width: (root.size - root.gap) * 0.34;
height: (root.size - 2 * root.gap) / 3;
}
}
Image {
source: root.playlist.cover4;
image-fit: cover;
width: (root.size - root.gap) * 0.66;
height: root.size;
}
}
}