-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendrequest.h
63 lines (50 loc) · 1.33 KB
/
sendrequest.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
#ifndef SENDREQUEST_H
#define SENDREQUEST_H
#include <QObject>
#include <QJsonDocument>
#include <QByteArray>
#include <QBuffer>
#include <QJsonObject>
#include <QHttpMultiPart>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QEventLoop>
#include <QDebug>
#include <QTimer>
#include <QTime>
#include <ServerConn/serverconn.h>
QT_BEGIN_NAMESPACE
class SendRequest : public QObject
{
Q_OBJECT
public:
enum ConnectType{
form_data,
JSON
};
explicit SendRequest(QObject *parent = nullptr);
~SendRequest();
ServerConn *serverConn;
void sendRequest(QJsonObject args, QString link);
void sendRequest(QJsonObject args, QString link,int type);
void uploadDone(QByteArray data);
void netError();
QNetworkReply *reply;
QTimer *timeOute;
int nextTime;
QJsonObject tempArgs;
QString tempLink;
int tryCount;
signals:
void setRespons(QByteArray data);
void finished();
void error();
public slots:
void respons();
void uploadProgress(qint64 bytesSent, qint64 bytesTotal);
void onDownloadProgress(qint64 bytesSent, qint64 bytesTotal);
void timeOuted();
void sendRequestAfterInterruption(QJsonObject args, QString link);
void sendJsonRequestAfterInterruption(QJsonObject args, QString link);
};
#endif // SENDREQUEST_H