diff options
author | lat9nq <lat9nq@virginia.edu> | 2020-07-13 23:08:50 +0200 |
---|---|---|
committer | lat9nq <lat9nq@virginia.edu> | 2020-07-19 19:26:55 +0200 |
commit | 58672cc7b6ee58209a802e030f2a427e579ca415 (patch) | |
tree | 720235a8890def2b4c28ba4d389ddc9e19b8ad11 | |
parent | configuration_shared: Initial functions and data for manual tristate (diff) | |
download | yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.tar yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.tar.gz yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.tar.bz2 yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.tar.lz yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.tar.xz yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.tar.zst yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.zip |
-rw-r--r-- | src/yuzu/configuration/configuration_shared.h | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_general.cpp | 42 |
2 files changed, 27 insertions, 17 deletions
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 1163604bf..4f0166fae 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -23,6 +23,8 @@ enum CheckState { }; struct Trackers { + CheckState use_frame_limit; + CheckState use_multi_core; } extern trackers; // Global-aware apply and set functions diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 20316c9cc..e3ddbc294 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -19,9 +19,10 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) SetConfiguration(); - connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit, [this]() { - ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked); - }); + if (Settings::configuring_global) { + connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, + [this]() { ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); }); + } } ConfigureGeneral::~ConfigureGeneral() = default; @@ -40,17 +41,13 @@ void ConfigureGeneral::SetConfiguration() { ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); - if (!Settings::configuring_global) { - if (Settings::values.use_multi_core.UsingGlobal()) { - ui->use_multi_core->setCheckState(Qt::PartiallyChecked); - } - if (Settings::values.use_frame_limit.UsingGlobal()) { - ui->toggle_frame_limit->setCheckState(Qt::PartiallyChecked); - } + if (Settings::configuring_global) { + ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue()); + } else { + ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue() && + ConfigurationShared::trackers.use_frame_limit != + ConfigurationShared::CheckState::Global); } - - ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked && - ui->toggle_frame_limit->isEnabled()); } void ConfigureGeneral::ApplyConfiguration() { @@ -71,9 +68,11 @@ void ConfigureGeneral::ApplyConfiguration() { } } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, - ui->use_multi_core); + ui->use_multi_core, + ConfigurationShared::trackers.use_multi_core); - bool global_frame_limit = ui->toggle_frame_limit->checkState() == Qt::PartiallyChecked; + bool global_frame_limit = ConfigurationShared::trackers.use_frame_limit == + ConfigurationShared::CheckState::Global; Settings::values.use_frame_limit.SetGlobal(global_frame_limit); Settings::values.frame_limit.SetGlobal(global_frame_limit); if (!global_frame_limit) { @@ -109,6 +108,15 @@ void ConfigureGeneral::SetupPerGameUI() { ui->toggle_background_pause->setVisible(false); ui->toggle_hide_mouse->setVisible(false); - ui->toggle_frame_limit->setTristate(true); - ui->use_multi_core->setTristate(true); + ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, + Settings::values.use_frame_limit, + ConfigurationShared::trackers.use_frame_limit); + ConfigurationShared::SetColoredTristate(ui->use_multi_core, Settings::values.use_multi_core, + ConfigurationShared::trackers.use_multi_core); + + connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { + ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked() && + (ConfigurationShared::trackers.use_frame_limit != + ConfigurationShared::CheckState::Global)); + }); } |