-
Notifications
You must be signed in to change notification settings - Fork 4
/
dataprovider.h
44 lines (36 loc) · 1.05 KB
/
dataprovider.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
#ifndef DATAPROVIDER_H
#define DATAPROVIDER_H
#include <QObject>
#include <QtNetwork>
#include <QNetworkDiskCache>
#include <QIcon>
typedef QHash<QString, QString> ChannelInfo;
typedef QHash<QString, ChannelInfo> ChannelData;
typedef QList<ChannelInfo> ChannelList;
class DataProvider : public QObject
{
Q_OBJECT
public:
explicit DataProvider(QObject *parent = 0);
QUrl getPlaylistUrl(QString);
private:
QNetworkAccessManager *m_networkManager;
QUrl m_channelsUrl;
QHash<QUrl, QString> m_iconRequests;
QHash<QUrl, QString> m_imageRequests;
QNetworkDiskCache *m_diskCache;
QString m_cacheDir;
ChannelData m_channelData;
void sendRequest(QUrl);
signals:
void channelListProvided(ChannelList);
void channelIconProvided(QString, QImage);
void channelImageProvided(QString, QImage);
public slots:
void handleNetworkReply(QNetworkReply*);
void parseChannelsXml(QByteArray);
void provideChannelList();
void provideChannelIcon(QString);
void provideChannelImage(QString id);
};
#endif // DATAPROVIDER_H