fix: play next track correctly skips to queued track
This commit is contained in:
@@ -124,14 +124,17 @@ public:
|
|||||||
return static_cast<qint64>(current()["id"].toDouble());
|
return static_cast<qint64>(current()["id"].toDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Advance and return the new current track. Returns {} at end of queue.
|
/// Advance and return the track to play next. Returns {} at end of queue.
|
||||||
QJsonObject advance()
|
QJsonObject advance()
|
||||||
{
|
{
|
||||||
if (!m_playNext.isEmpty()) {
|
if (!m_playNext.isEmpty()) {
|
||||||
m_playNext.removeFirst();
|
// Return the playNext item directly — do NOT call current() after
|
||||||
} else {
|
// removal, as that would fall back to the already-playing m_index track.
|
||||||
++m_index;
|
const QJsonObject next = m_playNext.takeFirst();
|
||||||
|
emit queueChanged();
|
||||||
|
return next;
|
||||||
}
|
}
|
||||||
|
++m_index;
|
||||||
emit queueChanged();
|
emit queueChanged();
|
||||||
return current();
|
return current();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user