fix(qbz-qt): local albums route to the local view, and the detail-page parity round

**The empty album view.** Opening a local album from Library "All" landed on a
blank page. The mixed feed hands Qobuz and local albums to the SAME card, and
the card always called the catalog open — so a local id, which is a group key
or a filesystem path, went to /album/get and came back 404. It was in the
owner's log before this round as `get_album(/mnt/nas/…) returned 404`; what
changed is that clearing the stale document turned "shows the previous album"
into "shows nothing", which is how it surfaced. Routing now happens in
open_album itself, using the predicate the feed already uses to route
favourites, so every call site is covered at once instead of card by card.

**Header atmosphere.** Both detail pages get Slint's two-band gradient, tinted
from THIS page's artwork through the ported header_tint — not the now-playing
ambient triad, which is a different subject with a different algorithm.

**Artist page.** The catalog/library toggle existed but was broken: a
hand-rolled copy of the shared tab bar whose delegate walked the wrong parent
chain, so it threw on every evaluation and never took its active colours. It
now mounts the shared control. Added the JUMP TO label, the tab-strip search
with the client-side filter it drives, and the year under release-section
albums. The Network panel ran the full window height and never auto-opened; it
is bounded below the tab strip now and opens unless the content is constrained,
as Slint does. The action circles were the wrong size with the wrong glyph
colour and no overlay arm — which would have left them dark-on-dark once the
gradient landed.

**Quality in track rows.** The column rendered a bare tier; it carries the
badge now, in the one shared row component every surface mounts. playlist_qt
was the only producer not emitting the bit-depth line.

**Skeletons hand over instead of disappearing.** They cleared when the PATH
arrived, but the image still had to load and rasterize after that, so the
placeholder vanished and left an empty cell. They now wait for the image to be
ready.

**Local covers.** Most local covers ARE already the scanner's thumbnail, but
re-hashing their path produced a different filename, so each one was decoded,
resized to its own size and re-encoded into a duplicate before being shown.
That was most of the wait.

cc
This commit is contained in:
vicrodh committed 2026-07-28 19:01:25 -06:00
1 parent f3a33245b2
commit 9ab3d7db96
29 files changed
+1776 -446

No files matched your search

@@ -0,0 +1,74 @@
// HeaderGradient — the artwork-tinted band behind the album / artist page
// headers. ONE component, mounted by BOTH AlbumView and ArtistView (the
// Slint paints them from identical blocks: AlbumPageView.slint:235-257 and
// ArtistPageView.slint:225-247 are the same four lines twice).
//
// The Slint has TWO routes for this band:
// route A header-atmosphere.width > 0 -> ImmersiveAtmosphere (a blurred,
// warped copy of the cover). GPU only.
// route B header-atmosphere.width <= 0 -> a flat linear gradient built
// from `header-color` (crates/qbz/src/artwork.rs header_tint).
// Route A needs a shader; shader effects render NOTHING on this port's
// software path (the same finding that killed ColorOverlay in QbzIcon), so
// this component is route B — which is not an approximation, it is the exact
// fallback arm the Slint itself paints whenever the atmosphere image is
// missing. `tint` is the header_tint hex the Rust side now publishes in the
// page document (album_qt.rs / artist_qt.rs `headerColor`).
//
// Two stacked bands, read off the .slint:
// band 1 linear-gradient(180deg, tint 0%, tint 16%, transparent 100%)
// band 2 linear-gradient(180deg, transparent 0%, transparent 82%,
// surface-main 100%)
// Band 2 lands the fade EXACTLY on the header/content boundary whatever
// height the header resolved to, which is why the host binds `height` to the
// divider's y rather than to a constant.
//
// Mount it as the FIRST child of the page Flickable (so it scrolls with the
// content, as the Slint's does) at x:0 with the viewport width — the band is
// deliberately full-bleed: the page's own 32px padding must not clip it, or
// a dark gutter strip appears on the right (the .slint comment at
// AlbumPageView.slint:199-202 documents that exact regression).
import QtQuick
import "../theme"
Item {
id: root
QbzTheme { id: theme }
/// Artwork-derived tint, "#rrggbb" (header_tint). Empty = nothing paints.
property string tint: ""
/// The appearance pref AND the "no app-wide dynamic background" gate:
/// `AppearanceState.album-header-gradient && !ShellState.app-background-active`
/// (AlbumPageView.slint:168). The dynamic background and this atmosphere
/// clash, so only one of them is ever on.
property bool active: false
// `visible` gates the paint, but bindings still evaluate underneath it —
// so the stops read this, never the raw string: coercing "" to a colour
// logs a warning on every re-evaluation.
readonly property color tintColor: root.tint === "" ? "transparent" : root.tint
visible: root.active && root.tint !== ""
// Never eat clicks meant for the header controls painted on top.
enabled: false
Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: root.tintColor }
GradientStop { position: 0.16; color: root.tintColor }
GradientStop { position: 1.0; color: "transparent" }
}
}
Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 0.82; color: "transparent" }
GradientStop { position: 1.0; color: theme.surfaceMain }
}
}
}
+43 -17
View File
@@ -1,39 +1,65 @@
// QbzCircleAction — the on-surface circular header action (Slint
// primitives/CircleAction.slint on-surface arm), consolidated in phase 22
// from THREE copies (AlbumView.CircleBtn ≡ ArtistView.CircleBtn,
// PlaylistView.CircleBtn = superset with the `primary` + `btnEnabled`
// arms). 32px elevated disc + 1.5px muted ring (active = accent glyph);
// `primary` = 40px accent disc (black glyph).
// NOTE: the OVERLAY-palette circle buttons (on artwork) are the separate
// CardOverlayButton.qml — different palette, deliberately not merged.
// QbzCircleAction — the circular header action, BOTH arms of Slint
// primitives/CircleAction.slint. Consolidated in phase 22 from THREE copies
// (AlbumView.CircleBtn ≡ ArtistView.CircleBtn, PlaylistView.CircleBtn =
// superset with the `primary` + `btnEnabled` arms).
//
// Numbers, read off primitives/CircleAction.slint:
// :24 diameter — primary 44, secondary 32 (the hierarchy lives HERE, not
// in the callers; the port had 40 and was uniformly small)
// :66 glyph — primary 19, secondary 15
// :48 ON-SURFACE arm (`overlay: false`, the default): primary = accent
// disc, secondary = surface-elevated disc, hover/active surface-hover
// :60 ring — border-strong (the port used border-muted)
// :70 glyph tint — active accent; else primary WHITE, secondary
// text-primary. The port painted the on-surface primary glyph BLACK,
// which is the OTHER arm's colour.
// :56 OVERLAY arm (`overlay: true`) — for buttons sitting on the dark
// artwork atmosphere (the album / artist header once the header
// gradient is on): primary = solid white disc with a BLACK glyph,
// secondary = #ffffff24 fill (#ffffff3d hover/active), 1.5px
// #ffffffcc ring, white glyph.
// NOTE: the card hover-overlay circles are still the separate
// CardOverlayButton.qml — same palette, different sizing contract.
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
id: root
property string name: ""
property bool active: false
property bool primary: false
property bool btnEnabled: true
/// Light-on-dark palette for a button painted over artwork/atmosphere
/// (CircleAction.slint's default arm; `on-surface: false` there).
property bool overlay: false
signal clicked(var mouse)
QbzTheme { id: theme }
width: primary ? 40 : 32
height: primary ? 40 : 32
width: primary ? 44 : 32
height: primary ? 44 : 32
radius: width / 2
color: primary ? (cbArea.containsMouse && btnEnabled ? theme.accentHover : theme.accent)
: (cbArea.containsMouse || active) ? theme.surfaceHover : theme.surfaceElevated
color: overlay
? (primary
? (cbArea.containsMouse && btnEnabled ? "#d6ffffff" : "#ffffff")
: ((cbArea.containsMouse || active) ? "#3dffffff" : "#24ffffff"))
: (primary
? (cbArea.containsMouse && btnEnabled ? theme.accentHover : theme.accent)
: ((cbArea.containsMouse || active) ? theme.surfaceHover : theme.surfaceElevated))
border.width: primary ? 0 : 1.5
border.color: theme.borderMuted
border.color: overlay ? "#ccffffff" : theme.borderStrong
opacity: btnEnabled ? 1.0 : 0.4
QbzIcon {
name: parent.name
width: primary ? 20 : 15
height: primary ? 20 : 15
name: root.name
width: root.primary ? 19 : 15
height: root.primary ? 19 : 15
anchors.centerIn: parent
tintName: parent.primary ? "black" : (parent.active ? "accent" : "primary")
// active wins in both arms; then: overlay primary = black glyph on
// the white disc, everything else = the light/primary glyph.
tintName: root.active ? "accent"
: (root.overlay && root.primary ? "black" : "primary")
}
MouseArea {
id: cbArea
@@ -0,0 +1,161 @@
// QbzJumpNavBar — 1:1 port of primitives/JumpNavBar.slint.
//
// The section-jump strip that sits between a page header and its body:
// [JUMP TO] tab tab tab … [magnifier]
// The Slint mounts it on the artist page and (without the search arm) on the
// label page, which is why it lives in controls/ rather than inside a view.
//
// Numbers, read off primitives/JumpNavBar.slint:
// :59 height 44 :60 background = `bar-bg` (host passes the page fill)
// :65 1px border-subtle hairline pinned to the BOTTOM edge
// :74 padding-left/right 32 :76 spacing 18 between label / tabs / search
// :84 "JUMP TO" — legal (13px), semibold, text-muted, letter-spacing 0.5
// :106 tab spacing 14; :111 32px tall cell, width = text + 4, text x = 2
// :116 active -> text-primary + semibold, hover -> text-primary,
// else text-secondary + regular; :128 2px accent underline when active
// :157 open search field 216px wide, 200ms ease-in-out, surface-card
// :260 closed toggle 32px, radius 6, hover surface-elevated, 16px glyph
//
// The search affordance is the SHARED controls/QbzLineEdit expandable arm
// (ExpandableSearch.slint), not a second inline input: same interaction —
// closed magnifier slot, opens right-anchored growing LEFT over the tabs,
// X clears and closes, Esc closes. Its closed slot is 34px against the
// .slint's 32px; that 2px is the price of not owning a fourth search box.
//
// Presentation only: sticky positioning and what a tab scrolls to are the
// host's business (the .slint says the same at :12).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
id: root
QbzTheme { id: theme }
/// [{ id, label }] — the sections present on the page.
property var tabs: []
property string activeTabId: ""
/// Page fill, so the bar reads as part of the page (and can go
/// translucent under the dynamic background, like the .slint's bar-bg).
property color barBg: theme.surfaceMain
/// The label page mounts the bar WITHOUT the search affordance.
property bool showSearch: true
/// Horizontal inset. 32 = the .slint's own padding for a full-bleed
/// mount; a host that already pads its column passes 0.
property real padH: 32
signal tabClicked(string id)
signal searchEdited(string text)
/// Host hook: clear the filter when the field closes itself (Esc / X).
property alias searchOpen: searchBox.open
height: 44
color: root.barBg
Rectangle {
x: 0
y: parent.height - 1
width: parent.width
height: 1
color: theme.borderSubtle
}
Text {
id: jumpLabel
x: root.padH
anchors.verticalCenter: parent.verticalCenter
text: QbzSession.tr("JUMP TO", QbzSession.trRev)
color: theme.textMuted
font.pixelSize: theme.fontLegal
font.weight: theme.weightSemibold
font.letterSpacing: 0.5
}
// Tab strip. Clipped so a long discography's tabs never spill under the
// search slot (the .slint's `center-region { clip: true }`).
Item {
id: centerRegion
x: jumpLabel.x + jumpLabel.width + 18
y: 0
width: Math.max(0, root.width - root.padH
- (searchSlot.visible ? searchSlot.width + 18 : 0)
- x)
height: parent.height
clip: true
Row {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: 14
Repeater {
model: root.tabs
delegate: Item {
id: tabCell
required property var modelData
readonly property bool active: modelData.id === root.activeTabId
width: tabText.implicitWidth + 4
height: 32
Text {
id: tabText
x: 2
height: parent.height
verticalAlignment: Text.AlignVCenter
text: tabCell.modelData.label
color: (tabCell.active || tabArea.containsMouse)
? theme.textPrimary : theme.textSecondary
font.pixelSize: theme.fontBody
font.weight: tabCell.active ? theme.weightSemibold
: theme.weightRegular
}
Rectangle {
visible: tabCell.active
x: 0
y: parent.height - 2
width: parent.width
height: 2
color: theme.accent
}
MouseArea {
id: tabArea
anchors.fill: parent
// The .slint disables the tabs while the field is
// open (they are behind it).
enabled: !searchBox.open
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.tabClicked(tabCell.modelData.id)
}
}
}
}
}
// Search slot — keeps the CLOSED footprint; the field itself grows left
// over the tabs, so nothing in the bar reflows when it opens.
Item {
id: searchSlot
visible: root.showSearch
width: searchBox.width
height: searchBox.height
anchors.right: parent.right
anchors.rightMargin: root.padH
anchors.verticalCenter: parent.verticalCenter
QbzLineEdit {
id: searchBox
searchMode: true
expandable: true
// surface-card overlay fill (JumpNavBar.slint:164), not the
// toolbar's elevated.
elevated: false
openWidth: Math.min(216, Math.max(120, centerRegion.width))
placeholder: QbzSession.tr("Search this page…", QbzSession.trRev)
onEdited: function (v) { root.searchEdited(v) }
}
}
}
+78 -5
View File
@@ -41,7 +41,32 @@
// skeleton binds `phase:` to it — N placeholders, 1 timer. `selfDrive: true`
// mounts a private timer for one-off mounts.
//
// ── CLEANUP (settleMs) ─────────────────────────────────────────────────────
// ── COVER HANDOVER (`pending` / `coverReady` / `coverSource`) ──────────────
// THE BUG THIS EXISTS FOR: every surface used to gate its cover placeholder
// on `artPath !== ""`. That predicate goes false the moment the PATH lands —
// but the art is not on screen then. theme/RoundedImage.qml is a Canvas: it
// still has to load the file through its probe and rasterize it. So the
// placeholder vanished and the cell sat EMPTY until the canvas painted.
//
// The honest gate is "has the image handed over", and there are two arms:
// - `coverReady` — bind it to `RoundedImage.ready` when the host can see
// the image item (the local rows, the detail headers). EXACT: the
// placeholder is still fully opaque on the frame the art appears.
// - `coverSource` — the art path, for hosts whose image is sealed inside a
// component they do not own (AlbumCard, PlaylistCard, SlimCard, …). This
// instance then loads the SAME path through its own hidden probe; because
// QQuickPixmapCache is shared and process-wide, that is the SAME cache
// entry the card is loading, so it costs no second decode and no second
// copy in memory — it only tells us WHEN the decode finished. The card's
// canvas paints on the next frame, which the 180ms fade below covers.
// `pending` is the third input: "this cell wants a cover at all". A row with
// no artwork slot passes false and gets no placeholder.
//
// Call sites that still set `visible:` by hand keep their own (path-based)
// behaviour — the new default binding only applies where `visible` is left
// alone. That is deliberate: the gate is opted into file by file.
//
// ── CLEANUP (settleMs / settleHold) ────────────────────────────────────────
// 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`)
@@ -53,6 +78,11 @@
// 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.
// `settleHold` suspends that countdown while the host knows a resolution pass
// is still in flight, so a cover that takes longer than settleMs to decode
// (a COLD local library takes seconds — see LocalLibraryView.artSettleMs)
// does not settle to an empty tile a beat before it lands. The bound still
// holds: the host drops the hold when its pass goes quiet.
import QtQuick
import QtQuick.Window
@@ -131,28 +161,66 @@ Item {
&& root.Window.window.visibility !== Window.Hidden)
: true
// ---- cover handover (see the block comment) ---------------------------
/// "This cell wants a cover." false retires the placeholder at once.
property bool pending: true
/// Host-driven readiness — bind to `RoundedImage.ready`.
property bool coverReady: false
/// Self-probing readiness — the art path, when the image is sealed inside
/// a component the host does not own. "" disarms the probe entirely.
property string coverSource: ""
Image {
id: coverProbe
source: root.coverSource
visible: false
asynchronous: true
cache: true
// NO sourceSize: it is part of the pixmap-cache key, so requesting a
// different decode size here would fork a SECOND decode of the same
// file instead of riding the one the card already asked for.
}
/// The art is on screen (or, on the probe arm, decoded and one frame from
/// it). This — not the path — is what retires the placeholder.
readonly property bool handedOver: root.coverReady
|| (root.coverSource !== "" && coverProbe.status === Image.Ready)
// ---- 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
/// While true the countdown is suspended: the host's resolution pass is
/// still in flight, so "nothing has landed yet" is not yet evidence that
/// nothing ever will.
property bool settleHold: false
property bool settled: false
Timer {
interval: Math.max(1, root.settleMs)
repeat: false
running: root.settleMs > 0 && !root.settled
running: root.settleMs > 0 && !root.settled && !root.settleHold
&& !root.handedOver
&& 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
// A new pass arming the hold un-settles an instance that already gave up:
// its cover may be in THIS pass.
onSettleHoldChanged: if (root.settleHold) root.settled = false
// One 180ms fade, once — at settle, at handover, or when the cell stops
// wanting a cover. The fade is what removes the empty frame on handover:
// the canvas paints on the next frame (~16ms in), while this is still at
// ~91% opacity, so the placeholder dissolves INTO the art.
readonly property bool retired: root.settled || root.handedOver || !root.pending
opacity: root.retired ? 0.0 : 1.0
Behavior on opacity { NumberAnimation { duration: 180 } }
// Default only — a call site that assigns `visible` replaces this and
// keeps its own gate (see the block comment).
visible: root.opacity > 0.004
readonly property bool pulsing: root.animated
&& root.cellIndex < root.animatedCap
&& !root.settled
&& !root.retired
&& root.visible && root.windowShowing
property bool _localPhase: false
@@ -183,6 +251,11 @@ Item {
Loader {
anchors.fill: parent
// A retired instance frees its rectangles instead of keeping a dead
// scene subtree per cell — a settled 48-cell grid is 144 Rectangles.
// Keyed off `opacity`, not `visible`, so a call site that overrides
// `visible` cannot strand the shape alive mid-fade.
active: root.opacity > 0.004
sourceComponent: (root.variant === "card" || root.variant === "circleCard") ? cellShape
: root.variant === "row" ? rowShape
: root.variant === "circle" ? circleShape