mirror of
https://github.com/laurent22/joplin.git
synced 2026-06-18 20:16:34 +02:00
42 lines
750 B
C++
Executable File
42 lines
750 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 };
|
|
|
|
Synchronizer(const QString& apiUrl, Database& database);
|
|
void start();
|
|
void setSessionId(const QString& v);
|
|
|
|
private:
|
|
|
|
QUrlQuery valuesToUrlQuery(const QHash<QString, BaseModel::Value> &values) const;
|
|
WebApi api_;
|
|
Database& db_;
|
|
SynchronizationState state_;
|
|
int uploadsRemaining_;
|
|
int downloadsRemaining_;
|
|
void downloadChanges();
|
|
|
|
public slots:
|
|
|
|
void api_requestDone(const QJsonObject& response, const QString& tag);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // SYNCHRONIZER_H
|