-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqc.h
65 lines (48 loc) · 1.35 KB
/
qc.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
64
65
#ifndef QC_H
#define QC_H
#include <QMap>
#include <QString>
#include <QList>
#include <QNetworkReply>
#include "../o2/o1.h"
#include "uploader.h"
#include "database.h"
class QNetworkAccessManager;
class O1Requestor;
/// QC connector and uploader.
class Qc: public O1 {
Q_OBJECT
public:
explicit Qc(QObject *parent = 0);
~Qc();
/// Is uploading enabled?
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
bool enabled();
void setEnabled(bool v);
static Qc *instance();
static void close();
/// Start uploading some records from the log database.
void upload();
/// Get tags.
QMap<QString, QString> getTags(Database &db, qlonglong recordId);
/// Upload a measurement batch to QC.
void uploadBatch(const QVariantMap &batch);
/// Finish uploading a batch.
void finishBatch(bool failed);
public slots:
/// Handle network reply error.
void onError(QNetworkReply::NetworkError error);
/// Handle network reply completion.
void onFinished();
signals:
/// Uploading has been enabled or disabled.
void enabledChanged();
/// Upload has finished.
/// @param result @see UploadResult.
void uploadFinished(int result);
public:
QList<qlonglong> uploadedRecords;
QNetworkAccessManager *manager;
O1Requestor *requestor;
};
#endif // QC_H