feat(qbz-qt): staged loading, skeletons everywhere, lyrics, gestures, richer menus

**Deferred external rows.** The album page awaited the Last.fm row before
publishing anything, so the tracklist waited on an external service plus
MusicBrainz. It publishes in stages now — header and tracks first, then each
Qobuz rail as it lands, then Last.fm — with every patch merged under a
generation counter so a late reply for album A cannot paint onto album B. The
artist page was already staged this way; its views were the part still showing
bare "Loading…" text.

**Skeletons as the standard.** One control, new variants rather than new
components, mounted across the views. Its second job is the one the owner
named: cleanup. A cover that never resolves settles the placeholder once and
reveals the card's own empty state instead of shimmering forever — local albums
with no embedded art produce no artwork entry at all, so a placeholder gated
only on "not arrived yet" would never stop.

**Local artwork streams.** Fifteen seconds to first cover on a 1274-album grid
was one batch emitted after the whole window resolved. Each cover emits as it
resolves now, visible band before prefetch margin.

**Lyrics migrated.** Smooth sync instead of a 1 Hz tick, word-level karaoke
where the document carries it, the surrounding-line dimming, the controls
flyout and the translation layer the v10 backend already supported. Exactly one
row subscribes to the 30 Hz output; the timer drops to 250ms when paused or
hidden.

**Navigation by mouse and touchpad.** Side buttons and a two-finger horizontal
swipe, matching #653 — including the part that matters, which is that a swipe
over a carousel scrolls the carousel. The layer is declared first in the shell
so everything else gets first refusal.

**Context menus.** Brought to the Slint inventory, Play later included, with
right-click opening the same menu as the button everywhere. Entries whose seam
does not exist are hidden rather than shipped inert.

Two controls that rendered and no-opped are now honestly disabled: the My QBZ
nav row, which routes to a view the shell has no case for, and three sidebar
menu entries with no backing call.

The sidebar caret was never a condition bug. The row is a positioner and the
name cell's width ignored the count label, so a folder WITH content pushed the
chevron past the clip — which is why it vanished exactly when it mattered.

cc
This commit is contained in:
vicrodh committed 2026-07-28 18:12:31 -06:00
1 parent 2b31d3866c
commit f3a33245b2
52 files changed
+4962 -719

No files matched your search

+67 -10
View File
@@ -1,6 +1,28 @@
// CardMenu — the shared ⋯ menu surface for card overlays (promoted from
// LibraryView in phase 21): 33px rows, icon 15 + label 13, driven by an
// `entries` model of {label, icon, action}; emits picked(action).
// CardMenu — THE shared ⋯ / right-click menu surface (promoted from
// LibraryView in phase 21, brought up to primitives/ContextMenuItem.slint
// in the menu-parity round).
//
// Driven by an `entries` model; emits picked(action). Entry shape:
//
// { label, icon, action } a normal row (33px)
// { ..., enabled: false } muted row, ignores clicks
// (ContextMenuItem.slint `enabled`)
// { ..., danger: true } destructive row, red label
// (ContextMenuItem.slint `danger`)
// { sep: true } 1px group separator + 3px air
// (AlbumContextMenu.slint's
// `Rectangle { height: 1px; }`)
//
// Row metrics are ContextMenuItem.slint's: 33px, icon 15px, label 13px,
// and BOTH go text-primary on hover (the .slint tints icon + label
// together; the old POC row kept them permanently secondary).
//
// DEVIATION, deliberate: a `danger` row reddens the LABEL only. Slint
// tints the icon with Theme.danger at render time; QML tinting here is
// pre-baked per tint directory (assets/icons/<tint>/) and there is no
// `danger` bake — inventing one needs a new asset set + build.rs glue, and
// a missing pre-baked file renders NOTHING at runtime. The red label
// carries the signal on its own.
import QtQuick
import com.blitzfc.qbz
@@ -17,32 +39,67 @@ QbzContextMenu {
Repeater {
model: cmRoot.entries
delegate: Rectangle {
id: row
required property var modelData
readonly property bool isSep: modelData.sep === true
readonly property bool rowEnabled: modelData.enabled !== false
readonly property bool isDanger: modelData.danger === true
readonly property bool hot: cmiArea.containsMouse && rowEnabled
width: parent ? parent.width : 0
height: 33
radius: 5
color: cmiArea.containsMouse ? theme.surfaceHover : "transparent"
height: isSep ? 7 : 33
radius: isSep ? 0 : 5
color: hot ? theme.surfaceHover : "transparent"
// ContextMenuItem.slint: `opacity: enabled ? 1.0 : 0.4`.
opacity: (isSep || rowEnabled) ? 1.0 : 0.4
// Separator: a 1px rule centred in the 7px band.
Rectangle {
visible: row.isSep
y: 3
width: parent.width
height: 1
color: theme.borderSubtle
}
Row {
visible: !row.isSep
anchors.fill: parent
anchors.leftMargin: 8
spacing: 8
QbzIcon { name: modelData.icon; width: 15; height: 15; anchors.verticalCenter: parent.verticalCenter; tintName: "secondary" }
QbzIcon {
name: row.modelData.icon || ""
width: 15
height: 15
anchors.verticalCenter: parent.verticalCenter
tintName: row.hot ? "primary" : "secondary"
}
Text {
height: parent.height
width: parent.width - 23
text: modelData.label
color: theme.textSecondary
text: row.modelData.label || ""
color: row.isDanger ? theme.danger
: (row.hot ? theme.textPrimary : theme.textSecondary)
font.pixelSize: 13
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}
MouseArea {
id: cmiArea
anchors.fill: parent
// A separator and a muted row take no input at all — a
// disabled MouseArea also reports no hover, so neither
// highlights.
enabled: !row.isSep && row.rowEnabled
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: { cmRoot.close(); cmRoot.picked(modelData.action) }
onClicked: {
cmRoot.close()
cmRoot.picked(row.modelData.action)
}
}
}
}
@@ -16,6 +16,10 @@
// The background matches ContextMenu.slint (surface-main, Radius.sm,
// 1px border-muted). Rows go in the default content (33px, icon 15 +
// label 13 per the existing per-site convention).
//
// Right-click parity: every ⋯ site also opens ITS menu on a right press
// through the same `openAtCursor(area, mouse.x, mouse.y)` — the button and
// the context gesture must never show different menus.
import QtQuick
import QtQuick.Controls
+274 -47
View File
@@ -1,4 +1,4 @@
// QbzSkeleton — THE shared loading placeholder.
// QbzSkeleton — THE shared loading placeholder, app-wide.
//
// Reference: crates/qbz-ui/ui/discover/HomeSkeleton.slint. The Slint HAS a
// skeleton treatment, and this is a 1:1 port of its primitive: a grey
@@ -7,18 +7,28 @@
// Slint and there is none here — see the COST note below.
//
// What is a deliberate ADDITION beyond the Slint (which mounts a bare 36px
// LoadingSpinner in FavoritesView and no per-item treatment anywhere):
// - the "row" shape (the Slint only has card + bar shapes),
// - the per-item "art" / "circle" tiles the Library mounts over a card
// whose cover has not landed yet,
// - the animated-instance cap + the visibility gate.
// LoadingSpinner in FavoritesView, SearchResultsView, LocalLibraryView and
// LocalAlbumView, and no per-item treatment anywhere):
// - the "row" / "text" / "header" shapes (the Slint only has card + bar),
// - the per-item "art" / "circle" tiles a host mounts over a card whose
// cover has not landed yet,
// - the "cardGrid" / "rowList" COMPOSITES (one instance = a whole grid or
// a whole list of placeholders — see COST),
// - the animated-instance cap, the visibility gate and the settle timeout.
//
// ── COST ───────────────────────────────────────────────────────────────────
// One instance = ONE animator, not one per bar: every bar binds its opacity
// to the single `breathe` real, so a 3-bar card animates one property. An
// instance whose `cellIndex` is past `animatedCap`, or whose view is hidden,
// or whose window is minimized/hidden, holds NO animator at all and renders
// as a static grey block (its Behavior is disabled, so nothing repaints).
// to the single `breathe` real, so a 3-bar card animates one property — and
// a "cardGrid" of 48 cells (144 bars) still animates exactly ONE. That is
// why a host should prefer ONE composite over N single instances.
// An instance whose `cellIndex` is past `animatedCap`, or whose view is
// hidden, or whose window is minimized/hidden, or that has SETTLED, holds NO
// animator at all and renders as a static grey block (its Behavior is
// disabled, so nothing repaints).
// Worst case a host may mount: `animatedCap` (48) animated instances, i.e.
// 48 concurrent 900ms NumberAnimations. A composite spends 1 of those 48 for
// a full viewport, so the realistic worst case per view is far lower — see
// each view's own note.
//
// ── GATING RULE ────────────────────────────────────────────────────────────
// Freeze on NOT VISIBLE — the item being hidden or the window being
@@ -30,6 +40,19 @@
// Preferred: the HOST owns ONE 900ms Timer toggling a bool and every
// skeleton binds `phase:` to it — N placeholders, 1 timer. `selfDrive: true`
// mounts a private timer for one-off mounts.
//
// ── CLEANUP (settleMs) ─────────────────────────────────────────────────────
// A placeholder gated only on "the payload has not landed" can shimmer
// FOREVER when the payload never lands. That is not hypothetical: local
// artwork resolution (src/local_artwork.rs, `resolve_window_blocking`)
// DROPS keys with no cover — "the QML map only ever grows with real hits" —
// so a local album with no embedded art never produces a map entry. The same
// holds for a Qobuz cover whose download fails: the document is republished
// without an `artPath`.
// `settleMs > 0` gives the instance a bounded life: it fades out once and
// stops animating, revealing whatever the real control draws when it has no
// art (AlbumCard's own empty tile, ArtistCard's designed round portrait).
// Per-item clearing still wins whenever the item DOES arrive.
import QtQuick
import QtQuick.Window
@@ -39,12 +62,18 @@ Item {
id: root
// Shape:
// "card" — grid cell: art square + title bar + subtitle bar
// (HomeSkeleton.slint's SkeletonRow card).
// "row" — list row: square art + two bars.
// "art" — bare square art tile (the per-item overlay).
// "block" — one bar (section titles). Same shape as "art".
// "circle" — bare round art tile (ArtistCard/LabelCard's 190 circle).
// "card" — grid cell: art square + title bar + subtitle bar
// (HomeSkeleton.slint's SkeletonRow card).
// "circleCard" — artist grid cell: ROUND art + two centred bars.
// "row" — list row: square art + two bars.
// "art" — bare square art tile (the per-item overlay).
// "block" — one bar (section titles). Same shape as "art".
// "circle" — bare round art tile (ArtistCard/LabelCard's portrait).
// "text" — `lines` stacked text bars, tapering.
// "header" — detail-page header: cover + eyebrow/title/meta bars
// + a row of round action buttons.
// "cardGrid" — COMPOSITE: fills this item with a grid of cards.
// "rowList" — COMPOSITE: fills this item with a column of rows.
property string variant: "card"
// Host-driven breathe phase (ignored when selfDrive is true).
@@ -60,10 +89,40 @@ Item {
property real blockRadius: 8
// "card" is the 200px card footprint: 200 art + 8 + 14 + 8 + 12 (the
// Slint numbers). The other shapes are sized by the host.
implicitWidth: root.variant === "card" ? 200 : 0
implicitHeight: root.variant === "card" ? (root.width + 42) : 0
// --- shape knobs ------------------------------------------------------
// "text"
property int lines: 2
property real lineHeight: 13
property real lineSpacing: 8
// "header"
property real coverSize: 150
property real coverGap: 24
property bool headerRound: false
property int actionCount: 0
// "cardGrid" — cell pitch vs the card drawn inside it.
property real cellW: 220
property real cellH: 266
property real cardW: 200
property real cardH: 246
property bool roundCells: false
property int maxCells: 48
// "rowList"
property real rowH: 50
property real rowGap: 6
// "row" / "rowList": some lists have no artwork cell, and the cell is
// usually SMALLER than the row (TrackRow: 36px art in a 50px row).
property bool rowArt: true
property real rowArtSize: 0 // 0 = square, the full row height
property bool rowArtRound: false // artist rails: the avatar is a disc
// "card"/"circleCard" is the 200px card footprint: 200 art + 8 + 14 + 8
// + 12 (the Slint numbers). The other shapes are sized by the host.
implicitWidth: (root.variant === "card" || root.variant === "circleCard") ? 200 : 0
implicitHeight: (root.variant === "card" || root.variant === "circleCard")
? (root.width + 42)
: root.variant === "text"
? (root.lines * root.lineHeight + Math.max(0, root.lines - 1) * root.lineSpacing)
: root.variant === "header" ? root.coverSize : 0
QbzTheme { id: theme }
@@ -72,8 +131,28 @@ Item {
&& root.Window.window.visibility !== Window.Hidden)
: true
// ---- cleanup / settle -------------------------------------------------
// 0 = never settle (the Home/Library mounts, whose documents always
// republish). > 0 = fade out and stop after that many ms of shimmering.
property int settleMs: 0
property bool settled: false
Timer {
interval: Math.max(1, root.settleMs)
repeat: false
running: root.settleMs > 0 && !root.settled
&& root.visible && root.windowShowing
onTriggered: root.settled = true
}
// A recycled delegate re-shows the placeholder for a DIFFERENT item, so
// the countdown restarts with it.
onVisibleChanged: if (root.visible) root.settled = false
// One 180ms fade, once, at settle — then the instance is inert.
opacity: root.settled ? 0.0 : 1.0
Behavior on opacity { NumberAnimation { duration: 180 } }
readonly property bool pulsing: root.animated
&& root.cellIndex < root.animatedCap
&& !root.settled
&& root.visible && root.windowShowing
property bool _localPhase: false
@@ -95,11 +174,22 @@ Item {
NumberAnimation { duration: 900; easing.type: Easing.InOutQuad }
}
// Cell geometry shared by "card" / "circleCard" (sized to this item) and
// by every cell of "cardGrid" (sized to cardW).
readonly property real _cellW: root.variant === "cardGrid" ? root.cardW : root.width
readonly property bool _cellRound: root.variant === "circleCard"
|| (root.variant === "cardGrid" && root.roundCells)
readonly property real _rowH: root.variant === "rowList" ? root.rowH : root.height
Loader {
anchors.fill: parent
sourceComponent: root.variant === "card" ? cardShape
sourceComponent: (root.variant === "card" || root.variant === "circleCard") ? cellShape
: root.variant === "row" ? rowShape
: root.variant === "circle" ? circleShape
: root.variant === "text" ? textShape
: root.variant === "header" ? headerShape
: root.variant === "cardGrid" ? cardGridShape
: root.variant === "rowList" ? rowListShape
: blockShape
}
@@ -121,26 +211,35 @@ Item {
opacity: root.breathe
}
}
// ONE card cell — art (square or round) + title bar + subtitle bar.
// Absolute child positions, never a Column: a Column inside a Repeater
// whose width comes from its children is a binding-loop invitation.
Component {
id: cardShape
Column {
spacing: 8
id: cellShape
Item {
width: root._cellW
height: root._cellW + 42
Rectangle {
width: root.width
height: root.width
radius: root.blockRadius
width: root._cellW
height: root._cellW
radius: root._cellRound ? root._cellW / 2 : root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
}
Rectangle {
width: root.width * 0.7
y: root._cellW + 8
x: root._cellRound ? (root._cellW - width) / 2 : 0
width: root._cellW * 0.7
height: 14
radius: root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
}
Rectangle {
width: root.width * 0.45
y: root._cellW + 30
x: root._cellRound ? (root._cellW - width) / 2 : 0
width: root._cellW * 0.45
height: 12
radius: root.blockRadius
color: theme.surfaceElevated
@@ -148,30 +247,58 @@ Item {
}
}
}
// ONE list row — art square (optional) + two bars.
Component {
id: rowShape
Row {
spacing: 12
Item {
id: rowRoot
width: root.width
height: root._rowH
readonly property real art: root.rowArtSize > 0 ? root.rowArtSize : root._rowH
readonly property real textX: root.rowArt ? rowRoot.art + 12 : 0
Rectangle {
width: root.height
height: root.height
radius: 6
visible: root.rowArt
y: (root._rowH - rowRoot.art) / 2
width: rowRoot.art
height: rowRoot.art
radius: root.rowArtRound ? rowRoot.art / 2 : 6
color: theme.surfaceElevated
opacity: root.breathe
}
Column {
anchors.verticalCenter: parent.verticalCenter
spacing: 6
Rectangle {
width: root.width * 0.34
height: 13
radius: root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
}
Rectangle {
width: root.width * 0.2
height: 11
Rectangle {
x: rowRoot.textX
y: (root._rowH - 30) / 2
width: root.width * 0.34
height: 13
radius: root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
}
Rectangle {
x: rowRoot.textX
y: (root._rowH - 30) / 2 + 19
width: root.width * 0.2
height: 11
radius: root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
}
}
}
// `lines` stacked text bars: full width, then 80%, last one 45%.
Component {
id: textShape
Item {
Repeater {
model: Math.max(1, root.lines)
delegate: Rectangle {
required property int index
y: index * (root.lineHeight + root.lineSpacing)
width: root.width * (index === 0 ? 1.0
: index === Math.max(1, root.lines) - 1 ? 0.45 : 0.8)
height: root.lineHeight
radius: root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
@@ -179,4 +306,104 @@ Item {
}
}
}
// Detail-page header: cover + eyebrow / title / two meta bars + a row of
// round action buttons (32px, the QbzCircleAction footprint).
Component {
id: headerShape
Item {
Rectangle {
width: root.coverSize
height: root.coverSize
radius: root.headerRound ? root.coverSize / 2 : 12
color: theme.surfaceElevated
opacity: root.breathe
}
Item {
x: root.coverSize + root.coverGap
y: 4
width: Math.max(0, root.width - root.coverSize - root.coverGap)
height: root.coverSize
Rectangle {
width: 88
height: 11
radius: root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
}
Rectangle {
y: 23
width: Math.min(parent.width, 420)
height: 28
radius: root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
}
Rectangle {
y: 63
width: Math.min(parent.width, 300)
height: 14
radius: root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
}
Rectangle {
y: 85
width: Math.min(parent.width, 200)
height: 13
radius: root.blockRadius
color: theme.surfaceElevated
opacity: root.breathe
}
Repeater {
model: root.actionCount
delegate: Rectangle {
required property int index
x: index * 44
y: 110
width: 32
height: 32
radius: 16
color: theme.surfaceElevated
opacity: root.breathe
}
}
}
}
}
// COMPOSITE: a whole grid of card cells on ONE animator. `cellShape`
// sizes itself (cardW x cardW+42), so the Grid only supplies the pitch.
Component {
id: cardGridShape
Item {
id: gridRoot
readonly property int cols: Math.max(1, Math.floor(root.width / root.cellW))
readonly property int rows: Math.max(1, Math.ceil(root.height / root.cellH))
Grid {
columns: gridRoot.cols
columnSpacing: Math.max(0, root.cellW - root.cardW)
rowSpacing: Math.max(0, root.cellH - root.cardH)
Repeater {
model: Math.min(root.maxCells, gridRoot.cols * gridRoot.rows)
delegate: cellShape
}
}
}
}
// COMPOSITE: a whole list of rows on ONE animator.
Component {
id: rowListShape
Item {
Column {
spacing: root.rowGap
Repeater {
model: Math.min(root.maxCells,
Math.max(1, Math.ceil(root.height / (root.rowH + root.rowGap))))
delegate: rowShape
}
}
}
}
}