7 class Video : public QObject {
15 const QString title() const { return m_title; }
16 void setTitle( QString title ) { m_title = title; }
18 const QString description() const { return m_description; }
19 void setDescription( QString description ) { m_description = description; }
21 const QString author() const { return m_author; }
22 void setAuthor( QString author ) { m_author = author; }
24 const QString authorUri() const { return m_authorUri; }
25 void setAuthorUri( QString authorUri ) { m_authorUri = authorUri; }
27 const QUrl webpage() const { return m_webpage; }
28 void setWebpage(QUrl webpage);
31 const QPixmap & thumbnail() const { return m_thumbnail; }
33 QString thumbnailUrl() { return m_thumbnailUrl; }
34 void setThumbnailUrl(QString url) { m_thumbnailUrl = url; }
36 void loadMediumThumbnail();
37 QString mediumThumbnailUrl() { return m_mediumThumbnailUrl; }
38 void setMediumThumbnailUrl(QString url) { m_mediumThumbnailUrl = url; }
40 int duration() const { return m_duration; }
41 void setDuration( int duration ) { m_duration = duration; }
42 QString formattedDuration() const;
44 int viewCount() const { return m_viewCount; }
45 void setViewCount( int viewCount ) { m_viewCount = viewCount; }
47 const QDateTime published() const { return m_published; }
48 void setPublished( QDateTime published ) { m_published = published; }
50 int getDefinitionCode() const { return definitionCode; }
53 QUrl getStreamUrl() { return m_streamUrl; }
55 QString id() const { return videoId; }
59 void gotMediumThumbnail(QByteArray bytes);
60 void gotStreamUrl(QUrl streamUrl);
61 void errorStreamUrl(QString message);
64 void setThumbnail(QByteArray bytes);
65 void gotVideoInfo(QByteArray);
66 void errorVideoInfo(QNetworkReply*);
67 void scrapeWebPage(QByteArray);
68 void gotHeadHeaders(QNetworkReply*);
72 void findVideoUrl(int definitionCode);
73 void foundVideoUrl(QString videoToken, int definitionCode);
76 QString m_description;
82 QString m_thumbnailUrl;
83 QString m_mediumThumbnailUrl;
85 QDateTime m_published;
92 // current index for the elTypes list
93 // needed to iterate on elTypes
96 bool loadingStreamUrl;
99 // This is required in order to use QPointer<Video> as a QVariant
100 // as used by the Model/View playlist
101 typedef QPointer<Video> VideoPointer;
102 Q_DECLARE_METATYPE(VideoPointer)