diff options
-rw-r--r-- | src/yuzu/configuration/config.cpp | 6 | ||||
-rw-r--r-- | src/yuzu/configuration/config.h | 1 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_general.cpp | 14 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_general.h | 1 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_general.ui | 7 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 4 |
6 files changed, 33 insertions, 0 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index eb58bfa5b..0ea508acd 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -1632,6 +1632,12 @@ void Config::Save() { SaveValues(); } +void Config::ResetDefaults() { + FS::Delete(qt_config_loc); + FS::CreateFullPath(qt_config_loc); + Reload(); +} + void Config::ReadControlPlayerValue(std::size_t player_index) { qt_config->beginGroup(QStringLiteral("Controls")); ReadPlayerValue(player_index); diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index ce3355588..cd68d7b4d 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h @@ -28,6 +28,7 @@ public: void Reload(); void Save(); + void ResetDefaults(); void ReadControlPlayerValue(std::size_t player_index); void SaveControlPlayerValue(std::size_t player_index); diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 55a6a37bd..a107cd3e1 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -4,11 +4,13 @@ #include <QCheckBox> #include <QSpinBox> +#include <QMessageBox> #include "common/settings.h" #include "core/core.h" #include "ui_configure_general.h" #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_general.h" +#include "yuzu/configuration/config.h" #include "yuzu/uisettings.h" ConfigureGeneral::ConfigureGeneral(QWidget* parent) @@ -23,6 +25,9 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); }); } + + connect(ui->button_reset_defaults, &QPushButton::clicked, this, + &ConfigureGeneral::ResetDefaults); } ConfigureGeneral::~ConfigureGeneral() = default; @@ -49,6 +54,15 @@ void ConfigureGeneral::SetConfiguration() { } } +void ConfigureGeneral::ResetDefaults() { + QMessageBox::StandardButton answer = QMessageBox::question( + this, tr("yuzu"), tr("Are you sure you want to <b>reset your settings</b>?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + if (answer == QMessageBox::No) + return; + UISettings::values. +} + void ConfigureGeneral::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, ui->use_multi_core, use_multi_core); diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index 323ffbd8f..3d8a1dae0 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h @@ -24,6 +24,7 @@ public: explicit ConfigureGeneral(QWidget* parent = nullptr); ~ConfigureGeneral() override; + void ResetDefaults(); void ApplyConfiguration(); private: diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index 2711116a2..ae8ed5ca5 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui @@ -91,6 +91,13 @@ </layout> </widget> </item> + <item alignment="Qt::AlignRight"> + <widget class="QPushButton" name="button_reset_defaults"> + <property name="text"> + <string>Reset All Settings</string> + </property> + </widget> + </item> <item> <spacer name="verticalSpacer"> <property name="orientation"> diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 0f0e228b0..838bb6926 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2593,7 +2593,11 @@ void GMainWindow::OnConfigure() { configure_dialog.ApplyConfiguration(); controller_dialog->refreshConfiguration(); } + + configure_dialog.ApplyConfiguration(); + controller_dialog->refreshConfiguration(); InitializeHotkeys(); + if (UISettings::values.theme != old_theme) { UpdateUITheme(); } |