Replace use of QMultiMap::insertMulti with QMultiMap::insert
This commit is contained in:
parent
07282e3de6
commit
bf5fea8951
|
@ -28,6 +28,8 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QTimer>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMultiMap>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
|
@ -250,7 +252,7 @@ void AlbumCoverFetcherSearch::ProviderCoverFetchFinished(QNetworkReply *reply) {
|
|||
QImage image;
|
||||
if (image.loadFromData(reply->readAll())) {
|
||||
result.score += ScoreImage(image);
|
||||
candidate_images_.insertMulti(result.score, CandidateImage(result, image));
|
||||
candidate_images_.insert(result.score, CandidateImage(result, image));
|
||||
qLog(Debug) << reply->url() << "from" << result.provider << "scored" << result.score;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include <QMap>
|
||||
#include <QMultiMap>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QImage>
|
||||
|
@ -102,7 +103,7 @@ class AlbumCoverFetcherSearch : public QObject {
|
|||
|
||||
// QMap is sorted by key (score). Values are (result, image)
|
||||
typedef QPair<CoverSearchResult, QImage> CandidateImage;
|
||||
QMap<float, CandidateImage> candidate_images_;
|
||||
QMultiMap<float, CandidateImage> candidate_images_;
|
||||
|
||||
QNetworkAccessManager *network_;
|
||||
|
||||
|
|
|
@ -954,7 +954,7 @@ void Playlist::InsertItemsWithoutUndo(const PlaylistItemList &items, int pos, bo
|
|||
if (item->source() == Song::Source_Collection) {
|
||||
int id = item->Metadata().id();
|
||||
if (id != -1) {
|
||||
collection_items_by_id_.insertMulti(id, item);
|
||||
collection_items_by_id_.insert(id, item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1030,12 +1030,13 @@ void Playlist::UpdateItems(const SongList &songs) {
|
|||
// we want to update: if an item corresponds to the song (we rely on URL for this), we update the item with the new metadata,
|
||||
// then we remove song from our list because we will not need to check it again.
|
||||
// And we also update undo actions.
|
||||
QLinkedList<Song> songs_list;
|
||||
|
||||
QList<Song> songs_list;
|
||||
for (const Song &song : songs) songs_list.append(song);
|
||||
|
||||
for (int i = 0; i < items_.size() ; i++) {
|
||||
// Update current items list
|
||||
QMutableLinkedListIterator<Song> it(songs_list);
|
||||
QMutableListIterator<Song> it(songs_list);
|
||||
while (it.hasNext()) {
|
||||
const Song &song = it.next();
|
||||
const PlaylistItemPtr &item = items_[i];
|
||||
|
@ -1044,7 +1045,7 @@ void Playlist::UpdateItems(const SongList &songs) {
|
|||
if (song.is_collection_song()) {
|
||||
new_item = PlaylistItemPtr(new CollectionPlaylistItem(song));
|
||||
if (collection_items_by_id_.contains(song.id(), item)) collection_items_by_id_.remove(song.id(), item);
|
||||
collection_items_by_id_.insertMulti(song.id(), new_item);
|
||||
collection_items_by_id_.insert(song.id(), new_item);
|
||||
}
|
||||
else {
|
||||
new_item = PlaylistItemPtr(new SongPlaylistItem(song));
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <QFuture>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMultiMap>
|
||||
#include <QMetaType>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
|
|
|
@ -688,7 +688,7 @@ void SubsonicRequest::AddAlbumCoverRequest(Song &song) {
|
|||
if (!cover_url.isValid()) return;
|
||||
|
||||
if (album_covers_requests_sent_.contains(cover_url)) {
|
||||
album_covers_requests_sent_.insertMulti(cover_url, &song);
|
||||
album_covers_requests_sent_.insert(cover_url, &song);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -698,7 +698,7 @@ void SubsonicRequest::AddAlbumCoverRequest(Song &song) {
|
|||
request.filename = Song::ImageCacheDir(Song::Source_Subsonic) + "/" + cover_url_query.queryItemValue("id");
|
||||
if (request.filename.isEmpty()) return;
|
||||
|
||||
album_covers_requests_sent_.insertMulti(cover_url, &song);
|
||||
album_covers_requests_sent_.insert(cover_url, &song);
|
||||
++album_covers_requested_;
|
||||
|
||||
album_cover_requests_queue_.enqueue(request);
|
||||
|
|
|
@ -217,7 +217,7 @@ void TidalFavoriteRequest::RemoveFavorites(const FavoriteType type, const SongLi
|
|||
break;
|
||||
}
|
||||
if (!ids.contains(id)) ids << id;
|
||||
songs_map.insertMulti(id, song);
|
||||
songs_map.insert(id, song);
|
||||
}
|
||||
|
||||
for (const QString &id : ids) {
|
||||
|
|
|
@ -1092,7 +1092,7 @@ void TidalRequest::GetAlbumCovers() {
|
|||
void TidalRequest::AddAlbumCoverRequest(Song &song) {
|
||||
|
||||
if (album_covers_requests_sent_.contains(song.album_id())) {
|
||||
album_covers_requests_sent_.insertMulti(song.album_id(), &song);
|
||||
album_covers_requests_sent_.insert(song.album_id(), &song);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1102,7 +1102,7 @@ void TidalRequest::AddAlbumCoverRequest(Song &song) {
|
|||
request.filename = app_->album_cover_loader()->CoverFilePath(song.source(), song.effective_albumartist(), song.effective_album(), song.album_id(), QString(), request.url);
|
||||
if (request.filename.isEmpty()) return;
|
||||
|
||||
album_covers_requests_sent_.insertMulti(song.album_id(), &song);
|
||||
album_covers_requests_sent_.insert(song.album_id(), &song);
|
||||
++album_covers_requested_;
|
||||
|
||||
album_cover_requests_queue_.enqueue(request);
|
||||
|
|
Loading…
Reference in New Issue