fix: art scaling on shrink + skip unavailable tracks in queue
- Now-playing art: use setFixedHeight (not setFixedSize) so the dock width constraint is removed and can shrink freely; use event->size() in resizeEvent to get the correct new width without layout lag - PlayQueue: filter non-streamable tracks out of setContext and reorderContext so unavailable tracks are never in the queue and pressing Next always lands on a playable track Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,14 +25,27 @@ public:
|
||||
{
|
||||
m_queue.clear();
|
||||
m_playNext.clear();
|
||||
for (const auto &v : tracks)
|
||||
m_queue.append(v.toObject());
|
||||
if (m_shuffle) {
|
||||
shuffleQueue(startIndex);
|
||||
// shuffleQueue moves the start track to index 0 and sets m_index = 0
|
||||
} else {
|
||||
m_index = qBound(0, startIndex, m_queue.size() - 1);
|
||||
|
||||
// Only queue streamable tracks; find the filtered index for startIndex
|
||||
int filteredStart = 0;
|
||||
int filteredIdx = 0;
|
||||
bool found = false;
|
||||
for (int orig = 0; orig < tracks.size(); ++orig) {
|
||||
const QJsonObject t = tracks[orig].toObject();
|
||||
if (!t["streamable"].toBool(true))
|
||||
continue;
|
||||
if (!found && orig >= startIndex) {
|
||||
filteredStart = filteredIdx;
|
||||
found = true;
|
||||
}
|
||||
m_queue.append(t);
|
||||
++filteredIdx;
|
||||
}
|
||||
m_index = qBound(0, filteredStart, qMax(0, m_queue.size() - 1));
|
||||
|
||||
if (m_shuffle)
|
||||
shuffleQueue(m_index);
|
||||
|
||||
emit queueChanged();
|
||||
}
|
||||
|
||||
@@ -41,8 +54,11 @@ public:
|
||||
void reorderContext(const QJsonArray &tracks, qint64 currentId)
|
||||
{
|
||||
m_queue.clear();
|
||||
for (const auto &v : tracks)
|
||||
m_queue.append(v.toObject());
|
||||
for (const auto &v : tracks) {
|
||||
const QJsonObject t = v.toObject();
|
||||
if (t["streamable"].toBool(true))
|
||||
m_queue.append(t);
|
||||
}
|
||||
|
||||
m_index = 0;
|
||||
for (int i = 0; i < m_queue.size(); ++i) {
|
||||
|
||||
Reference in New Issue
Block a user