Merge pull request #2602 from CookiePLMonster/gamesettings-oc-tick

GamePropertiesDialog: Unlock the CPU OC slider only when the option is
This commit is contained in:
Connor McLaughlin 2021-09-15 12:23:53 +10:00 committed by GitHub
commit 8a5c8bc410
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -311,7 +311,7 @@ void GamePropertiesDialog::populateGameSettings()
populateBooleanUserSetting(m_ui.userEnableCPUClockSpeedControl, gs.cpu_overclock_enable);
populateBooleanUserSetting(m_ui.userEnable8MBRAM, gs.enable_8mb_ram);
m_ui.userCPUClockSpeed->setEnabled(m_ui.userEnableCPUClockSpeedControl->checkState() != Qt::Unchecked);
m_ui.userCPUClockSpeed->setEnabled(m_ui.userEnableCPUClockSpeedControl->checkState() == Qt::Checked);
updateCPUClockSpeedLabel();
if (gs.cdrom_read_speedup.has_value())
@ -858,14 +858,14 @@ void GamePropertiesDialog::connectUi()
void GamePropertiesDialog::updateCPUClockSpeedLabel()
{
const int percent =
m_ui.userEnableCPUClockSpeedControl->checkState() != Qt::Unchecked ? m_ui.userCPUClockSpeed->value() : 100;
m_ui.userEnableCPUClockSpeedControl->checkState() == Qt::Checked ? m_ui.userCPUClockSpeed->value() : 100;
const double frequency = (static_cast<double>(System::MASTER_CLOCK) * static_cast<double>(percent)) / 100.0;
m_ui.userCPUClockSpeedLabel->setText(tr("%1% (%2MHz)").arg(percent).arg(frequency / 1000000.0, 0, 'f', 2));
}
void GamePropertiesDialog::onEnableCPUClockSpeedControlChecked(int state)
{
m_ui.userCPUClockSpeed->setEnabled(state != Qt::Unchecked);
m_ui.userCPUClockSpeed->setEnabled(state == Qt::Checked);
updateCPUClockSpeedLabel();
}