citra-emu
/
citra
Archived
1
0
Fork 0

Per-Game Settings: options to reset game settings (#6219)

This commit is contained in:
Vitor K 2022-12-17 12:04:31 -03:00 committed by GitHub
parent cb82ffbe20
commit 812c4fa059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 1 deletions

View File

@ -141,10 +141,12 @@ void ConfigureGeneral::ResetDefaults() {
tr("Are you sure you want to <b>reset your settings</b> and close Citra?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (answer == QMessageBox::No)
if (answer == QMessageBox::No) {
return;
}
FileUtil::Delete(FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "qt-config.ini");
FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "custom");
std::exit(0);
}

View File

@ -3,6 +3,7 @@
#include <utility>
#include <vector>
#include <QMessageBox>
#include <QPushButton>
#include <QString>
#include <fmt/format.h>
@ -13,6 +14,7 @@
#include "citra_qt/configuration/configure_per_game.h"
#include "citra_qt/configuration/configure_system.h"
#include "citra_qt/util/util.h"
#include "common/file_util.h"
#include "core/core.h"
#include "core/loader/loader.h"
#include "core/loader/smdh.h"
@ -51,11 +53,30 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString
&ConfigurePerGame::HandleApplyButtonClicked);
}
connect(ui->button_reset_per_game, &QPushButton::clicked, this,
&ConfigurePerGame::ResetDefaults);
LoadConfiguration();
}
ConfigurePerGame::~ConfigurePerGame() = default;
void ConfigurePerGame::ResetDefaults() {
const auto config_file_name = title_id == 0 ? filename : fmt::format("{:016X}", title_id);
QMessageBox::StandardButton answer = QMessageBox::question(
this, tr("Citra"), tr("Are you sure you want to <b>reset your settings for this game</b>?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (answer == QMessageBox::No) {
return;
}
FileUtil::Delete(fmt::format("{}/custom/{}.ini",
FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir),
config_file_name));
close();
}
void ConfigurePerGame::ApplyConfiguration() {
general_tab->ApplyConfiguration();
system_tab->ApplyConfiguration();

View File

@ -43,6 +43,9 @@ public:
/// Save all button configurations to settings file
void ApplyConfiguration();
/// Reset the settings for this game
void ResetDefaults();
private:
void changeEvent(QEvent* event) override;
void RetranslateUI();

View File

@ -177,6 +177,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="button_reset_per_game">
<property name="text">
<string>Reset Game Settings</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>