-
Notifications
You must be signed in to change notification settings - Fork 0
/
myt.h
64 lines (58 loc) · 1.63 KB
/
myt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef MYT_H
#define MYT_H
#include <QImage>
#include <QNetworkAccessManager>
#include <QObject>
#include <QString>
#include <QTableWidgetItem>
#include "thumbnailgrabber.h"
class videoData
{
public:
QTableWidgetItem thumbnail;
QTableWidgetItem channel;
QTableWidgetItem title;
QTableWidgetItem uploadDate;
QTableWidgetItem videoUrl;
QTableWidgetItem views;
};
class MYTApp : public QObject
{
Q_OBJECT
public:
MYTApp();
QList<videoData> searchResults;
/*!
* \brief Requests a video search whose results are returned via the searchFinished signal.
* \param query Search string.
* \param page What page to look for. Set to the first page by default.
*/
void getSearch(QString query, int page = 1);
private slots:
/*!
* \brief Slot for receiving the NetHandler object's response.
* \param response QByteArray containing the HTTP response obtained by the NetHandler object.
*/
void responseReceived(QNetworkReply *reply);
private:
/*!
* \brief QNetworkManager object for making search requests.
*/
QNetworkAccessManager manager;
/*!
* \brief ThumbnailGrabber object for retrieving video thumbnails.
*/
ThumbnailGrabber thumbGrab;
signals:
/*!
* \brief Signals that the search is finished and returns the list of found videos.
* \param videoList List of found videos.
*/
void searchFinished(QList<videoData> videoList);
/*!
* \brief Starts a process to play a video on yt-dl/MPV.
* \param A QString containing the URL of the video to be played.
*/
void playVideo(QString);
};
#endif // MYT_H