-
Notifications
You must be signed in to change notification settings - Fork 0
/
safeworker.h
46 lines (39 loc) · 1.09 KB
/
safeworker.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
#ifndef SAFEWORKER_H
#define SAFEWORKER_H
#include <QObject>
#include <QJsonDocument>
#include <QtNetwork>
#include <QUrlQuery>
class SafeWorker : public QObject
{
Q_OBJECT
public:
SafeWorker(QString host);
void setCmd(QString cmd) { this->cmd = cmd; }
QString getCmd() { return this->cmd; }
void setFilepath(QString filepath) { this->filepath = filepath; }
void setId(ulong call_id) { this->id = call_id; }
ulong getId() { return this->id; }
QHash<QString, QString> getCookies() const { return cookies; }
signals:
void done(SafeWorker *worker, QByteArray data);
void progress(ulong bytes, ulong total_bytes);
void error(QString text);
private slots:
void handleData();
public slots:
void run();
void pushFile();
void pullFile();
void addParam(QString name, QVariant value);
private:
QString host;
QString cmd;
QString filepath;
ulong id;
QUrlQuery params;
QNetworkAccessManager *manager;
QHash<QString, QString> cookies; // C IS FOR COOKIE, THAT's GOOD ENOUGH FOR ME
QNetworkReply *reply;
};
#endif // SAFEWORKER_H