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
140 lines
5.4 KiB
Plaintext
140 lines
5.4 KiB
Plaintext
// Miniplayer QUEUE surface — a NAVIGABLE list of current + full upcoming
|
|
// (NOT capped at 20). Per-row play routes remote-first via
|
|
// MiniPlayerState.queue-play (REQ-2). Rows mirror the MAIN queue sidebar's
|
|
// UP NEXT rows for coherence: a position NUMBER (no per-row album art — the
|
|
// main only shows art on the now-playing/history rows), title/artist, explicit
|
|
// badge, and a trailing duration. The mini must not have MORE than the main.
|
|
|
|
import { Theme } from "../foundation/semantic-colors.slint";
|
|
import { MiniPlayerState } from "../state.slint";
|
|
import { ListScrollbar } from "../primitives/ListScrollbar.slint";
|
|
import { ExplicitBadge } from "MiniBits.slint";
|
|
|
|
export component MiniQueueSurface inherits Rectangle {
|
|
// Empty state.
|
|
if MiniPlayerState.queue-tracks.length == 0: Text {
|
|
width: 100%;
|
|
height: 100%;
|
|
text: @tr("Queue is empty");
|
|
color: Theme.text-muted;
|
|
font-size: 13px;
|
|
horizontal-alignment: center;
|
|
vertical-alignment: center;
|
|
}
|
|
|
|
// Scrollable list.
|
|
if MiniPlayerState.queue-tracks.length > 0: Rectangle {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
flick := Flickable {
|
|
width: 100%;
|
|
height: 100%;
|
|
viewport-width: self.width;
|
|
viewport-height: list.preferred-height;
|
|
|
|
list := VerticalLayout {
|
|
width: parent.width;
|
|
padding-top: 6px;
|
|
padding-bottom: 8px;
|
|
|
|
for item[idx] in MiniPlayerState.queue-tracks: row := Rectangle {
|
|
property <bool> active: item.id != "" && item.id == MiniPlayerState.current-track-id;
|
|
height: 44px;
|
|
border-radius: 4px;
|
|
background: rta.has-hover
|
|
? Theme.surface-hover
|
|
: (row.active ? Theme.accent.with-alpha(0.10) : transparent);
|
|
|
|
// Hover + click to play (row has no other TouchArea; declared
|
|
// first so the content renders on top, matching the main row).
|
|
rta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
MiniPlayerState.queue-play(idx);
|
|
}
|
|
}
|
|
|
|
if row.active: Rectangle {
|
|
x: 0;
|
|
y: 4px;
|
|
width: 3px;
|
|
height: parent.height - 8px;
|
|
border-radius: 3px;
|
|
background: Theme.accent;
|
|
}
|
|
|
|
HorizontalLayout {
|
|
width: 100%;
|
|
height: 100%;
|
|
padding-left: 12px;
|
|
padding-right: 12px;
|
|
padding-top: 4px;
|
|
padding-bottom: 4px;
|
|
spacing: 9px;
|
|
|
|
// Position number (no album art — main parity).
|
|
VerticalLayout {
|
|
alignment: center;
|
|
width: 22px;
|
|
Text {
|
|
text: idx + 1;
|
|
color: row.active ? Theme.accent : Theme.text-muted;
|
|
font-size: 12px;
|
|
horizontal-alignment: center;
|
|
}
|
|
}
|
|
|
|
VerticalLayout {
|
|
horizontal-stretch: 1;
|
|
alignment: center;
|
|
spacing: 2px;
|
|
HorizontalLayout {
|
|
spacing: 5px;
|
|
Text {
|
|
horizontal-stretch: 1;
|
|
text: item.title;
|
|
color: row.active ? Theme.text-primary : Theme.text-secondary;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
overflow: elide;
|
|
}
|
|
if item.explicit: VerticalLayout {
|
|
alignment: center;
|
|
ExplicitBadge { }
|
|
}
|
|
}
|
|
if item.artist != "": Text {
|
|
text: item.artist;
|
|
color: Theme.text-muted;
|
|
font-size: 10px;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
|
|
// Duration (the main UP NEXT rows show this too).
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Text {
|
|
text: item.duration;
|
|
color: Theme.text-muted;
|
|
font-size: 11px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
ListScrollbar {
|
|
x: parent.width - self.width;
|
|
y: 0;
|
|
height: parent.height;
|
|
viewport-height: flick.viewport-height;
|
|
visible-height: flick.height;
|
|
viewport-y <=> flick.viewport-y;
|
|
auto-hide: true;
|
|
}
|
|
}
|
|
}
|