12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #ifndef RADIO_H
- #define RADIO_H
-
- #include <QObject>
- #include <QColor>
- #include <QUrl>
- #include <QPixmap>
- #include <QNetworkAccessManager>
- #include <QNetworkReply>
- #include <QMediaPlayer>
- #include <QList>
- #include <QTimer>
- #include "song.h"
-
- class Radio : public QObject
- {
- Q_OBJECT
- public:
- explicit Radio(QObject *parent = 0);
-
- QString getName();
- QString getClaim();
- QColor getTextColor();
- QUrl getLogoUrl();
- QUrl getStreamUrl();
- int getId();
- QUrl getApiBase();
- QUrl getCoverBase();
-
- Song* getCurrentSong();
-
- signals:
- void logoDownloaded(QPixmap);
- void songChanged(Song*);
- void nextSongsUpdated();
-
- public slots:
- void setName(QString n);
- void setClaim(QString c);
- void setTextColor(QColor c);
- void setLogoUrl(QUrl u);
- void setStreamUrl(QUrl u);
- void setId(int i);
- void setApiBase(QUrl u);
- void setCoverBase(QUrl u);
-
- void setCurrentSong(Song* s);
- void updateNextSongs();
- void downloadLogo();
- void startStream();
- void stopStream();
-
- public slots:
- void setNetworkManager(QNetworkAccessManager* m);
-
- private slots:
- void logoFinished();
- void logoError(QNetworkReply::NetworkError);
-
- void songsFinished();
- void songsError(QNetworkReply::NetworkError);
-
- //void streamRead();
- void streamError();
-
- void songEnded();
-
- private:
- QString name;
- QString claim;
- QColor textColor;
- QUrl logoUrl;
- QUrl streamUrl;
- int id;
- QPixmap logo;
- QUrl apiBase;
- QUrl coverBase;
-
- QList<Song*> nextSongs;
- Song* currentSong;
- QTimer* songTimer;
-
- QNetworkAccessManager* mgr;
- QMediaPlayer* player;
- int logoTries;
- int songsTries;
- int streamTries;
-
- };
-
- #endif // RADIO_H
|