-
Notifications
You must be signed in to change notification settings - Fork 4
/
netmanager.h
58 lines (49 loc) · 1.49 KB
/
netmanager.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
#ifndef NETMANAGER_H
#define NETMANAGER_H
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkCookieJar>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkProxy>
#include <QDateTime>
#include <QEventLoop>
#include <QUrl>
#include <QTimer>
#include <QNetworkCookie>
#include <QUrlQuery>
#include <QByteArray>
class NetManager : public QObject
{
Q_OBJECT
public:
static NetManager& GetInstance();
~NetManager();
quint64 GetTimeStamp10();
quint64 GetTimeStamp13();
QList<QNetworkCookie> GetCookies(QString url);
void GetUrl(QString url, QString referer = "");
void GetUrl(QNetworkRequest request);
void PostUrl(QString url, QByteArray data, QString referer = "");
void PostUrl(QNetworkRequest request, QByteArray data);
void GetUrlSync(QString url, QString referer = "");
void GetUrlSync(QNetworkRequest request);
void PostUrlSync(QString url, QByteArray data, QString referer = "");
void PostUrlSync(QNetworkRequest request, QByteArray data);
QUrl GetUrl();
QByteArray GetContent();
protected:
QNetworkAccessManager *m_pManager;
QUrl m_url;
QByteArray m_content;
private:
NetManager(QObject *parent = 0);
signals:
void loadFinish(QUrl &url, QByteArray &content);
void loadError(QNetworkReply::NetworkError error);
protected slots:
void finished(QNetworkReply *reply);
void networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility accessible);
void sslErrors(QNetworkReply * reply, const QList<QSslError> & errors);
};
#endif // NETMANAGER_H