fix(qt): the defects found smoking the playlist and My QBZ round

Un-following a Qobuz playlist left it in the sidebar and in My Library.
toggle_follow called unsubscribe_playlist and settled the ownership snapshot
and stopped there, so the row only left at the next full refetch. Both
surfaces are patched directly now, in both directions: following from a card
buys the metadata with one get_playlist rather than re-reading
getUserPlaylists, which lags the write. The un-follow collapses a
hearted-and-followed playlist to the one row the next load will actually
produce instead of dropping it, because the local heart is a library.db flag
that survives the unsubscribe — removing every row made it vanish and come
back, which is the original complaint wearing the other shoe.

The Plex mark on album cards was a hard-drive glyph tinted accent — a blue
hard drive — and the three Qobuz kinds drew no badge at all. The badge now
ports discover/AlbumCard.slint:326-354 exactly: 24x24 at radius 4 pinned
bottom-right with a 6px inset, plex-logo untinted at 16, qobuz-logo at 18
(22 for a download), the purchase arm gold on its amber chip, hard-drive
white at 14 for local only. The brand marks are plain Images: routing them
through QbzIcon floods every pixel with the tint and flattens a logo to a
silhouette. SourceIcon moves to controls/ since it is no longer local-only,
and every other surface drawing a hard-drive was audited against its .slint.

The local album detail loses the two nav chevrons above the art. They are a
Tauri-era leftover from before the app had global navigation.

My QBZ used a bespoke card in the grid. MyQbzDetailCard is deleted and the
standard cards/AlbumCard is mounted with its overlay. localMode bundled four
separate things — action routing, the heart, the pin and Block this album —
so a multi-source container had to switch all four off together; it is split,
and the catalog affordances now follow the ITEM. On a Qobuz cell the heart
works through the shared favourite seam; on a track, playlist, local or Plex
cell it is absent rather than dead. Row covers carry two rungs: the list keeps
_50, the grid gets _600. Not the _230 that would merely cover a 200px card —
the complaint was that the cover reads softer than a normal AlbumCard, and a
normal AlbumCard is fed image.large, which IS _600. _200 is not a rung the
CDN serves at all (it answers 404).

The My QBZ grid sets reuseItems, and AlbumCard assigns to its own isFavorite
and isPinned when toggled, which destroys the binding that fed them. A
recycled delegate therefore showed the previous row's heart and the click
added the new album while the glyph said remove. Restored with the
Qt.binding idiom this port already uses on TrackCard, PlaylistCard and
TrackRow.

The details view no longer force-opens every row on entry, and the per-row
open state persists.

Library > Artists showed placeholders for nearly every portrait. The side
panel never reported its artwork window — the one caller of
libraryArtworkWindow is LibraryView.reportWindow, and the panel had no
report call at all, so no key ever reached the resolver and artMap stayed
empty for its rows. The rail now reports through that same path, with the
section-header sentinel reportWindow already skips. Note the reference has
no portrait fallback either: an artist Qobuz serves no image for is a
placeholder on both sides.

cc
This commit is contained in:
vicrodh committed 2026-08-01 15:29:03 -06:00
1 parent a16cf56c86
commit 35508b5f87
37 files changed
+2043 -506

No files matched your search

+40 -2
View File
@@ -692,16 +692,30 @@ Rectangle {
}
// Debounced window reporting (180ms, library_all.rs throttle).
//
// `pendingRows` is the array the band indexes into. It is null for every
// body that scrolls `visibleRows` itself (grid, list, albums list,
// playlists list) and non-null ONLY for a body whose mounted order is not
// `visibleRows` — today that is the Artists sidepanel rail, which sorts
// A-Z and interleaves letter headers, so its ListView index N is NOT
// `visibleRows[N]`. Reporting the rail against `visibleRows` would name
// the wrong artists; reporting nothing (what it did until now) left
// `artMap` empty for every row it mounts and every rail avatar fell to
// the placeholder.
Timer {
id: windowDebounce
interval: 180
onTriggered: root.reportWindow(root.visibleRows, pendingFirst, pendingLast)
onTriggered: root.reportWindow(
pendingRows ? pendingRows : root.visibleRows, pendingFirst, pendingLast)
property int pendingFirst: 0
property int pendingLast: 0
property var pendingRows: null
}
function queueWindowReport(first, last) {
/// `rows` is optional — omit it and the band is read off `visibleRows`.
function queueWindowReport(first, last, rows) {
windowDebounce.pendingFirst = first
windowDebounce.pendingLast = last
windowDebounce.pendingRows = rows === undefined ? null : rows
windowDebounce.restart()
}
@@ -957,6 +971,7 @@ Rectangle {
onContentYChanged: root.gridWindowReport()
onModelChanged: root.gridWindowReport()
onWidthChanged: root.gridWindowReport()
onVisibleChanged: root.gridWindowReport()
Component.onCompleted: root.gridWindowReport()
delegate: FeedGridCell {
@@ -984,6 +999,7 @@ Rectangle {
model: root.visibleRows
onContentYChanged: root.listWindowReport()
onModelChanged: root.listWindowReport()
onVisibleChanged: root.listWindowReport()
Component.onCompleted: root.listWindowReport()
delegate: Loader {
@@ -1091,7 +1107,16 @@ Rectangle {
boundsBehavior: Flickable.StopAtBounds
model: content.showPlaylistsList ? root.visibleRows : []
// Gated on visibility for the same reason gridWindowReport and
// listWindowReport are: `artMap` is ONE map, a report PRUNES
// outside its band, and this body still fires while hidden —
// `model` flips to [] on every tab switch (onModelChanged) and
// `anchors.fill` makes every window resize an onHeightChanged.
// Ungated, a resize on the Artists sidepanel evicted the rail's
// avatars and requested a `visibleRows` band the rail is not
// even showing (its order is A-Z, not feed order).
function report() {
if (!playlistsList.visible) return
var first = Math.max(0, Math.floor(playlistsList.contentY / 62) - 4)
var last = Math.ceil((playlistsList.contentY + playlistsList.height) / 62) + 4
root.queueWindowReport(first, Math.min(root.visibleRows.length - 1, last))
@@ -1099,6 +1124,7 @@ Rectangle {
onContentYChanged: playlistsList.report()
onModelChanged: playlistsList.report()
onHeightChanged: playlistsList.report()
onVisibleChanged: playlistsList.report()
Component.onCompleted: playlistsList.report()
delegate: PlaylistListRow {
@@ -1202,7 +1228,18 @@ Rectangle {
// setModel() — see the visibleRows comment. Everything they touch on the
// view (width/height/contentY/cellWidth/cellHeight) is a plain qreal on
// the private; the array comes from root, never from the view.
//
// Both early-return while their body is hidden. `artMap` is ONE map and a
// report PRUNES everything outside the reported band, so a hidden body
// that still fires (the grid's rightMargin changes when `alphaVisible`
// flips; the list's `onModelChanged` fires on every tab switch because its
// `model` is bound to `visibleRows` unconditionally) would evict the
// covers of whichever body is actually on screen — the Artists sidepanel
// rail above all, since it is the one body whose band is NOT a
// `visibleRows` band. `onVisibleChanged` keeps the gate from swallowing
// the first report of a body that becomes visible after its model landed.
function gridWindowReport() {
if (!grid.visible) return
var cols = Math.max(1, Math.floor(grid.width / grid.cellWidth))
var firstRow = Math.max(0, Math.floor(grid.contentY / grid.cellHeight) - 1)
var lastRow = Math.ceil((grid.contentY + grid.height) / grid.cellHeight) + 1
@@ -1210,6 +1247,7 @@ Rectangle {
queueWindowReport(firstRow * cols, Math.min(m.length - 1, lastRow * cols - 1))
}
function listWindowReport() {
if (!list.visible) return
var first = Math.max(0, Math.floor(list.contentY / 44) - 4)
var last = Math.ceil((list.contentY + list.height) / 44) + 4
queueWindowReport(first, Math.min(root.visibleRows.length - 1, last))
+10 -13
View File
@@ -218,19 +218,16 @@ Rectangle {
spacing: 0
// ---- History navigation ----
Row {
spacing: 6
QbzNavButton {
name: "chevron-left"
btnEnabled: QbzShell.canBack
onClicked: QbzShell.navigateBack()
}
QbzNavButton {
name: "chevron-right"
btnEnabled: QbzShell.canForward
onClicked: QbzShell.navigateForward()
}
}
// NOTHING here, by design. LocalAlbumView.slint:207 does mount
// `NavButtons { }`, but NavButtons.slint:5-8 is a ZERO-SIZE empty
// placeholder: "the back / forward / collapse buttons moved to the
// app header (HeaderBar, floating right) … the real buttons live
// once, in the header". Drawing real chevrons here was a Tauri-era
// leftover — the page-level nav from before the app had global
// history — and views/AlbumView.qml already gets this right.
// The 22px spacer stays: it is the .slint's own
// `Rectangle { height: 22px; }` (:211), which follows a zero-high
// NavButtons, so the header lands exactly where it does today.
Item { width: 1; height: 22 }
// ---- Album header ----
+16
View File
@@ -76,6 +76,12 @@ Rectangle {
/// only affordances and, for the reorder below, it changes WHICH sort is
/// the reorderable one.
readonly property bool isLocal: doc.isLocalPlaylist === true
/// A Qobuz WRITE can be attempted. `QbzSession.offlineMode` is the shared
/// tri-state (0 = online, 1 = no connection, 2 = induced offline — the same
/// property `shell/HeaderBar.qml:101` and `controls/QbzOfflinePlaceholder`
/// read), and BOTH non-zero arms refuse the request in Rust, so the buttons
/// that depend on one must not advertise otherwise.
readonly property bool online: QbzSession.offlineMode === 0
// --- Reorderable? (owner findings 5 + 8) -----------------------------
// PlaylistView.slint:1094-1096 states the rule: the reorder affordance is
@@ -452,8 +458,17 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
onClicked: QbzBridge.playlistTogglePin()
}
// Follow / unfollow and Copy are Qobuz WRITES
// (`playlist/subscribe`, `playlist/create`): offline they
// cannot succeed, and the port let them be clicked anyway —
// the request was gate-refused and the only trace was a log
// line. They stay visible and go inert (0.4 opacity, no
// hover, arrow cursor), which is the reference's read-only
// treatment of the offline hearts rather than a control
// that vanishes and leaves the row jumping.
QbzCircleAction {
visible: !root.isOwner
btnEnabled: root.online
name: (doc.isFollowing === true) ? "check" : "user-plus"
active: doc.isFollowing === true
anchors.verticalCenter: parent.verticalCenter
@@ -461,6 +476,7 @@ Rectangle {
}
QbzCircleAction {
visible: !root.isOwner && doc.isCopied !== true
btnEnabled: root.online
name: "copy"
anchors.verticalCenter: parent.verticalCenter
onClicked: QbzBridge.playlistCopy()
@@ -49,7 +49,13 @@ Item {
// landed in the Home Pinned rail as a permanent grey placeholder,
// across restarts.
artworkUrl: cell.item.imageUrl || ""
// The source word is ALWAYS passed (the "Block this album" menu
// gate reads it); the toolbar's show-local toggle only decides
// whether the BADGE is drawn — FavoritesView.slint:1097
// `show-source-badge: LibraryAllState.show-local`, the same gate
// the track card below already uses.
source: cell.item.source
showSourceBadge: cell.view.showLocal
}
}
// Group separator. These are pseudo-rows injected into the SAME flat model
@@ -243,16 +243,28 @@ Rectangle {
width: 44
height: parent.height
color: "transparent"
QbzIcon {
visible: feedRow.item.source === "local" || feedRow.item.source === "plex"
name: "hard-drive"
width: 14
height: 14
anchors.verticalCenter: parent.verticalCenter
// Through controls/SourceIcon.qml, never QbzIcon: the Plex and
// Qobuz marks are MULTI-COLOUR and a tint flattens them to a
// silhouette. This column used to draw an accent-tinted
// `hard-drive` for Plex — a blue hard drive.
//
// DEVIATION, stated on purpose: the .slint has NO source column in
// this list at all (FavoritesView.slint:1767/2154 pass
// `show-source: false` to AlbumCollectionView). The numbers below
// are therefore its siblings' — AlbumListRow.slint:319, the row
// glyph, not the card badge.
SourceIcon {
visible: (feedRow.item.source || "") !== ""
&& feedRow.item.source !== "qobuz"
kind: feedRow.item.source || ""
glyphSize: 15
plexSize: 16
qobuzSize: 16
// Host is a transparent column over the theme row (NOT an
// artwork scrim), so this matches its siblings
// local/LocalAlbumRow.qml and local/LocalTrackRow.qml.
tintName: feedRow.item.source === "plex" ? "accent" : "muted"
localTint: "muted"
anchors.verticalCenter: parent.verticalCenter
}
}
// Col — quality (albums + tracks).
@@ -96,7 +96,17 @@ Item {
// Windowed artwork, same contract as the grid: never read
// `list.model` back off the view (views/LibraryView.qml
// documents the SIGSEGV), always the array from the host.
//
// Gated on visibility like the host's own bodies
// (LibraryView.gridWindowReport / listWindowReport): `artMap`
// is ONE map and a report PRUNES outside its band, while this
// body keeps firing hidden — `rows` flips to [] on every tab
// switch (onModelChanged) and `anchors.fill` turns any window
// resize into onHeightChanged. Ungated it evicted whichever
// body is actually on screen, the Artists sidepanel rail above
// all, whose band is NOT a `visibleRows` band.
function report() {
if (!list.visible) return
var stride = root.rowH + root.rowGap
var first = Math.max(0, Math.floor(list.contentY / stride) - 4)
var last = Math.ceil((list.contentY + list.height) / stride) + 4
@@ -106,6 +116,7 @@ Item {
onContentYChanged: list.report()
onModelChanged: list.report()
onHeightChanged: list.report()
onVisibleChanged: list.report()
Component.onCompleted: list.report()
delegate: AlbumListRow {
@@ -39,6 +39,25 @@ Item {
// shape), instead of a Repeater per section.
property var entries: []
property var alphaJumps: []
// The SAME array, indexed the same way, in the shape LibraryView's
// `reportWindow` reads (`kind` / `artKey` / `imageUrl`): rail rows are the
// feed row objects themselves, letter headers are the group-header
// sentinel that report already knows to skip. It exists because the rail's
// order is NOT `visibleRows` (it re-sorts A-Z and interleaves headers), so
// index N here is not `visibleRows[N]` and the band has to travel with its
// own array — see LibraryView.queueWindowReport's third argument.
property var railRows: []
readonly property var headerRow: ({ "kind": "group-header", "artKey": "", "imageUrl": "" })
/// Held while `entries` and `railRows` are being swapped. Assigning
/// `entries` re-evaluates the ListView's `model` binding SYNCHRONOUSLY,
/// which emits `onModelChanged` -> `report()` one statement BEFORE
/// `railRows` is updated — an index band read off the new entries against
/// the old flat array. The trailing `report()` supersedes it in the common
/// case (the debounce is a `restart()`), but NOT when the rebuild ends
/// empty: `report()` bails on `railRows.length === 0`, leaving the stale
/// band queued and pinning covers for artists the rail no longer shows
/// (the "search with no matches" path). One flag closes both.
property bool _rebuilding: false
function rebuild() {
var rows = root.view ? root.view.visibleRows : []
var artists = []
@@ -52,6 +71,7 @@ Item {
return av < bv ? -1 : av > bv ? 1 : 0
})
var out = []
var flat = []
var jumps = []
var last = null
for (i = 0; i < artists.length; i++) {
@@ -59,18 +79,68 @@ Item {
if (key !== last) {
jumps.push({ "letter": key, "index": out.length })
out.push({ "t": 0, "label": key })
flat.push(root.headerRow)
last = key
}
out.push({ "t": 1, "item": artists[i] })
flat.push(artists[i])
}
root._rebuilding = true
root.entries = out
root.railRows = flat
root.alphaJumps = jumps
root._rebuilding = false
root.report()
}
Component.onCompleted: root.rebuild()
Component.onCompleted: { root.rebuild(); root.reportSoon() }
Connections {
target: root.view
function onVisibleRowsChanged() { root.rebuild() }
}
// ------------------------ windowed avatars ---------------------------
// The rail rides the SAME id-keyed artwork window every other Library
// body uses — LibraryView.reportWindow -> QbzLibrary.libraryArtworkWindow
// -> main.rs library_artwork_window -> libraryArtworkReady -> `artMap`,
// which is what the row avatars bind to below. Until this landed the
// panel reported nothing at all, so `artMap` only ever held whatever
// another tab had left in it and practically every rail avatar drew the
// placeholder glyph.
//
// Only the mounted band is asked for (rule 6): the rail is one row per
// followed artist and can run to hundreds.
function report() {
if (root._rebuilding) return
if (!root.view || root.railRows.length === 0) return
// Same gate the sibling rail uses (views/local/LocalArtistsTab.qml:309)
// and the host's own bodies now use: a hidden surface must not report,
// because `artMap` is ONE map and a report PRUNES outside its band.
// `contentY`/`height` keep firing while the whole Library view is off
// screen (another nav destination), and a report made then evicts the
// covers of whatever IS on screen. The `onVisibleChanged` handler on
// `railList` re-reports when the rail comes back.
if (!railList.visible) return
var first = railList.indexAt(4, railList.contentY + 1)
var last = railList.indexAt(4, railList.contentY + Math.max(1, railList.height) - 1)
if (first < 0) first = 0
if (last < 0) last = Math.min(root.railRows.length - 1, first + 12)
root.view.queueWindowReport(Math.max(0, first - 4),
Math.min(root.railRows.length - 1, last + 4),
root.railRows)
}
/// Report now, then again once the ListView has laid out — `indexAt`
/// answers -1 before that, which is the state of a rail that has just been
/// built or just been mounted (views/local/LocalArtistsTab.qml:330).
Timer {
id: reportSettle
interval: 50
repeat: false
onTriggered: root.report()
}
function reportSoon() {
root.report()
reportSettle.restart()
}
// Leaving the mode drops the selection, so re-entering does not paint a
// stale artist's discography under a rail with nothing highlighted.
Component.onDestruction: QbzLibrary.sidepanelClear()
@@ -140,6 +210,16 @@ Item {
boundsBehavior: Flickable.StopAtBounds
model: root.entries
// The trigger set views/local/LocalArtistsTab.qml:161-165 already
// uses for the same shape of rail: scroll, model swap, viewport
// resize, and a settle pass when the pane becomes visible (a
// report made against a ListView that has not laid out gets -1
// from `indexAt`, and nothing re-fires once it has).
onContentYChanged: root.report()
onModelChanged: root.report()
onHeightChanged: root.report()
onVisibleChanged: if (visible) root.reportSoon()
delegate: Loader {
required property var modelData
width: railList.width
@@ -243,10 +243,35 @@ Item {
qualityTier: cardCell.modelData.qualityTier
artSource: root.view
? (root.view.artMap[cardCell.modelData.artKey] || "") : ""
source: root.showSource ? cardCell.modelData.source : ""
onOpenRequested: root.selectMode
? root.toggleSelect(cardCell.modelData.id)
: root.openRequested(cardCell.modelData.id)
// LocalLibraryView.slint:1267 `show-source-badge`
// — the card takes the raw source word and the
// BADGE is what the flag switches (blanking
// `source` would also silence the card's
// source-aware menu gates).
source: cardCell.modelData.source
showSourceBadge: root.showSource
// SELECT MODE IS THE CARD'S (AlbumCard's
// `selectMode`/`selected`/`selectToggled`, the
// port of discover/AlbumCard.slint:83, :179-197,
// :207, :239, :465). This host used to paint its
// OWN 22px tick on top of the card at top-left —
// a THIRD geometry, and one that could only add
// the indicator: the card's hover PLAY button
// stayed live underneath it, so hovering a card
// you meant to tick and hitting play started the
// album. The card hides the whole hover action
// row and the pin badge in select mode and draws
// the reference's 24px tick in the reference's
// corner (top-right); all three move together,
// which is exactly what a host overlay cannot
// do. Do not re-add one.
selectMode: root.selectMode
selected: root.selected[cardCell.modelData.id] === true
onSelectToggled: root.toggleSelect(cardCell.modelData.id)
// Non-select mode only — the card routes a
// select-mode click to `selectToggled` and never
// emits this while ticking.
onOpenRequested: root.openRequested(cardCell.modelData.id)
onPlayRequested: root.playRequested(cardCell.modelData.id)
onEnqueueRequested: function (m) {
root.enqueueRequested(cardCell.modelData.id, m)
@@ -287,22 +312,9 @@ Item {
cardMenu.openAtCursor(cardRc, mouse.x, mouse.y)
}
}
// Multi-select tick — the collection view's
// select-mode overlay (top-left of the artwork).
Rectangle {
visible: root.selectMode
x: 8
y: 8
width: 22
height: 22
radius: 11
color: "#b3000000"
SelectCheck {
anchors.centerIn: parent
on: root.selected[cardCell.modelData.id] === true
onToggled: root.toggleSelect(cardCell.modelData.id)
}
}
// (The multi-select tick that used to sit here is
// gone — it is AlbumCard's `selectMode` now; see
// the note on the card above.)
}
}
}
@@ -167,14 +167,21 @@ Rectangle {
visible: root.showSource
width: visible ? 34 : 0
height: parent.height
QbzIcon {
visible: root.item.source === "local" || root.item.source === "plex"
|| root.item.source === "offline"
name: root.item.source === "offline" ? "cloud-download" : "hard-drive"
width: 14
height: 14
// AlbumListRow.slint:308-322 — through controls/SourceIcon.qml,
// never QbzIcon: the Plex and Qobuz marks are MULTI-COLOUR and a
// tint flattens them to a silhouette. This row used to draw an
// accent-tinted `hard-drive` for Plex (a blue hard drive) and
// `cloud-download` for an offline copy.
SourceIcon {
visible: (root.item.source || "") !== ""
kind: root.item.source || ""
// .slint:319 — local 15, the marks 16; muted local tint.
glyphSize: 15
plexSize: 16
qobuzSize: 16
localTint: "muted"
x: 0 // .slint:321
anchors.verticalCenter: parent.verticalCenter
tintName: root.item.source === "plex" ? "accent" : "muted"
}
}
// Trailing ⋯ overflow (AlbumListRow.slint:360).
@@ -148,16 +148,25 @@ Item {
}
}
// Source glyph (local / offline cache / Plex).
QbzIcon {
visible: root.item.source === "local" || root.item.source === "plex"
|| root.item.source === "offline"
name: root.item.source === "offline" ? "cloud-download" : "hard-drive"
width: 14
height: 14
x: root.width - 20
// Source glyph (local / offline cache / Plex) — TrackRow.slint:709-727.
// Through controls/SourceIcon.qml, never QbzIcon: the Plex and Qobuz marks
// are MULTI-COLOUR and a tint flattens them to a silhouette. This row used
// to draw an accent-tinted `hard-drive` for Plex (a blue hard drive) and
// `cloud-download` for an offline copy, where the .slint draws the two
// brand marks.
SourceIcon {
visible: (root.item.source || "") !== ""
kind: root.item.source || ""
// .slint:722 — local 15, the marks 16. `localTint` muted is the rule
// SourceGlyph.slint:6-8 calls load-bearing (never accent).
glyphSize: 15
plexSize: 16
qobuzSize: 16
localTint: "muted"
// The glyph's CENTRE stays where the 14px icon's was (x = width-20,
// centre = width-13) now that the marks are 15-16px wide.
x: Math.round(root.width - 13 - width / 2)
anchors.verticalCenter: parent.verticalCenter
tintName: root.item.source === "plex" ? "accent" : "muted"
}
// Right-click anywhere on the row opens the SAME menu at the pointer
@@ -1,111 +0,0 @@
// Per-source glyph — the QML port of `primitives/SourceGlyph.slint`, used by
// the version picker, the MyQBZ collection-detail rows and the Discography
// Builder rows.
//
// ── THE LOAD-BEARING RULE (SourceGlyph.slint:4-8) ─────────────────────────
// The full-colour Qobuz and Plex logos render **UNTINTED**; only the
// monochrome local hard-drive glyph is tinted, and to MUTED text, never
// accent. Slint states the reason out loud: routing the logos through a
// tinting primitive "would turn the logos into a flat accent silhouette — the
// bug this primitive replaces". `QbzIcon` floods every pixel with its tint, so
// the logo arms deliberately do NOT go through it — they are plain `Image`s.
//
// ── WHY THIS FILE USED TO LIE ─────────────────────────────────────────────
// The port shipped with neither logo: `qobuz-logo-filled.svg` and
// `plex-logo.svg` were never carried over from the Slint tree, so this
// component substituted `cloud-download` for every Qobuz kind and a tinted
// `hard-drive` for Plex — i.e. it drew "downloaded" and "local file" where the
// design calls for two brand marks. Both assets now live in
// `qml/assets/brand/`, which is where the untinted marks belong (the Discogs /
// Last.fm / MusicBrainz marks are already there for the same reason).
//
// `qobuz_purchase` reuses the Qobuz mark GOLD (#eab308) — same glyph as a
// download, the colour is what says "purchased". That is the ONE arm that
// needs a tint on a multi-colour asset, so it is the one arm that uses an
// effect; on a software renderer it degrades to the untinted mark rather than
// to nothing.
import QtQuick
import QtQuick.Effects
import com.blitzfc.qbz
import "../../theme"
Item {
id: root
/// "local" | "qobuz" | "qobuz_download" | "qobuz_purchase" | "offline" | "plex"
/// (anything else = local). Plain "qobuz" is what the MyQBZ collection
/// items carry; `SourceGlyph.slint:23` groups it with the downloads.
property string kind: "local"
/// 14 = `album/LocalAlbumView.slint:24` (the version picker, the default
/// here because those are the call sites that set nothing).
/// 15 = `primitives/SourceGlyph.slint:29-30` (every row glyph).
/// SourceGlyph gives the three Qobuz kinds 16px to compensate the
/// wordmark's proportions (`:29`) — now reproducible, because the wordmark
/// is finally the asset being drawn.
property int glyphSize: 14
/// Tint of the MONOCHROME local glyph. "secondary" = LocalAlbumView.slint:36;
/// "muted" = SourceGlyph.slint:28, whose header calls the
/// muted-never-accent rule load-bearing.
property string localTint: "secondary"
readonly property bool isQobuz: kind === "qobuz" || kind === "qobuz_download"
|| kind === "qobuz_purchase" || kind === "offline"
readonly property bool isPlex: kind === "plex"
readonly property bool isPurchase: kind === "qobuz_purchase"
// SourceGlyph.slint:31 — the Qobuz marks run one pixel larger.
width: root.isQobuz ? root.glyphSize + 2 : root.glyphSize
height: width
readonly property string brandDir: "qrc:/qt/qml/com/blitzfc/qbz/qml/assets/brand/"
// --- The brand marks: UNTINTED, by rule -------------------------------
Image {
id: mark
anchors.fill: parent
visible: (root.isQobuz && !root.isPurchase) || root.isPlex
source: root.isPlex ? root.brandDir + "plex-logo.svg"
: root.brandDir + "qobuz-logo-filled.svg"
fillMode: Image.PreserveAspectFit // SourceGlyph's `image-fit: contain`
// Decode at the size actually drawn: these are a 512x512 and a
// ~1000x1006 source rendered into 15-16px.
sourceSize.width: root.width
sourceSize.height: root.height
smooth: true
asynchronous: true
}
// --- Purchased: the same mark, gold ------------------------------------
// The only arm that tints a multi-colour asset, so the only one that needs
// an effect. `_noShaders` degrades to the plain mark — the source is still
// legible, it just loses the "purchased" colour, which beats an empty cell.
readonly property bool _noShaders: GraphicsInfo.api === GraphicsInfo.Software
|| GraphicsInfo.api === GraphicsInfo.Null
Image {
id: purchaseMark
anchors.fill: parent
visible: root.isPurchase
source: root.brandDir + "qobuz-logo-filled.svg"
fillMode: Image.PreserveAspectFit
sourceSize.width: root.width
sourceSize.height: root.height
smooth: true
asynchronous: true
layer.enabled: root.isPurchase && !root._noShaders
layer.effect: MultiEffect {
colorization: 1.0
// SourceGlyph.slint:27 — the §8.7 purchase gold.
colorizationColor: "#eab308"
}
}
// --- Local / anything else: the monochrome glyph, tinted ---------------
QbzIcon {
anchors.fill: parent
visible: !root.isQobuz && !root.isPlex
name: "hard-drive"
tintName: root.localTint
}
}
@@ -38,6 +38,9 @@ Rectangle {
SourceIcon {
anchors.verticalCenter: parent.verticalCenter
kind: root.currentVersion.source || "local"
// No size overrides on purpose: LocalAlbumView.slint:24-26 draws
// ALL THREE kinds at a flat 14px here, which is SourceIcon's
// default (the row glyphs are the ones that grow the marks).
}
Text {
anchors.verticalCenter: parent.verticalCenter
@@ -430,8 +430,12 @@ Rectangle {
SourceIcon {
anchors.centerIn: parent
kind: root.candidate.source || ""
// Row glyph — SourceGlyph.slint:29-30.
// Row glyph — SourceGlyph.slint:31: 15px, and the three
// Qobuz kinds one pixel larger (the wordmark's
// proportions). Explicit since the size rule became a
// per-arm knob; it used to be a hardcoded +2.
glyphSize: 15
qobuzSize: 16
localTint: "muted"
}
}
@@ -1,165 +0,0 @@
// MyQbzDetailCard — ONE grid card of the My QBZ detail body, the port of the
// local `DetailCard` component in myqbz/MixtapeDetailView.slint:495-594.
//
// Geometry 1:1 with the .slint: `height = cardW + 8 + 18 + 16 + 16`
// (= cardW + 58, :501), radius 8, padding 8, spacing 8, a square artwork of
// `cardW - 16` at radius 6, title 14px/medium, subtitle 12px/muted. Selected
// = a 2px accent border plus the `surface-hover` fill the hover uses.
//
// The host GridView owns the column arithmetic (spec 01 §7.4) and hands the
// width down as `cardW`, exactly as the .slint passes `card-w` (:498).
//
// TWO deviations from the .slint, both deliberate:
//
// * `cardArea` is declared FIRST and pinned `z: -1`. The .slint declares
// `card-ta` LAST (:584), i.e. frontmost, which puts it over the artwork's
// own play / checkbox TouchAreas — the identical defect
// `MixtapeDetailView.slint:203-217` describes and fixes for the ROW but
// never fixed here, so the card's hover scrim and its play affordance
// cannot fire upstream. Fixed on the way over.
// * `rev` is a dependency of every `item` read — the host patches the row
// objects IN PLACE and a plain JS object mutation fires no notifier. See
// the long note in MyQbzDetailRow.qml; the `>= 0` guard is always true
// and exists only to capture the dependency.
import QtQuick
import com.blitzfc.qbz
import "../../theme"
import "../local"
Rectangle {
id: root
/// One `DetailRow` object out of `detailJson.items` (spec 02 §5.2).
property var item: ({})
/// Card width, computed by the host from the auto-fill arithmetic.
property real cardW: 150
property bool selectMode: false
/// In-place-patch revision (see the header).
property int rev: 0
QbzTheme { id: theme }
readonly property int itemPosition: root.rev >= 0 ? (root.item.position || 0) : 0
readonly property string itemType: root.rev >= 0 ? (root.item.itemType || "") : ""
readonly property string itemSource: root.rev >= 0 ? (root.item.source || "") : ""
readonly property string sourceItemId: root.rev >= 0 ? (root.item.sourceItemId || "") : ""
readonly property string rowTitle: root.rev >= 0 ? (root.item.title || "") : ""
readonly property string rowSubtitle: root.rev >= 0 ? (root.item.subtitle || "") : ""
readonly property string artPath: root.rev >= 0 ? (root.item.artPath || "") : ""
readonly property bool selected: root.rev >= 0 && root.item.selected === true
/// track → music, playlist → list-music, else disc (.slint :522-526).
readonly property string typeGlyph: root.itemType === "track" ? "music"
: (root.itemType === "playlist" ? "list-music" : "disc")
readonly property bool hovered: cardArea.containsMouse || playArea.containsMouse
width: root.cardW
height: root.cardW + 58
radius: 8
color: (root.hovered || root.selected) ? theme.surfaceHover : "transparent"
border.width: root.selected ? 2 : 0
border.color: theme.accent
// Card-wide target — FIRST + `z: -1` (see the header).
MouseArea {
id: cardArea
anchors.fill: parent
z: -1
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
if (root.selectMode) QbzMyQbz.detailToggleItemSelect(root.itemPosition)
else QbzMyQbz.openItem(root.itemSource, root.itemType, root.sourceItemId)
}
}
Column {
x: 8
y: 8
width: parent.width - 16
spacing: 8
// --- Artwork ------------------------------------------------------
Rectangle {
width: parent.width
height: width
radius: 6
color: theme.surfaceElevated
clip: true
RoundedImage {
visible: root.artPath !== ""
anchors.fill: parent
source: root.artPath
radius: 6
}
QbzIcon {
visible: root.artPath === ""
anchors.centerIn: parent
name: root.typeGlyph
width: 28
height: 28
tintName: "muted"
}
// Select-mode: the checkbox rides a dark disc so it stays legible
// over a bright cover (.slint :536-549).
Rectangle {
visible: root.selectMode
x: 6
y: 6
width: 22
height: 22
radius: 11
color: root.selected ? "transparent" : "#8c000000"
SelectCheck {
anchors.centerIn: parent
on: root.selected
onToggled: QbzMyQbz.detailToggleItemSelect(root.itemPosition)
}
}
// Otherwise: the hover play scrim (.slint :550-566).
Rectangle {
visible: !root.selectMode
anchors.fill: parent
color: "#73000000"
opacity: playArea.containsMouse ? 1.0 : 0.0
Behavior on opacity { NumberAnimation { duration: 150 } }
QbzIcon {
anchors.centerIn: parent
name: "play-fill"
width: 24
height: 24
tintName: "white"
}
}
MouseArea {
id: playArea
anchors.fill: parent
enabled: !root.selectMode
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: QbzMyQbz.playItem(root.sourceItemId)
}
}
Text {
width: parent.width
text: root.rowTitle
color: theme.textPrimary
font.pixelSize: 14
font.weight: theme.weightMedium
elide: Text.ElideRight
}
Text {
width: parent.width
text: root.rowSubtitle
color: theme.textMuted
font.pixelSize: 12
elide: Text.ElideRight
}
}
}
@@ -6,9 +6,10 @@
// bottom hairline `Theme.alpha-4`, hover/selected fill `surface-hover`.
//
// Plus a NINTH, leading 24px cell that no reference has: the accordion
// chevron (owner-authorised divergence, see its own comment below). It shifts
// the eight reference columns 36px right; `titleColWidth` and the host's
// `ColHead` row are retuned together.
// chevron (owner-authorised divergence, see its own comment below). It is
// mounted ONLY in the details arm (`showExpander`, owner 2026-07-31); when it
// is, it shifts the eight reference columns 36px right and `titleColWidth`
// plus the host's `ColHead` row are retuned together.
//
// --- TWO THINGS THAT ARE LOAD-BEARING -----------------------------------
//
@@ -57,6 +58,23 @@ Rectangle {
/// without shadowing the delegate's own context `index`.
property int ordinal: 0
property bool selectMode: false
/// Does THIS row carry the accordion chevron cell?
///
/// The accordion is the owner's feature, but it is scoped to the DETAILS
/// arm (the `expanded` segment) — the plain LIST arm never had a use for it
/// and the owner asked for it back out of there (2026-07-31). Off, the
/// leading 24px cell is `visible: false`, which in a `Row` drops the cell
/// AND its 12px gap, so the eight reference columns land exactly where
/// `MixtapeDetailView.slint:219-491` puts them again (`titleColWidth`
/// below switches back to the reference's 700 with it).
///
/// The STATE is untouched: `rowOpen` stays the one notion of open and Rust
/// stays its only writer. Rust also AND-s `rowOpen` with the details arm
/// (`myqbz_detail_qt.rs` `to_item` / `resync_row_open`), so with the chevron
/// gone from list mode no row renders open there and nothing is orphaned —
/// while the user's open set itself SURVIVES the round trip (it is persisted
/// per collection now, `collection_open_rows.json`).
property bool showExpander: false
/// The host's shared 3-phase clock for `QbzLoadingDots` (ONE timer per
/// view — spec 01 §7.5 / §15.5).
property int dotPhase: 0
@@ -87,8 +105,8 @@ Rectangle {
/// nothing to show, so it gets no chevron (Rust decides — `canExpand`).
readonly property bool canExpand: root.rev >= 0 && root.item.canExpand === true
/// THE accordion state, and the ONLY one: Rust derives it from the shared
/// `OPEN_ROWS` set that the `expanded` view-mode segment also writes, so
/// this row never needs to know what the view mode is.
/// `OPEN_ROWS` set — the chevron's own writes, persisted per collection —
/// so this row never needs to know what the view mode is.
readonly property bool rowOpen: root.rev >= 0 && root.item.rowOpen === true
/// track → music, playlist → list-music, else disc (.slint :263-267).
@@ -106,14 +124,16 @@ Rectangle {
height: 56
color: (root.hovered || root.selected) ? theme.surfaceHover : "transparent"
/// Title column = rowWidth − padding(24) − fixed cells(616) − gaps(96).
/// Title column = rowWidth − padding(24) − fixed cells(592) − gaps(84)
/// = width − 700, the reference's own arithmetic (:219-491).
///
/// 736, not the reference's 700: the accordion chevron added a NINTH cell
/// (24px) and a ninth 12px gap in front of the ordinal, shifting the
/// 8-column template 36px right. `MyQbzDetailView.qml`'s `ColHead` row
/// carries the identical 24px leader and the identical `- 736`, and the two
/// must be changed together or the header stops lining up with the rows.
readonly property int titleColWidth: Math.max(0, root.width - 736)
/// 736 while `showExpander`: the accordion chevron adds a NINTH cell (24px)
/// and a ninth 12px gap in front of the ordinal, shifting the 8-column
/// template 36px right. `MyQbzDetailView.qml`'s `ColHead` row carries the
/// identical leader and the identical switch, and the two must be changed
/// together or the header stops lining up with the rows.
readonly property int titleColWidth: Math.max(0,
root.width - (root.showExpander ? 736 : 700))
// Bottom hairline — `#ffffff0a` in the .slint (:200) == `alpha-4`, taken
// from the polarity-baked ramp so it is visible on light themes too. The
@@ -154,14 +174,20 @@ Rectangle {
anchors.rightMargin: 12
spacing: 12
// --- Col 0 (24) — THE ACCORDION CHEVRON --------------------------
// --- Col 0 (24) — THE ACCORDION CHEVRON, details arm only ---------
//
// ADDITIVE, and a deliberate divergence from BOTH references
// (owner-authorised 2026-07-30): neither `MixtapeDetailView.slint` nor
// the Tauri build ever had a per-row accordion — both render inline
// tracks only as a whole-list VIEW MODE, explicitly "no chevron". The
// owner asked for the accordion anyway. The view mode survives
// untouched and now means "open all", through the same per-row state.
// untouched but no longer means "open all" (owner 2026-08-01): the arm
// opens fully CLOSED and what the user opens here is remembered, per
// collection, across view switches and restarts.
//
// SCOPED to the details arm 2026-07-31 (`showExpander`): the plain LIST
// arm shows no chevron and is the reference's 8-column row again. Do
// not remove the accordion itself — only this gate is the owner's.
//
// The MouseArea is INVISIBLE on a non-expandable row, and an invisible
// item is not hit-tested — so a track row's chevron cell falls through
@@ -170,6 +196,7 @@ Rectangle {
// area sits at the default z, above `rowArea`'s `z: -1`, and swallows
// the click: the chevron toggles ONLY this row, it never navigates.
Item {
visible: root.showExpander
width: 24
height: parent.height
QbzIcon {
@@ -354,9 +381,11 @@ Rectangle {
x: 0
anchors.verticalCenter: parent.verticalCenter
kind: root.sourceKind
// Row glyph, so SourceGlyph.slint's numbers (15px, muted),
// not the version picker's defaults.
// Row glyph, so SourceGlyph.slint's numbers (:31 — 15px, the
// three Qobuz kinds 16px, muted local tint), not the version
// picker's flat-14 defaults.
glyphSize: 15
qobuzSize: 16
localTint: "muted"
}
}
+310 -51
View File
@@ -17,22 +17,30 @@
// ListView/GridView (spec 01 §15.1, non-negotiable). A recycling view cannot
// be content-sized inside an outer Flickable, and `ListView.header` is not
// available to the GRID arm either — the grid is hosted in a clipped Item and
// given `width: parent.width + 20 - 24` to reproduce Slint's column count
// (spec 01 §7.4), which would offset and over-widen a header inside it. The
// given a corrected width to reproduce the app album grid's column count
// (see the grid arm), which would offset and over-widen a header inside it. The
// paddings, the 32px hero→body gap and the 10px toolbar tail are all kept;
// the toolbar simply became literally sticky, which is what §7.2 calls it.
//
// --- PER-ROW COLLAPSIBLE ROWS (owner-authorised divergence) -------------
// Every album / playlist row carries a chevron that opens ITS OWN inline track
// list (`MyQbzDetailRow.qml`, col 0). NEITHER the .slint NOR the Tauri build
// had this — both render inline tracks only as a whole-list view MODE,
// explicitly "no chevron". The owner asked for the accordion anyway
// In the DETAILS arm every album / playlist row carries a chevron that opens
// ITS OWN inline track list (`MyQbzDetailRow.qml`, col 0). NEITHER the .slint
// NOR the Tauri build had this — both render inline tracks only as a whole-list
// view MODE, explicitly "no chevron". The owner asked for the accordion anyway
// (2026-07-30); do not "restore" it toward either reference.
// It is ADDITIVE on machinery that already existed: Rust already published
// per-row `canExpand` / `inlineTracks` / `expandLoading` / `tracksLoaded`, so
// the accordion added exactly one thing — `rowOpen`, THE single notion of open.
// The `expanded` segment writes the same state and now means "open all"; there
// is deliberately no second, QML-side definition of "is this row open".
// There is deliberately no second, QML-side definition of "is this row open".
// DEFAULT + PERSISTENCE, owner 2026-08-01: the details arm opens with every row
// CLOSED (the segment no longer force-opens anything) and the rows the user
// opens are remembered per collection across view switches and restarts
// (`collection_open_rows.json`). Rust gates the published `rowOpen` on the
// details arm itself, so the other arms still render no inline block.
// SCOPE, owner 2026-07-31: the chevron belongs to the DETAILS arm only — the
// plain LIST arm carries no affordance and is the reference's 8-column row
// again (`rowExpander` below). The accordion itself stays; only its reach
// changed, and `rowOpen` is still the one notion of open.
//
// --- THE MODEL IS PATCHED, NEVER REPLACED, AND PARSED ONCE --------------
// `QbzMyQbz` carries no signals: every Rust-side change arrives as a whole new
@@ -51,7 +59,18 @@
// a real re-derive (sort / filter / search / another collection), which is
// exactly when Slint also rebuilds and the scroll reset is correct.
//
// Reused, not rebuilt: rows/TrackRow.qml (inline tracks),
// --- THE GRID ARM MOUNTS THE STANDARD CARD ------------------------------
// `cards/AlbumCard.qml`, not a My QBZ card. The port used to carry
// `MyQbzDetailCard.qml`, a 1:1 of the reference's local `DetailCard`
// (MixtapeDetailView.slint:495-594); the owner rejected it (2026-07-31,
// "quiero el de siempre con su overlay") and it is DELETED. Select mode is the
// CARD's (`selectMode`/`selected`/`selectToggled` — the port of the reference
// card's own `select-mode`, discover/AlbumCard.slint:83), because it has to
// hide the pin and the hover action row as well as draw the tick; only "Remove
// from collection" is host knowledge and it rides AlbumCard's
// `extraMenuEntries` tail.
//
// Reused, not rebuilt: rows/TrackRow.qml (inline tracks), cards/AlbumCard,
// controls/QualityBadgeFull, controls/CardMenu, controls/QbzContextMenu,
// controls/QbzSegToggle, controls/QbzMultiSelectBar, controls/QbzToolButton,
// controls/QbzLoadingDots, controls/QbzLineEdit, controls/QbzSelect,
@@ -181,6 +200,19 @@ Rectangle {
readonly property int filterCount: doc.filterCount || 0
readonly property bool hasAnyFilter: doc.hasAnyFilter === true
/// Does the body carry the per-row accordion chevron?
///
/// ONLY the DETAILS arm — the `rows-3` segment, the one whose whole point
/// is showing each item's tracks (the segment id stays `expanded`, which is
/// now only the arm's name: it no longer means "open all"). The owner asked
/// for the chevron out of the plain LIST arm (2026-07-31); it is not a
/// removal of the accordion, which stays his feature, and `rowOpen` stays
/// the ONE notion of open with Rust as its only writer. Rust AND-s the
/// published `rowOpen` with this same arm, so list mode cannot render an
/// open row and no state is orphaned by hiding the affordance — the user's
/// open set survives the switch instead of being cleared by it.
readonly property bool rowExpander: root.viewMode === "expanded"
// --------------------------- the row model -----------------------------
property var rows: []
property string rowsKey: ""
@@ -602,15 +634,19 @@ Rectangle {
spacing: 12
// The accordion chevron's leading cell (see
// MyQbzDetailRow.qml). Unlabelled — a header for a
// disclosure control would be noise — but it MUST be
// here, at exactly the row's 24px, or the eight
// reference columns below drift 36px out of the header.
Item { width: 24; height: 1 }
// disclosure control would be noise — but while the
// details arm mounts it, it MUST be here at exactly the
// row's 24px or the eight reference columns below drift
// 36px out of the header. `visible: false` drops the
// cell AND its 12px gap, exactly like the row's.
Item { visible: root.rowExpander; width: 24; height: 1 }
ColHead { width: 40; text: "#"; horizontalAlignment: Text.AlignHCenter }
ColHead {
// Paired with MyQbzDetailRow's `titleColWidth`:
// 24 padding + 616 fixed cells + 96 gaps.
width: Math.max(0, listHost.width - 736)
// 24 padding + 592 fixed cells + 84 gaps = 700,
// plus the chevron's 24 + 12 while it is mounted.
width: Math.max(0,
listHost.width - (root.rowExpander ? 736 : 700))
text: root.trs("Item")
}
ColHead { width: 140; text: root.trs("Type") }
@@ -694,11 +730,11 @@ Rectangle {
/// two writers (the chevron and the segment) and
/// two definitions would disagree the first time a
/// row was closed inside expanded mode — so the
/// view mode is not read here at all. Rust sets
/// `rowOpen` on every expandable row while the mode
/// is `expanded` (open all) and clears it on the
/// way out; `canExpand` is implied, because a
/// non-expandable row is never marked open.
/// view mode is not read here at all. Rust publishes
/// `rowOpen` only for a row the USER opened while
/// the details arm is up; `canExpand` is implied,
/// because a non-expandable row is never marked
/// open.
///
/// Through `live`, like every other row read — see
/// the note above.
@@ -716,6 +752,7 @@ Rectangle {
item: rowCell.live
ordinal: rowCell.index + 1
selectMode: root.selectMode
showExpander: root.rowExpander
dotPhase: root.dotPhase
rev: root.patchRev
}
@@ -723,23 +760,27 @@ Rectangle {
// Inline tracks (.slint :1151-1218): padding
// 52 / 12 / 4 / 8, spacing 0.
//
// 88, not 52: the reference's 52 is `12 padding +
// 40 ordinal cell`, i.e. exactly where the row's
// artwork column starts. The chevron cell added
// `24 + 12` in front of the ordinal, so the same
// alignment is 88 and the right inset stays 12
// (width - 88 - 12). Keep it tied to the row's
// template or the inline block stops hanging under
// the title it belongs to.
// The reference's 52 is `12 padding + 40 ordinal
// cell`, i.e. exactly where the row's artwork
// column starts; the chevron cell adds `24 + 12` in
// front of the ordinal, so the same alignment is 88
// whenever the chevron is mounted. The right inset
// stays 12 either way (width - x - 12). Keep it tied
// to the row's template — off by one cell and the
// inline block stops hanging under its own title.
//
// Only the details arm can have an open row today
// (see `rowExpander`), so the 88 branch is the live
// one; the 52 keeps the two definitions honest.
Item {
visible: rowCell.expanded
width: parent.width
height: visible ? inlineCol.height + 12 : 0
Column {
id: inlineCol
x: 88
x: root.rowExpander ? 88 : 52
y: 4
width: Math.max(0, parent.width - 100)
width: Math.max(0, parent.width - inlineCol.x - 12)
spacing: 0
Item {
@@ -831,33 +872,47 @@ Rectangle {
}
// ======================= BODY: GRID =======================
// `auto-fill minmax(150, 1fr)`, gap 20, 12px content inset
// (.slint :1090-1108). The clipped host + `width: parent.width +
// 20 - 24` reproduces Slint's `floor((W - 24 + gap) / (150 + gap))`
// column count, which GridView's own `floor(W / cellWidth)` would
// otherwise undercount by one at every exact boundary.
// THE STANDARD `cards/AlbumCard.qml`, at its app-wide size, with
// its own hover overlay and its own ⋯ / right-click menu.
//
// This REPLACES the port's `MyQbzDetailCard.qml` (deleted), which
// was a faithful 1:1 of the reference's local `DetailCard`
// (MixtapeDetailView.slint:495-594): a 150px-ish hand-rolled tile
// with no overlay buttons, no quality badge, no source badge and no
// menu. The owner ruled against that card (2026-07-31): "quiero el
// de siempre con su overlay". So this arm is a DELIBERATE, OWNER-
// ORDERED divergence from the .slint, and the .slint's `auto-fill
// minmax(150,1fr)` / gap-20 arithmetic went with it.
//
// Geometry is now the one every other album grid in the app uses
// (`views/AlbumCollection.qml:44-46`): a fixed 200x246 card in a
// 200x266 cell with a 24px gap. AlbumCard hardcodes its 200px
// width, so this grid cannot be fluid — matching the app is both
// the correct and the only option.
Item {
id: gridHost
anchors.fill: parent
visible: root.viewMode === "grid"
clip: true
readonly property int columns: Math.max(1,
Math.floor((width - 24 + 20) / (150 + 20)))
// Clamped: the first frame has width 0, and a negative
// cellWidth is a silent GridView layout trap.
readonly property real cardW: Math.max(1,
(width - 24 - 20 * (columns - 1)) / columns)
readonly property real cardH: cardW + 58
readonly property int cardWidth: 200
readonly property int cardHeight: 266
readonly property int cardGap: 24
GridView {
id: itemGrid
x: 12
y: 0
width: Math.max(0, gridHost.width + 20 - 24)
// The app grid takes `floor((avail + gap) / (card + gap))`
// columns over `avail = width - 24` (the 12px content inset
// on both sides); GridView takes `floor(width / cellWidth)`.
// Since the gap and the two insets are both 24, handing it
// the UNINSET width makes the two agree exactly — the same
// correction the old 150/20 arm made with `+ 20 - 24`.
width: Math.max(0, gridHost.width)
height: gridHost.height
cellWidth: gridHost.cardW + 20
cellHeight: gridHost.cardH + 20
cellWidth: gridHost.cardWidth + gridHost.cardGap
cellHeight: gridHost.cardHeight + gridHost.cardGap
cacheBuffer: 500
reuseItems: true
boundsBehavior: Flickable.StopAtBounds
@@ -865,15 +920,219 @@ Rectangle {
bottomMargin: 100
model: root.rows
delegate: MyQbzDetailCard {
delegate: Item {
id: gcell
required property var modelData
required property int index
width: gridHost.cardWidth
height: gridHost.cardHeight
// Live row, not the delegate model's snapshot — see the
// list delegate's `live` note.
item: root.patchRev >= 0 ? (root.rows[index] || modelData) : modelData
cardW: gridHost.cardW
selectMode: root.selectMode
rev: root.patchRev
// list delegate's `live` note. AlbumCard has no `rev`
// property, so EVERY leaf below carries the
// `root.patchRev >= 0` guard itself: that is what makes
// `patchRev` a captured dependency of the binding, and
// an in-place `Object.assign` patch fires no notifier of
// its own. Always true; never "simplify" it away.
readonly property var live: root.patchRev >= 0
? (root.rows[index] || modelData) : modelData
readonly property int cPosition: root.patchRev >= 0 ? (gcell.live.position || 0) : 0
readonly property string cItemId: root.patchRev >= 0 ? (gcell.live.sourceItemId || "") : ""
readonly property string cItemType: root.patchRev >= 0 ? (gcell.live.itemType || "") : ""
readonly property string cSource: root.patchRev >= 0 ? (gcell.live.source || "") : ""
readonly property string cTitle: root.patchRev >= 0 ? (gcell.live.title || "") : ""
readonly property string cSubtitle: root.patchRev >= 0 ? (gcell.live.subtitle || "") : ""
readonly property string cYear: root.patchRev >= 0 ? (gcell.live.yearText || "") : ""
readonly property string cQuality: root.patchRev >= 0 ? (gcell.live.qualityTier || "") : ""
/// The GRID rung of the cover, NOT the list row's.
/// `artPath` is the 50px thumbnail every list row draws
/// at 40px; this cell's artwork well is 200px, so
/// reading `artPath` here upscaled it 4x — the owner's
/// "la calidad de la portada es menor que la del
/// albumcard". Rust publishes both rungs per row
/// (`myqbz_detail_qt::DetailRow::art_url_large`) so the
/// list/grid toggle stays instant: re-deriving one rung
/// per view mode would republish the document, and a
/// republish resets the view's scroll offset.
readonly property string cArt: root.patchRev >= 0 ? (gcell.live.artPathLarge || "") : ""
/// The REMOTE url of that same rung — AlbumCard's
/// `artworkUrl`, i.e. the pin payload and the block
/// snapshot, never the `file://` cache path.
readonly property string cArtUrl: root.patchRev >= 0 ? (gcell.live.artUrlLarge || "") : ""
readonly property string cSourceKind: root.patchRev >= 0 ? (gcell.live.sourceKind || "") : ""
readonly property bool cSelected: root.patchRev >= 0 && gcell.live.selected === true
readonly property bool cFavorite: root.patchRev >= 0 && gcell.live.isFavorite === true
readonly property bool cPinned: root.patchRev >= 0 && gcell.live.isPinned === true
/// Is THIS cell's `sourceItemId` a Qobuz catalog album
/// id? The per-item gate for the card's catalog-only
/// affordances (heart, pin, "Block this album"), and the
/// QML twin of `myqbz_detail_qt::is_catalog_album` — the
/// two must agree, because Rust seeds `isFavorite` /
/// `isPinned` behind the same predicate.
///
/// The STORED source (`source`, "qobuz" | "local"), not
/// the resolved `sourceKind`: the stored word is what
/// makes the id a catalog id. And the TYPE, because a
/// Qobuz track item carries a track id and a Qobuz
/// playlist item a playlist id — hearting either as
/// "album" would hit a different entity.
readonly property bool cCatalogAlbum: gcell.cSource === "qobuz"
&& gcell.cItemType === "album" && gcell.cItemId !== ""
/// track → music, playlist → list-music, else disc —
/// the reference card's empty-well glyph (.slint
/// :522-526), carried over on AlbumCard's opt-in
/// `placeholderIcon`.
readonly property string cGlyph: gcell.cItemType === "track" ? "music"
: (gcell.cItemType === "playlist" ? "list-music" : "disc")
/// RE-ESTABLISH the two self-mutating bindings whenever
/// this delegate changes row.
///
/// `AlbumCard` writes its OWN `isFavorite` / `isPinned`
/// — optimistically in `toggleFavorite()` /
/// `togglePin()`, and again from its
/// `libraryFavoriteChanged` / `pinChanged` Connections —
/// and a QML property assignment DESTROYS the binding
/// that fed it. On a non-recycling host that is
/// harmless: the delegate dies with its row. This grid
/// sets `reuseItems: true`, so the very same AlbumCard
/// instance is handed the NEXT row, with a dead
/// `isFavorite` binding — it would keep the previous
/// album's filled heart, and clicking it would toggle
/// the new album the wrong way (glyph says "remove", the
/// call adds). Same for the pin badge.
///
/// This is the idiom the port already uses for exactly
/// this hazard on the cards that own an `item`
/// (`cards/TrackCard.qml:49`, `cards/PlaylistCard.qml:117`,
/// `rows/TrackRow.qml:233`, `views/library/FeedListRow.qml:39`);
/// AlbumCard takes flat properties instead of an `item`,
/// so the restore belongs to the recycling HOST. Keyed
/// on `cItemId`, which is derived from `index` and
/// therefore changes on every reuse.
onCItemIdChanged: gcell.rebindCardState()
function rebindCardState() {
// The change signal can fire while the delegate is
// still being built, before the child below exists;
// at that point nothing has broken a binding yet, so
// skipping is the correct answer, not a workaround.
if (!gcard)
return
gcard.isFavorite = Qt.binding(function () { return gcell.cFavorite })
gcard.isPinned = Qt.binding(function () { return gcell.cPinned })
}
AlbumCard {
id: gcard
// localMode = ROUTING: open / play / enqueue go to
// the host signals below, because a My QBZ item can
// be a Plex or local album, a track or a playlist
// and only `QbzMyQbz` knows how to open and play
// one. TRUE for every cell, no exceptions.
localMode: true
// …but the catalog-only affordances are decided PER
// ITEM, which is the whole point of the split (see
// AlbumCard's `catalogAffordances`). A My QBZ
// container is multi-source per ROW: a Qobuz album
// cell's id IS a catalog album id and its heart /
// pin / block are perfectly valid; a track, a
// playlist, a local or a Plex cell's is not, and
// there the three are ABSENT rather than dead.
catalogAffordances: gcell.cCatalogAlbum
// Seeded by Rust behind the SAME predicate, then
// settled by the card itself on
// `QbzLibrary.libraryFavoriteChanged` / `pinChanged`
// — so a heart flipped here, on the album page or
// on a Home rail agrees everywhere, and no toggle
// republishes this document.
isFavorite: gcell.cFavorite
isPinned: gcell.cPinned
albumId: gcell.cItemId
title: gcell.cTitle
artist: gcell.cSubtitle
// No artist link: the reference grid card's subtitle
// is a plain Text (.slint :578-583), and a My QBZ
// subtitle can be a Plex/local artist whose id would
// route QbzArtist.openArtist into a Qobuz lookup.
artistId: ""
genre: ""
year: gcell.cYear
qualityTier: gcell.cQuality
artSource: gcell.cArt
// The pin payload / block snapshot url (see
// `cArtUrl`). Without it a pinned My QBZ album
// lands in the Pinned rail as a placeholder.
artworkUrl: gcell.cArtUrl
// Badge ON: a My QBZ container is multi-source BY
// DEFINITION and the sibling LIST arm gives every
// row a Source column (col 4, the same
// `sourceKind` through the same `SourceIcon`), so
// the grid arm hiding it would be the odd one out.
// All four kinds `sourceKind` can carry —
// qobuz / plex / local / offline — draw a mark;
// only "" (nothing resolved yet) draws none, which
// is AlbumCard's `source !== ""` gate.
source: gcell.cSourceKind
showSourceBadge: true
placeholderIcon: gcell.cGlyph
// The first menu entry's NOUN. `open_item` sends
// "album" AND "track" to the album page and only
// "playlist" elsewhere (myqbz_detail_qt.rs:1893-1901,
// 1:1 with qbz/src/main.rs:6275-6288), so "Open
// album" is accurate on an album and on a track and
// wrong on exactly one arm. A label, not an action:
// the routing below is unchanged.
openLabel: gcell.cItemType === "playlist"
? root.trs("Open playlist") : ""
// The container action the card cannot know about.
// Same msgid, same icon and same destructive styling
// as the list row's last entry
// (MyQbzDetailRow.qml:457-458 == .slint :481-486),
// after the same separator. It applies to a
// Collection, a Mixtape and an artist Collection
// alike: `remove_item` removes by POSITION from
// whatever container is open
// (myqbz_edit_qt.rs:360-362), so there is no arm
// here that could render and no-op.
extraMenuEntries: [
{ "sep": true },
{ "label": QbzSession.tr("Remove from collection", QbzSession.trRev),
"icon": "trash-2", "action": "remove", "danger": true },
]
onExtraMenuAction: function (a) {
if (a === "remove") QbzMyQbz.removeItem(gcell.cPosition)
}
// SELECT MODE is the card's, not this host's
// (discover/AlbumCard.slint:83 declares
// `select-mode` and :179-239 hides the pin and the
// whole hover action row behind it). Overlaying a
// tick from here — the shape
// `views/local/LocalAlbumCollection.qml` used until
// 2026-08-01 — can only add the indicator: it leaves
// the hover
// PLAY button live under the selection, so hovering
// a card you meant to tick and hitting play starts
// the album instead. The owner's own instruction
// for this round was to extend AlbumCard with the
// selection checkbox rather than bolt one on.
selectMode: root.selectMode
selected: gcell.cSelected
onSelectToggled: QbzMyQbz.detailToggleItemSelect(gcell.cPosition)
// Card body click, non-select mode only (the card
// routes a select-mode click to `selectToggled`).
onOpenRequested: QbzMyQbz.openItem(gcell.cSource,
gcell.cItemType, gcell.cItemId)
onPlayRequested: QbzMyQbz.playItem(gcell.cItemId)
// AlbumCard's `next|later|queue` -> the wire's
// `play-next|play-later|add-to-queue`
// (myqbz_play_qt.rs:84-91), the same mapping the
// row menu hands `itemAction`.
onEnqueueRequested: function (mode) {
QbzMyQbz.itemAction(gcell.cItemId,
mode === "next" ? "play-next"
: mode === "later" ? "play-later" : "add-to-queue")
}
}
}
}
}