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