-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkuaipanhttp.h
41 lines (32 loc) · 980 Bytes
/
kuaipanhttp.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
#ifndef KUAIPANHTTP_H
#define KUAIPANHTTP_H
#include <QObject>
#include <QtNetwork>
#include <QString>
namespace Kuaipan {
class Http : public QObject
{
Q_OBJECT
private:
QEventLoop _readLoop;
QNetworkReply *_reply;
QString _buffer;
QFile *_downloadfile;
public:
explicit Http(QObject *parent = 0);
QString get(QString url,QMap<QString, QString> params);
QString post(QString url,QMap<QString, QString> params);
bool downloadGet(QString url,QMap<QString, QString> params,QString filePath);
bool uploadPost(QString url,QMap<QString, QString> params,QString filePath);
private:
QString _makeQuery(QMap<QString, QString> params);
QString _makeStdBaseUrl(QString url);
signals:
public slots:
void httpReadyRead();
void httpFinished();
void downFileReadyRead();
void downFileFinished();
};
}
#endif // KUAIPANHTTP_H