Rename enums

This commit is contained in:
Jonas Kvinge
2024-08-05 17:53:07 +02:00
parent ff6e93fc15
commit 1c4d3aebad
12 changed files with 72 additions and 72 deletions

View File

@@ -50,9 +50,9 @@ class QobuzBaseRequest : public QObject {
enum class Type {
None,
Artists,
Albums,
Songs,
FavouriteArtists,
FavouriteAlbums,
FavouriteSongs,
SearchArtists,
SearchAlbums,
SearchSongs,

View File

@@ -124,13 +124,13 @@ QobuzRequest::~QobuzRequest() {
void QobuzRequest::Process() {
switch (query_type_) {
case Type::Artists:
case Type::FavouriteArtists:
GetArtists();
break;
case Type::Albums:
case Type::FavouriteAlbums:
GetAlbums();
break;
case Type::Songs:
case Type::FavouriteSongs:
GetSongs();
break;
case Type::SearchArtists:
@@ -226,7 +226,7 @@ void QobuzRequest::FlushArtistsRequests() {
Request request = artists_requests_queue_.dequeue();
ParamList params;
if (query_type_ == Type::Artists) {
if (query_type_ == Type::FavouriteArtists) {
params << Param(QStringLiteral("type"), QStringLiteral("artists"));
params << Param(QStringLiteral("user_auth_token"), user_auth_token());
}
@@ -234,7 +234,7 @@ void QobuzRequest::FlushArtistsRequests() {
if (request.limit > 0) params << Param(QStringLiteral("limit"), QString::number(request.limit));
if (request.offset > 0) params << Param(QStringLiteral("offset"), QString::number(request.offset));
QNetworkReply *reply = nullptr;
if (query_type_ == Type::Artists) {
if (query_type_ == Type::FavouriteArtists) {
reply = CreateRequest(QStringLiteral("favorite/getUserFavorites"), params);
}
else if (query_type_ == Type::SearchArtists) {
@@ -278,7 +278,7 @@ void QobuzRequest::FlushAlbumsRequests() {
Request request = albums_requests_queue_.dequeue();
ParamList params;
if (query_type_ == Type::Albums) {
if (query_type_ == Type::FavouriteAlbums) {
params << Param(QStringLiteral("type"), QStringLiteral("albums"));
params << Param(QStringLiteral("user_auth_token"), user_auth_token());
}
@@ -286,7 +286,7 @@ void QobuzRequest::FlushAlbumsRequests() {
if (request.limit > 0) params << Param(QStringLiteral("limit"), QString::number(request.limit));
if (request.offset > 0) params << Param(QStringLiteral("offset"), QString::number(request.offset));
QNetworkReply *reply = nullptr;
if (query_type_ == Type::Albums) {
if (query_type_ == Type::FavouriteAlbums) {
reply = CreateRequest(QStringLiteral("favorite/getUserFavorites"), params);
}
else if (query_type_ == Type::SearchAlbums) {
@@ -330,7 +330,7 @@ void QobuzRequest::FlushSongsRequests() {
Request request = songs_requests_queue_.dequeue();
ParamList params;
if (query_type_ == Type::Songs) {
if (query_type_ == Type::FavouriteSongs) {
params << Param(QStringLiteral("type"), QStringLiteral("tracks"));
params << Param(QStringLiteral("user_auth_token"), user_auth_token());
}
@@ -338,7 +338,7 @@ void QobuzRequest::FlushSongsRequests() {
if (request.limit > 0) params << Param(QStringLiteral("limit"), QString::number(request.limit));
if (request.offset > 0) params << Param(QStringLiteral("offset"), QString::number(request.offset));
QNetworkReply *reply = nullptr;
if (query_type_ == Type::Songs) {
if (query_type_ == Type::FavouriteSongs) {
reply = CreateRequest(QStringLiteral("favorite/getUserFavorites"), params);
}
else if (query_type_ == Type::SearchSongs) {
@@ -534,7 +534,7 @@ void QobuzRequest::ArtistsFinishCheck(const int limit, const int offset, const i
if ((limit == 0 || limit > artists_received) && artists_received_ < artists_total_) {
int offset_next = offset + artists_received;
if (offset_next > 0 && offset_next < artists_total_) {
if (query_type_ == Type::Artists) AddArtistsRequest(offset_next);
if (query_type_ == Type::FavouriteArtists) AddArtistsRequest(offset_next);
else if (query_type_ == Type::SearchArtists) AddArtistsSearchRequest(offset_next);
}
}
@@ -689,7 +689,7 @@ void QobuzRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_req
}
QJsonArray array_items = value_items.toArray();
if (array_items.isEmpty()) {
if ((query_type_ == Type::Albums || query_type_ == Type::SearchAlbums) && offset_requested == 0) {
if ((query_type_ == Type::FavouriteAlbums || query_type_ == Type::SearchAlbums) && offset_requested == 0) {
no_results_ = true;
}
AlbumsFinishCheck(artist_requested);
@@ -755,7 +755,7 @@ void QobuzRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_req
}
if (query_type_ == Type::Albums || query_type_ == Type::SearchAlbums) {
if (query_type_ == Type::FavouriteAlbums || query_type_ == Type::SearchAlbums) {
albums_received_ += albums_received;
emit UpdateProgress(query_id_, GetProgress(albums_received_, albums_total_));
}
@@ -772,13 +772,13 @@ void QobuzRequest::AlbumsFinishCheck(const Artist &artist, const int limit, cons
int offset_next = offset + albums_received;
if (offset_next > 0 && offset_next < albums_total) {
switch (query_type_) {
case Type::Albums:
case Type::FavouriteAlbums:
AddAlbumsRequest(offset_next);
break;
case Type::SearchAlbums:
AddAlbumsSearchRequest(offset_next);
break;
case Type::Artists:
case Type::FavouriteArtists:
case Type::SearchArtists:
AddArtistAlbumsRequest(artist, offset_next);
break;
@@ -984,7 +984,7 @@ void QobuzRequest::SongsReceived(QNetworkReply *reply, const Artist &artist_requ
QJsonArray array_items = value_items.toArray();
if (array_items.isEmpty()) {
if ((query_type_ == Type::Songs || query_type_ == Type::SearchSongs) && offset_requested == 0) {
if ((query_type_ == Type::FavouriteSongs || query_type_ == Type::SearchSongs) && offset_requested == 0) {
no_results_ = true;
}
SongsFinishCheck(album_artist, album, limit_requested, offset_requested, songs_total);
@@ -1018,7 +1018,7 @@ void QobuzRequest::SongsReceived(QNetworkReply *reply, const Artist &artist_requ
songs_.insert(song.song_id(), song);
}
if (query_type_ == Type::Songs || query_type_ == Type::SearchSongs) {
if (query_type_ == Type::FavouriteSongs || query_type_ == Type::SearchSongs) {
songs_received_ += songs_received;
emit UpdateProgress(query_id_, GetProgress(songs_received_, songs_total_));
}
@@ -1035,15 +1035,15 @@ void QobuzRequest::SongsFinishCheck(const Artist &artist, const Album &album, co
int offset_next = offset + songs_received;
if (offset_next > 0 && offset_next < songs_total) {
switch (query_type_) {
case Type::Songs:
case Type::FavouriteSongs:
AddSongsRequest(offset_next);
break;
case Type::SearchSongs:
AddSongsSearchRequest(offset_next);
break;
case Type::Artists:
case Type::FavouriteArtists:
case Type::SearchArtists:
case Type::Albums:
case Type::FavouriteAlbums:
case Type::SearchAlbums:
AddAlbumSongsRequest(artist, album, offset_next);
break;

View File

@@ -121,7 +121,7 @@ class QobuzRequest : public QobuzBaseRequest {
private:
bool IsQuery() const { return (query_type_ == Type::Artists || query_type_ == Type::Albums || query_type_ == Type::Songs); }
bool IsQuery() const { return (query_type_ == Type::FavouriteArtists || query_type_ == Type::FavouriteAlbums || query_type_ == Type::FavouriteSongs); }
bool IsSearch() const { return (query_type_ == Type::SearchArtists || query_type_ == Type::SearchAlbums || query_type_ == Type::SearchSongs); }
void StartRequests();

View File

@@ -519,7 +519,7 @@ void QobuzService::GetArtists() {
}
ResetArtistsRequest();
artists_request_.reset(new QobuzRequest(this, url_handler_, app_, network_, QobuzBaseRequest::Type::Artists), [](QobuzRequest *request) { request->deleteLater(); });
artists_request_.reset(new QobuzRequest(this, url_handler_, app_, network_, QobuzBaseRequest::Type::FavouriteArtists), [](QobuzRequest *request) { request->deleteLater(); });
QObject::connect(&*artists_request_, &QobuzRequest::Results, this, &QobuzService::ArtistsResultsReceived);
QObject::connect(&*artists_request_, &QobuzRequest::UpdateStatus, this, &QobuzService::ArtistsUpdateStatusReceived);
QObject::connect(&*artists_request_, &QobuzRequest::UpdateProgress, this, &QobuzService::ArtistsUpdateProgressReceived);
@@ -569,7 +569,7 @@ void QobuzService::GetAlbums() {
}
ResetAlbumsRequest();
albums_request_.reset(new QobuzRequest(this, url_handler_, app_, network_, QobuzBaseRequest::Type::Albums), [](QobuzRequest *request) { request->deleteLater(); });
albums_request_.reset(new QobuzRequest(this, url_handler_, app_, network_, QobuzBaseRequest::Type::FavouriteAlbums), [](QobuzRequest *request) { request->deleteLater(); });
QObject::connect(&*albums_request_, &QobuzRequest::Results, this, &QobuzService::AlbumsResultsReceived);
QObject::connect(&*albums_request_, &QobuzRequest::UpdateStatus, this, &QobuzService::AlbumsUpdateStatusReceived);
QObject::connect(&*albums_request_, &QobuzRequest::UpdateProgress, this, &QobuzService::AlbumsUpdateProgressReceived);
@@ -619,7 +619,7 @@ void QobuzService::GetSongs() {
}
ResetSongsRequest();
songs_request_.reset(new QobuzRequest(this, url_handler_, app_, network_, QobuzBaseRequest::Type::Songs), [](QobuzRequest *request) { request->deleteLater(); });
songs_request_.reset(new QobuzRequest(this, url_handler_, app_, network_, QobuzBaseRequest::Type::FavouriteSongs), [](QobuzRequest *request) { request->deleteLater(); });
QObject::connect(&*songs_request_, &QobuzRequest::Results, this, &QobuzService::SongsResultsReceived);
QObject::connect(&*songs_request_, &QobuzRequest::UpdateStatus, this, &QobuzService::SongsUpdateStatusReceived);
QObject::connect(&*songs_request_, &QobuzRequest::UpdateProgress, this, &QobuzService::SongsUpdateProgressReceived);

View File

@@ -49,9 +49,9 @@ class SpotifyBaseRequest : public QObject {
enum class Type {
None,
Artists,
Albums,
Songs,
FavouriteArtists,
FavouriteAlbums,
FavouriteSongs,
SearchArtists,
SearchAlbums,
SearchSongs,

View File

@@ -129,13 +129,13 @@ void SpotifyRequest::Process() {
}
switch (type_) {
case Type::Artists:
case Type::FavouriteArtists:
GetArtists();
break;
case Type::Albums:
case Type::FavouriteAlbums:
GetAlbums();
break;
case Type::Songs:
case Type::FavouriteSongs:
GetSongs();
break;
case Type::SearchArtists:
@@ -243,7 +243,7 @@ void SpotifyRequest::FlushArtistsRequests() {
parameters << Param(QStringLiteral("offset"), QString::number(request.offset));
}
QNetworkReply *reply = nullptr;
if (type_ == Type::Artists) {
if (type_ == Type::FavouriteArtists) {
reply = CreateRequest(QStringLiteral("me/following"), parameters);
}
if (type_ == Type::SearchArtists) {
@@ -297,7 +297,7 @@ void SpotifyRequest::FlushAlbumsRequests() {
if (request.limit > 0) parameters << Param(QStringLiteral("limit"), QString::number(request.limit));
if (request.offset > 0) parameters << Param(QStringLiteral("offset"), QString::number(request.offset));
QNetworkReply *reply = nullptr;
if (type_ == Type::Albums) {
if (type_ == Type::FavouriteAlbums) {
reply = CreateRequest(QStringLiteral("me/albums"), parameters);
}
if (type_ == Type::SearchAlbums) {
@@ -352,7 +352,7 @@ void SpotifyRequest::FlushSongsRequests() {
parameters << Param(QStringLiteral("offset"), QString::number(request.offset));
}
QNetworkReply *reply = nullptr;
if (type_ == Type::Songs) {
if (type_ == Type::FavouriteSongs) {
reply = CreateRequest(QStringLiteral("me/tracks"), parameters);
}
if (type_ == Type::SearchSongs) {
@@ -539,7 +539,7 @@ void SpotifyRequest::ArtistsFinishCheck(const int limit, const int offset, const
if ((limit == 0 || limit > artists_received) && artists_received_ < artists_total_) {
int offset_next = offset + artists_received;
if (offset_next > 0 && offset_next < artists_total_) {
if (type_ == Type::Artists) AddArtistsRequest(offset_next);
if (type_ == Type::FavouriteArtists) AddArtistsRequest(offset_next);
else if (type_ == Type::SearchArtists) AddArtistsSearchRequest(offset_next);
}
}
@@ -655,7 +655,7 @@ void SpotifyRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_a
int offset = json_obj[QLatin1String("offset")].toInt();
int albums_total = json_obj[QLatin1String("total")].toInt();
if (type_ == Type::Albums || type_ == Type::SearchAlbums) {
if (type_ == Type::FavouriteAlbums || type_ == Type::SearchAlbums) {
albums_total_ = albums_total;
}
@@ -672,7 +672,7 @@ void SpotifyRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_a
}
QJsonArray array_items = value_items.toArray();
if (array_items.isEmpty()) {
if ((type_ == Type::Albums || type_ == Type::SearchAlbums || (type_ == Type::SearchSongs && fetchalbums_)) && offset_requested == 0) {
if ((type_ == Type::FavouriteAlbums || type_ == Type::SearchAlbums || (type_ == Type::SearchSongs && fetchalbums_)) && offset_requested == 0) {
no_results_ = true;
}
AlbumsFinishCheck(artist_artist);
@@ -799,7 +799,7 @@ void SpotifyRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_a
}
if (type_ == Type::Albums || type_ == Type::SearchAlbums) {
if (type_ == Type::FavouriteAlbums || type_ == Type::SearchAlbums) {
albums_received_ += albums_received;
emit UpdateProgress(query_id_, GetProgress(albums_received_, albums_total_));
}
@@ -816,13 +816,13 @@ void SpotifyRequest::AlbumsFinishCheck(const Artist &artist, const int limit, co
int offset_next = offset + albums_received;
if (offset_next > 0 && offset_next < albums_total) {
switch (type_) {
case Type::Albums:
case Type::FavouriteAlbums:
AddAlbumsRequest(offset_next);
break;
case Type::SearchAlbums:
AddAlbumsSearchRequest(offset_next);
break;
case Type::Artists:
case Type::FavouriteArtists:
case Type::SearchArtists:
AddArtistAlbumsRequest(artist, offset_next);
break;
@@ -954,7 +954,7 @@ void SpotifyRequest::SongsReceived(QNetworkReply *reply, const Artist &artist, c
int offset = json_obj[QLatin1String("offset")].toInt();
int songs_total = json_obj[QLatin1String("total")].toInt();
if (type_ == Type::Songs || type_ == Type::SearchSongs) {
if (type_ == Type::FavouriteSongs || type_ == Type::SearchSongs) {
songs_total_ = songs_total;
}
@@ -972,7 +972,7 @@ void SpotifyRequest::SongsReceived(QNetworkReply *reply, const Artist &artist, c
QJsonArray array_items = json_value.toArray();
if (array_items.isEmpty()) {
if ((type_ == Type::Songs || type_ == Type::SearchSongs) && offset_requested == 0) {
if ((type_ == Type::FavouriteSongs || type_ == Type::SearchSongs) && offset_requested == 0) {
no_results_ = true;
}
SongsFinishCheck(artist, album, limit_requested, offset_requested, songs_total, 0);
@@ -1014,7 +1014,7 @@ void SpotifyRequest::SongsReceived(QNetworkReply *reply, const Artist &artist, c
songs_.insert(song.song_id(), song);
}
if (type_ == Type::Songs || type_ == Type::SearchSongs) {
if (type_ == Type::FavouriteSongs || type_ == Type::SearchSongs) {
songs_received_ += songs_received;
emit UpdateProgress(query_id_, GetProgress(songs_received_, songs_total_));
}
@@ -1031,7 +1031,7 @@ void SpotifyRequest::SongsFinishCheck(const Artist &artist, const Album &album,
int offset_next = offset + songs_received;
if (offset_next > 0 && offset_next < songs_total) {
switch (type_) {
case Type::Songs:
case Type::FavouriteSongs:
AddSongsRequest(offset_next);
break;
case Type::SearchSongs:
@@ -1041,9 +1041,9 @@ void SpotifyRequest::SongsFinishCheck(const Artist &artist, const Album &album,
break;
}
// fallthrough
case Type::Artists:
case Type::FavouriteArtists:
case Type::SearchArtists:
case Type::Albums:
case Type::FavouriteAlbums:
case Type::SearchAlbums:
AddAlbumSongsRequest(artist, album, offset_next);
break;

View File

@@ -117,7 +117,7 @@ class SpotifyRequest : public SpotifyBaseRequest {
private:
void StartRequests();
bool IsQuery() const { return (type_ == Type::Artists || type_ == Type::Albums || type_ == Type::Songs); }
bool IsQuery() const { return (type_ == Type::FavouriteArtists || type_ == Type::FavouriteAlbums || type_ == Type::FavouriteSongs); }
bool IsSearch() const { return (type_ == Type::SearchArtists || type_ == Type::SearchAlbums || type_ == Type::SearchSongs); }
void GetArtists();

View File

@@ -519,7 +519,7 @@ void SpotifyService::GetArtists() {
}
ResetArtistsRequest();
artists_request_.reset(new SpotifyRequest(this, app_, network_, SpotifyBaseRequest::Type::Artists, this), [](SpotifyRequest *request) { request->deleteLater(); });
artists_request_.reset(new SpotifyRequest(this, app_, network_, SpotifyBaseRequest::Type::FavouriteArtists, this), [](SpotifyRequest *request) { request->deleteLater(); });
QObject::connect(&*artists_request_, &SpotifyRequest::Results, this, &SpotifyService::ArtistsResultsReceived);
QObject::connect(&*artists_request_, &SpotifyRequest::UpdateStatus, this, &SpotifyService::ArtistsUpdateStatusReceived);
QObject::connect(&*artists_request_, &SpotifyRequest::ProgressSetMaximum, this, &SpotifyService::ArtistsProgressSetMaximumReceived);
@@ -571,7 +571,7 @@ void SpotifyService::GetAlbums() {
}
ResetAlbumsRequest();
albums_request_.reset(new SpotifyRequest(this, app_, network_, SpotifyBaseRequest::Type::Albums, this), [](SpotifyRequest *request) { request->deleteLater(); });
albums_request_.reset(new SpotifyRequest(this, app_, network_, SpotifyBaseRequest::Type::FavouriteAlbums, this), [](SpotifyRequest *request) { request->deleteLater(); });
QObject::connect(&*albums_request_, &SpotifyRequest::Results, this, &SpotifyService::AlbumsResultsReceived);
QObject::connect(&*albums_request_, &SpotifyRequest::UpdateStatus, this, &SpotifyService::AlbumsUpdateStatusReceived);
QObject::connect(&*albums_request_, &SpotifyRequest::ProgressSetMaximum, this, &SpotifyService::AlbumsProgressSetMaximumReceived);
@@ -623,7 +623,7 @@ void SpotifyService::GetSongs() {
}
ResetSongsRequest();
songs_request_.reset(new SpotifyRequest(this, app_, network_, SpotifyBaseRequest::Type::Songs, this), [](SpotifyRequest *request) { request->deleteLater(); });
songs_request_.reset(new SpotifyRequest(this, app_, network_, SpotifyBaseRequest::Type::FavouriteSongs, this), [](SpotifyRequest *request) { request->deleteLater(); });
QObject::connect(&*songs_request_, &SpotifyRequest::Results, this, &SpotifyService::SongsResultsReceived);
QObject::connect(&*songs_request_, &SpotifyRequest::UpdateStatus, this, &SpotifyService::SongsUpdateStatusReceived);
QObject::connect(&*songs_request_, &SpotifyRequest::ProgressSetMaximum, this, &SpotifyService::SongsProgressSetMaximumReceived);

View File

@@ -50,9 +50,9 @@ class TidalBaseRequest : public QObject {
enum class Type {
None,
Artists,
Albums,
Songs,
FavouriteArtists,
FavouriteAlbums,
FavouriteSongs,
SearchArtists,
SearchAlbums,
SearchSongs,

View File

@@ -148,13 +148,13 @@ void TidalRequest::Process() {
}
switch (query_type_) {
case Type::Artists:
case Type::FavouriteArtists:
GetArtists();
break;
case Type::Albums:
case Type::FavouriteAlbums:
GetAlbums();
break;
case Type::Songs:
case Type::FavouriteSongs:
GetSongs();
break;
case Type::SearchArtists:
@@ -254,7 +254,7 @@ void TidalRequest::FlushArtistsRequests() {
if (request.limit > 0) parameters << Param(QStringLiteral("limit"), QString::number(request.limit));
if (request.offset > 0) parameters << Param(QStringLiteral("offset"), QString::number(request.offset));
QNetworkReply *reply = nullptr;
if (query_type_ == Type::Artists) {
if (query_type_ == Type::FavouriteArtists) {
reply = CreateRequest(QStringLiteral("users/%1/favorites/artists").arg(service_->user_id()), parameters);
}
if (query_type_ == Type::SearchArtists) {
@@ -302,7 +302,7 @@ void TidalRequest::FlushAlbumsRequests() {
if (request.limit > 0) parameters << Param(QStringLiteral("limit"), QString::number(request.limit));
if (request.offset > 0) parameters << Param(QStringLiteral("offset"), QString::number(request.offset));
QNetworkReply *reply = nullptr;
if (query_type_ == Type::Albums) {
if (query_type_ == Type::FavouriteAlbums) {
reply = CreateRequest(QStringLiteral("users/%1/favorites/albums").arg(service_->user_id()), parameters);
}
if (query_type_ == Type::SearchAlbums) {
@@ -350,7 +350,7 @@ void TidalRequest::FlushSongsRequests() {
if (request.limit > 0) parameters << Param(QStringLiteral("limit"), QString::number(request.limit));
if (request.offset > 0) parameters << Param(QStringLiteral("offset"), QString::number(request.offset));
QNetworkReply *reply = nullptr;
if (query_type_ == Type::Songs) {
if (query_type_ == Type::FavouriteSongs) {
reply = CreateRequest(QStringLiteral("users/%1/favorites/tracks").arg(service_->user_id()), parameters);
}
if (query_type_ == Type::SearchSongs) {
@@ -532,7 +532,7 @@ void TidalRequest::ArtistsFinishCheck(const int limit, const int offset, const i
if ((limit == 0 || limit > artists_received) && artists_received_ < artists_total_) {
int offset_next = offset + artists_received;
if (offset_next > 0 && offset_next < artists_total_) {
if (query_type_ == Type::Artists) AddArtistsRequest(offset_next);
if (query_type_ == Type::FavouriteArtists) AddArtistsRequest(offset_next);
else if (query_type_ == Type::SearchArtists) AddArtistsSearchRequest(offset_next);
}
}
@@ -766,7 +766,7 @@ void TidalRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_req
}
if (query_type_ == Type::Albums || query_type_ == Type::SearchAlbums) {
if (query_type_ == Type::FavouriteAlbums || query_type_ == Type::SearchAlbums) {
albums_received_ += albums_received;
emit UpdateProgress(query_id_, GetProgress(albums_received_, albums_total_));
}
@@ -783,13 +783,13 @@ void TidalRequest::AlbumsFinishCheck(const Artist &artist, const int limit, cons
int offset_next = offset + albums_received;
if (offset_next > 0 && offset_next < albums_total) {
switch (query_type_) {
case Type::Albums:
case Type::FavouriteAlbums:
AddAlbumsRequest(offset_next);
break;
case Type::SearchAlbums:
AddAlbumsSearchRequest(offset_next);
break;
case Type::Artists:
case Type::FavouriteArtists:
case Type::SearchArtists:
AddArtistAlbumsRequest(artist, offset_next);
break;
@@ -972,7 +972,7 @@ void TidalRequest::SongsReceived(QNetworkReply *reply, const Artist &artist, con
songs_.insert(song.song_id(), song);
}
if (query_type_ == Type::Songs || query_type_ == Type::SearchSongs) {
if (query_type_ == Type::FavouriteSongs || query_type_ == Type::SearchSongs) {
songs_received_ += songs_received;
emit UpdateProgress(query_id_, GetProgress(songs_received_, songs_total_));
}
@@ -989,7 +989,7 @@ void TidalRequest::SongsFinishCheck(const Artist &artist, const Album &album, co
int offset_next = offset + songs_received;
if (offset_next > 0 && offset_next < songs_total) {
switch (query_type_) {
case Type::Songs:
case Type::FavouriteSongs:
AddSongsRequest(offset_next);
break;
case Type::SearchSongs:
@@ -999,9 +999,9 @@ void TidalRequest::SongsFinishCheck(const Artist &artist, const Album &album, co
break;
}
[[fallthrough]];
case Type::Artists:
case Type::FavouriteArtists:
case Type::SearchArtists:
case Type::Albums:
case Type::FavouriteAlbums:
case Type::SearchAlbums:
AddAlbumSongsRequest(artist, album, offset_next);
break;

View File

@@ -124,7 +124,7 @@ class TidalRequest : public TidalBaseRequest {
void LoginComplete(const bool success, const QString &error = QString());
private:
bool IsQuery() const { return (query_type_ == Type::Artists || query_type_ == Type::Albums || query_type_ == Type::Songs); }
bool IsQuery() const { return (query_type_ == Type::FavouriteArtists || query_type_ == Type::FavouriteAlbums || query_type_ == Type::FavouriteSongs); }
bool IsSearch() const { return (query_type_ == Type::SearchArtists || query_type_ == Type::SearchAlbums || query_type_ == Type::SearchSongs); }
void StartRequests();

View File

@@ -732,7 +732,7 @@ void TidalService::GetArtists() {
}
ResetArtistsRequest();
artists_request_.reset(new TidalRequest(this, url_handler_, app_, network_, TidalBaseRequest::Type::Artists, this), [](TidalRequest *request) { request->deleteLater(); });
artists_request_.reset(new TidalRequest(this, url_handler_, app_, network_, TidalBaseRequest::Type::FavouriteArtists, this), [](TidalRequest *request) { request->deleteLater(); });
QObject::connect(&*artists_request_, &TidalRequest::RequestLogin, this, &TidalService::SendLogin);
QObject::connect(&*artists_request_, &TidalRequest::Results, this, &TidalService::ArtistsResultsReceived);
QObject::connect(&*artists_request_, &TidalRequest::UpdateStatus, this, &TidalService::ArtistsUpdateStatusReceived);
@@ -787,7 +787,7 @@ void TidalService::GetAlbums() {
}
ResetAlbumsRequest();
albums_request_.reset(new TidalRequest(this, url_handler_, app_, network_, TidalBaseRequest::Type::Albums, this), [](TidalRequest *request) { request->deleteLater(); });
albums_request_.reset(new TidalRequest(this, url_handler_, app_, network_, TidalBaseRequest::Type::FavouriteAlbums, this), [](TidalRequest *request) { request->deleteLater(); });
QObject::connect(&*albums_request_, &TidalRequest::RequestLogin, this, &TidalService::SendLogin);
QObject::connect(&*albums_request_, &TidalRequest::Results, this, &TidalService::AlbumsResultsReceived);
QObject::connect(&*albums_request_, &TidalRequest::UpdateStatus, this, &TidalService::AlbumsUpdateStatusReceived);
@@ -842,7 +842,7 @@ void TidalService::GetSongs() {
}
ResetSongsRequest();
songs_request_.reset(new TidalRequest(this, url_handler_, app_, network_, TidalBaseRequest::Type::Songs, this), [](TidalRequest *request) { request->deleteLater(); });
songs_request_.reset(new TidalRequest(this, url_handler_, app_, network_, TidalBaseRequest::Type::FavouriteSongs, this), [](TidalRequest *request) { request->deleteLater(); });
QObject::connect(&*songs_request_, &TidalRequest::RequestLogin, this, &TidalService::SendLogin);
QObject::connect(&*songs_request_, &TidalRequest::Results, this, &TidalService::SongsResultsReceived);
QObject::connect(&*songs_request_, &TidalRequest::UpdateStatus, this, &TidalService::SongsUpdateStatusReceived);