-
Notifications
You must be signed in to change notification settings - Fork 0
/
manager.h
73 lines (48 loc) · 1.33 KB
/
manager.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
#pragma once
#include <memory>
#include <QObject>
#include <QUrl>
#include "database/database.h"
#include "types.h"
class handler_t;
class manager_t : public QObject {
Q_OBJECT
Q_ENUMS(status_e)
public:
struct connection {
QString schema;
QString host;
quint32 port;
QString login;
QString password;
QUrl url;
};
explicit manager_t(database_p db, connection conn);
virtual ~manager_t();
bool busy() const;
QWebdav* network() const;
public Q_SLOTS:
void start(); /// start updating and sync process
void stop(); /// stop any activity
void wait();
Q_SIGNALS:
void finished();
void new_actions(const Actions& actions);
void error(const QString);
void action_started(const action_t& action);
void progress(const action_t& action, qint64 progress, qint64 total);
void action_success(const action_t& action);
void action_error(const action_t& action, const QString& error);
void need_stop();
void can_finish();
private Q_SLOTS:
void receive_new_actions(const Actions& actions);
void compare(conflict_ctx& ctx, bool& result);
void merge(conflict_ctx& ctx, bool& result);
private:
void start_update(); /// calculate tasks for sync
handler_t* create_handler(const action_t& action);
private:
struct Pimpl;
std::unique_ptr<Pimpl> p_;
};