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:
joren
2026-03-24 17:15:49 +01:00
parent 9ca17b4406
commit 9327147021
2 changed files with 32 additions and 13 deletions

View File

@@ -84,15 +84,18 @@ void View::onArtReady(QNetworkReply *reply)
void View::resizeEvent(QResizeEvent *event)
{
QDockWidget::resizeEvent(event);
scaleArtToWidth();
if (m_artPixmap.isNull()) return;
// Use the new dock width from the event so we don't lag behind the layout
const int side = qMax(32, event->size().width() - 16);
m_albumArt->setFixedHeight(side);
m_albumArt->setPixmap(m_artPixmap.scaled(side, side, Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
void View::scaleArtToWidth()
{
if (m_artPixmap.isNull()) return;
// Available width = dock width minus the 8px margins on each side
const int side = qMax(32, widget() ? widget()->width() - 16 : width() - 16);
m_albumArt->setFixedSize(side, side);
const int side = qMax(32, width() - 16);
m_albumArt->setFixedHeight(side);
m_albumArt->setPixmap(m_artPixmap.scaled(side, side, Qt::KeepAspectRatio, Qt::SmoothTransformation));
}