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
61 lines
1.8 KiB
Plaintext
61 lines
1.8 KiB
Plaintext
// A single row of a header nav-tab dropdown, with an optional leading
|
|
// glyph. Shared by HeaderBar (tab definitions) and HeaderMenuOverlay
|
|
// (the in-window menu panel that actually renders the rows).
|
|
|
|
import { Theme } from "../foundation/semantic-colors.slint";
|
|
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
|
|
|
export component NavMenuItem inherits Rectangle {
|
|
in property <string> label;
|
|
in property <image> icon;
|
|
in property <bool> has-glyph: false;
|
|
callback clicked();
|
|
// Fires whenever the pointer is over the row — drives the dropdown's
|
|
// idle-close timer reset.
|
|
callback hovered();
|
|
// Fires on hover enter/leave so the host keeps the menu open while the
|
|
// pointer rests on a row (the idle timer must not close it then).
|
|
callback hover-changed(bool);
|
|
|
|
height: 32px;
|
|
background: ta.has-hover ? Theme.surface-hover : transparent;
|
|
|
|
HorizontalLayout {
|
|
padding-left: 14px;
|
|
padding-right: 22px;
|
|
spacing: 9px;
|
|
if root.has-glyph: VerticalLayout {
|
|
alignment: center;
|
|
QbzIcon {
|
|
source: root.icon;
|
|
width: 14px;
|
|
height: 14px;
|
|
tint: Theme.text-secondary;
|
|
}
|
|
}
|
|
Text {
|
|
text: root.label;
|
|
color: Theme.text-secondary;
|
|
font-size: 13px;
|
|
vertical-alignment: center;
|
|
horizontal-stretch: 1;
|
|
}
|
|
}
|
|
|
|
ta := TouchArea {
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
root.clicked();
|
|
}
|
|
changed has-hover => {
|
|
root.hover-changed(self.has-hover);
|
|
if (self.has-hover) {
|
|
root.hovered();
|
|
}
|
|
}
|
|
moved => {
|
|
root.hovered();
|
|
}
|
|
}
|
|
}
|