-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgft.h
65 lines (49 loc) · 1.6 KB
/
gft.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 GFT_H
#define GFT_H
#include <QObject>
#include <QString>
#include <QSettings>
#include <QSqlDatabase>
#include "otwo/o2gft.h"
#include "database.h"
#include "uploader.h"
#include "gftprogram.h"
/// Google Fusion Tables account connector and uploader.
class Gft: public O2Gft {
Q_OBJECT
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
public:
static Gft *instance();
static void close();
/// Is upload enabled?
bool enabled();
/// Start uploading some records from the log.
void upload();
signals:
/// Emitted when enabling/disabling uploads.
void enabledChanged();
/// Emitted when an upload batch has finished.
/// @param result Status of the finished upload, @see UploadResult.
void uploadFinished(int result);
public slots:
/// Enable/disable uploads.
void setEnabled(bool v);
protected slots:
/// Handle step completion: Add record ID to the list of uploaded record IDs.
void onStepCompleted(GftIdList recordIdList);
/// Handle program completion.
void onProgramCompleted(bool failed);
protected:
explicit Gft(QObject *parent = 0);
~Gft();
/// Get tags for a log record ID
/// @return Tags as a single string of sanitized name/value pairs: "name1=value1;name2=value2;..."
QString getTags(Database &db, qlonglong id);
/// Sanitize string by removing the following characters: quote, double quote, backslash, equal, semicolon.
QString sanitize(const QString &s);
protected:
GftProgram *program;
QList<qlonglong> uploadedRecords;
QString archive;
};
#endif // GFT_H