Files
qbz/crates/qbz-ui/ui/primitives/PmFolderIcon.slint
T
vicrodh c8ef2a1b1d refactor(slint): split qbz-slint into qbz-ui lib + qbz bin; reclaim qbz binary
Slint cannot split the .slint compilation across crates, but a Slint LIBRARY
crate exposes its generated Rust types to dependent crates (verified with a
minimal proof). So:

- NEW crate `qbz-ui` (lib): owns the whole .slint tree + build.rs + bundled
  translations; `slint::include_modules!()` + the generated types (AppWindow,
  MiniPlayerWindow, all globals/structs) are re-exported. Translation domain is
  now `qbz-ui` (the .po files renamed accordingly).
- `qbz-slint` (bin) -> renamed to `qbz` (package + `[[bin]] name = "qbz"`),
  reclaiming the binary name from the retired Tauri app. It depends on `qbz-ui`
  and does `pub use qbz_ui::*;` so existing `crate::AppWindow` / `crate::*State`
  references resolve unchanged.

This splits the single ~20 GB rustc into two crates (UI/codegen vs the 75k LOC
of logic) — the foundation for lower build peak, incremental caching, and the
upcoming per-feature crate extraction.

Also fixed for the move: qbz-i18n bundled-.po include paths, the font/WGSL
`include_bytes!`/`include_str!` paths (-> ../../qbz-ui/ui/), workspace members,
dev scripts (`-p qbz`), and the CI workflows. `cargo check -p qbz` is green.

cc
2026-06-25 17:51:09 -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;
}
}