7 class Video : public QObject {
14 const QString title() const { return m_title; }
15 void setTitle( QString title ) { m_title = title; }
17 const QString description() const { return m_description; }
18 void setDescription( QString description ) { m_description = description; }
20 const QString author() const { return m_author; }
21 void setAuthor( QString author ) { m_author = author; }
23 const QUrl webpage() const { return m_webpage; }
24 void setWebpage( QUrl webpage ) { m_webpage = webpage; }
26 void loadStreamUrl() {
27 if (m_streamUrl.isEmpty())
28 this->scrapeStreamUrl();
29 else emit gotStreamUrl(m_streamUrl);
32 QList<QUrl> thumbnailUrls() const { return m_thumbnailUrls; }
33 void addThumbnailUrl(QUrl url) {
34 m_thumbnailUrls << url;
37 void preloadThumbnail();
38 const QImage thumbnail() const;
40 int duration() const { return m_duration; }
41 void setDuration( int duration ) { m_duration = duration; }
43 int viewCount() const { return m_viewCount; }
44 void setViewCount( int viewCount ) { m_viewCount = viewCount; }
46 const QDateTime published() const { return m_published; }
47 void setPublished( QDateTime published ) { m_published = published; }
50 void setThumbnail(QByteArray bytes);
54 void gotStreamUrl(QUrl streamUrl);
55 void errorStreamUrl(QString message);
58 void gotVideoInfo(QByteArray);
59 void errorVideoInfo(QNetworkReply*);
62 void scrapeStreamUrl();
65 QString m_description;
71 QList<QUrl> m_thumbnailUrls;
72 // QList<QImage> m_thumbnails;
74 QDateTime m_published;
77 // The YouTube video id
78 // This is needed by the gotVideoInfo callback
82 // This is required in order to use QPointer<Video> as a QVariant
83 // as used by the Model/View playlist
84 typedef QPointer<Video> VideoPointer;
85 Q_DECLARE_METATYPE(VideoPointer)