feat: add seamless lazy loading for genre and playlist views
Some checks failed
Build for Windows / build-windows (push) Has been cancelled
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:
@@ -150,6 +150,9 @@ MainWindow::MainWindow(QobuzBackend *backend, QWidget *parent)
|
||||
connect(m_library, &List::Library::userPlaylistIdsChanged,
|
||||
this, [this](const QSet<qint64> &playlistIds) {
|
||||
m_userPlaylistIds = playlistIds;
|
||||
const qint64 currentPlaylistId = m_content->tracksList()->playlistId();
|
||||
if (currentPlaylistId > 0)
|
||||
m_content->setCurrentPlaylistFollowed(m_userPlaylistIds.contains(currentPlaylistId));
|
||||
});
|
||||
connect(m_library, &List::Library::userPlaylistsChanged,
|
||||
this, &MainWindow::onUserPlaylistsChanged);
|
||||
@@ -537,6 +540,13 @@ void MainWindow::onArtistLoaded(const QJsonObject &artist)
|
||||
|
||||
void MainWindow::onPlaylistLoaded(const QJsonObject &playlist)
|
||||
{
|
||||
const bool fullLoad = playlist["full_load"].toBool(false);
|
||||
const int trackOffset = playlist["tracks"].toObject()["offset"].toInt(0);
|
||||
if (!fullLoad && trackOffset > 0) {
|
||||
m_content->tracksList()->appendPlaylistPage(playlist);
|
||||
return;
|
||||
}
|
||||
|
||||
const qint64 id = static_cast<qint64>(playlist["id"].toDouble());
|
||||
const qint64 ownerId = static_cast<qint64>(playlist["owner"].toObject()["id"].toDouble());
|
||||
const qint64 myId = AppSettings::instance().userId();
|
||||
|
||||
Reference in New Issue
Block a user