fix(qt): "Play all next" enqueues the artist instead of replacing the queue

The artist ⋯ menu offers "Play all next", "Add all to queue" and "Shuffle
all". The first was wired to `playArtistTop(false)` — which the bridge's own
doc calls "Play all": it REPLACES the queue and starts playing. There is no
plain "Play all" row in that menu, so there was no way to get the intended
behaviour, and asking to queue an artist next wiped whatever was queued.

The invokable takes a mode now and both rows route through the shared
insertion funnel: "next" inserts at the cursor, "queue" appends. That is
what the reference does (`enqueue_artist_top_selected(.., next: true)`) and
what `playback_qt::enqueue_artist_top_mode` was written for — it had no
caller at all, which is how the miswiring survived.

cc
This commit is contained in:
vicrodh committed 2026-08-16 18:56:38 -06:00
1 parent dc2496e5c0
commit 1f636679d5
3 files changed
+28 -11

No files matched your search

+8 -2
View File
@@ -3418,8 +3418,14 @@ Rectangle {
topMenu.close() topMenu.close()
var a = modelData.action var a = modelData.action
if (a === "shuffle-all") QbzPlayer.playArtistTop(true) if (a === "shuffle-all") QbzPlayer.playArtistTop(true)
else if (a === "next-all") QbzPlayer.playArtistTop(false) // "Play all next" INSERTS at the cursor; it does
else if (a === "queue-all") QbzPlayer.enqueueArtistTop() // not replay the artist. It used to call
// playArtistTop(false) — "Play all" — so the row
// labelled "next" wiped the queue and started
// over (ArtistPageView's twin in Slint enqueues,
// main.rs:15301).
else if (a === "next-all") QbzPlayer.enqueueArtistTop("next")
else if (a === "queue-all") QbzPlayer.enqueueArtistTop("queue")
else if (a === "playlist-all") { else if (a === "playlist-all") {
// ArtistPageView.slint:797-802 // ArtistPageView.slint:797-802
// `top-tracks-menu-action("playlist-all")` — // `top-tracks-menu-action("playlist-all")` —
+9 -5
View File
@@ -1436,13 +1436,17 @@ pub(crate) fn play_artist_top(shuffle: bool) {
}); });
} }
/// ArtistView ⋯ "Add all to queue". /// ArtistView ⋯ "Play all next" ("next") / "Add all to queue" ("queue").
pub(crate) fn enqueue_artist_top() { ///
/// Both rows land here now. The append-only body this shim used to hold was
/// the reason `playback_qt::enqueue_artist_top_mode` — written for exactly
/// this, and the reference's own shape (`main.rs:15301`,
/// `enqueue_artist_top_selected(.., next: true)`) — had no caller at all.
pub(crate) fn enqueue_artist_top(mode: String) {
let runtime = app(); let runtime = app();
spawn(async move { spawn(async move {
let (queue, _) = artist_qt::top_queue(None); if let Err(e) = playback_qt::enqueue_artist_top_mode(&runtime, &mode).await {
if let Err(e) = playback_qt::enqueue_track_list(&runtime, queue).await { log::error!("[qbz-qt] enqueue_artist_top ({mode}) failed: {e}");
log::error!("[qbz-qt] enqueue_artist_top failed: {e}");
} }
}); });
} }
+11 -4
View File
@@ -207,9 +207,16 @@ pub mod qbz_player {
/// ArtistView "Play all" (shuffle=false) / "Shuffle all" (true). /// ArtistView "Play all" (shuffle=false) / "Shuffle all" (true).
#[qinvokable] #[qinvokable]
fn play_artist_top(self: Pin<&mut QbzPlayer>, shuffle: bool); fn play_artist_top(self: Pin<&mut QbzPlayer>, shuffle: bool);
/// ArtistView ⋯ "Add all to queue" — appends the top-tracks queue. /// ArtistView ⋯ "Play all next" / "Add all to queue" — the top-tracks
/// queue through the shared insertion funnel. `mode` is "next"
/// (insert at the cursor) | "later" | anything else (append).
///
/// It takes a MODE because the menu has both rows and only one of
/// them was reachable: `next-all` was wired to `play_artist_top`,
/// which REPLACES the queue and starts playing. Asking to queue an
/// artist next wiped whatever was queued.
#[qinvokable] #[qinvokable]
fn enqueue_artist_top(self: Pin<&mut QbzPlayer>); fn enqueue_artist_top(self: Pin<&mut QbzPlayer>, mode: QString);
/// Artist-card overlay play (ArtistGridCard): Popular tracks, /// Artist-card overlay play (ArtistGridCard): Popular tracks,
/// falling back to the studio discography (playback.rs play_artist). /// falling back to the studio discography (playback.rs play_artist).
#[qinvokable] #[qinvokable]
@@ -470,8 +477,8 @@ impl qbz_player::QbzPlayer {
crate::play_artist_top(shuffle); crate::play_artist_top(shuffle);
} }
pub fn enqueue_artist_top(self: Pin<&mut Self>) { pub fn enqueue_artist_top(self: Pin<&mut Self>, mode: QString) {
crate::enqueue_artist_top(); crate::enqueue_artist_top(mode.to_string());
} }
pub fn play_artist_card(self: Pin<&mut Self>, artist_id: QString) { pub fn play_artist_card(self: Pin<&mut Self>, artist_id: QString) {