QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
Signals | Public Member Functions | Properties | List of all members
de::skycoder42::QtDataSync::SyncManager Class Reference

The QML binding of QtDataSync::SyncManager. More...

#include <qqmlsyncmanager.h>

+ Inheritance diagram for de::skycoder42::QtDataSync::SyncManager:

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.
 
- Signals inherited from QtDataSync::SyncManager
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...
 
- Public Member Functions inherited from QtDataSync::SyncManager
 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 QRemoteObjectReplicareplica () 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...
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () 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)
 
QThreadthread () 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)
 
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 &regExp, 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< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () 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...
 
- Properties inherited from QtDataSync::SyncManager
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...
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Types inherited from QtDataSync::SyncManager
enum  SyncState {
  Initializing, Downloading, Uploading, Synchronized,
  Error, Disconnected
}
 The possible states the sync engine can be in. More...
 
- Public Slots inherited from QtDataSync::SyncManager
void setSyncEnabled (bool syncEnabled)
 WRITE accessor for syncEnabled.
 
void synchronize ()
 Triggers a synchronization. More...
 
void reconnect ()
 Tries to reconnect to the remote. More...
 
- Static Public Member Functions inherited from QObject
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)
 
- Protected Member Functions inherited from QObject
QObjectsender () 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)
 

Detailed Description

The QML binding of QtDataSync::SyncManager.

Since
4.0
See also
QtDataSync::SyncManager

Definition at line 20 of file qqmlsyncmanager.h.

Member Function Documentation

◆ runOnDownloaded()

Q_INVOKABLE void de::skycoder42::QtDataSync::SyncManager::runOnDownloaded ( const QJSValue resultFn,
bool  triggerSync = true 
)

Performs an operation once all changes have been downloaded.

Parameters
resultFnThe function to be called as soon as a target state is reached
triggerSyncTrigger a synchronisation in case the engine is currently synchronized

Semantics of the resultFn:

  • Parameter 1: The state reached that triggered this callback

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.

See also
SyncManager::runOnSynchronized

◆ runOnSynchronized()

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)

Parameters
resultFnThe function to be called as soon as a target state is reached
triggerSyncTrigger a synchronisation in case the engine is currently synchronized

Semantics of the resultFn:

  • Parameter 1: The state reached that triggered this callback

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.

See also
SyncManager::runOnDownloaded

Property Documentation

◆ node

QRemoteObjectNode de::skycoder42::QtDataSync::SyncManager::node
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.

Warning
This property must only ever be set on construction of the object and must not be changed afterwards. Do not set both, this property and setupName
Accessors
MEMBERnode
NOTIFYnodeChanged()
See also
SyncManager::setupName, SyncManager::valid

Definition at line 64 of file qqmlsyncmanager.h.

◆ setupName

QString de::skycoder42::QtDataSync::SyncManager::setupName
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

Warning
This property must only ever be set on construction of the object and must not be changed afterwards. Do not set both, this property and node
Accessors
MEMBERsetupName
NOTIFYsetupNameChanged()
See also
QtDataSync::SyncManager::setupName, SyncManager::node, SyncManager::valid

Definition at line 47 of file qqmlsyncmanager.h.

◆ valid

bool de::skycoder42::QtDataSync::SyncManager::valid
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
MEMBERvalid
NOTIFYvalidChanged()
READ ONLY
See also
SyncManager::setupName, SyncManager::node

Definition at line 80 of file qqmlsyncmanager.h.


The documentation for this class was generated from the following file: