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
This commit is contained in:
465 files changed
+129
-89
No files matched your search
@@ -0,0 +1,194 @@
|
||||
// Discover > For You "Spotlight" — port of Tauri's SpotlightLite.
|
||||
// One favorite artist highlighted: a header, a hero (portrait +
|
||||
// ARTIST + name + play-top-tracks / open-artist circle buttons), and
|
||||
// a draggable row mixing a TOP TRACKS card, a RADIO card, and the
|
||||
// artist's albums.
|
||||
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { ForYouState, AlbumCardItem } from "../state.slint";
|
||||
import { AlbumCard } from "AlbumCard.slint";
|
||||
import { RadioCard } from "RadioCard.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
|
||||
component CircleButton inherits Rectangle {
|
||||
in property <image> icon;
|
||||
in property <bool> primary: false;
|
||||
callback clicked();
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 22px;
|
||||
background: root.primary
|
||||
? (ta.has-hover ? #ffffffd6 : Theme.accent)
|
||||
: (ta.has-hover ? Theme.surface-hover : Theme.surface-elevated);
|
||||
QbzIcon {
|
||||
source: root.icon;
|
||||
width: root.primary ? 18px : 16px;
|
||||
height: root.primary ? 18px : 16px;
|
||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||
tint: root.primary ? #ffffff : Theme.text-secondary;
|
||||
}
|
||||
ta := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
root.clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component Spotlight inherits VerticalLayout {
|
||||
callback open-artist(string);
|
||||
callback open-album(string);
|
||||
callback play-top-tracks(string);
|
||||
callback start-radio(string);
|
||||
callback media-action(string, string, string);
|
||||
|
||||
property <length> gap: 24px;
|
||||
// Row content width: TopTracks(200) + Radio(200) + albums(200 each)
|
||||
// + gaps. has-top-tracks toggles the first card.
|
||||
property <length> radio-cards-width:
|
||||
(ForYouState.spotlight-has-top-tracks ? 200px + root.gap : 0px) + 200px + root.gap;
|
||||
property <int> album-count: ForYouState.spotlight-albums.length;
|
||||
property <length> content-width:
|
||||
root.radio-cards-width
|
||||
+ root.album-count * (200px + root.gap);
|
||||
|
||||
spacing: 12px;
|
||||
|
||||
// Header.
|
||||
VerticalLayout {
|
||||
spacing: 2px;
|
||||
Text {
|
||||
text: @tr("Spotlight");
|
||||
color: Theme.text-primary;
|
||||
font-size: 18px;
|
||||
font-weight: Typography.semibold;
|
||||
}
|
||||
Text {
|
||||
text: @tr("Shine a light on one of your favourite artists.");
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.legal;
|
||||
}
|
||||
}
|
||||
|
||||
// Hero.
|
||||
HorizontalLayout {
|
||||
spacing: 16px;
|
||||
alignment: start;
|
||||
Rectangle {
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
border-radius: 70px;
|
||||
background: Theme.surface-elevated;
|
||||
clip: true;
|
||||
Image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
source: ForYouState.spotlight-image;
|
||||
image-fit: cover;
|
||||
}
|
||||
if ForYouState.spotlight-image-url == "": QbzIcon {
|
||||
source: @image-url("../assets/icons/user.svg");
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||
tint: Theme.text-muted;
|
||||
}
|
||||
portrait-ta := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
root.open-artist(ForYouState.spotlight-artist-id);
|
||||
}
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: 8px;
|
||||
if ForYouState.spotlight-category != "": Text {
|
||||
text: @tr("ARTIST");
|
||||
color: Theme.text-muted;
|
||||
font-size: 10px;
|
||||
font-weight: Typography.semibold;
|
||||
letter-spacing: 1.5px;
|
||||
}
|
||||
Text {
|
||||
text: ForYouState.spotlight-name;
|
||||
color: Theme.text-primary;
|
||||
font-size: Typography.title;
|
||||
font-weight: Typography.bold;
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: 10px;
|
||||
alignment: start;
|
||||
if ForYouState.spotlight-has-top-tracks: CircleButton {
|
||||
icon: @image-url("../assets/icons/play-fill.svg");
|
||||
primary: true;
|
||||
clicked => {
|
||||
root.play-top-tracks(ForYouState.spotlight-artist-id);
|
||||
}
|
||||
}
|
||||
CircleButton {
|
||||
icon: @image-url("../assets/icons/user.svg");
|
||||
clicked => {
|
||||
root.open-artist(ForYouState.spotlight-artist-id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { height: 4px; }
|
||||
|
||||
// Content row — draggable (Flickable), like the other carousels.
|
||||
Rectangle {
|
||||
height: 270px;
|
||||
clip: true;
|
||||
Flickable {
|
||||
width: 100%;
|
||||
height: parent.height;
|
||||
viewport-width: root.content-width;
|
||||
viewport-height: self.height;
|
||||
|
||||
HorizontalLayout {
|
||||
spacing: root.gap;
|
||||
alignment: start;
|
||||
|
||||
if ForYouState.spotlight-has-top-tracks: RadioCard {
|
||||
seed-title: @tr("Top tracks");
|
||||
seed-subtitle: @tr("By {}", ForYouState.spotlight-name);
|
||||
label: @tr("TOP TRACKS");
|
||||
artwork: ForYouState.spotlight-image;
|
||||
clicked => {
|
||||
root.play-top-tracks(ForYouState.spotlight-artist-id);
|
||||
}
|
||||
play => {
|
||||
root.play-top-tracks(ForYouState.spotlight-artist-id);
|
||||
}
|
||||
}
|
||||
RadioCard {
|
||||
seed-title: ForYouState.spotlight-name;
|
||||
seed-subtitle: @tr("Qobuz Radio Station");
|
||||
label: @tr("RADIO");
|
||||
artwork: ForYouState.spotlight-image;
|
||||
clicked => {
|
||||
root.start-radio(ForYouState.spotlight-artist-id);
|
||||
}
|
||||
play => {
|
||||
root.start-radio(ForYouState.spotlight-artist-id);
|
||||
}
|
||||
}
|
||||
for album in ForYouState.spotlight-albums: AlbumCard {
|
||||
album: album;
|
||||
clicked(id) => {
|
||||
root.open-album(id);
|
||||
}
|
||||
media-action(kind, id, action) => {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user