mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-26 17:02:47 +00:00
Per-Game Settings: options to reset game settings (#6219)
This commit is contained in:
parent
cb82ffbe20
commit
812c4fa059
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue