Files
eden/src/yuzu/migration_worker.h
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
1.9 KiB
C++
Raw Normal View History

2025-06-27 06:03:19 +00:00
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
2025-05-11 23:58:25 +00:00
#ifndef MIGRATION_WORKER_H
#define MIGRATION_WORKER_H
#include <QObject>
#include "common/fs/path_util.h"
using namespace Common::FS;
typedef struct Emulator {
2025-10-18 22:19:06 +02:00
const char *m_name;
2025-10-28 03:46:47 +01:00
EmuPath e_user_dir;
EmuPath e_config_dir;
EmuPath e_cache_dir;
const std::string get_user_dir() const {
return Common::FS::GetLegacyPath(e_user_dir).string();
}
const std::string get_config_dir() const {
return Common::FS::GetLegacyPath(e_config_dir).string();
}
const std::string get_cache_dir() const {
return Common::FS::GetLegacyPath(e_cache_dir).string();
}
2025-10-18 22:19:06 +02:00
const QString name() const { return QObject::tr(m_name);
}
2025-10-18 22:19:06 +02:00
const QString lower_name() const { return name().toLower();
}
} Emulator;
static constexpr std::array<Emulator, 4> legacy_emus = {
2025-10-18 22:19:06 +02:00
Emulator{QT_TR_NOOP("Citron"), CitronDir, CitronConfigDir, CitronCacheDir},
Emulator{QT_TR_NOOP("Sudachi"), SudachiDir, SudachiConfigDir, SudachiCacheDir},
Emulator{QT_TR_NOOP("Suyu"), SuyuDir, SuyuConfigDir, SuyuCacheDir},
Emulator{QT_TR_NOOP("Yuzu"), YuzuDir, YuzuConfigDir, YuzuCacheDir},
};
2025-05-11 23:58:25 +00:00
class MigrationWorker : public QObject
{
Q_OBJECT
public:
enum class MigrationStrategy {
Copy,
Move,
Link,
};
MigrationWorker(const Emulator selected_legacy_emu,
2025-05-11 23:58:25 +00:00
const bool clear_shader_cache,
const MigrationStrategy strategy);
public slots:
void process();
signals:
void finished(const QString &success_text, const std::string &user_dir);
2025-05-11 23:58:25 +00:00
void error(const QString &error_message);
private:
Emulator selected_legacy_emu;
2025-05-11 23:58:25 +00:00
bool clear_shader_cache;
MigrationStrategy strategy;
QString success_text = tr("Data was migrated successfully.");
};
#endif // MIGRATION_WORKER_H