feat: add seamless lazy loading for genre and playlist views
Some checks failed
Build for Windows / build-windows (push) Has been cancelled

Introduce paged loading with early prefetch for genre albums/playlists and playlist tracks, while preserving full-data behavior for deep shuffle and playlist play-all actions.
This commit is contained in:
joren
2026-03-31 10:43:36 +02:00
parent 4ebd5ed3f0
commit e453f8acf3
12 changed files with 543 additions and 17 deletions

View File

@@ -14,6 +14,7 @@
#include <QStackedWidget>
#include <QTreeWidget>
#include <QWidget>
#include <QScrollBar>
class GenreBrowserView : public QWidget
{
@@ -48,6 +49,8 @@ private slots:
void onPlaylistActivated(QTreeWidgetItem *item, int column);
void onPlaylistContextMenu(const QPoint &pos);
void onDeepShuffleClicked();
void onAlbumScroll(int value);
void onPlaylistScroll(int value);
private:
QobuzBackend *m_backend = nullptr;
@@ -72,12 +75,28 @@ private:
int m_lastGenreComboIndex = 0;
QSet<qint64> m_multiGenreIds;
bool m_waitingDeepShuffle = false;
bool m_collectAlbumsForDeepShuffle = false;
bool m_loadingAlbums = false;
bool m_loadingPlaylists = false;
int m_albumOffset = 0;
int m_albumTotal = 0;
int m_playlistOffset = 0;
int m_playlistTotal = 0;
QString m_lastAlbumGenreIds;
QString m_lastAlbumType;
QString m_lastPlaylistGenreIds;
QString m_lastPlaylistType;
QString m_lastPlaylistTags;
QString m_lastPlaylistQuery;
void refreshModeUi();
void refreshGenreTypeChoices();
QString currentGenreIds() const;
QStringList currentAlbumIds() const;
void startDeepShuffleFromLoadedAlbums();
void requestAlbumsPage(const QString &genreIds, const QString &type, int offset, bool append);
void requestPlaylistsPage(const QString &genreIds, const QString &type, const QString &tags, const QString &query, int offset, bool append);
bool chooseMultiGenres();
void updateMultiGenreLabel();
void setPlaylistItems(const QJsonArray &items);
void setPlaylistItems(const QJsonArray &items, bool append = false);
};