From be9bf5c173a14b2c3021db63556d93cad71557b0 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 21 Dec 2019 18:22:18 +0100 Subject: [PATCH] Replace use of QSet::fromList with Qt 5.14 and above --- src/collection/collectionview.cpp | 4 ++++ src/core/standarditemiconloader.cpp | 4 ++++ src/covermanager/albumcovermanager.cpp | 4 ++++ src/musicbrainz/musicbrainzclient.cpp | 6 +++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/collection/collectionview.cpp b/src/collection/collectionview.cpp index 0e85388bb..72dd1391b 100644 --- a/src/collection/collectionview.cpp +++ b/src/collection/collectionview.cpp @@ -463,7 +463,11 @@ void CollectionView::ShowInVarious(bool on) { } } +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + for (const QString &album : QSet(albums.begin(), albums.end())) { +#else for (const QString &album : QSet::fromList(albums.keys())) { +#endif app_->collection_backend()->ForceCompilation(album, albums.values(album), on); } diff --git a/src/core/standarditemiconloader.cpp b/src/core/standarditemiconloader.cpp index 71890ae6f..66a08ec8b 100644 --- a/src/core/standarditemiconloader.cpp +++ b/src/core/standarditemiconloader.cpp @@ -87,7 +87,11 @@ void StandardItemIconLoader::RowsAboutToBeRemoved(const QModelIndex &parent, int void StandardItemIconLoader::ModelReset() { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + cover_loader_->CancelTasks(QSet(pending_covers_.begin(), pending_covers_.end())); +#else cover_loader_->CancelTasks(QSet::fromList(pending_covers_.keys())); +#endif pending_covers_.clear(); } diff --git a/src/covermanager/albumcovermanager.cpp b/src/covermanager/albumcovermanager.cpp index c9fc0e0e5..85b62ee2b 100644 --- a/src/covermanager/albumcovermanager.cpp +++ b/src/covermanager/albumcovermanager.cpp @@ -251,7 +251,11 @@ void AlbumCoverManager::closeEvent(QCloseEvent *e) { void AlbumCoverManager::CancelRequests() { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + app_->album_cover_loader()->CancelTasks(QSet(cover_loading_tasks_.begin(), cover_loading_tasks_.end())); +#else app_->album_cover_loader()->CancelTasks(QSet::fromList(cover_loading_tasks_.keys())); +#endif cover_loading_tasks_.clear(); cover_exporter_->Cancel(); diff --git a/src/musicbrainz/musicbrainzclient.cpp b/src/musicbrainz/musicbrainzclient.cpp index 49f647322..afa1ff1ef 100644 --- a/src/musicbrainz/musicbrainzclient.cpp +++ b/src/musicbrainz/musicbrainzclient.cpp @@ -488,7 +488,11 @@ MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(const ResultList& ResultList ret; if (opt == SortResults) { - ret = QSet::fromList(results).toList(); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + ret = QSet(results.begin(), results.end()).values(); +#else + ret = QSet::fromList(results).values(); +#endif std::sort(ret.begin(), ret.end()); } else { // KeepOriginalOrder