Use list instead of map for songs in internet search
Fixes issues with sorting
This commit is contained in:
parent
f1dc0f95c8
commit
fa3891e383
|
@ -393,11 +393,11 @@ MimeData *InternetSearchModel::LoadTracks(const InternetSearchView::ResultList &
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
SongMap songs;
|
||||
SongList songs;
|
||||
QList<QUrl> urls;
|
||||
urls.reserve(results.count());
|
||||
for (const InternetSearchView::Result &result : results) {
|
||||
songs.insert(result.metadata_.song_id(), result.metadata_);
|
||||
songs.append(result.metadata_);
|
||||
urls << result.metadata_.url();
|
||||
}
|
||||
|
||||
|
|
|
@ -766,7 +766,7 @@ void InternetSearchView::AddArtists() {
|
|||
MimeData *mimedata = SelectedMimeData();
|
||||
if (!mimedata) return;
|
||||
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(mimedata)) {
|
||||
emit AddArtistsSignal(internet_song_data->songs.values());
|
||||
emit AddArtistsSignal(internet_song_data->songs);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ void InternetSearchView::AddAlbums() {
|
|||
MimeData *mimedata = SelectedMimeData();
|
||||
if (!mimedata) return;
|
||||
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(mimedata)) {
|
||||
emit AddAlbumsSignal(internet_song_data->songs.values());
|
||||
emit AddAlbumsSignal(internet_song_data->songs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ class InternetSearchView : public QWidget {
|
|||
void AddToPlaylist(QMimeData*);
|
||||
void AddArtistsSignal(SongList);
|
||||
void AddAlbumsSignal(SongList);
|
||||
void AddSongsSignal(SongMap);
|
||||
void AddSongsSignal(SongList);
|
||||
|
||||
private slots:
|
||||
void SwapModels();
|
||||
|
|
|
@ -123,7 +123,7 @@ class InternetService : public QObject {
|
|||
|
||||
void AddArtists(SongList songs);
|
||||
void AddAlbums(SongList songs);
|
||||
void AddSongs(SongMap songs);
|
||||
void AddSongs(SongList songs);
|
||||
|
||||
void RemoveArtists(SongList songs);
|
||||
void RemoveAlbums(SongList songs);
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#ifndef INTERNETSONGMIMEDATA_H
|
||||
#define INTERNETSONGMIMEDATA_H
|
||||
|
||||
#include <QMap>
|
||||
|
||||
#include "core/mimedata.h"
|
||||
#include "core/song.h"
|
||||
|
||||
|
@ -35,7 +33,7 @@ class InternetSongMimeData : public MimeData {
|
|||
explicit InternetSongMimeData(InternetService *_service, QObject* = nullptr) : service(_service) {}
|
||||
|
||||
InternetService *service;
|
||||
SongMap songs;
|
||||
SongList songs;
|
||||
};
|
||||
|
||||
#endif // INTERNETSONGMIMEDATA_H
|
||||
|
|
|
@ -796,7 +796,7 @@ bool Playlist::dropMimeData(const QMimeData *data, Qt::DropAction action, int ro
|
|||
InsertSmartPlaylist(generator_data->generator_, row, play_now, enqueue_now, enqueue_next_now);
|
||||
}
|
||||
else if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(data)) {
|
||||
InsertInternetItems(internet_song_data->service, internet_song_data->songs.values(), row, play_now, enqueue_now, enqueue_next_now);
|
||||
InsertInternetItems(internet_song_data->service, internet_song_data->songs, row, play_now, enqueue_now, enqueue_next_now);
|
||||
}
|
||||
else if (const RadioMimeData *radio_data = qobject_cast<const RadioMimeData*>(data)) {
|
||||
InsertRadioItems(radio_data->songs, row, play_now, enqueue_now, enqueue_next_now);
|
||||
|
|
|
@ -93,6 +93,10 @@ void QobuzFavoriteRequest::AddAlbums(const SongList &songs) {
|
|||
AddFavorites(FavoriteType_Albums, songs);
|
||||
}
|
||||
|
||||
void QobuzFavoriteRequest::AddSongs(const SongList &songs) {
|
||||
AddFavorites(FavoriteType_Songs, songs);
|
||||
}
|
||||
|
||||
void QobuzFavoriteRequest::AddSongs(const SongMap &songs) {
|
||||
AddFavoritesRequest(FavoriteType_Songs, songs.keys(), songs.values());
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ class QobuzFavoriteRequest : public QobuzBaseRequest {
|
|||
public slots:
|
||||
void AddArtists(const SongList &songs);
|
||||
void AddAlbums(const SongList &songs);
|
||||
void AddSongs(const SongList &songs);
|
||||
void AddSongs(const SongMap &songs);
|
||||
void RemoveArtists(const SongList &songs);
|
||||
void RemoveAlbums(const SongList &songs);
|
||||
|
|
|
@ -157,7 +157,7 @@ QobuzService::QobuzService(Application *app, QObject *parent)
|
|||
|
||||
QObject::connect(this, &QobuzService::AddArtists, favorite_request_, &QobuzFavoriteRequest::AddArtists);
|
||||
QObject::connect(this, &QobuzService::AddAlbums, favorite_request_, &QobuzFavoriteRequest::AddAlbums);
|
||||
QObject::connect(this, &QobuzService::AddSongs, favorite_request_, &QobuzFavoriteRequest::AddSongs);
|
||||
QObject::connect(this, &QobuzService::AddSongs, favorite_request_, QOverload<const SongList&>::of(&QobuzFavoriteRequest::AddSongs));
|
||||
|
||||
QObject::connect(this, &QobuzService::RemoveArtists, favorite_request_, &QobuzFavoriteRequest::RemoveArtists);
|
||||
QObject::connect(this, &QobuzService::RemoveAlbums, favorite_request_, &QobuzFavoriteRequest::RemoveAlbums);
|
||||
|
|
|
@ -96,6 +96,10 @@ void TidalFavoriteRequest::AddAlbums(const SongList &songs) {
|
|||
AddFavorites(FavoriteType_Albums, songs);
|
||||
}
|
||||
|
||||
void TidalFavoriteRequest::AddSongs(const SongList &songs) {
|
||||
AddFavorites(FavoriteType_Songs, songs);
|
||||
}
|
||||
|
||||
void TidalFavoriteRequest::AddSongs(const SongMap &songs) {
|
||||
AddFavoritesRequest(FavoriteType_Songs, songs.keys(), songs.values());
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ class TidalFavoriteRequest : public TidalBaseRequest {
|
|||
public slots:
|
||||
void AddArtists(const SongList &songs);
|
||||
void AddAlbums(const SongList &songs);
|
||||
void AddSongs(const SongList &songs);
|
||||
void AddSongs(const SongMap &songs);
|
||||
|
||||
void RemoveArtists(const SongList &songs);
|
||||
|
|
|
@ -177,7 +177,7 @@ TidalService::TidalService(Application *app, QObject *parent)
|
|||
|
||||
QObject::connect(this, &TidalService::AddArtists, favorite_request_, &TidalFavoriteRequest::AddArtists);
|
||||
QObject::connect(this, &TidalService::AddAlbums, favorite_request_, &TidalFavoriteRequest::AddAlbums);
|
||||
QObject::connect(this, &TidalService::AddSongs, favorite_request_, &TidalFavoriteRequest::AddSongs);
|
||||
QObject::connect(this, &TidalService::AddSongs, favorite_request_, QOverload<const SongList&>::of(&TidalFavoriteRequest::AddSongs));
|
||||
|
||||
QObject::connect(this, &TidalService::RemoveArtists, favorite_request_, &TidalFavoriteRequest::RemoveArtists);
|
||||
QObject::connect(this, &TidalService::RemoveAlbums, favorite_request_, &TidalFavoriteRequest::RemoveAlbums);
|
||||
|
|
Loading…
Reference in New Issue