diff options
| author | 2020-07-13 17:08:50 -0400 | |
|---|---|---|
| committer | 2020-07-19 13:26:55 -0400 | |
| commit | 58672cc7b6ee58209a802e030f2a427e579ca415 (patch) | |
| tree | 720235a8890def2b4c28ba4d389ddc9e19b8ad11 /src | |
| parent | configuration_shared: Initial functions and data for manual tristate (diff) | |
| download | yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.tar.gz yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.tar.xz yuzu-58672cc7b6ee58209a802e030f2a427e579ca415.zip | |
configure_general: Implement manual tristate buttons
Diffstat (limited to 'src')
| -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 { | |||
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | struct Trackers { | 25 | struct Trackers { |
| 26 | CheckState use_frame_limit; | ||
| 27 | CheckState use_multi_core; | ||
| 26 | } extern trackers; | 28 | } extern trackers; |
| 27 | 29 | ||
| 28 | // Global-aware apply and set functions | 30 | // 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) | |||
| 19 | 19 | ||
| 20 | SetConfiguration(); | 20 | SetConfiguration(); |
| 21 | 21 | ||
| 22 | connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit, [this]() { | 22 | if (Settings::configuring_global) { |
| 23 | ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked); | 23 | connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, |
| 24 | }); | 24 | [this]() { ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); }); |
| 25 | } | ||
| 25 | } | 26 | } |
| 26 | 27 | ||
| 27 | ConfigureGeneral::~ConfigureGeneral() = default; | 28 | ConfigureGeneral::~ConfigureGeneral() = default; |
| @@ -40,17 +41,13 @@ void ConfigureGeneral::SetConfiguration() { | |||
| 40 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); | 41 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); |
| 41 | ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); | 42 | ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); |
| 42 | 43 | ||
| 43 | if (!Settings::configuring_global) { | 44 | if (Settings::configuring_global) { |
| 44 | if (Settings::values.use_multi_core.UsingGlobal()) { | 45 | ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue()); |
| 45 | ui->use_multi_core->setCheckState(Qt::PartiallyChecked); | 46 | } else { |
| 46 | } | 47 | ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue() && |
| 47 | if (Settings::values.use_frame_limit.UsingGlobal()) { | 48 | ConfigurationShared::trackers.use_frame_limit != |
| 48 | ui->toggle_frame_limit->setCheckState(Qt::PartiallyChecked); | 49 | ConfigurationShared::CheckState::Global); |
| 49 | } | ||
| 50 | } | 50 | } |
| 51 | |||
| 52 | ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked && | ||
| 53 | ui->toggle_frame_limit->isEnabled()); | ||
| 54 | } | 51 | } |
| 55 | 52 | ||
| 56 | void ConfigureGeneral::ApplyConfiguration() { | 53 | void ConfigureGeneral::ApplyConfiguration() { |
| @@ -71,9 +68,11 @@ void ConfigureGeneral::ApplyConfiguration() { | |||
| 71 | } | 68 | } |
| 72 | } else { | 69 | } else { |
| 73 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, | 70 | ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, |
| 74 | ui->use_multi_core); | 71 | ui->use_multi_core, |
| 72 | ConfigurationShared::trackers.use_multi_core); | ||
| 75 | 73 | ||
| 76 | bool global_frame_limit = ui->toggle_frame_limit->checkState() == Qt::PartiallyChecked; | 74 | bool global_frame_limit = ConfigurationShared::trackers.use_frame_limit == |
| 75 | ConfigurationShared::CheckState::Global; | ||
| 77 | Settings::values.use_frame_limit.SetGlobal(global_frame_limit); | 76 | Settings::values.use_frame_limit.SetGlobal(global_frame_limit); |
| 78 | Settings::values.frame_limit.SetGlobal(global_frame_limit); | 77 | Settings::values.frame_limit.SetGlobal(global_frame_limit); |
| 79 | if (!global_frame_limit) { | 78 | if (!global_frame_limit) { |
| @@ -109,6 +108,15 @@ void ConfigureGeneral::SetupPerGameUI() { | |||
| 109 | ui->toggle_background_pause->setVisible(false); | 108 | ui->toggle_background_pause->setVisible(false); |
| 110 | ui->toggle_hide_mouse->setVisible(false); | 109 | ui->toggle_hide_mouse->setVisible(false); |
| 111 | 110 | ||
| 112 | ui->toggle_frame_limit->setTristate(true); | 111 | ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, |
| 113 | ui->use_multi_core->setTristate(true); | 112 | Settings::values.use_frame_limit, |
| 113 | ConfigurationShared::trackers.use_frame_limit); | ||
| 114 | ConfigurationShared::SetColoredTristate(ui->use_multi_core, Settings::values.use_multi_core, | ||
| 115 | ConfigurationShared::trackers.use_multi_core); | ||
| 116 | |||
| 117 | connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { | ||
| 118 | ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked() && | ||
| 119 | (ConfigurationShared::trackers.use_frame_limit != | ||
| 120 | ConfigurationShared::CheckState::Global)); | ||
| 121 | }); | ||
| 114 | } | 122 | } |