mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 22:30:14 +00:00
Only write settings to disk once in config dialog
This commit is contained in:
parent
5ea3c9b0aa
commit
36aaaafc26
@ -53,7 +53,7 @@ void ConfigureAudio::setConfiguration() {
|
||||
ui->audio_device_combo_box->setCurrentIndex(new_device_index);
|
||||
}
|
||||
|
||||
void ConfigureAudio::applyConfiguration() {
|
||||
void ConfigureAudio::applyConfiguration(bool commit_settings_file) {
|
||||
Settings::values.sink_id =
|
||||
ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex())
|
||||
.toStdString();
|
||||
@ -61,7 +61,9 @@ void ConfigureAudio::applyConfiguration() {
|
||||
Settings::values.audio_device_id =
|
||||
ui->audio_device_combo_box->itemText(ui->audio_device_combo_box->currentIndex())
|
||||
.toStdString();
|
||||
Settings::Apply();
|
||||
if (commit_settings_file) {
|
||||
Settings::Apply();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureAudio::updateAudioDevices(int sink_index) {
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
explicit ConfigureAudio(QWidget* parent = nullptr);
|
||||
~ConfigureAudio();
|
||||
|
||||
void applyConfiguration();
|
||||
void applyConfiguration(bool commit_settings_file = true);
|
||||
|
||||
public slots:
|
||||
void updateAudioDevices(int sink_index);
|
||||
|
@ -19,8 +19,10 @@ void ConfigureDebug::setConfiguration() {
|
||||
ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port);
|
||||
}
|
||||
|
||||
void ConfigureDebug::applyConfiguration() {
|
||||
void ConfigureDebug::applyConfiguration(bool commit_settings_file) {
|
||||
Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked();
|
||||
Settings::values.gdbstub_port = ui->gdbport_spinbox->value();
|
||||
Settings::Apply();
|
||||
if (commit_settings_file) {
|
||||
Settings::Apply();
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
explicit ConfigureDebug(QWidget* parent = nullptr);
|
||||
~ConfigureDebug();
|
||||
|
||||
void applyConfiguration();
|
||||
void applyConfiguration(bool commit_settings_file = true);
|
||||
|
||||
private:
|
||||
void setConfiguration();
|
||||
|
@ -17,11 +17,15 @@ ConfigureDialog::~ConfigureDialog() {}
|
||||
void ConfigureDialog::setConfiguration() {}
|
||||
|
||||
void ConfigureDialog::applyConfiguration() {
|
||||
ui->generalTab->applyConfiguration();
|
||||
ui->systemTab->applyConfiguration();
|
||||
ui->inputTab->applyConfiguration();
|
||||
ui->graphicsTab->applyConfiguration();
|
||||
ui->audioTab->applyConfiguration();
|
||||
ui->debugTab->applyConfiguration();
|
||||
// apply each, but don't commit the ini file (and trigger
|
||||
// associated changes) until the end
|
||||
ui->generalTab->applyConfiguration(false);
|
||||
ui->inputTab->applyConfiguration(false);
|
||||
ui->graphicsTab->applyConfiguration(false);
|
||||
ui->audioTab->applyConfiguration(false);
|
||||
ui->debugTab->applyConfiguration(false);
|
||||
|
||||
Settings::Apply();
|
||||
// system settings doesn't actually put settings in the ini file
|
||||
ui->systemTab->applyConfiguration();
|
||||
}
|
||||
|
@ -28,10 +28,12 @@ void ConfigureGeneral::setConfiguration() {
|
||||
ui->region_combobox->setCurrentIndex(Settings::values.region_value + 1);
|
||||
}
|
||||
|
||||
void ConfigureGeneral::applyConfiguration() {
|
||||
void ConfigureGeneral::applyConfiguration(bool commit_settings_file) {
|
||||
UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked();
|
||||
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
|
||||
Settings::values.region_value = ui->region_combobox->currentIndex() - 1;
|
||||
Settings::values.use_cpu_jit = ui->toggle_cpu_jit->isChecked();
|
||||
Settings::Apply();
|
||||
if (commit_settings_file) {
|
||||
Settings::Apply();
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
explicit ConfigureGeneral(QWidget* parent = nullptr);
|
||||
~ConfigureGeneral();
|
||||
|
||||
void applyConfiguration();
|
||||
void applyConfiguration(bool commit_settings_file = true);
|
||||
|
||||
private:
|
||||
void setConfiguration();
|
||||
|
@ -101,7 +101,7 @@ void ConfigureGraphics::setConfiguration() {
|
||||
ui->swap_screen->setChecked(Settings::values.swap_screen);
|
||||
}
|
||||
|
||||
void ConfigureGraphics::applyConfiguration() {
|
||||
void ConfigureGraphics::applyConfiguration(bool commit_settings_file) {
|
||||
Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked();
|
||||
Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked();
|
||||
Settings::values.resolution_factor =
|
||||
@ -111,5 +111,7 @@ void ConfigureGraphics::applyConfiguration() {
|
||||
Settings::values.layout_option =
|
||||
static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
|
||||
Settings::values.swap_screen = ui->swap_screen->isChecked();
|
||||
Settings::Apply();
|
||||
if (commit_settings_file) {
|
||||
Settings::Apply();
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
explicit ConfigureGraphics(QWidget* parent = nullptr);
|
||||
~ConfigureGraphics();
|
||||
|
||||
void applyConfiguration();
|
||||
void applyConfiguration(bool commit = true);
|
||||
|
||||
private:
|
||||
void setConfiguration();
|
||||
|
@ -112,13 +112,15 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
||||
ui->buttonCStickRight->setEnabled(false);
|
||||
}
|
||||
|
||||
void ConfigureInput::applyConfiguration() {
|
||||
void ConfigureInput::applyConfiguration(bool commit_settings_file) {
|
||||
std::transform(buttons_param.begin(), buttons_param.end(), Settings::values.buttons.begin(),
|
||||
[](const Common::ParamPackage& param) { return param.Serialize(); });
|
||||
std::transform(analogs_param.begin(), analogs_param.end(), Settings::values.analogs.begin(),
|
||||
[](const Common::ParamPackage& param) { return param.Serialize(); });
|
||||
|
||||
Settings::Apply();
|
||||
if (commit_settings_file) {
|
||||
Settings::Apply();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureInput::loadConfiguration() {
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
explicit ConfigureInput(QWidget* parent = nullptr);
|
||||
|
||||
/// Save all button configurations to settings file
|
||||
void applyConfiguration();
|
||||
void applyConfiguration(bool commit_settings_file = true);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::ConfigureInput> ui;
|
||||
|
Loading…
Reference in New Issue
Block a user