1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-03 23:50:33 +02:00
Files
joplin/QtClient/JoplinQtClient/synchronizer.h

42 lines
770 B
C
Raw Normal View History

2016-12-27 21:25:07 +01:00
#ifndef SYNCHRONIZER_H
#define SYNCHRONIZER_H
#include <stable.h>
#include "webapi.h"
#include "database.h"
2017-01-03 19:42:01 +01:00
#include "models/change.h"
2016-12-27 21:25:07 +01:00
namespace jop {
class Synchronizer : public QObject {
Q_OBJECT
public:
2017-01-05 18:59:01 +01:00
enum SynchronizationState { Idle, UploadingChanges, DownloadingChanges };
Synchronizer(const QString& apiUrl, Database& database);
2016-12-27 21:25:07 +01:00
void start();
2017-01-05 18:59:01 +01:00
void setSessionId(const QString& v);
2016-12-27 21:25:07 +01:00
private:
2017-01-03 19:42:01 +01:00
QUrlQuery valuesToUrlQuery(const QHash<QString, BaseModel::Value> &values) const;
2017-01-05 18:59:01 +01:00
WebApi api_;
2016-12-27 21:25:07 +01:00
Database& db_;
2017-01-05 18:59:01 +01:00
SynchronizationState state_;
int uploadsRemaining_;
2017-01-09 12:13:58 +01:00
void checkNextState();
void switchState(SynchronizationState state);
2016-12-27 21:25:07 +01:00
public slots:
void api_requestDone(const QJsonObject& response, const QString& tag);
};
}
#endif // SYNCHRONIZER_H