2022-10-25 01:20:35 +05:30
|
|
|
// SPDX-FileCopyrightText: 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
2022-10-23 05:15:32 +05:30
|
|
|
#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;
|
|
|
|
};
|