mirror of
https://github.com/laurent22/joplin.git
synced 2025-02-13 19:42:36 +02:00
46 lines
830 B
C++
Executable File
46 lines
830 B
C++
Executable File
#ifndef SYNCHRONIZER_H
|
|
#define SYNCHRONIZER_H
|
|
|
|
#include <stable.h>
|
|
#include "webapi.h"
|
|
#include "database.h"
|
|
#include "models/change.h"
|
|
|
|
namespace jop {
|
|
|
|
class Synchronizer : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum SynchronizationState { Idle, UploadingChanges, DownloadingChanges, Aborting, Frozen };
|
|
|
|
Synchronizer(Database& database);
|
|
void start();
|
|
void setSessionId(const QString& v);
|
|
void abort();
|
|
void freeze();
|
|
void unfreeze();
|
|
WebApi& api();
|
|
|
|
private:
|
|
|
|
QUrlQuery valuesToUrlQuery(const QHash<QString, BaseModel::Value> &values) const;
|
|
WebApi api_;
|
|
Database& db_;
|
|
SynchronizationState state_;
|
|
int uploadsRemaining_;
|
|
void checkNextState();
|
|
void switchState(SynchronizationState state);
|
|
|
|
public slots:
|
|
|
|
void api_requestDone(const QJsonObject& response, const QString& tag);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // SYNCHRONIZER_H
|