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