aboutsummaryrefslogtreecommitdiff
path: root/launcher/DataMigrationTask.h
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/DataMigrationTask.h')
-rw-r--r--launcher/DataMigrationTask.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/launcher/DataMigrationTask.h b/launcher/DataMigrationTask.h
new file mode 100644
index 00000000..105a9493
--- /dev/null
+++ b/launcher/DataMigrationTask.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "FileSystem.h"
+#include "pathmatcher/IPathMatcher.h"
+#include "tasks/Task.h"
+
+#include <QFuture>
+#include <QFutureWatcher>
+
+/*
+ * Migrate existing data from other MMC-like launchers.
+ */
+
+class DataMigrationTask : public Task {
+ Q_OBJECT
+ public:
+ explicit DataMigrationTask(QObject* parent, const QString& sourcePath, const QString& targetPath, const IPathMatcher::Ptr pathmatcher);
+ ~DataMigrationTask() override = default;
+
+ protected:
+ virtual void executeTask() override;
+
+ protected slots:
+ void dryRunFinished();
+ void dryRunAborted();
+ void copyFinished();
+ void copyAborted();
+
+ private:
+ const QString& m_sourcePath;
+ const QString& m_targetPath;
+ const IPathMatcher::Ptr m_pathMatcher;
+
+ FS::copy m_copy;
+ int m_toCopy = 0;
+ QFuture<bool> m_copyFuture;
+ QFutureWatcher<bool> m_copyFutureWatcher;
+};