2020-09-17 17:50:17 +02:00
|
|
|
/*
|
|
|
|
* Strawberry Music Player
|
2021-03-20 21:14:47 +01:00
|
|
|
* Copyright 2019-2021, Jonas Kvinge <jonas@jkvinge.net>
|
2020-09-17 17:50:17 +02:00
|
|
|
*
|
|
|
|
* Strawberry is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Strawberry is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QOBUZFAVORITEREQUEST_H
|
|
|
|
#define QOBUZFAVORITEREQUEST_H
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QList>
|
2021-09-19 15:41:36 +02:00
|
|
|
#include <QMap>
|
2020-09-17 17:50:17 +02:00
|
|
|
#include <QVariant>
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include "qobuzbaserequest.h"
|
|
|
|
#include "core/song.h"
|
|
|
|
|
|
|
|
class QNetworkReply;
|
|
|
|
class QobuzService;
|
|
|
|
class NetworkAccessManager;
|
|
|
|
|
|
|
|
class QobuzFavoriteRequest : public QobuzBaseRequest {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2021-07-01 02:01:38 +02:00
|
|
|
explicit QobuzFavoriteRequest(QobuzService *service, NetworkAccessManager *network, QObject *parent = nullptr);
|
2020-09-17 17:50:17 +02:00
|
|
|
~QobuzFavoriteRequest();
|
|
|
|
|
|
|
|
enum FavoriteType {
|
|
|
|
FavoriteType_Artists,
|
|
|
|
FavoriteType_Albums,
|
|
|
|
FavoriteType_Songs
|
|
|
|
};
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void ArtistsAdded(SongList);
|
|
|
|
void AlbumsAdded(SongList);
|
|
|
|
void SongsAdded(SongList);
|
|
|
|
void ArtistsRemoved(SongList);
|
|
|
|
void AlbumsRemoved(SongList);
|
|
|
|
void SongsRemoved(SongList);
|
|
|
|
|
|
|
|
private slots:
|
2021-03-21 04:47:11 +01:00
|
|
|
void AddFavoritesReply(QNetworkReply *reply, const QobuzFavoriteRequest::FavoriteType type, const SongList &songs);
|
|
|
|
void RemoveFavoritesReply(QNetworkReply *reply, const QobuzFavoriteRequest::FavoriteType type, const SongList &songs);
|
2021-01-26 16:48:04 +01:00
|
|
|
|
|
|
|
public slots:
|
2020-09-17 17:50:17 +02:00
|
|
|
void AddArtists(const SongList &songs);
|
|
|
|
void AddAlbums(const SongList &songs);
|
2021-09-19 15:41:36 +02:00
|
|
|
void AddSongs(const SongMap &songs);
|
2020-09-17 17:50:17 +02:00
|
|
|
void RemoveArtists(const SongList &songs);
|
|
|
|
void RemoveAlbums(const SongList &songs);
|
|
|
|
void RemoveSongs(const SongList &songs);
|
2021-09-19 15:41:36 +02:00
|
|
|
void RemoveSongs(const SongMap &songs);
|
2020-09-17 17:50:17 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void Error(const QString &error, const QVariant &debug = QVariant());
|
2021-06-22 13:41:38 +02:00
|
|
|
static QString FavoriteText(const FavoriteType type);
|
2021-09-19 15:41:36 +02:00
|
|
|
static QString FavoriteMethod(const FavoriteType type);
|
2020-09-17 17:50:17 +02:00
|
|
|
void AddFavorites(const FavoriteType type, const SongList &songs);
|
2021-09-19 15:41:36 +02:00
|
|
|
void AddFavoritesRequest(const FavoriteType type, const QStringList &ids_list, const SongList &songs);
|
2020-09-17 17:50:17 +02:00
|
|
|
void RemoveFavorites(const FavoriteType type, const SongList &songs);
|
2021-09-19 15:41:36 +02:00
|
|
|
void RemoveFavoritesRequest(const FavoriteType type, const QStringList &ids_list, const SongList &songs);
|
2020-09-17 17:50:17 +02:00
|
|
|
|
|
|
|
QobuzService *service_;
|
|
|
|
NetworkAccessManager *network_;
|
|
|
|
QList<QNetworkReply*> replies_;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // QOBUZFAVORITEREQUEST_H
|