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();
58 void gotVideoInfo(QByteArray);
61 void scrapeStreamUrl();
64 QString m_description;
70 QList<QUrl> m_thumbnailUrls;
71 // QList<QImage> m_thumbnails;
73 QDateTime m_published;
76 // The YouTube video id
77 // This is needed by the gotVideoInfo callback
81 // This is required in order to use QPointer<Video> as a QVariant
82 // as used by the Model/View playlist
83 typedef QPointer<Video> VideoPointer;
84 Q_DECLARE_METATYPE(VideoPointer)