QtDataSync
4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
|
The QML binding of QtDataSync::SyncManager. More...
#include <qqmlsyncmanager.h>
Signals | |
void | setupNameChanged (const QString &setupName) |
NOTIFY accessor for AccountManager::setupName. | |
void | nodeChanged (QRemoteObjectNode *node) |
NOTIFY accessor for AccountManager::node. | |
void | validChanged (bool valid) |
NOTIFY accessor for AccountManager::valid. | |
![]() | |
QT_DATASYNC_REVISION_2 void | setupNameChanged (const QString &setupName, QPrivateSignal) |
NOTIFY accessor for AccountManager::setupName. | |
void | syncEnabledChanged (bool syncEnabled, QPrivateSignal) |
NOTIFY accessor for syncEnabled. | |
void | syncStateChanged (QtDataSync::SyncManager::SyncState syncState, QPrivateSignal) |
NOTIFY accessor for syncState. | |
void | syncProgressChanged (qreal syncProgress, QPrivateSignal) |
NOTIFY accessor for syncProgress. | |
void | lastErrorChanged (const QString &lastError, QPrivateSignal) |
NOTIFY accessor for lastError. | |
Public Member Functions | |
Q_INVOKABLE void | runOnDownloaded (const QJSValue &resultFn, bool triggerSync=true) |
Performs an operation once all changes have been downloaded. More... | |
Q_INVOKABLE void | runOnSynchronized (const QJSValue &resultFn, bool triggerSync=true) |
Performs an operation once all changes have been synchronized (both directions) More... | |
![]() | |
SyncManager (QObject *parent=nullptr) | |
Default constructor, uses the default setup. More... | |
SyncManager (const QString &setupName, QObject *parent=nullptr) | |
Constructor with an explicit setup. More... | |
SyncManager (QRemoteObjectNode *node, QObject *parent=nullptr) | |
Constructor with a remote object node to connect to. More... | |
Q_INVOKABLE QRemoteObjectReplica * | replica () const |
The internal replica used to connect to the engine. More... | |
QString | setupName () const |
READ accessor for AccountManager::setupName. | |
bool | isSyncEnabled () const |
READ accessor for syncEnabled. | |
SyncState | syncState () const |
READ accessor for syncState. | |
qreal | syncProgress () const |
READ accessor for syncProgress. | |
QString | lastError () const |
READ accessor for lastError. | |
void | runOnDownloaded (const std::function< void(SyncState)> &resultFn, bool triggerSync=true) |
Performs an operation once all changes have been downloaded. More... | |
void | runOnSynchronized (const std::function< void(SyncState)> &resultFn, bool triggerSync=true) |
Performs an operation once all changes have been synchronized (both directions) More... | |
![]() | |
virtual const QMetaObject * | metaObject () const const |
virtual void * | qt_metacast (const char *) |
virtual int | qt_metacall (QMetaObject::Call, int, void **) |
QObject (QObject *parent) | |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
QString | objectName () const const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
bool | signalsBlocked () const const |
bool | blockSignals (bool block) |
QThread * | thread () const const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
const QObjectList & | children () const const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
void | dumpObjectTree () const const |
void | dumpObjectInfo () const const |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const const |
QList< QByteArray > | dynamicPropertyNames () const const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
bool | inherits (const char *className) const const |
void | deleteLater () |
Properties | |
QString | setupName |
Holds the name of the setup this manager operates on. More... | |
QRemoteObjectNode | node |
Allows to directly set the remote object node to use. More... | |
bool | valid |
Specifies if the object was correctly initialized. More... | |
![]() | |
QString | setupName |
Holds the name of the setup this manager operates on. More... | |
bool | syncEnabled |
Specifies whether synchronization is currently enabled or disabled. More... | |
SyncState | syncState |
Holds the current synchronization state. More... | |
qreal | syncProgress |
Holds the progress of the current sync operation. More... | |
QString | lastError |
Holds a description of the last internal error. More... | |
![]() | |
objectName | |
Additional Inherited Members | |
![]() | |
enum | SyncState { Initializing, Downloading, Uploading, Synchronized, Error, Disconnected } |
The possible states the sync engine can be in. More... | |
![]() | |
void | setSyncEnabled (bool syncEnabled) |
WRITE accessor for syncEnabled. | |
void | synchronize () |
Triggers a synchronization. More... | |
void | reconnect () |
Tries to reconnect to the remote. More... | |
![]() | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
![]() | |
QObject * | sender () const const |
int | senderSignalIndex () const const |
int | receivers (const char *signal) const const |
bool | isSignalConnected (const QMetaMethod &signal) const const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
The QML binding of QtDataSync::SyncManager.
Definition at line 20 of file qqmlsyncmanager.h.
Q_INVOKABLE void de::skycoder42::QtDataSync::SyncManager::runOnDownloaded | ( | const QJSValue & | resultFn, |
bool | triggerSync = true |
||
) |
Performs an operation once all changes have been downloaded.
resultFn | The function to be called as soon as a target state is reached |
triggerSync | Trigger a synchronisation in case the engine is currently synchronized |
Semantics of the resultFn
:
This method behaves just like runOnSynchronized(), but with the one difference that the SyncManager::Uploading state will also trigger the callback (in both phases). This method can be used to only wait for all changes to be downloaded from the remote, instead of waiting for the uploads as well.
Q_INVOKABLE void de::skycoder42::QtDataSync::SyncManager::runOnSynchronized | ( | const QJSValue & | resultFn, |
bool | triggerSync = true |
||
) |
Performs an operation once all changes have been synchronized (both directions)
resultFn | The function to be called as soon as a target state is reached |
triggerSync | Trigger a synchronisation in case the engine is currently synchronized |
Semantics of the resultFn
:
This method will pass a callback to the engine that is called as soon as a "stable" state is reached. The logic is as follows:
If the engine is in the SyncManager::Error or SyncManager::Disconnected state, the callback is immediatly called. If it is SyncManager::Synchronized, and triggerSync
is false
, it will be called too. If it is true
a new synchronization is triggered and the method is not called yet. For all other states, nothing happens yet.
If the method was not directly called, the engine will instead call it as soon as one of the SyncManager::Synchronized, SyncManager::Error or SyncManager::Disconnected states is reached.
The state that triggerd the function to be called is the one that is passed to the callback.
|
readwrite |
Allows to directly set the remote object node to use.
Default: nullptr
Instead of a setup name, you can directly specify the remote object node via this property.
Accessors | |
---|---|
MEMBER | node |
NOTIFY | nodeChanged() |
Definition at line 64 of file qqmlsyncmanager.h.
|
readwrite |
Holds the name of the setup this manager operates on.
Default: QtDataSync::DefaultSetup
Allows you to specify the name of the setup that this manager should use
Accessors | |
---|---|
MEMBER | setupName |
NOTIFY | setupNameChanged() |
Definition at line 47 of file qqmlsyncmanager.h.
|
read |
Specifies if the object was correctly initialized.
Default: false
Only becomes true if the given setup name resolves to a valid datasync instance or if the given node is valid
Accessors | |
---|---|
MEMBER | valid |
NOTIFY | validChanged() |
READ ONLY |
Definition at line 80 of file qqmlsyncmanager.h.