From 662772c2fc8ec598a64cc4cabe13a86f1e83fb2e Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Wed, 19 Dec 2018 11:19:03 -0600 Subject: Optionally delete and restore profile-specific game INI files when changing the setting --- src/profile.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/profile.cpp') diff --git a/src/profile.cpp b/src/profile.cpp index e2274346..536dfd98 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -773,6 +773,27 @@ bool Profile::localSettingsEnabled() const bool Profile::enableLocalSettings(bool enable) { + if (enable) { + m_GamePlugin->initializeProfile(m_Directory.absolutePath(), IPluginGame::CONFIGURATION); + } else { + QMessageBox::StandardButton res = QMessageBox::question( + QApplication::activeModalWidget(), tr("Delete profile-specific game INI files?"), + tr("Do you want to delete profile-specific game INI files? (If you select \"No\", the " + "save games will be used again if you re-enable profile-specific game INI files.)"), + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, + QMessageBox::Cancel); + if (res == QMessageBox::Yes) { + QStringList filesToDelete; + for (QString file : m_GamePlugin->iniFiles()) { + filesToDelete << m_Directory.absoluteFilePath(file); + } + shellDelete(filesToDelete, true); + } else if (res == QMessageBox::No) { + // No action + } else { + return false; + } + } storeSetting("LocalSettings", enable); return true; } -- cgit v1.3.1