feat: pagination, back/forward nav, context menu, artist fav, image fix

**Artist portrait**
- Fix CDN URL: images.portrait.{hash,format} →
  https://static.qobuz.com/images/artists/covers/large/{hash}.{format}

**Section alignment**
- Qt::ToolButtonTextOnly on all section toggles so text is truly left-aligned

**Auth 401 race condition**
- qobuz_backend_set_token now uses blocking_lock() instead of spawning an
  async task, guaranteeing the token is set before any subsequent API call

**Pagination (infinite scroll)**
- Release sections load 50 at a time (was 500)
- ArtistSection tracks has_more + loaded count; scrolling to the bottom
  emits loadMoreRequested → ArtistView calls getArtistReleases(offset=N)
- AlbumListView gains addAlbums() for append; setReleases routes to
  setAlbums (offset=0) or appendAlbums (offset>0)

**Back/Forward navigation**
- MainToolBar exposes Back/Forward QActions (go-previous/go-next icons)
- MainWindow keeps a NavPage vector + index; pushNav() on every album/artist
  navigation; goBack/goForward re-navigate without pushing history

**Context menu on now-playing label**
- Right-click on track label in toolbar → "Go to Album" / "Go to Artist"
- MainToolBar stores current track; emits albumRequested/artistRequested
  signals wired to MainWindow's existing handlers

**Artist favourites button**
- ♡ Favourite / ♥ Favourited toggle in artist header
- Calls new addFavArtist / removeFavArtist (Rust + Qt backend wiring)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
joren
2026-03-25 18:25:12 +01:00
parent 963c9ad232
commit 3e96b6d7a8
157 changed files with 64124 additions and 84 deletions

View File

@@ -169,6 +169,25 @@ MainWindow::MainWindow(QobuzBackend *backend, QWidget *parent)
connect(m_toolBar, &MainToolBar::queueToggled,
this, [this](bool v) { m_queuePanel->setVisible(v); });
connect(m_toolBar->backAction(), &QAction::triggered, this, [this] {
if (m_navIndex <= 0) return;
--m_navIndex;
m_navFromHistory = true;
navigateTo(m_navHistory[m_navIndex]);
m_navFromHistory = false;
updateNavButtons();
});
connect(m_toolBar->forwardAction(), &QAction::triggered, this, [this] {
if (m_navIndex >= m_navHistory.size() - 1) return;
++m_navIndex;
m_navFromHistory = true;
navigateTo(m_navHistory[m_navIndex]);
m_navFromHistory = false;
updateNavButtons();
});
connect(m_toolBar, &MainToolBar::albumRequested, this, &MainWindow::onSearchAlbumSelected);
connect(m_toolBar, &MainToolBar::artistRequested, this, &MainWindow::onSearchArtistSelected);
// Apply playback options from saved settings
m_backend->setReplayGain(AppSettings::instance().replayGainEnabled());
m_backend->setGapless(AppSettings::instance().gaplessEnabled());
@@ -359,12 +378,16 @@ void MainWindow::onPlayTrackRequested(qint64 trackId)
void MainWindow::onSearchAlbumSelected(const QString &albumId)
{
NavPage p; p.type = NavPage::Album; p.albumId = albumId;
pushNav(p.type, p.albumId);
m_backend->getAlbum(albumId);
statusBar()->showMessage(tr("Loading album…"));
}
void MainWindow::onSearchArtistSelected(qint64 artistId)
{
NavPage p; p.type = NavPage::Artist; p.artistId = artistId;
pushNav(p.type, {}, p.artistId);
m_backend->getArtist(artistId);
statusBar()->showMessage(tr("Loading artist…"));
}
@@ -389,3 +412,39 @@ void MainWindow::onUserPlaylistsChanged(const QVector<QPair<qint64, QString>> &p
m_userPlaylists = playlists;
m_content->tracksList()->setUserPlaylists(playlists);
}
void MainWindow::pushNav(NavPage::Type type, const QString &albumId, qint64 artistId)
{
if (m_navFromHistory) return;
// Truncate any forward history
while (m_navHistory.size() > m_navIndex + 1)
m_navHistory.removeLast();
NavPage p;
p.type = type;
p.albumId = albumId;
p.artistId = artistId;
m_navHistory.push_back(p);
m_navIndex = m_navHistory.size() - 1;
updateNavButtons();
}
void MainWindow::navigateTo(const NavPage &page)
{
switch (page.type) {
case NavPage::Album:
m_backend->getAlbum(page.albumId);
statusBar()->showMessage(tr("Loading album…"));
break;
case NavPage::Artist:
m_backend->getArtist(page.artistId);
statusBar()->showMessage(tr("Loading artist…"));
break;
default: break;
}
}
void MainWindow::updateNavButtons()
{
m_toolBar->backAction()->setEnabled(m_navIndex > 0);
m_toolBar->forwardAction()->setEnabled(m_navIndex < m_navHistory.size() - 1);
}