From 22e65e939b18a45e9094e1284d953229ae402e4a Mon Sep 17 00:00:00 2001
From: vicrodh <103399283+vicrodh@users.noreply.github.com>
Date: Tue, 28 Jul 2026 02:26:24 -0600
Subject: [PATCH] =?UTF-8?q?feat(qbz-qt):=20phase=2016=20=E2=80=94=20card?=
=?UTF-8?q?=20overlays=20everywhere=20+=20window-centered=20modals?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Overlay opacity bindings referenced a nonexistent parent chain — all
card overlays evaluated invisible. Fixed per family: LibTrackCard
(scrim + fav/play/more row, full Slint menu), LibArtistCard rewrite
(circle-clipped scrim, play + more; play_artist with Popular-tracks
first and studio-discography fallback), LibPlaylistCard overlay fixed,
LibLabelCard verified overlay-less like the Slint. Modals: shared
AppShell-level layer (full-window scrim, window-centered panel)
replacing the view-local content-frame-centered ones.
km
---
crates/qbz-qt/qml/AlbumView.qml | 79 +---------
crates/qbz-qt/qml/AppShell.qml | 85 ++++++++++
crates/qbz-qt/qml/ArtistView.qml | 79 +---------
crates/qbz-qt/qml/LibraryView.qml | 148 ++++++++++++++----
crates/qbz-qt/qml/Main.qml | 1 +
.../qml/assets/icons/accent/thumbs-down.svg | 4 +
.../qml/assets/icons/black/thumbs-down.svg | 4 +
.../qml/assets/icons/favorite/thumbs-down.svg | 4 +
.../qml/assets/icons/muted/thumbs-down.svg | 4 +
.../qml/assets/icons/primary/thumbs-down.svg | 4 +
.../assets/icons/secondary/thumbs-down.svg | 4 +
.../qml/assets/icons/warning/thumbs-down.svg | 4 +
crates/qbz-qt/src/bridge.rs | 8 +
crates/qbz-qt/src/main.rs | 11 ++
crates/qbz-qt/src/playback_qt.rs | 119 ++++++++++++++
15 files changed, 376 insertions(+), 182 deletions(-)
create mode 100644 crates/qbz-qt/qml/assets/icons/accent/thumbs-down.svg
create mode 100644 crates/qbz-qt/qml/assets/icons/black/thumbs-down.svg
create mode 100644 crates/qbz-qt/qml/assets/icons/favorite/thumbs-down.svg
create mode 100644 crates/qbz-qt/qml/assets/icons/muted/thumbs-down.svg
create mode 100644 crates/qbz-qt/qml/assets/icons/primary/thumbs-down.svg
create mode 100644 crates/qbz-qt/qml/assets/icons/secondary/thumbs-down.svg
create mode 100644 crates/qbz-qt/qml/assets/icons/warning/thumbs-down.svg
diff --git a/crates/qbz-qt/qml/AlbumView.qml b/crates/qbz-qt/qml/AlbumView.qml
index c38c8bf79..5455586a3 100644
--- a/crates/qbz-qt/qml/AlbumView.qml
+++ b/crates/qbz-qt/qml/AlbumView.qml
@@ -38,7 +38,6 @@ Rectangle {
property var coverMap: ({})
// Client-side track search (AlbumActions.search equivalent).
property string trackQuery: ""
- property bool showDescription: false
readonly property var visibleTracks: {
if (trackQuery === "") return tracks
@@ -578,7 +577,11 @@ Rectangle {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
- onClicked: root.showDescription = true
+ onClicked: {
+ var shell = root.parent
+ while (shell && shell.openTextModal === undefined) shell = shell.parent
+ if (shell) shell.openTextModal(QbzBridge.tr("About this album"), header.description || "")
+ }
}
}
@@ -917,78 +920,6 @@ Rectangle {
target: pageFlick
}
- // --- Full-description modal ------------------------------------------
- Rectangle {
- visible: root.showDescription
- anchors.fill: parent
- color: "#bf000000"
- MouseArea {
- anchors.fill: parent
- onClicked: root.showDescription = false
- }
- Rectangle {
- anchors.centerIn: parent
- width: Math.min(root.width - 80, 560)
- height: Math.min(root.height - 120, 460)
- radius: theme.radiusMd
- color: theme.surfaceCard
- border.width: 1
- border.color: theme.borderSubtle
- MouseArea { anchors.fill: parent }
- Column {
- anchors.fill: parent
- anchors.margins: 24
- spacing: 14
- Row {
- width: parent.width
- Text {
- width: parent.width - 28
- text: QbzBridge.tr("About this album")
- color: theme.textPrimary
- font.pixelSize: theme.fontHeading
- font.weight: theme.weightSemibold
- anchors.verticalCenter: parent.verticalCenter
- }
- Rectangle {
- width: 28
- height: 28
- color: closeArea.containsMouse ? theme.surfaceHover : "transparent"
- radius: 6
- QbzIcon {
- name: "x"
- width: 18
- height: 18
- anchors.centerIn: parent
- tintName: closeArea.containsMouse ? "primary" : "muted"
- }
- MouseArea {
- id: closeArea
- anchors.fill: parent
- hoverEnabled: true
- cursorShape: Qt.PointingHandCursor
- onClicked: root.showDescription = false
- }
- }
- }
- Flickable {
- width: parent.width
- height: parent.height - 42
- clip: true
- contentWidth: width
- contentHeight: descText.implicitHeight
- Text {
- id: descText
- width: parent.width
- text: header.description || ""
- color: theme.textSecondary
- font.pixelSize: theme.fontBody
- wrapMode: Text.WordWrap
- }
- }
- }
- }
- }
-
// Album ⋯ menu (AlbumContextMenu subset — card menu + pin).
QbzContextMenu {
id: albumMenu
diff --git a/crates/qbz-qt/qml/AppShell.qml b/crates/qbz-qt/qml/AppShell.qml
index 669cfe6ff..e221e677e 100644
--- a/crates/qbz-qt/qml/AppShell.qml
+++ b/crates/qbz-qt/qml/AppShell.qml
@@ -156,4 +156,89 @@ Rectangle {
anchors.fill: parent
headerBar: header
}
+
+ // --- Shared text modal (phase 16) ---------------------------------------
+ // The AppShell-level modal layer (the Slint AppShell modals mount at
+ // window level, ADR-009): the scrim covers the WHOLE window — sidebar /
+ // header / NPB included — and the panel centers on the WINDOW, not on
+ // the content frame. Views reach it via `openTextModal(title, body)`.
+ property bool textModalOpen: false
+ property string textModalTitle: ""
+ property string textModalBody: ""
+ function openTextModal(title, body) {
+ textModalTitle = title
+ textModalBody = body
+ textModalOpen = true
+ }
+
+ Rectangle {
+ visible: root.textModalOpen
+ anchors.fill: parent
+ color: "#bf000000"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: root.textModalOpen = false
+ }
+ Rectangle {
+ anchors.centerIn: parent
+ width: Math.min(root.width - 80, 560)
+ height: Math.min(root.height - 120, 460)
+ radius: theme.radiusMd
+ color: theme.surfaceCard
+ border.width: 1
+ border.color: theme.borderSubtle
+ MouseArea { anchors.fill: parent }
+ Column {
+ anchors.fill: parent
+ anchors.margins: 24
+ spacing: 14
+ Row {
+ width: parent.width
+ Text {
+ width: parent.width - 28
+ text: root.textModalTitle
+ color: theme.textPrimary
+ font.pixelSize: theme.fontHeading
+ font.weight: theme.weightSemibold
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Rectangle {
+ width: 28
+ height: 28
+ color: tmCloseArea.containsMouse ? theme.surfaceHover : "transparent"
+ radius: 6
+ QbzIcon {
+ name: "x"
+ width: 18
+ height: 18
+ anchors.centerIn: parent
+ tintName: tmCloseArea.containsMouse ? "primary" : "muted"
+ }
+ MouseArea {
+ id: tmCloseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
+ onClicked: root.textModalOpen = false
+ }
+ }
+ }
+ Flickable {
+ width: parent.width
+ height: parent.height - 42
+ clip: true
+ contentWidth: width
+ contentHeight: tmText.implicitHeight
+ Text {
+ id: tmText
+ width: parent.width
+ text: root.textModalBody
+ color: theme.textSecondary
+ font.pixelSize: theme.fontBody
+ wrapMode: Text.WordWrap
+ }
+ }
+ }
+ }
+ }
}
diff --git a/crates/qbz-qt/qml/ArtistView.qml b/crates/qbz-qt/qml/ArtistView.qml
index cc6c70233..95a0651d6 100644
--- a/crates/qbz-qt/qml/ArtistView.qml
+++ b/crates/qbz-qt/qml/ArtistView.qml
@@ -47,7 +47,6 @@ Rectangle {
property bool appearsOnExpanded: false
property bool otherExpanded: false
property bool networkOpen: false
- property bool showBio: false
property string netTab: "network"
readonly property int preview: 5
@@ -599,7 +598,11 @@ Rectangle {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
- onClicked: root.showBio = true
+ onClicked: {
+ var shell = root.parent
+ while (shell && shell.openTextModal === undefined) shell = shell.parent
+ if (shell) shell.openTextModal(artist.name || "", artist.bio || "")
+ }
}
}
@@ -1487,76 +1490,4 @@ Rectangle {
}
}
}
-
- // --- Full-bio modal ----------------------------------------------------
- Rectangle {
- visible: root.showBio
- anchors.fill: parent
- color: "#bf000000"
- MouseArea {
- anchors.fill: parent
- onClicked: root.showBio = false
- }
- Rectangle {
- anchors.centerIn: parent
- width: Math.min(root.width - 80, 560)
- height: Math.min(root.height - 120, 460)
- radius: theme.radiusMd
- color: theme.surfaceCard
- border.width: 1
- border.color: theme.borderSubtle
- MouseArea { anchors.fill: parent }
- Column {
- anchors.fill: parent
- anchors.margins: 24
- spacing: 14
- Row {
- width: parent.width
- Text {
- width: parent.width - 28
- text: artist.name || ""
- color: theme.textPrimary
- font.pixelSize: theme.fontHeading
- font.weight: theme.weightSemibold
- anchors.verticalCenter: parent.verticalCenter
- }
- Rectangle {
- width: 28
- height: 28
- color: bioCloseArea.containsMouse ? theme.surfaceHover : "transparent"
- radius: 6
- QbzIcon {
- anchors.centerIn: parent
- name: "x"
- width: 18
- height: 18
- tintName: bioCloseArea.containsMouse ? "primary" : "muted"
- }
- MouseArea {
- id: bioCloseArea
- anchors.fill: parent
- hoverEnabled: true
- cursorShape: Qt.PointingHandCursor
- onClicked: root.showBio = false
- }
- }
- }
- Flickable {
- width: parent.width
- height: parent.height - 42
- clip: true
- contentWidth: width
- contentHeight: bioText.implicitHeight
- Text {
- id: bioText
- width: parent.width
- text: artist.bio || ""
- color: theme.textSecondary
- font.pixelSize: theme.fontBody
- wrapMode: Text.WordWrap
- }
- }
- }
- }
- }
}
diff --git a/crates/qbz-qt/qml/LibraryView.qml b/crates/qbz-qt/qml/LibraryView.qml
index f94fbfdde..e559e4f63 100644
--- a/crates/qbz-qt/qml/LibraryView.qml
+++ b/crates/qbz-qt/qml/LibraryView.qml
@@ -501,6 +501,7 @@ Rectangle {
// --- TrackCard (discover/TrackCard.slint) -----------------------------
component LibTrackCard: Rectangle {
+ id: trackCard
property var item: ({})
color: "transparent"
readonly property bool overlayOn: tcArtArea.containsMouse || favBtn.hovered
@@ -523,7 +524,7 @@ Rectangle {
anchors.fill: parent
radius: theme.radiusSm
color: "#000000"
- opacity: parent.parent.overlayOn ? 0.6 : 0.0
+ opacity: trackCard.overlayOn ? 0.6 : 0.0
Behavior on opacity { NumberAnimation { duration: 150 } }
}
// Body click PLAYS the track (TrackCard hover).
@@ -540,7 +541,7 @@ Rectangle {
y: 120
width: 200
height: 44
- opacity: parent.parent.overlayOn ? 1.0 : 0.0
+ opacity: trackCard.overlayOn ? 1.0 : 0.0
Behavior on opacity { NumberAnimation { duration: 150 } }
Item { width: (200 - 44 - 2 * 36 - 2 * 12) / 2; height: 1 }
LibOverlayBtn {
@@ -642,14 +643,18 @@ Rectangle {
}
}
- // --- ArtistGridCard (discover/ArtistGridCard.slint; the Favorites arm
- // uses follow-mode "none" and wires ONLY open-artist — the hover overlay
- // buttons are dead even in Slint there, so they are omitted here;
- // POC-NOTE) ------------------------------------------------------------
+ // --- ArtistGridCard (discover/ArtistGridCard.slint, phase 16 overlay) --
+ // 200px surface-card frame + 190px circle (gradient + user glyph until
+ // the artwork resolves), scrim 0.55 CLIPPED TO THE CIRCLE, hover overlay
+ // at y=113: play (primary 44 — Popular tracks with the studio-discography
+ // fallback, playback_qt::play_artist) + ⋯ menu (Open artist / Play /
+ // Not interested). The Favorites arm uses follow-mode "none" in Slint, so
+ // the follow button is hidden here too (search/reco arms would show it).
component LibArtistCard: Rectangle {
+ id: artistCard
property var item: ({})
color: "transparent"
- readonly property bool overlayOn: agArea.containsMouse
+ readonly property bool overlayOn: agArea.containsMouse || agPlay.hovered || agMore.hovered
Column {
spacing: 0
@@ -657,29 +662,92 @@ Rectangle {
width: 200
height: 200
radius: theme.radiusSm
- color: theme.surfaceElevated
- clip: true
- RoundedImage {
+ color: theme.surfaceCard
+
+ // 190px round portrait, centered (5px surround = the
+ // album-tile frame). All overlay content lives inside so it
+ // clips to the circle.
+ Rectangle {
x: 5
y: 5
width: 190
height: 190
- source: root.artMap[item.artKey] || ""
radius: 95
- }
- Rectangle {
- anchors.fill: parent
- radius: theme.radiusSm
- color: "#000000"
- opacity: parent.parent.overlayOn ? 0.25 : 0.0
- Behavior on opacity { NumberAnimation { duration: 150 } }
- }
- MouseArea {
- id: agArea
- anchors.fill: parent
- hoverEnabled: true
- cursorShape: Qt.PointingHandCursor
- onClicked: QbzBridge.openArtist(item.id)
+ clip: true
+ gradient: Gradient {
+ orientation: Gradient.Horizontal
+ GradientStop { position: 0.0; color: theme.surfaceElevated }
+ GradientStop { position: 1.0; color: theme.surfaceCard }
+ }
+ // Placeholder glyph until the artwork resolves on top.
+ QbzIcon {
+ name: "user"
+ width: 54
+ height: 54
+ anchors.centerIn: parent
+ tintName: "muted"
+ }
+ RoundedImage {
+ anchors.fill: parent
+ source: root.artMap[item.artKey] || ""
+ radius: 95
+ }
+ // Hover scrim (clipped to the circle by the parent's clip).
+ Rectangle {
+ anchors.fill: parent
+ radius: 95
+ color: "#000000"
+ opacity: artistCard.overlayOn ? 0.55 : 0.0
+ Behavior on opacity { NumberAnimation { duration: 150 } }
+ }
+ // Card-open + hover detector (before the buttons so they
+ // win the pointer).
+ MouseArea {
+ id: agArea
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
+ onClicked: QbzBridge.openArtist(item.id)
+ }
+ // Hover overlay — play / more (follow hidden: Favorites
+ // arm is follow-mode "none").
+ Row {
+ y: 113
+ width: 190
+ height: 44
+ opacity: artistCard.overlayOn ? 1.0 : 0.0
+ Behavior on opacity { NumberAnimation { duration: 150 } }
+ Item { width: (190 - 44 - 36 - 12) / 2; height: 1 }
+ LibOverlayBtn {
+ id: agPlay
+ name: "play-fill"
+ primary: true
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: QbzBridge.playArtistCard(item.id)
+ }
+ LibOverlayBtn {
+ id: agMore
+ name: "ellipsis"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: function (mouse) { agMenu.openAtCursor(agMore, mouse.x, mouse.y) }
+ }
+ Item { width: (190 - 44 - 36 - 12) / 2; height: 1 }
+ }
+ CardMenu {
+ id: agMenu
+ menuWidth: 196
+ entries: [
+ { "label": QbzBridge.tr("Open artist"), "icon": "user", "action": "open" },
+ { "label": QbzBridge.tr("Play"), "icon": "play-fill", "action": "play" },
+ { "label": QbzBridge.tr("Not interested"), "icon": "thumbs-down", "action": "not-interested" },
+ ]
+ onPicked: function (a) {
+ if (a === "open") QbzBridge.openArtist(item.id)
+ else if (a === "play") QbzBridge.playArtistCard(item.id)
+ // "not-interested": the reco dismissal store is
+ // not open in the POC (POC-NOTE — inert).
+ }
+ }
}
}
Item { width: 1; height: 6 }
@@ -708,6 +776,7 @@ Rectangle {
// --- PlaylistCard (discover/PlaylistCard.slint) ------------------------
component LibPlaylistCard: Rectangle {
+ id: playlistCard
property var item: ({})
color: "transparent"
readonly property bool overlayOn: plArtArea.containsMouse || plFav.hovered
@@ -730,7 +799,7 @@ Rectangle {
anchors.fill: parent
radius: theme.radiusSm
color: "#000000"
- opacity: parent.parent.overlayOn ? 0.6 : 0.0
+ opacity: playlistCard.overlayOn ? 0.6 : 0.0
Behavior on opacity { NumberAnimation { duration: 150 } }
}
MouseArea {
@@ -745,7 +814,7 @@ Rectangle {
y: 120
width: 200
height: 44
- opacity: parent.parent.overlayOn ? 1.0 : 0.0
+ opacity: playlistCard.overlayOn ? 1.0 : 0.0
Behavior on opacity { NumberAnimation { duration: 150 } }
Item { width: (200 - 44 - 2 * 36 - 2 * 12) / 2; height: 1 }
LibOverlayBtn {
@@ -782,18 +851,29 @@ Rectangle {
CardMenu {
id: plMenu
menuWidth: 196
+ // PlaylistCard.slint's menu: queueing actions + favorite
+ // (owned) / follow (foreign). The queueing actions need
+ // the playlist track-list builder (out of scope) — inert,
+ // POC-NOTE; favorite stays wired for owned playlists.
entries: [
- { "label": QbzBridge.tr("Open playlist"), "icon": "list-music", "action": "open" },
{ "label": QbzBridge.tr("Play"), "icon": "play-fill", "action": "play" },
- { "label": item.isFavorite ? QbzBridge.tr("Remove from Library") : QbzBridge.tr("Add to Library"),
- "icon": item.isFavorite ? "heart-filled" : "heart", "action": "favorite" },
+ { "label": QbzBridge.tr("Play next"), "icon": "list-start", "action": "play-next" },
+ { "label": QbzBridge.tr("Play later"), "icon": "list-plus", "action": "play-later" },
+ { "label": QbzBridge.tr("Add to queue"), "icon": "list-end", "action": "queue" },
+ { "label": item.playlistOwned
+ ? (item.isFavorite ? QbzBridge.tr("Remove from Library") : QbzBridge.tr("Add to Library"))
+ : (item.playlistFollowing ? QbzBridge.tr("Unfollow on Qobuz") : QbzBridge.tr("Follow on Qobuz")),
+ "icon": item.playlistOwned ? (item.isFavorite ? "heart-filled" : "heart")
+ : (item.playlistFollowing ? "check" : "user-plus"),
+ "action": "favorite" },
]
onPicked: function (a) {
- // "open"/"play": no playlist view / playlist queue in
- // the POC (POC-NOTE — inert).
if (a === "favorite") {
- item.isFavorite = !item.isFavorite
- QbzBridge.libraryToggleFavorite("playlist", item.id)
+ if (item.playlistOwned) {
+ item.isFavorite = !item.isFavorite
+ QbzBridge.libraryToggleFavorite("playlist", item.id)
+ }
+ // follow/unfollow: inert (POC-NOTE).
}
}
}
diff --git a/crates/qbz-qt/qml/Main.qml b/crates/qbz-qt/qml/Main.qml
index f807bfcdf..3e2c91bfe 100644
--- a/crates/qbz-qt/qml/Main.qml
+++ b/crates/qbz-qt/qml/Main.qml
@@ -43,6 +43,7 @@ ApplicationWindow {
+
Loader {
id: screenLoader
anchors.fill: parent
diff --git a/crates/qbz-qt/qml/assets/icons/accent/thumbs-down.svg b/crates/qbz-qt/qml/assets/icons/accent/thumbs-down.svg
new file mode 100644
index 000000000..7499678a9
--- /dev/null
+++ b/crates/qbz-qt/qml/assets/icons/accent/thumbs-down.svg
@@ -0,0 +1,4 @@
+
diff --git a/crates/qbz-qt/qml/assets/icons/black/thumbs-down.svg b/crates/qbz-qt/qml/assets/icons/black/thumbs-down.svg
new file mode 100644
index 000000000..3b4e39a40
--- /dev/null
+++ b/crates/qbz-qt/qml/assets/icons/black/thumbs-down.svg
@@ -0,0 +1,4 @@
+
diff --git a/crates/qbz-qt/qml/assets/icons/favorite/thumbs-down.svg b/crates/qbz-qt/qml/assets/icons/favorite/thumbs-down.svg
new file mode 100644
index 000000000..0c2553aba
--- /dev/null
+++ b/crates/qbz-qt/qml/assets/icons/favorite/thumbs-down.svg
@@ -0,0 +1,4 @@
+
diff --git a/crates/qbz-qt/qml/assets/icons/muted/thumbs-down.svg b/crates/qbz-qt/qml/assets/icons/muted/thumbs-down.svg
new file mode 100644
index 000000000..4118bff1b
--- /dev/null
+++ b/crates/qbz-qt/qml/assets/icons/muted/thumbs-down.svg
@@ -0,0 +1,4 @@
+
diff --git a/crates/qbz-qt/qml/assets/icons/primary/thumbs-down.svg b/crates/qbz-qt/qml/assets/icons/primary/thumbs-down.svg
new file mode 100644
index 000000000..952b5b739
--- /dev/null
+++ b/crates/qbz-qt/qml/assets/icons/primary/thumbs-down.svg
@@ -0,0 +1,4 @@
+
diff --git a/crates/qbz-qt/qml/assets/icons/secondary/thumbs-down.svg b/crates/qbz-qt/qml/assets/icons/secondary/thumbs-down.svg
new file mode 100644
index 000000000..199212236
--- /dev/null
+++ b/crates/qbz-qt/qml/assets/icons/secondary/thumbs-down.svg
@@ -0,0 +1,4 @@
+
diff --git a/crates/qbz-qt/qml/assets/icons/warning/thumbs-down.svg b/crates/qbz-qt/qml/assets/icons/warning/thumbs-down.svg
new file mode 100644
index 000000000..e61c3497f
--- /dev/null
+++ b/crates/qbz-qt/qml/assets/icons/warning/thumbs-down.svg
@@ -0,0 +1,4 @@
+
diff --git a/crates/qbz-qt/src/bridge.rs b/crates/qbz-qt/src/bridge.rs
index e8b907654..642cfc2a3 100644
--- a/crates/qbz-qt/src/bridge.rs
+++ b/crates/qbz-qt/src/bridge.rs
@@ -393,6 +393,10 @@ pub mod qbz_bridge {
/// ArtistView per-section "Load more" — the next releases page.
#[qinvokable]
fn load_release_section(self: Pin<&mut QbzBridge>, artist_id: QString, release_type: QString, offset: i32);
+ /// Artist-card overlay play (ArtistGridCard): Popular tracks,
+ /// falling back to the studio discography (playback.rs play_artist).
+ #[qinvokable]
+ fn play_artist_card(self: Pin<&mut QbzBridge>, artist_id: QString);
/// Emitted with the next page of a releases bucket.
#[qsignal]
fn release_section_ready(self: Pin<&mut QbzBridge>, release_type: QString, cards_json: QString, has_more: bool);
@@ -885,6 +889,10 @@ impl qbz_bridge::QbzBridge {
crate::load_release_section(artist_id.to_string(), release_type.to_string(), offset);
}
+ pub fn play_artist_card(self: Pin<&mut Self>, artist_id: QString) {
+ crate::play_artist_card(artist_id.to_string());
+ }
+
pub fn settings_bool(self: Pin<&mut Self>, key: QString, value: bool) {
crate::settings_bool(key.to_string(), value);
}
diff --git a/crates/qbz-qt/src/main.rs b/crates/qbz-qt/src/main.rs
index 9e7aa3b06..cc4154b57 100644
--- a/crates/qbz-qt/src/main.rs
+++ b/crates/qbz-qt/src/main.rs
@@ -619,6 +619,17 @@ pub(crate) fn play_track(track_id: u64) {
});
}
+/// Artist-card overlay play (ArtistGridCard): Popular tracks with the
+/// studio-discography fallback.
+pub(crate) fn play_artist_card(artist_id: String) {
+ let runtime = app();
+ spawn(async move {
+ if let Err(e) = playback_qt::play_artist(&runtime, &artist_id).await {
+ log::error!("[qbz-qt] play_artist_card {artist_id} failed: {e}");
+ }
+ });
+}
+
/// Library track menu: Play next / Play later / Add to queue (single feed
/// track into the existing queue).
pub(crate) fn enqueue_track(track_id: u64, mode: String) {
diff --git a/crates/qbz-qt/src/playback_qt.rs b/crates/qbz-qt/src/playback_qt.rs
index b39b0dffd..af528b5b5 100644
--- a/crates/qbz-qt/src/playback_qt.rs
+++ b/crates/qbz-qt/src/playback_qt.rs
@@ -124,6 +124,125 @@ async fn fetch_album_queue(
Ok(tracks)
}
+/// Artist-card play (ArtistGridCard overlay / menu, phase 16) — playback.rs
+/// `play_artist` 1:1: fetch the artist page ONCE, play the Popular tracks;
+/// when the artist has none, fall back to the STUDIO discography (release
+/// buckets album/epSingle/ep/single in page order, deduped), concatenating
+/// each album's tracks and skipping albums that fail (a bulk play must not
+/// abort on one unavailable album).
+pub async fn play_artist(runtime: &Arc>, artist_id: &str) -> Result<(), String> {
+ const STUDIO_TYPES: &[&str] = &["album", "epSingle", "ep", "single"];
+ let id: u64 = artist_id
+ .parse()
+ .map_err(|_| format!("invalid artist id: {artist_id}"))?;
+ let page = runtime
+ .core()
+ .get_artist_page(id, None)
+ .await
+ .map_err(|e| format!("get_artist_page {artist_id} failed: {e}"))?;
+ let artist_name = page.name.display.clone();
+
+ // 1) Popular tracks — the primary behavior.
+ let top: Vec = page
+ .top_tracks
+ .unwrap_or_default()
+ .iter()
+ .map(|track| {
+ // make_top_track_queue: /artist/page tracks carry a thinner
+ // audio_info than /album/get tracks; fields fall back.
+ let audio = track.audio_info.as_ref();
+ let album = track.album.as_ref();
+ let album_id = album.map(|a| a.id.clone());
+ QueueTrack {
+ id: track.id,
+ title: track.title.clone(),
+ version: track.version.clone(),
+ artist: track
+ .artist
+ .as_ref()
+ .map(|a| a.name.display.clone())
+ .filter(|n| !n.is_empty())
+ .unwrap_or_else(|| artist_name.clone()),
+ album: album.map(|a| a.title.clone()).unwrap_or_default(),
+ album_version: None,
+ duration_secs: track.duration.unwrap_or(0) as u64,
+ artwork_url: album
+ .and_then(|a| a.image.as_ref())
+ .and_then(|img| img.best().cloned()),
+ hires: audio
+ .and_then(|a| a.maximum_bit_depth)
+ .map(|b| b > 16)
+ .unwrap_or(false),
+ bit_depth: audio.and_then(|a| a.maximum_bit_depth),
+ sample_rate: audio.and_then(|a| a.maximum_sampling_rate),
+ is_local: false,
+ album_id: album_id.clone(),
+ artist_id: track.artist.as_ref().map(|a| a.id),
+ streamable: track
+ .rights
+ .as_ref()
+ .and_then(|r| r.streamable)
+ .unwrap_or(true),
+ source: Some("qobuz".to_string()),
+ parental_warning: track.parental_warning.unwrap_or(false),
+ source_item_id_hint: album_id,
+ context_kind: Some("artist".to_string()),
+ context_id: Some(artist_id.to_string()),
+ }
+ })
+ .collect();
+ if !top.is_empty() {
+ let first_id = top[0].id;
+ runtime.core().set_queue(top, Some(0)).await;
+ publish_queue(runtime).await;
+ runtime
+ .core()
+ .play_track_resolved(first_id, current_quality(), None, None, 0)
+ .await
+ .map_err(|e| format!("play_track {first_id} failed: {e}"))?;
+ refresh_now_playing(runtime).await;
+ return Ok(());
+ }
+
+ // 2) Fallback — the studio discography (deduped album ids in the page's
+ // section order; compilation/live/other omitted — studio releases only).
+ let mut album_ids: Vec = Vec::new();
+ let mut seen = std::collections::HashSet::new();
+ for group in page.releases.unwrap_or_default() {
+ if STUDIO_TYPES.contains(&group.release_type.as_str()) {
+ for item in group.items {
+ if seen.insert(item.id.clone()) {
+ album_ids.push(item.id);
+ }
+ }
+ }
+ }
+ if album_ids.is_empty() {
+ return Err(format!("artist {artist_id} has no top tracks and no studio releases"));
+ }
+ let mut queue: Vec = Vec::new();
+ for aid in &album_ids {
+ match fetch_album_queue(runtime, aid).await {
+ Ok(tracks) => queue.extend(tracks),
+ Err(e) => log::warn!("[qbz-qt] artist-play: album {aid} skipped: {e}"),
+ }
+ }
+ if queue.is_empty() {
+ return Err(format!("artist {artist_id} studio discography produced no playable tracks"));
+ }
+ log::info!("[qbz-qt] artist-play {artist_id}: discography fallback, {} tracks", queue.len());
+ let first_id = queue[0].id;
+ runtime.core().set_queue(queue, Some(0)).await;
+ publish_queue(runtime).await;
+ runtime
+ .core()
+ .play_track_resolved(first_id, current_quality(), None, None, 0)
+ .await
+ .map_err(|e| format!("play_track {first_id} failed: {e}"))?;
+ refresh_now_playing(runtime).await;
+ Ok(())
+}
+
/// "Play next" / "Add to queue" for an album (AlbumCard ⋯ menu): resolve
/// the album's tracks and insert them after the current track (mode
/// "next") or append them (mode "later").