Files
qbz/crates/qbz-slint/ui/primitives/PmFolderIcon.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

49 lines
2.0 KiB
Plaintext

// Playlist Manager folder icon square — a rounded color tile with either
// a custom image or one of the lucide preset glyphs. The background color
// is `folder.icon-color` (solid hex) or the accent when empty. Gradient
// folder colors are not supported (Slint brush limitation) and fall back
// to the accent in the Rust controller.
import { Theme } from "../foundation/semantic-colors.slint";
import { PmFolderItem } from "../state.slint";
import { QbzIcon } from "QbzIcon.slint";
export component PmFolderIcon inherits Rectangle {
in property <PmFolderItem> folder;
in property <length> size: 64px;
in property <length> glyph-size: 32px;
in property <length> radius: 12px;
width: root.size;
height: root.size;
border-radius: root.radius;
clip: true;
// Resolved color -> that color; otherwise accent.
background: root.folder.has-color ? root.folder.icon-color : Theme.accent;
// Custom image (icon-type == "custom").
if root.folder.has-custom-image: Image {
width: 100%;
height: 100%;
source: root.folder.custom-image;
image-fit: cover;
}
// Preset glyph (white over the color tile).
if !root.folder.has-custom-image: QbzIcon {
source:
root.folder.icon-preset == "heart" ? @image-url("../assets/icons/heart.svg")
: root.folder.icon-preset == "star" ? @image-url("../assets/icons/star.svg")
: root.folder.icon-preset == "music" ? @image-url("../assets/icons/music.svg")
: root.folder.icon-preset == "disc" ? @image-url("../assets/icons/disc.svg")
: root.folder.icon-preset == "library" ? @image-url("../assets/icons/library.svg")
: root.folder.icon-preset == "headphones" ? @image-url("../assets/icons/audio-lines.svg")
: @image-url("../assets/icons/folder.svg");
width: root.glyph-size;
height: root.glyph-size;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: #ffffff;
}
}