-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsynchandler.h
63 lines (47 loc) · 1.86 KB
/
synchandler.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
#ifndef SYNCHANDLER_H
#define SYNCHANDLER_H
#include "interface.syncprocessor.h"
#include <QObject>
#include <QSignalMapper>
#include <QVariantMap>
/*!
* \brief The SyncHandler class is responsible for subject syncProcessors
*
* Functions of this class are called by QML throught SubjectHandler for current subject.
* Actions related to processor registration\initiation are run in parallel thread
* using QtConcurrent framework.
*/
class SyncHandler : public QObject
{
Q_OBJECT
public:
SyncHandler(QObject* parent);
~SyncHandler();
void registerProcessor(ISyncProcessor* processor);
void unregisterProcessor(ISyncProcessor* processor);
void deleteProcessor(int processorId);
void sync(int processorIndex, ISyncProcessor::SyncDirection direction = ISyncProcessor::SyncDefault);
void sync(ISyncProcessor::Origin origin = ISyncProcessor::OriginAny);
/*!
* \brief buildProcessorsData
* \return data structure used by QML to display list of processors
*/
QVariantList buildProcessorsData();
private:
ISyncProcessor* getProcessorById(int processorId);
void sync(ISyncProcessor* processor, ISyncProcessor::SyncDirection direction = ISyncProcessor::SyncDefault);
QVariantMap buildProcessorData(ISyncProcessor* processor);
void deleteProcessor(ISyncProcessor* processor);
QVector<ISyncProcessor*> syncProcessors;
/*!
* \brief signalMapper is uset to replace processor pointer with processor id in signal
*/
QSignalMapper* signalMapper;
signals:
void processorAddCalled(QVariantMap processorData);
void processorAdded(QVariantMap processorData);
void syncStopped(int processorId);
private slots:
void checkProcessorInit(bool success);
};
#endif // SYNCHANDLER_H