qt: Check for migration before qt-config.ini is created

This commit is contained in:
OpenSauce04 2025-03-07 14:16:11 +00:00 committed by OpenSauce
parent 6cc98148db
commit cee3c8ad31
2 changed files with 11 additions and 7 deletions

View File

@ -167,6 +167,8 @@ void GMainWindow::ShowCommandOutput(std::string title, std::string message) {
GMainWindow::GMainWindow(Core::System& system_)
: ui{std::make_unique<Ui::MainWindow>()}, system{system_}, movie{system.Movie()},
emu_dir_exists{
std::filesystem::is_directory(FileUtil::GetUserPath(FileUtil::UserPath::UserDir))},
config{std::make_unique<QtConfig>()}, emu_thread{nullptr} {
Common::Log::Initialize();
Common::Log::Start();
@ -308,7 +310,9 @@ GMainWindow::GMainWindow(Core::System& system_)
}
// Check if data migration from Citra/Lime3DS needs to be performed
CheckForMigration();
if (!emu_dir_exists) {
ShowMigrationPrompt();
}
#ifdef __unix__
SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue());
@ -1218,13 +1222,9 @@ void GMainWindow::ShowMigrationCancelledMessage() {
QMessageBox::Ok);
}
void GMainWindow::CheckForMigration() {
void GMainWindow::ShowMigrationPrompt() {
namespace fs = std::filesystem;
if (fs::is_directory(FileUtil::GetUserPath(FileUtil::UserPath::UserDir))) {
return;
}
const QString migration_prompt_message =
tr("Would you like to migrate your data for use in Azahar?\n"
"(This may take a while; The old data will not be deleted)");

View File

@ -178,7 +178,7 @@ private:
Lime3DS,
};
void ShowMigrationCancelledMessage();
void CheckForMigration();
void ShowMigrationPrompt();
void MigrateUserData(const LegacyEmu selected_legacy_emu);
/**
@ -357,6 +357,10 @@ private:
bool message_label_used_for_movie = false;
MultiplayerState* multiplayer_state = nullptr;
// Created before `config` to ensure that emu data directory
// isn't created before the check is performed
bool emu_dir_exists;
std::unique_ptr<QtConfig> config;
// Whether emulation is currently running in Citra.