Qt: Simplify runahead settings
This commit is contained in:
@@ -18,8 +18,7 @@ EmulationSettingsWidget::EmulationSettingsWidget(QtHostInterface* host_interface
|
||||
SettingWidgetBinder::BindWidgetToFloatSetting(m_host_interface, m_ui.rewindSaveFrequency, "Main", "RewindFrequency",
|
||||
10.0f);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.rewindSaveSlots, "Main", "RewindSaveSlots", 10);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.runaheadEnable, "Main", "RunaheadEnable", false);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.runaheadFrames, "Main", "RunaheadFrames", 1);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.runaheadFrames, "Main", "RunaheadFrameCount", 0);
|
||||
|
||||
QtUtils::FillComboBoxWithEmulationSpeeds(m_ui.emulationSpeed);
|
||||
const int emulation_speed_index =
|
||||
@@ -43,12 +42,13 @@ EmulationSettingsWidget::EmulationSettingsWidget(QtHostInterface* host_interface
|
||||
connect(m_ui.turboSpeed, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&EmulationSettingsWidget::onTurboSpeedIndexChanged);
|
||||
|
||||
connect(m_ui.rewindEnable, &QCheckBox::stateChanged, this, &EmulationSettingsWidget::updateRewindSummaryLabel);
|
||||
connect(m_ui.rewindEnable, &QCheckBox::stateChanged, this, &EmulationSettingsWidget::updateRewind);
|
||||
connect(m_ui.rewindSaveFrequency, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
&EmulationSettingsWidget::updateRewindSummaryLabel);
|
||||
&EmulationSettingsWidget::updateRewind);
|
||||
connect(m_ui.rewindSaveSlots, QOverload<int>::of(&QSpinBox::valueChanged), this,
|
||||
&EmulationSettingsWidget::updateRewindSummaryLabel);
|
||||
connect(m_ui.runaheadEnable, &QCheckBox::stateChanged, this, &EmulationSettingsWidget::updateRunaheadFields);
|
||||
&EmulationSettingsWidget::updateRewind);
|
||||
connect(m_ui.runaheadFrames, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&EmulationSettingsWidget::updateRewind);
|
||||
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.emulationSpeed, tr("Emulation Speed"), "100%",
|
||||
@@ -69,8 +69,7 @@ EmulationSettingsWidget::EmulationSettingsWidget(QtHostInterface* host_interface
|
||||
"the console's refresh rate is too far from the host's refresh rate. Users with variable refresh rate displays "
|
||||
"should disable this option."));
|
||||
|
||||
updateRewindSummaryLabel();
|
||||
updateRunaheadFields();
|
||||
updateRewind();
|
||||
}
|
||||
|
||||
EmulationSettingsWidget::~EmulationSettingsWidget() = default;
|
||||
@@ -99,8 +98,10 @@ void EmulationSettingsWidget::onTurboSpeedIndexChanged(int index)
|
||||
m_host_interface->applySettings();
|
||||
}
|
||||
|
||||
void EmulationSettingsWidget::updateRewindSummaryLabel()
|
||||
void EmulationSettingsWidget::updateRewind()
|
||||
{
|
||||
m_ui.rewindEnable->setEnabled(!runaheadEnabled());
|
||||
|
||||
if (m_ui.rewindEnable->isEnabled() && m_ui.rewindEnable->isChecked())
|
||||
{
|
||||
const u32 frames = static_cast<u32>(m_ui.rewindSaveSlots->value());
|
||||
@@ -124,7 +125,8 @@ void EmulationSettingsWidget::updateRewindSummaryLabel()
|
||||
{
|
||||
if (!m_ui.rewindEnable->isEnabled())
|
||||
{
|
||||
m_ui.rewindSummary->setText(tr("Rewind is disabled because runahead is enabled."));
|
||||
m_ui.rewindSummary->setText(tr(
|
||||
"Rewind is disabled because runahead is enabled. Runahead will significantly increase system requirements."));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -135,10 +137,3 @@ void EmulationSettingsWidget::updateRewindSummaryLabel()
|
||||
m_ui.rewindSaveSlots->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void EmulationSettingsWidget::updateRunaheadFields()
|
||||
{
|
||||
m_ui.runaheadFrames->setEnabled(m_ui.runaheadEnable->isChecked());
|
||||
m_ui.rewindEnable->setEnabled(!m_ui.runaheadEnable->isChecked());
|
||||
updateRewindSummaryLabel();
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ private Q_SLOTS:
|
||||
void onEmulationSpeedIndexChanged(int index);
|
||||
void onFastForwardSpeedIndexChanged(int index);
|
||||
void onTurboSpeedIndexChanged(int index);
|
||||
void updateRewindSummaryLabel();
|
||||
void updateRunaheadFields();
|
||||
void updateRewind();
|
||||
|
||||
private:
|
||||
bool runaheadEnabled() { return m_ui.runaheadFrames->currentIndex() > 0; }
|
||||
|
||||
Ui::EmulationSettingsWidget m_ui;
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Rewind</string>
|
||||
<string>Rewind/Runahead</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
@@ -125,7 +125,73 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Runahead:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="runaheadFrames">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Disabled</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1 Frame</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2 Frames</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3 Frames</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4 Frames</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5 Frames</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6 Frames</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7 Frames</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8 Frames</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9 Frames</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10 Frames</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="rewindSummary">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
@@ -138,42 +204,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Runahead</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="runaheadEnable">
|
||||
<property name="text">
|
||||
<string>Enable Runahead</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Runahead Frames:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="runaheadFrames">
|
||||
<property name="suffix">
|
||||
<string> Frames</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user