feat(queue): clear-queue includeCurrent flag stops + clears now-playing

QueueManager::clear previously always preserved the current track;
plus bridge.play_index only mutates queue state, never triggers
audio. Result: when the user hit Clear Queue with nothing playing,
a stale track stayed in NOW PLAYING across app restarts.

- QueueManager::clear(keep_current: bool) — existing callers pin to
  true (legacy behavior). New test covers the false path.
- QbzCore::clear_queue / CoreBridge::clear_queue take the flag through.
- v2_clear_queue accepts an optional includeCurrent flag from the
  frontend; when true, calls bridge.stop() first so the audio pipeline
  actually stops, then wipes the current slot too.
- qconnect sync path + qbzd daemon pin keep_current=true (no behavior
  change).

cc
This commit is contained in:
vicrodh committed 2026-04-19 21:17:09 -06:00
1 parent de96afccd5
commit f01fc17383
6 files changed
+58 -17

No files matched your search

+6 -3
View File
@@ -216,10 +216,13 @@ impl<A: FrontendAdapter + Send + Sync + 'static> QbzCore<A> {
new_enabled
}
/// Clear the queue
pub async fn clear_queue(&self) {
/// Clear the queue. `keep_current=true` preserves the now-playing track
/// (historical behavior); `false` wipes everything including the current
/// slot — use when nothing is actively playing and the user wants a full
/// reset.
pub async fn clear_queue(&self, keep_current: bool) {
let queue = self.queue.write().await;
queue.clear();
queue.clear(keep_current);
self.emit(CoreEvent::QueueUpdated {
state: queue.get_state(),
})