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

103 lines
4.0 KiB
Plaintext

// Album header "more" (⋯) context menu — ported 1:1 from the Tauri
// `AlbumMenu` (src/lib/components/AlbumMenu.svelte) as wired by the album
// detail header. Tauri nests Share/Download as submenus; we render them
// FLAT (the same cosmetic-flat convention as TrackContextMenu) with group
// separators matching Tauri's menu grouping.
//
// Item -> media-action("album", <album-id>, <action>) mapping:
// Play next -> "play-next"
// Add to queue -> "queue"
// --
// Add to playlist -> "add-to-playlist"
// Add to Mixtape/Coll. -> "add-to-mixtape"
// --
// Share Qobuz link -> "share-qobuz"
// Share Album.link -> "share-songlink"
// --
// Make available offline -> "cache" (album NOT fully cached)
// Refresh offline copy -> "recache" (album fully cached)
//
// Tauri's onMakeOffline ("download.makeAvailable") item is NOT passed by
// the album detail header, so it is intentionally absent (1:1). The last
// row swaps Make-available-offline <-> Refresh-offline-copy on
// `fully-cached`, the flat form of Tauri's isAlbumFullyDownloaded submenu
// (which only carries Refresh — no Remove at album level).
import { Theme } from "../foundation/semantic-colors.slint";
import { ContextMenu } from "ContextMenu.slint";
import { ContextMenuItem } from "ContextMenuItem.slint";
export component AlbumContextMenu inherits PopupWindow {
in property <string> album-id;
// Every track of the album already has a ready offline copy.
in property <bool> fully-cached: false;
callback media-action(string, string, string);
width: 224px;
// 7 rows x 33px + 3 separators x 1px + ContextMenu's 5/5 padding. The
// offline row swaps label/action on `fully-cached` — count is constant.
height: 7 * 33px + 3 * 1px + 10px;
ContextMenu {
ContextMenuItem {
icon: @image-url("../assets/icons/list-plus.svg");
label: @tr("Play next");
clicked => {
root.media-action("album", root.album-id, "play-next");
}
}
ContextMenuItem {
icon: @image-url("../assets/icons/list-end.svg");
label: @tr("Add to queue");
clicked => {
root.media-action("album", root.album-id, "queue");
}
}
Rectangle { height: 1px; background: Theme.border-subtle; }
ContextMenuItem {
icon: @image-url("../assets/icons/list-music.svg");
label: @tr("Add to playlist");
clicked => {
root.media-action("album", root.album-id, "add-to-playlist");
}
}
ContextMenuItem {
icon: @image-url("../assets/icons/cassette-tape.svg");
label: @tr("Add to mixtape");
clicked => {
root.media-action("album", root.album-id, "add-to-mixtape");
}
}
Rectangle { height: 1px; background: Theme.border-subtle; }
ContextMenuItem {
icon: @image-url("../assets/icons/link.svg");
label: @tr("Share Qobuz link");
clicked => {
root.media-action("album", root.album-id, "share-qobuz");
}
}
ContextMenuItem {
icon: @image-url("../assets/icons/link.svg");
label: @tr("Share Album.link");
clicked => {
root.media-action("album", root.album-id, "share-songlink");
}
}
Rectangle { height: 1px; background: Theme.border-subtle; }
if !root.fully-cached: ContextMenuItem {
icon: @image-url("../assets/icons/cloud-download.svg");
label: @tr("Make available offline");
clicked => {
root.media-action("album", root.album-id, "cache");
}
}
if root.fully-cached: ContextMenuItem {
icon: @image-url("../assets/icons/refresh-cw.svg");
label: @tr("Refresh offline copy");
clicked => {
root.media-action("album", root.album-id, "recache");
}
}
}
}