GamePropertiesDialog: Unlock the CPU OC slider only when the option is checked

This commit is contained in:
Silent 2021-09-10 18:28:09 +02:00
parent e12474ac91
commit 9d537ba03c
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
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();
}