You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef SONG_H
  2. #define SONG_H
  3. #include <QObject>
  4. #include <QString>
  5. #include <QTime>
  6. #include <QUrl>
  7. #include <QNetworkAccessManager>
  8. #include <QNetworkReply>
  9. #include <QNetworkRequest>
  10. #include <QPixmap>
  11. class Song : public QObject
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit Song(QObject *parent = 0);
  16. QString getArtist() const;
  17. QString getTitle() const;
  18. QUrl getCoverUrl() const;
  19. int getDuration() const;
  20. signals:
  21. void coverDownloaded(QPixmap);
  22. public slots:
  23. void setArtist(QString a);
  24. void setTitle(QString t);
  25. void setCoverUrl(QUrl u);
  26. void setDuration(int d);
  27. void downloadCover();
  28. void setNetworkManager(QNetworkAccessManager* m);
  29. private slots:
  30. void onCoverFinished();
  31. void onCoverError(QNetworkReply::NetworkError);
  32. private:
  33. QString artist;
  34. QString title;
  35. QUrl coverUrl;
  36. int duration;
  37. QPixmap cover;
  38. QNetworkAccessManager* mgr;
  39. int tries;
  40. };
  41. #endif // SONG_H