-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwidget.h
More file actions
executable file
·60 lines (49 loc) · 1.17 KB
/
widget.h
File metadata and controls
executable file
·60 lines (49 loc) · 1.17 KB
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
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
typedef struct {
QByteArray key;
QByteArray value;
} httpHeader_t;
typedef enum {
HTTP_METHOD_GET = 0,
HTTP_METHOD_POST = 1,
HTTP_METHOD_PUT = 2,
HTTP_METHOD_HEAD = 3,
HTTP_METHOD_DELETE = 4,
} httpMethod_e;
typedef struct {
httpMethod_e method;
QUrl url;
QList<httpHeader_t> header;
QByteArray postData;
} httpRequest_t;
typedef struct {
int httpCode;
QList<httpHeader_t> header;
QByteArray response;
} httpReply_t;
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
private:
Ui::Widget *ui;
QNetworkAccessManager *manager;
QNetworkReply *reply;
int httpRequest(httpRequest_t *request, httpReply_t *reply);
private slots:
void authRequiredReply(QNetworkReply *reply, QAuthenticator *auth);
void sendBtnClicked(void);
void sendQueryAppendBtnClicked(void);
void sendQueryClearBtnClicked(void);
};
#endif // WIDGET_H