Qt: Move emulation speed settings to console settings

This commit is contained in:
Connor McLaughlin
2021-01-11 02:12:20 +10:00
parent 54f5563321
commit fdeef65676
6 changed files with 173 additions and 177 deletions

View File

@ -38,29 +38,6 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
m_host_interface, m_ui.controllerBackend, "Main", "ControllerBackend", &ControllerInterface::ParseBackendName,
&ControllerInterface::GetBackendName, ControllerInterface::GetDefaultBackend());
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.emulationSpeed);
const int emulation_speed_index =
m_ui.emulationSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "EmulationSpeed", 1.0f)));
if (emulation_speed_index >= 0)
m_ui.emulationSpeed->setCurrentIndex(emulation_speed_index);
connect(m_ui.emulationSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&GeneralSettingsWidget::onEmulationSpeedIndexChanged);
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.fastForwardSpeed);
const int fast_forward_speed_index =
m_ui.fastForwardSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "FastForwardSpeed", 0.0f)));
if (fast_forward_speed_index >= 0)
m_ui.fastForwardSpeed->setCurrentIndex(fast_forward_speed_index);
connect(m_ui.fastForwardSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&GeneralSettingsWidget::onFastForwardSpeedIndexChanged);
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.turboSpeed);
const int turbo_speed_index =
m_ui.turboSpeed->findData(QVariant(m_host_interface->GetFloatSettingValue("Main", "TurboSpeed", 0.0f)));
if (turbo_speed_index >= 0)
m_ui.turboSpeed->setCurrentIndex(turbo_speed_index);
connect(m_ui.turboSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&GeneralSettingsWidget::onTurboSpeedIndexChanged);
dialog->registerWidgetHelp(
m_ui.confirmPowerOff, tr("Confirm Power Off"), tr("Checked"),
tr("Determines whether a prompt will be displayed to confirm shutting down the emulator/game "
@ -90,16 +67,6 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
m_ui.applyGameSettings, tr("Apply Per-Game Settings"), tr("Checked"),
tr("When enabled, per-game settings will be applied, and incompatible enhancements will be disabled. You should "
"leave this option enabled except when testing enhancements with incompatible games."));
dialog->registerWidgetHelp(
m_ui.emulationSpeed, tr("Emulation Speed"), "100%",
tr("Sets the target emulation speed. It is not guaranteed that this speed will be reached, "
"and if not, the emulator will run as fast as it can manage."));
dialog->registerWidgetHelp(
m_ui.fastForwardSpeed, tr("Fast Forward Speed"), "100%",
tr("Sets the fast forward speed. This speed will be used when the fast forward hotkey is pressed/toggled."));
dialog->registerWidgetHelp(
m_ui.turboSpeed, tr("Turbo Speed"), "100%",
tr("Sets the turbo speed. This speed will be used when the turbo hotkey is pressed/toggled."));
dialog->registerWidgetHelp(m_ui.controllerBackend, tr("Controller Backend"),
qApp->translate("ControllerInterface", ControllerInterface::GetBackendName(
ControllerInterface::GetDefaultBackend())),
@ -149,27 +116,3 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
}
GeneralSettingsWidget::~GeneralSettingsWidget() = default;
void GeneralSettingsWidget::onEmulationSpeedIndexChanged(int index)
{
bool okay;
const float value = m_ui.emulationSpeed->currentData().toFloat(&okay);
m_host_interface->SetFloatSettingValue("Main", "EmulationSpeed", okay ? value : 1.0f);
m_host_interface->applySettings();
}
void GeneralSettingsWidget::onFastForwardSpeedIndexChanged(int index)
{
bool okay;
const float value = m_ui.fastForwardSpeed->currentData().toFloat(&okay);
m_host_interface->SetFloatSettingValue("Main", "FastForwardSpeed", okay ? value : 0.0f);
m_host_interface->applySettings();
}
void GeneralSettingsWidget::onTurboSpeedIndexChanged(int index)
{
bool okay;
const float value = m_ui.turboSpeed->currentData().toFloat(&okay);
m_host_interface->SetFloatSettingValue("Main", "TurboSpeed", okay ? value : 0.0f);
m_host_interface->applySettings();
}