forked from sialan-labs/kaqaz
-
Notifications
You must be signed in to change notification settings - Fork 12
/
smartiodboxsingle.h
103 lines (75 loc) · 2.88 KB
/
smartiodboxsingle.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
Copyright (C) 2014 Aseman
http://aseman.co
Papyrus is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Papyrus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SMARTIODBOXSINGLE_H
#define SMARTIODBOXSINGLE_H
#include <QObject>
class SmartIODBoxSinglePrivate;
class SmartIODBoxSingle : public QObject
{
Q_OBJECT
public:
SmartIODBoxSingle(QObject *parent = 0);
~SmartIODBoxSingle();
public slots:
void setToken(const QString & t);
QString token() const;
void setTokenSecret(const QString & s);
QString tokenSecret() const;
void setPassword( const QString & pass );
QString password() const;
void pushFile(const QString &file, const QString &dest);
void fetchFile(const QString &path , const QString &dest);
void pushPaper(const QString & uuid, qint64 revision , const QString &dest);
void fetchPaper(const QString & uuid, qint64 revision, const QString & path);
void pushGroups( const QString & path, qint64 revision );
void fetchGroups( const QString & path, qint64 revision, qint64 current_revision );
void setDeleted(const QString & path );
void close();
QString cache() const;
static bool fatalError();
signals:
void passwordChanged();
void started( SmartIODBoxSingle *s );
void finished( SmartIODBoxSingle *s );
void revisionChanged( const QString & id, qint64 revision );
private slots:
void cacheIsReady(const QByteArray &data );
void coreFinished();
private:
QByteArray encryptData(const QByteArray &data );
QByteArray decryptData( const QByteArray & sdata );
private:
SmartIODBoxSinglePrivate *p;
};
class SmartIODBoxSingleCore: public QObject
{
Q_OBJECT
friend class SmartIODBoxSingle;
public:
SmartIODBoxSingleCore(QObject *parent = 0): QObject(parent){}
public slots:
void requestPaperToSync( const QString & uuid );
void requestGroupsToSync();
void paperPushed(const QString & id, quint64 revision );
void paperFetched(const QString & id, const QByteArray &data, quint64 revision );
void groupsPushed( quint64 revision );
void groupsFetched(const QByteArray &data, quint64 revision, qint64 current_revision );
void paperDeleted( const QString & id );
signals:
void paperIsReady( const QByteArray & data );
void groupsIsReady( const QByteArray & data );
void finished();
};
#endif // SMARTIODBOXSINGLE_H