QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
migrationhelper.h
1 #ifndef QTDATASYNC_MIGRATIONHELPER_H
2 #define QTDATASYNC_MIGRATIONHELPER_H
3 
4 #include <QtCore/qobject.h>
5 #include <QtCore/qscopedpointer.h>
6 
7 #include "QtDataSync/qtdatasync_global.h"
8 
9 namespace QtDataSync {
10 
11 class MigrationHelperPrivate;
13 class Q_DATASYNC_EXPORT MigrationHelper : public QObject //MAJOR remove
14 {
15  Q_OBJECT
16 
17 public:
20  MigrateData = 0x01,
21  MigrateChanged = (0x02 | MigrateData),
22  MigrateRemoteConfig = 0x04,
23 
24  MigrateWithCleanup = 0x08,
25  MigrateOverwriteConfig = 0x10,
26  MigrateOverwriteData = 0x20,
27 
28  MigrateDefault = (MigrateData | MigrateRemoteConfig | MigrateWithCleanup)
29  };
30  Q_DECLARE_FLAGS(MigrationFlags, MigrationFlag)
31  Q_FLAG(MigrationFlags)
32 
33 
34  static const QString DefaultOldStorageDir;
35 
37  explicit MigrationHelper(QObject *parent = nullptr);
39  explicit MigrationHelper(const QString &setupName, QObject *parent = nullptr);
40  ~MigrationHelper() override;
41 
42 public Q_SLOTS:
44  void startMigration(const QString &storageDir = DefaultOldStorageDir, MigrationFlags flags = MigrateDefault);
45 
46 Q_SIGNALS:
48  void migrationPrepared(int operations);
50  void migrationProgress(int current);
52  void migrationDone(bool ok);
53 
54 private:
55  QScopedPointer<MigrationHelperPrivate> d;
56 };
57 
58 }
59 
60 Q_DECLARE_OPERATORS_FOR_FLAGS(QtDataSync::MigrationHelper::MigrationFlags)
61 
62 #endif // QTDATASYNC_MIGRATIONHELPER_H
A helper class to migrate data from DataSync 3.0 to this version.
The primary namespace of the QtDataSync library.
MigrationFlag
Flags to configure what and how should be migrated.