configuration: Initial work to reset all settings

This commit does not compile.

Initial work to add and connect a Reset to Defaults button to the
configure_general tab.

Co-authored-by: german77 <juangerman-13@hotmail.com>
This commit is contained in:
fearlessTobi 2021-05-25 20:48:02 -04:00 committed by lat9nq
parent 65b389da70
commit 8aeb425669
6 changed files with 33 additions and 0 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -24,6 +24,7 @@ public:
explicit ConfigureGeneral(QWidget* parent = nullptr);
~ConfigureGeneral() override;
void ResetDefaults();
void ApplyConfiguration();
private:

View file

@ -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">

View file

@ -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();
}