QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
Public Types | Public Slots | Signals | Public Member Functions | Static Public Attributes | List of all members
QtDataSync::MigrationHelper Class Reference

A helper class to migrate data from DataSync 3.0 to this version. More...

#include <migrationhelper.h>

+ Inheritance diagram for QtDataSync::MigrationHelper:

Public Types

enum  MigrationFlag {
  MigrateData = 0x01, MigrateChanged = (0x02 | MigrateData), MigrateRemoteConfig = 0x04, MigrateWithCleanup = 0x08,
  MigrateOverwriteConfig = 0x10, MigrateOverwriteData = 0x20, MigrateDefault = (MigrateData | MigrateRemoteConfig | MigrateWithCleanup)
}
 Flags to configure what and how should be migrated. More...
 

Public Slots

void startMigration (const QString &storageDir=DefaultOldStorageDir, MigrationFlags flags=MigrateDefault)
 Start the migration process from the given directory with flags. More...
 

Signals

void migrationPrepared (int operations)
 Is emitted when the number of migrate operations has been determined.
 
void migrationProgress (int current)
 Is emitted for every successful migration step done to give a progress.
 
void migrationDone (bool ok)
 Is emitted when the migration has been finished.
 

Public Member Functions

 MigrationHelper (QObject *parent=nullptr)
 Default constructor, uses the default setup. More...
 
 MigrationHelper (const QString &setupName, QObject *parent=nullptr)
 Constructor with an explicit setup. 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 ()
 

Static Public Attributes

static const QString DefaultOldStorageDir
 The previous default path where data was stored.
 

Additional Inherited Members

- 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)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

A helper class to migrate data from DataSync 3.0 to this version.

If you used QtDataSync below version 4 before, you will have to use this class to migrate the data from that old datasync to the current new one, as they are not compatible. This is what this class is used for.

The migration is performed asynchronously once started and cannot be stopped. To start a migration, use startMigration().

See also
MigrationHelper::startMigration, MigrationHelper::migrationDone

Definition at line 13 of file migrationhelper.h.

Member Enumeration Documentation

◆ MigrationFlag

Flags to configure what and how should be migrated.

Enumerator
MigrateData 

Migrate actual stored data.

MigrateChanged 

Migrate the changed state of that data.

MigrateRemoteConfig 

Migrate the connection configuration.

MigrateWithCleanup 

Remove all old data after a successful migration.

MigrateOverwriteConfig 

Overwrite existing configurations with the migrated remote config.

MigrateOverwriteData 

Overwrite existing data with the migrated data.

MigrateDefault 

The default flags when leaving out the parameter.

Definition at line 19 of file migrationhelper.h.

Constructor & Destructor Documentation

◆ MigrationHelper() [1/2]

QtDataSync::MigrationHelper::MigrationHelper ( QObject parent = nullptr)
explicit

Default constructor, uses the default setup.

Parameters
parentThe parent object
Exceptions
SetupDoesNotExistExceptionThrown if the default setup was not created yet

◆ MigrationHelper() [2/2]

QtDataSync::MigrationHelper::MigrationHelper ( const QString setupName,
QObject parent = nullptr 
)
explicit

Constructor with an explicit setup.

Parameters
setupNameThe name of the setup to connect to
parentThe parent object
Exceptions
SetupDoesNotExistExceptionThrown if the given setup was not created yet

Member Function Documentation

◆ startMigration

QtDataSync::MigrationHelper::startMigration ( const QString storageDir = DefaultOldStorageDir,
MigrationFlags  flags = MigrateDefault 
)
slot

Start the migration process from the given directory with flags.

Parameters
storageDirThe old datasync directory to import the data from
flagsFlags to configure what and how to migrate the data

The storageDir must be the directory that the old datasync used as storage directory. If you did not change it, the DefaultOldStorageDir constant can be used, as it points to the previous default datasync storage dir.

Migration is performed asynchronously with the status beeing reported via the signals. Errors, warnings and other stuff is logged as usual. Use the qtdatasync.<setupName>.migration logging category to filter for it.

See also
MigrationHelper::MigrationFlag, MigrationHelper::DefaultOldStorageDir, MigrationHelper::migrationDone, MigrationHelper::migrationPrepared, MigrationHelper::migrationProgress,

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