feat(slint): Track Info + Album Info (Credits/Review) modals
1:1 port of the Tauri TrackInfoModal + AlbumCreditsModal to the Slint UI.
The Track Info invocations were already wired (TransportControls info
button, SongCard title, TrackContextMenu item) and only needed the modal
plus the fetch; the backend (core get_track/get_album, qbz-qobuz performers,
models) already carried all the data.
- qbz-qobuz/performers.rs: group_credits_ordered (matches the Tauri
getGroupedCredits ordering: Composer/Lyricist first, MainArtist last, rest
alphabetical, deduped) + format_role_label backed by the 147-entry English
performerRoles map.
- qbz-slint/info_modals.rs: fetch + map + apply controllers (mirror of
navigate_album); track/album quality strings match Tauri exactly.
- state.slint: TrackInfoState / AlbumInfoState + InfoCreditRow / InfoCreditPair
/ AlbumCreditPerformer / AlbumCreditTrack + Actions; re-exported in app.slint.
- TrackInfoModal.slint + AlbumCreditsModal.slint: scrim modals (FocusScope +
Timer for Esc, ListScrollbar), 3-col metadata + 2-col credits grids,
expandable track rows with play-on-hover, Credits/Review tabs gated on a
review. Album modal is content-sized with a capped max height.
- AppShell mounts both; AlbumPageView (i) button wired (Qobuz albums only);
main.rs adds the ("track","track-info") + ("album","info") arms and the
modal action callbacks (close/tab/play/artist/label/musician).
cc
This commit is contained in:
9 files changed
+1876
-5
No files matched your search
@@ -0,0 +1,472 @@
|
||||
// Album Info (Credits / Review) modal — 1:1 port of Tauri's
|
||||
// AlbumCreditsModal.svelte. Opened from the AlbumPageView header (i) button via
|
||||
// media-action("album", id, "info"). The Rust controller (crate::info_modals)
|
||||
// fetches the album, parses per-track performers, and populates AlbumInfoState.
|
||||
// Rectangle-scrim + centered fixed-height card, mounted in AppShell after the
|
||||
// other modals (ADR-009/010). Left column = album info (fixed). Right column =
|
||||
// Credits (expandable track list) / Review (editorial text), independent scroll.
|
||||
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { AlbumInfoState, AlbumInfoActions, AlbumCreditTrack } from "../state.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
import { ListScrollbar } from "../primitives/ListScrollbar.slint";
|
||||
|
||||
// One track row in the Credits tab: number / play-on-hover, title + artist,
|
||||
// expand chevron; an expanded panel with per-performer credit lines + the
|
||||
// copyright. Local `expanded` persists while the modal stays open.
|
||||
component AlbumTrackRow inherits VerticalLayout {
|
||||
in property <AlbumCreditTrack> track;
|
||||
in property <bool> is-last;
|
||||
callback play(string /* track-id */);
|
||||
callback musician(string /* name */, string /* primary-role */);
|
||||
property <bool> expanded: false;
|
||||
|
||||
// ---- Header row -------------------------------------------------------
|
||||
Rectangle {
|
||||
height: 46px;
|
||||
// Declared FIRST so the per-cell play TouchArea sits on top (footgun:
|
||||
// a later full-row TouchArea would eat the cell clicks).
|
||||
rowha := TouchArea {
|
||||
mouse-cursor: root.track.has-credits ? pointer : default;
|
||||
clicked => {
|
||||
if (root.track.has-credits) {
|
||||
root.expanded = !root.expanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: 12px;
|
||||
// Whole-row hover dim, 1:1 with Tauri .track-header:hover.
|
||||
opacity: (rowha.has-hover && root.track.has-credits) ? 0.8 : 1.0;
|
||||
// Number / play-on-hover cell.
|
||||
Rectangle {
|
||||
width: 28px;
|
||||
if !(rowha.has-hover || pcell.has-hover): Text {
|
||||
text: root.track.number;
|
||||
color: Theme.text-muted;
|
||||
font-size: 14px;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
pcell := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
root.play(root.track.id);
|
||||
}
|
||||
if rowha.has-hover || pcell.has-hover: Rectangle {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 14px;
|
||||
background: Theme.accent;
|
||||
x: (parent.width - self.width) / 2;
|
||||
y: (parent.height - self.height) / 2;
|
||||
QbzIcon {
|
||||
source: @image-url("../assets/icons/play-fill.svg");
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
x: (parent.width - self.width) / 2;
|
||||
y: (parent.height - self.height) / 2;
|
||||
tint: Theme.accent-text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Title + artist.
|
||||
VerticalLayout {
|
||||
horizontal-stretch: 1;
|
||||
alignment: center;
|
||||
spacing: 2px;
|
||||
Text {
|
||||
text: root.track.title;
|
||||
color: Theme.text-primary;
|
||||
font-size: 14px;
|
||||
font-weight: Typography.medium;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: root.track.artist;
|
||||
color: Theme.text-muted;
|
||||
font-size: 12px;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
// Expand chevron (only when there are credits).
|
||||
if root.track.has-credits: VerticalLayout {
|
||||
alignment: center;
|
||||
QbzIcon {
|
||||
source: root.expanded
|
||||
? @image-url("../assets/icons/chevron-up.svg")
|
||||
: @image-url("../assets/icons/chevron-down.svg");
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
tint: root.expanded ? Theme.text-primary : Theme.text-muted;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Expanded credits -------------------------------------------------
|
||||
if root.expanded && root.track.has-credits: VerticalLayout {
|
||||
padding-left: 40px;
|
||||
padding-bottom: 12px;
|
||||
spacing: 0px;
|
||||
for perf in root.track.performers: HorizontalLayout {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
alignment: start;
|
||||
pta := TouchArea {
|
||||
width: pname.preferred-width;
|
||||
height: pname.preferred-height;
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
root.musician(perf.name, perf.primary-role);
|
||||
}
|
||||
pname := Text {
|
||||
text: perf.name;
|
||||
color: pta.has-hover ? Theme.accent : Theme.text-primary;
|
||||
font-size: 13px;
|
||||
font-weight: Typography.medium;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: perf.roles;
|
||||
color: Theme.text-muted;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
if root.track.copyright != "": Rectangle { height: 8px; }
|
||||
if root.track.copyright != "": Rectangle {
|
||||
height: 1px;
|
||||
background: Theme.border-subtle;
|
||||
}
|
||||
if root.track.copyright != "": Rectangle { height: 8px; }
|
||||
if root.track.copyright != "": Text {
|
||||
text: root.track.copyright;
|
||||
color: Theme.text-muted;
|
||||
font-size: 12px;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Divider ----------------------------------------------------------
|
||||
if !root.is-last: Rectangle {
|
||||
height: 1px;
|
||||
background: Theme.border-subtle;
|
||||
}
|
||||
}
|
||||
|
||||
export component AlbumCreditsModal inherits Rectangle {
|
||||
visible: AlbumInfoState.open;
|
||||
|
||||
if AlbumInfoState.open: Rectangle {
|
||||
background: #000000bf;
|
||||
|
||||
TouchArea {
|
||||
mouse-cursor: default;
|
||||
clicked => {
|
||||
AlbumInfoActions.close();
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Math.min(root.width - 40px, 850px);
|
||||
// Content-sized with a decent cap: as tall as the header + the
|
||||
// taller of the two columns (left meta vs tabs + the full credit
|
||||
// list), but never beyond the content area (40px margin each side).
|
||||
// When the list exceeds the cap, the right column's Flickable
|
||||
// scrolls. All inputs are width-driven (card width is fixed by
|
||||
// root.width) so the height binding is acyclic. The +42px is the
|
||||
// tab strip when a review exists.
|
||||
height: Math.min(
|
||||
root.height - 80px,
|
||||
hdr.preferred-height
|
||||
+ Math.max(
|
||||
leftcol.preferred-height,
|
||||
(AlbumInfoState.has-review ? 42px : 0px) + content.preferred-height)
|
||||
+ 24px);
|
||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||
border-radius: Radius.md;
|
||||
background: Theme.surface-card;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border-subtle;
|
||||
drop-shadow-blur: 32px;
|
||||
drop-shadow-color: Theme.card-shadow;
|
||||
|
||||
TouchArea { }
|
||||
|
||||
fs := FocusScope {
|
||||
Timer {
|
||||
interval: 30ms;
|
||||
running: true;
|
||||
triggered => {
|
||||
self.running = false;
|
||||
fs.focus();
|
||||
}
|
||||
}
|
||||
key-pressed(event) => {
|
||||
if (event.text == Key.Escape) {
|
||||
AlbumInfoActions.close();
|
||||
return accept;
|
||||
}
|
||||
return reject;
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
// ---- Header -------------------------------------------
|
||||
hdr := HorizontalLayout {
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
spacing: 16px;
|
||||
VerticalLayout {
|
||||
horizontal-stretch: 1;
|
||||
spacing: 4px;
|
||||
Text {
|
||||
text: AlbumInfoState.title;
|
||||
color: Theme.text-primary;
|
||||
font-size: 16px;
|
||||
font-weight: Typography.semibold;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: AlbumInfoState.artist;
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.legal;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
close-x := TouchArea {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
AlbumInfoActions.close();
|
||||
}
|
||||
QbzIcon {
|
||||
source: @image-url("../assets/icons/x.svg");
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
x: (parent.width - self.width) / 2;
|
||||
y: (parent.height - self.height) / 2;
|
||||
tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Body (two columns) — always rendered so the card
|
||||
// height can read the real content height (loading/error
|
||||
// are overlays below, since Slint can't reference elements
|
||||
// nested in an `if` from the height binding).
|
||||
HorizontalLayout {
|
||||
vertical-stretch: 1;
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
padding-bottom: 24px;
|
||||
spacing: 24px;
|
||||
|
||||
// LEFT — album info (fixed width). alignment:start so
|
||||
// the meta stacks tightly under the cover instead of
|
||||
// the layout distributing the tall body's slack between
|
||||
// the rows.
|
||||
leftcol := VerticalLayout {
|
||||
width: 260px;
|
||||
spacing: 0px;
|
||||
alignment: start;
|
||||
Rectangle {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: 8px;
|
||||
clip: true;
|
||||
Image {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
source: AlbumInfoState.artwork;
|
||||
image-fit: cover;
|
||||
}
|
||||
}
|
||||
Rectangle { height: 16px; }
|
||||
// Released by <label> on <date>.
|
||||
if AlbumInfoState.label != "": VerticalLayout {
|
||||
spacing: 0px;
|
||||
Text {
|
||||
text: @tr("Released by");
|
||||
color: Theme.text-muted;
|
||||
font-size: 13px;
|
||||
}
|
||||
lbl := TouchArea {
|
||||
width: lbltext.preferred-width;
|
||||
height: lbltext.preferred-height;
|
||||
mouse-cursor: AlbumInfoState.label-id != "" ? pointer : default;
|
||||
clicked => {
|
||||
if (AlbumInfoState.label-id != "") {
|
||||
AlbumInfoActions.open-label(AlbumInfoState.label-id);
|
||||
}
|
||||
}
|
||||
lbltext := Text {
|
||||
text: AlbumInfoState.label;
|
||||
color: (lbl.has-hover && AlbumInfoState.label-id != "")
|
||||
? Theme.accent : Theme.text-primary;
|
||||
font-size: 13px;
|
||||
font-weight: Typography.semibold;
|
||||
}
|
||||
}
|
||||
if AlbumInfoState.release-date != "": Text {
|
||||
text: @tr("on") + " " + AlbumInfoState.release-date;
|
||||
color: Theme.text-muted;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
if AlbumInfoState.label != "": Rectangle { height: 8px; }
|
||||
if AlbumInfoState.meta-line != "": Text {
|
||||
text: AlbumInfoState.meta-line;
|
||||
color: Theme.text-muted;
|
||||
font-size: 13px;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
if AlbumInfoState.quality != "": Rectangle { height: 12px; }
|
||||
if AlbumInfoState.quality != "": Text {
|
||||
text: AlbumInfoState.quality;
|
||||
color: Theme.text-secondary;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
// RIGHT — tabs + scrollable content.
|
||||
VerticalLayout {
|
||||
horizontal-stretch: 1;
|
||||
spacing: 0px;
|
||||
|
||||
// Tab switcher (only when a review exists).
|
||||
if AlbumInfoState.has-review: VerticalLayout {
|
||||
spacing: 0px;
|
||||
HorizontalLayout {
|
||||
spacing: 16px;
|
||||
alignment: start;
|
||||
credits-tab := TouchArea {
|
||||
width: ct.preferred-width;
|
||||
height: ct.preferred-height;
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
AlbumInfoActions.set-tab("credits");
|
||||
}
|
||||
ct := Text {
|
||||
text: @tr("Credits");
|
||||
color: AlbumInfoState.active-tab == "credits"
|
||||
? Theme.accent : Theme.text-muted;
|
||||
font-size: 13px;
|
||||
font-weight: Typography.medium;
|
||||
}
|
||||
}
|
||||
review-tab := TouchArea {
|
||||
width: rt.preferred-width;
|
||||
height: rt.preferred-height;
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
AlbumInfoActions.set-tab("review");
|
||||
}
|
||||
rt := Text {
|
||||
text: @tr("Review");
|
||||
color: AlbumInfoState.active-tab == "review"
|
||||
? Theme.accent : Theme.text-muted;
|
||||
font-size: 13px;
|
||||
font-weight: Typography.medium;
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle { height: 12px; }
|
||||
Rectangle {
|
||||
height: 1px;
|
||||
background: Theme.border-subtle;
|
||||
}
|
||||
Rectangle { height: 12px; }
|
||||
}
|
||||
|
||||
// Content (scrollable) + overlaid scrollbar.
|
||||
Rectangle {
|
||||
vertical-stretch: 1;
|
||||
rflick := Flickable {
|
||||
viewport-width: self.width;
|
||||
viewport-height: content.preferred-height;
|
||||
|
||||
content := VerticalLayout {
|
||||
width: parent.width;
|
||||
spacing: 0px;
|
||||
// Reserve the scrollbar gutter so rows
|
||||
// (and the expand chevron at the row's
|
||||
// right edge) never sit under the 14px
|
||||
// ListScrollbar.
|
||||
padding-right: 18px;
|
||||
|
||||
// Credits tab.
|
||||
if AlbumInfoState.active-tab == "credits": VerticalLayout {
|
||||
spacing: 0px;
|
||||
for t[i] in AlbumInfoState.tracks: AlbumTrackRow {
|
||||
track: t;
|
||||
is-last: i == AlbumInfoState.tracks.length - 1;
|
||||
play(id) => {
|
||||
AlbumInfoActions.play-track(id);
|
||||
}
|
||||
musician(n, r) => {
|
||||
AlbumInfoActions.open-musician(n, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Review tab.
|
||||
if AlbumInfoState.active-tab == "review": Text {
|
||||
text: AlbumInfoState.review;
|
||||
color: Theme.text-secondary;
|
||||
font-size: 14px;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListScrollbar {
|
||||
x: parent.width - self.width;
|
||||
width: 14px;
|
||||
height: 100%;
|
||||
viewport-height: rflick.viewport-height;
|
||||
visible-height: rflick.height;
|
||||
viewport-y <=> rflick.viewport-y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Loading / error overlay -------------------------------
|
||||
// Covers the (empty) skeleton while fetching or on error.
|
||||
if AlbumInfoState.loading || AlbumInfoState.error != "": Rectangle {
|
||||
background: Theme.surface-card;
|
||||
border-radius: Radius.md;
|
||||
// Swallow clicks so the skeleton behind isn't reachable.
|
||||
TouchArea { }
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: 8px;
|
||||
Text {
|
||||
text: AlbumInfoState.error != ""
|
||||
? @tr("Failed to load album credits")
|
||||
: @tr("Loading credits...");
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.body;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
if AlbumInfoState.error != "": Text {
|
||||
text: AlbumInfoState.error;
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.legal;
|
||||
horizontal-alignment: center;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,11 +445,17 @@ export component AlbumPageView inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Album info (i) — icon only for now; the detail panel
|
||||
// logic lands later.
|
||||
VerticalLayout {
|
||||
// Album info (i) — opens the Album Info (Credits/Review)
|
||||
// modal. Qobuz albums only (local albums have no Qobuz
|
||||
// credits/review), 1:1 with Tauri's album-credits button.
|
||||
if !AlbumState.is-local: VerticalLayout {
|
||||
alignment: center;
|
||||
CircleAction { icon: @image-url("../assets/icons/info.svg"); }
|
||||
CircleAction {
|
||||
icon: @image-url("../assets/icons/info.svg");
|
||||
clicked => {
|
||||
root.media-action("album", AlbumState.id, "info");
|
||||
}
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
|
||||
@@ -0,0 +1,348 @@
|
||||
// Track Info modal — 1:1 port of Tauri's TrackInfoModal.svelte. Opened from
|
||||
// the NPB (i) button / song-card title / TrackRow context menu via
|
||||
// media-action("track", id, "track-info"). The Rust controller
|
||||
// (crate::info_modals) fetches the track, parses + groups + localizes the
|
||||
// credits, and populates TrackInfoState. Rectangle-scrim + centered card
|
||||
// (no PopupWindow), mounted in AppShell after the other modals (ADR-009/010).
|
||||
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { TrackInfoState, TrackInfoActions, InfoCreditRow } from "../state.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
import { ListScrollbar } from "../primitives/ListScrollbar.slint";
|
||||
|
||||
// One metadata cell: uppercase label (11px) + a value supplied as a child.
|
||||
component MetaCell inherits VerticalLayout {
|
||||
in property <string> label;
|
||||
spacing: 6px;
|
||||
Text {
|
||||
text: root.label;
|
||||
color: Theme.text-muted;
|
||||
font-size: 11px;
|
||||
font-weight: Typography.semibold;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
@children
|
||||
}
|
||||
|
||||
// One credit cell: role label (11px upper) + the performer names, each
|
||||
// clickable -> musician. Clipped so a long name list can't bleed into the
|
||||
// neighbouring column (the common 1-3 name case fits one line).
|
||||
component CreditCell inherits VerticalLayout {
|
||||
in property <InfoCreditRow> cell;
|
||||
callback name-clicked(string /* name */, string /* role-raw */);
|
||||
spacing: 6px;
|
||||
Text {
|
||||
text: root.cell.role;
|
||||
color: Theme.text-muted;
|
||||
font-size: 11px;
|
||||
font-weight: Typography.semibold;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
Rectangle {
|
||||
clip: true;
|
||||
height: names-row.preferred-height;
|
||||
names-row := HorizontalLayout {
|
||||
alignment: start;
|
||||
for name[j] in root.cell.names: HorizontalLayout {
|
||||
nta := TouchArea {
|
||||
width: nm.preferred-width;
|
||||
height: nm.preferred-height;
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
root.name-clicked(name, root.cell.role-raw);
|
||||
}
|
||||
nm := Text {
|
||||
text: name;
|
||||
color: nta.has-hover ? Theme.accent : Theme.text-primary;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
if j < root.cell.names.length - 1: Text {
|
||||
text: ", ";
|
||||
color: Theme.text-primary;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component TrackInfoModal inherits Rectangle {
|
||||
visible: TrackInfoState.open;
|
||||
|
||||
if TrackInfoState.open: Rectangle {
|
||||
background: #000000bf;
|
||||
|
||||
// Scrim — click outside dismisses.
|
||||
TouchArea {
|
||||
mouse-cursor: default;
|
||||
clicked => {
|
||||
TrackInfoActions.close();
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Math.min(root.width - 40px, 728px);
|
||||
height: Math.min(root.height * 0.8, card-body.preferred-height);
|
||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||
border-radius: Radius.md;
|
||||
background: Theme.surface-card;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border-subtle;
|
||||
drop-shadow-blur: 32px;
|
||||
drop-shadow-color: Theme.card-shadow;
|
||||
|
||||
// Swallow clicks so they don't reach the scrim.
|
||||
TouchArea { }
|
||||
|
||||
fs := FocusScope {
|
||||
// Focus a tick after mount (synchronous focus races layout).
|
||||
Timer {
|
||||
interval: 30ms;
|
||||
running: true;
|
||||
triggered => {
|
||||
self.running = false;
|
||||
fs.focus();
|
||||
}
|
||||
}
|
||||
key-pressed(event) => {
|
||||
if (event.text == Key.Escape) {
|
||||
TrackInfoActions.close();
|
||||
return accept;
|
||||
}
|
||||
return reject;
|
||||
}
|
||||
|
||||
flick := Flickable {
|
||||
viewport-width: self.width;
|
||||
viewport-height: card-body.preferred-height;
|
||||
|
||||
card-body := VerticalLayout {
|
||||
width: parent.width;
|
||||
|
||||
// ---- Loading --------------------------------
|
||||
if TrackInfoState.loading && TrackInfoState.error == "": VerticalLayout {
|
||||
alignment: center;
|
||||
padding: 60px;
|
||||
Text {
|
||||
text: @tr("Loading track info...");
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.body;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Error ----------------------------------
|
||||
if TrackInfoState.error != "": VerticalLayout {
|
||||
alignment: center;
|
||||
padding: 60px;
|
||||
spacing: 8px;
|
||||
Text {
|
||||
text: @tr("Failed to load track info");
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.body;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
Text {
|
||||
text: TrackInfoState.error;
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.legal;
|
||||
horizontal-alignment: center;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Loaded ---------------------------------
|
||||
if !TrackInfoState.loading && TrackInfoState.error == "": VerticalLayout {
|
||||
// Header
|
||||
HorizontalLayout {
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
spacing: 16px;
|
||||
VerticalLayout {
|
||||
horizontal-stretch: 1;
|
||||
spacing: 4px;
|
||||
Text {
|
||||
text: TrackInfoState.title;
|
||||
color: Theme.text-primary;
|
||||
font-size: 16px;
|
||||
font-weight: Typography.semibold;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
if TrackInfoState.album != "": Text {
|
||||
text: TrackInfoState.album;
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.legal;
|
||||
}
|
||||
if TrackInfoState.artist != "": HorizontalLayout {
|
||||
alignment: start;
|
||||
artist-link := TouchArea {
|
||||
width: artist-text.preferred-width;
|
||||
height: artist-text.preferred-height;
|
||||
mouse-cursor: TrackInfoState.artist-id != "" ? pointer : default;
|
||||
clicked => {
|
||||
if (TrackInfoState.artist-id != "") {
|
||||
TrackInfoActions.open-artist(TrackInfoState.artist-id);
|
||||
}
|
||||
}
|
||||
artist-text := Text {
|
||||
text: TrackInfoState.artist;
|
||||
color: TrackInfoState.artist-id != ""
|
||||
? Theme.accent : Theme.text-primary;
|
||||
font-size: 16px;
|
||||
font-weight: Typography.semibold;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Close X
|
||||
close-x := TouchArea {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
TrackInfoActions.close();
|
||||
}
|
||||
QbzIcon {
|
||||
source: @image-url("../assets/icons/x.svg");
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||
tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Content
|
||||
VerticalLayout {
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
padding-bottom: 24px;
|
||||
spacing: 0px;
|
||||
|
||||
// Metadata: fixed 3-column rows.
|
||||
VerticalLayout {
|
||||
spacing: 24px;
|
||||
HorizontalLayout {
|
||||
spacing: 24px;
|
||||
MetaCell {
|
||||
horizontal-stretch: 1;
|
||||
label: @tr("Duration");
|
||||
Text {
|
||||
text: TrackInfoState.duration;
|
||||
color: Theme.text-primary;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
MetaCell {
|
||||
horizontal-stretch: 1;
|
||||
label: @tr("Quality");
|
||||
Text {
|
||||
text: TrackInfoState.quality;
|
||||
color: Theme.text-primary;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
if TrackInfoState.isrc != "": MetaCell {
|
||||
horizontal-stretch: 1;
|
||||
label: "ISRC";
|
||||
Text {
|
||||
text: TrackInfoState.isrc;
|
||||
color: Theme.text-muted;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
if TrackInfoState.isrc == "": Rectangle { horizontal-stretch: 1; }
|
||||
}
|
||||
if TrackInfoState.label != "": HorizontalLayout {
|
||||
spacing: 24px;
|
||||
MetaCell {
|
||||
horizontal-stretch: 1;
|
||||
label: @tr("Label");
|
||||
label-link := TouchArea {
|
||||
width: label-text.preferred-width;
|
||||
height: label-text.preferred-height;
|
||||
mouse-cursor: TrackInfoState.label-id != "" ? pointer : default;
|
||||
clicked => {
|
||||
if (TrackInfoState.label-id != "") {
|
||||
TrackInfoActions.open-label(TrackInfoState.label-id);
|
||||
}
|
||||
}
|
||||
label-text := Text {
|
||||
text: TrackInfoState.label;
|
||||
color: (label-link.has-hover && TrackInfoState.label-id != "")
|
||||
? Theme.accent : Theme.text-primary;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
}
|
||||
}
|
||||
|
||||
// Credits (2 columns), only when present.
|
||||
if TrackInfoState.credits.length > 0: Rectangle { height: 20px; }
|
||||
if TrackInfoState.credits.length > 0: Rectangle {
|
||||
height: 1px;
|
||||
background: Theme.surface-elevated;
|
||||
}
|
||||
if TrackInfoState.credits.length > 0: Rectangle { height: 20px; }
|
||||
if TrackInfoState.credits.length > 0: VerticalLayout {
|
||||
spacing: 16px;
|
||||
for pair in TrackInfoState.credits: HorizontalLayout {
|
||||
spacing: 24px;
|
||||
CreditCell {
|
||||
horizontal-stretch: 1;
|
||||
cell: pair.left;
|
||||
name-clicked(n, r) => {
|
||||
TrackInfoActions.open-musician(n, r);
|
||||
}
|
||||
}
|
||||
if pair.has-right: CreditCell {
|
||||
horizontal-stretch: 1;
|
||||
cell: pair.right;
|
||||
name-clicked(n, r) => {
|
||||
TrackInfoActions.open-musician(n, r);
|
||||
}
|
||||
}
|
||||
if !pair.has-right: Rectangle { horizontal-stretch: 1; }
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright.
|
||||
if TrackInfoState.copyright != "": Rectangle { height: 20px; }
|
||||
if TrackInfoState.copyright != "": Rectangle {
|
||||
height: 1px;
|
||||
background: Theme.surface-elevated;
|
||||
}
|
||||
if TrackInfoState.copyright != "": Rectangle { height: 20px; }
|
||||
if TrackInfoState.copyright != "": Text {
|
||||
text: TrackInfoState.copyright;
|
||||
color: Theme.text-muted;
|
||||
font-size: 12px;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListScrollbar {
|
||||
x: parent.width - self.width - 4px;
|
||||
width: 14px;
|
||||
height: 100%;
|
||||
viewport-height: flick.viewport-height;
|
||||
visible-height: flick.height;
|
||||
viewport-y <=> flick.viewport-y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import { Toast } from "primitives/Toast.slint";
|
||||
import { ShellState } from "state.slint";
|
||||
|
||||
// Re-export the state globals so the Rust layer can populate them.
|
||||
export { HomeState, HomeActions, DiscoverBrowseState, DiscoverBrowseActions, ForYouState, MixState, GenreFilterState, GenreFilterActions, AlbumState, ArtistState, NavState, ShellState, SessionState, SettingsState, AlbumActions, ArtistActions, ArtworkActions, NowPlayingState, QueueState, LyricsState, LyricsLineItem, SearchState, SearchActions, NetworkSidebarState, NetworkSidebarActions, MusicianState, MusicianActions, LabelState, LabelActions, LocationViewState, LocationViewActions, FavoritesState, FavoritesActions, PlaylistPickerState, PlaylistPickerActions, DuplicateConfirmState, DuplicateConfirmActions, PlaylistState, PlaylistActions, SidebarState, SidebarActions, SidebarFolderPopupState, CreatePlaylistState, CreatePlaylistActions, EditPlaylistState, EditPlaylistActions, CreateFolderState, CreateFolderActions, MyQbzCreateState, MyQbzCreateActions, DragState, DragActions, PlaylistManagerState, PlaylistManagerActions, OfflineManagerState, OfflineManagerActions, MyQbzState, MyQbzActions, MixtapeCardItem, MyQbzAddState, MyQbzAddActions, MyQbzAddRow, MyQbzDetailState, MyQbzDetailActions, MixtapeDetailItem, MyQbzEditState, MyQbzEditActions, MyQbzMixState, MyQbzMixActions, DiscoBuilderState, DiscoBuilderActions, DiscoGroup, DiscoCandidate, LocalLibraryState, LocalLibraryActions, LibraryFoldersState, LibFolderEditState, LibraryManageActions, LibraryScanState, LibAlbumFilterState, LocalAlbumState, LocalAlbumActions, TagEditorState, TagEditorActions, FolderEditState, FolderEditActions, ToastState, TextUtil, QconnectDevState, QconnectDevice, AppearanceState, MyQbzBrandingState, EphemeralPlayChoiceState, EphemeralPlayChoiceActions, PlexSettingsState, PlexAuthActions, PlexSectionItem, ScrobbleState, ScrobbleActions, OfflineState, OfflineModeActions, OfflineFavoritesState, OfflineFavoritesActions, ImportLogEntry, PlaylistImportState, PlaylistImportActions } from "state.slint";
|
||||
export { HomeState, HomeActions, DiscoverBrowseState, DiscoverBrowseActions, ForYouState, MixState, GenreFilterState, GenreFilterActions, AlbumState, ArtistState, NavState, ShellState, SessionState, SettingsState, AlbumActions, ArtistActions, ArtworkActions, NowPlayingState, QueueState, LyricsState, LyricsLineItem, SearchState, SearchActions, NetworkSidebarState, NetworkSidebarActions, MusicianState, MusicianActions, LabelState, LabelActions, LocationViewState, LocationViewActions, FavoritesState, FavoritesActions, PlaylistPickerState, PlaylistPickerActions, DuplicateConfirmState, DuplicateConfirmActions, PlaylistState, PlaylistActions, SidebarState, SidebarActions, SidebarFolderPopupState, CreatePlaylistState, CreatePlaylistActions, EditPlaylistState, EditPlaylistActions, CreateFolderState, CreateFolderActions, MyQbzCreateState, MyQbzCreateActions, DragState, DragActions, PlaylistManagerState, PlaylistManagerActions, OfflineManagerState, OfflineManagerActions, MyQbzState, MyQbzActions, MixtapeCardItem, MyQbzAddState, MyQbzAddActions, MyQbzAddRow, MyQbzDetailState, MyQbzDetailActions, MixtapeDetailItem, MyQbzEditState, MyQbzEditActions, MyQbzMixState, MyQbzMixActions, DiscoBuilderState, DiscoBuilderActions, DiscoGroup, DiscoCandidate, LocalLibraryState, LocalLibraryActions, LibraryFoldersState, LibFolderEditState, LibraryManageActions, LibraryScanState, LibAlbumFilterState, LocalAlbumState, LocalAlbumActions, TagEditorState, TagEditorActions, FolderEditState, FolderEditActions, ToastState, TextUtil, QconnectDevState, QconnectDevice, AppearanceState, MyQbzBrandingState, EphemeralPlayChoiceState, EphemeralPlayChoiceActions, PlexSettingsState, PlexAuthActions, PlexSectionItem, ScrobbleState, ScrobbleActions, OfflineState, OfflineModeActions, OfflineFavoritesState, OfflineFavoritesActions, ImportLogEntry, PlaylistImportState, PlaylistImportActions, InfoCreditRow, InfoCreditPair, AlbumCreditPerformer, AlbumCreditTrack, TrackInfoState, TrackInfoActions, AlbumInfoState, AlbumInfoActions } from "state.slint";
|
||||
|
||||
// Which top-level screen is shown. The app starts on `splash` while it
|
||||
// restores a saved session, then resolves to `shell` or `login`.
|
||||
|
||||
@@ -31,6 +31,8 @@ import { FolderEditModal } from "../primitives/FolderEditModal.slint";
|
||||
import { LibFolderEditModal } from "../settings/LibFolderEditModal.slint";
|
||||
import { TagEditorModal } from "../primitives/TagEditorModal.slint";
|
||||
import { PlaylistImportModal } from "../primitives/PlaylistImportModal.slint";
|
||||
import { TrackInfoModal } from "../album/TrackInfoModal.slint";
|
||||
import { AlbumCreditsModal } from "../album/AlbumCreditsModal.slint";
|
||||
import { QconnectDevModal } from "QconnectDevModal.slint";
|
||||
import { DragGhost } from "../primitives/DragGhost.slint";
|
||||
import { Toast } from "../primitives/Toast.slint";
|
||||
@@ -486,6 +488,18 @@ export component AppShell inherits Rectangle {
|
||||
// `open`), keeping QconnectDevModal topmost.
|
||||
PlaylistImportModal { }
|
||||
|
||||
// Track Info + Album Info (Credits/Review) modals — fed by crate::info_modals
|
||||
// through TrackInfoState / AlbumInfoState. Conditional-mount on their own
|
||||
// `open`; stacked above the feature modals (ADR-009/010).
|
||||
TrackInfoModal {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
AlbumCreditsModal {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
// Qobuz Connect DEV diagnostics modal (opened from the connect flyout).
|
||||
QconnectDevModal {
|
||||
width: 100%;
|
||||
|
||||
@@ -341,6 +341,115 @@ export global AlbumState {
|
||||
in property <string> source;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Track Info + Album Info (Credits/Review) modals — 1:1 port of Tauri's
|
||||
// TrackInfoModal.svelte + AlbumCreditsModal.svelte. Data is fetched fresh by
|
||||
// the Rust controller (crate::info_modals) via core.get_track/get_album and
|
||||
// mapped to these plain structs. Roles are parsed + grouped + localized in
|
||||
// qbz_qobuz::performers (frontend-agnostic).
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// One grouped-by-role credit cell in the Track Info grid. `role` is the
|
||||
// already-localized, UPPER-CASED label; each name is clickable -> musician.
|
||||
export struct InfoCreditRow {
|
||||
role: string,
|
||||
// Original (non-localized) role string, passed to the musician-nav hint.
|
||||
role-raw: string,
|
||||
names: [string],
|
||||
}
|
||||
|
||||
// A row in the Track Info 2-column credits grid. The Rust side pairs the
|
||||
// ordered cells (left + optional right) so the modal needs no dynamic grid
|
||||
// placement. `has-right` is false on a trailing odd cell.
|
||||
export struct InfoCreditPair {
|
||||
left: InfoCreditRow,
|
||||
right: InfoCreditRow,
|
||||
has-right: bool,
|
||||
}
|
||||
|
||||
// One performer line inside an expanded Album-Credits track. `roles` is the
|
||||
// raw ", Role1, Role2" suffix (empty when the performer has no roles).
|
||||
export struct AlbumCreditPerformer {
|
||||
name: string,
|
||||
roles: string,
|
||||
// First role (clean) — the musician-nav role hint (Tauri roles[0]).
|
||||
primary-role: string,
|
||||
}
|
||||
|
||||
// One track row in the Album-Credits "Credits" tab.
|
||||
export struct AlbumCreditTrack {
|
||||
id: string,
|
||||
number: string,
|
||||
title: string,
|
||||
artist: string,
|
||||
// True when the row has performers or a copyright line (expandable).
|
||||
has-credits: bool,
|
||||
performers: [AlbumCreditPerformer],
|
||||
copyright: string,
|
||||
}
|
||||
|
||||
// Track Info modal — opened from the NPB (i) button / song-card title /
|
||||
// TrackRow context menu via media-action("track", id, "track-info").
|
||||
export global TrackInfoState {
|
||||
in-out property <bool> open: false;
|
||||
in property <bool> loading: false;
|
||||
in property <string> error: "";
|
||||
in property <string> title;
|
||||
in property <string> album;
|
||||
in property <string> artist;
|
||||
// "" -> artist rendered as plain text (not a link).
|
||||
in property <string> artist-id;
|
||||
in property <string> duration;
|
||||
in property <string> quality;
|
||||
// "" -> the row is hidden.
|
||||
in property <string> isrc;
|
||||
in property <string> label;
|
||||
in property <string> label-id;
|
||||
// Paired (2-column) ordered credit cells.
|
||||
in property <[InfoCreditPair]> credits: [];
|
||||
in property <string> copyright;
|
||||
}
|
||||
|
||||
export global TrackInfoActions {
|
||||
callback close();
|
||||
callback open-artist(string /* artist-id */);
|
||||
callback open-label(string /* label-id */);
|
||||
callback open-musician(string /* name */, string /* role */);
|
||||
}
|
||||
|
||||
// Album Info modal — opened from the AlbumPageView header (i) button via
|
||||
// media-action("album", id, "info").
|
||||
export global AlbumInfoState {
|
||||
in-out property <bool> open: false;
|
||||
in property <bool> loading: false;
|
||||
in property <string> error: "";
|
||||
// "credits" | "review". The Review tab only exists when has-review.
|
||||
in-out property <string> active-tab: "credits";
|
||||
in property <bool> has-review: false;
|
||||
in property <image> artwork;
|
||||
in property <string> title;
|
||||
in property <string> artist;
|
||||
in property <string> label;
|
||||
in property <string> label-id;
|
||||
// Localized "September 2, 2021" ("" hides the date span).
|
||||
in property <string> release-date;
|
||||
// "Hard Rock · 10 tracks · 1h 21m".
|
||||
in property <string> meta-line;
|
||||
// "24-Bit / 96 kHz" ("" hides).
|
||||
in property <string> quality;
|
||||
in property <[AlbumCreditTrack]> tracks: [];
|
||||
// HTML-stripped editorial review ("" -> no Review tab).
|
||||
in property <string> review;
|
||||
}
|
||||
|
||||
export global AlbumInfoActions {
|
||||
callback close();
|
||||
callback set-tab(string /* "credits" | "review" */);
|
||||
callback play-track(string /* track-id */);
|
||||
callback open-label(string /* label-id */);
|
||||
callback open-musician(string /* name */, string /* role */);
|
||||
}
|
||||
|
||||
// Album-view actions wired to Rust callbacks.
|
||||
export global AlbumActions {
|
||||
// Filter the visible track list by a query (client-side).
|
||||
|
||||
Reference in new issue
Block a user