File indexing completed on 2025-01-19 04:23:50

0001 #ifndef ABSTRACTMUSICPROVIDER_H
0002 #define ABSTRACTMUSICPROVIDER_H
0003 
0004 #include <QObject>
0005 
0006 #include <MauiKit3/Core/fmh.h>
0007 
0008 /**
0009  * @brief The AbstractMusicSyncer class
0010  * is an abstraction for different services backend to stream music.
0011  * Different services to be added to VVave are expected to derived from this.
0012  */
0013 
0014 class AbstractMusicProvider : public QObject
0015 {
0016     Q_OBJECT
0017 public:
0018     explicit AbstractMusicProvider(QObject *parent = nullptr);
0019     virtual ~AbstractMusicProvider()
0020     {
0021     }
0022 
0023     virtual void getCollection(const std::initializer_list<QString> &parameters = {}) = 0;
0024 
0025     virtual void getTracks() = 0;
0026     virtual void getTrack(const QString &id) = 0;
0027 
0028     virtual void getArtists() = 0;
0029     virtual void getArtist(const QString &id) = 0;
0030 
0031     virtual void getAlbums() = 0;
0032     virtual void getAlbum(const QString &id) = 0;
0033 
0034     virtual void getPlaylists() = 0;
0035     virtual void getPlaylist(const QString &id) = 0;
0036 
0037     virtual void getFolders() = 0;
0038     virtual void getFolder(const QString &id) = 0;
0039 
0040     virtual QVariantList getAlbumsList() const
0041     {
0042         return QVariantList();
0043     }
0044     virtual QVariantList getArtistsList() const
0045     {
0046         return QVariantList();
0047     }
0048     /**
0049      * @brief setCredentials
0050      * sets the credential to authenticate to the provider server
0051      * @param account
0052      * the account data is represented by FMH::MODEL
0053      */
0054     virtual void setCredentials(const FMH::MODEL &account) final
0055     {
0056         this->m_user = account[FMH::MODEL_KEY::USER];
0057         this->m_password = account[FMH::MODEL_KEY::PASSWORD];
0058         this->m_provider = account[FMH::MODEL_KEY::SERVER];
0059     }
0060 
0061     virtual QString user() final
0062     {
0063         return this->m_user;
0064     }
0065     virtual QString provider() final
0066     {
0067         return this->m_provider;
0068     }
0069 
0070 protected:
0071     QString m_user = "";
0072     QString m_password = "";
0073     QString m_provider = "";
0074 
0075 signals:
0076     void collectionReady(FMH::MODEL_LIST data);
0077     void tracksReady(FMH::MODEL_LIST data);
0078     void trackReady(FMH::MODEL data);
0079     void artistsRedy(FMH::MODEL_LIST data);
0080     void artistReady(FMH::MODEL data);
0081     void albumsReady(FMH::MODEL_LIST data);
0082     void albumReady(FMH::MODEL data);
0083     void playlistsReady(FMH::MODEL_LIST data);
0084     void playlistReady(FMH::MODEL data);
0085 
0086     void trackPathReady(QString id, QString path);
0087 
0088 public slots:
0089 };
0090 
0091 #endif // ABSTRACTMUSICPROVIDER_H