Qt: Add fast forward cap to settings

This commit is contained in:
Jeffrey Pfau 2015-07-12 12:27:15 -07:00
parent 712b0ccb84
commit 1b8fe1aa09
2 changed files with 72 additions and 7 deletions

View File

@ -36,6 +36,19 @@ SettingsView::SettingsView(ConfigController* controller, QWidget* parent)
loadSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
loadSetting("suspendScreensaver", m_ui.suspendScreensaver);
double fastForwardRatio = loadSetting("fastForwardRatio").toDouble();
if (fastForwardRatio <= 0) {
m_ui.fastForwardUnbounded->setChecked(true);
m_ui.fastForwardRatio->setEnabled(false);
} else {
m_ui.fastForwardUnbounded->setChecked(false);
m_ui.fastForwardRatio->setEnabled(true);
m_ui.fastForwardRatio->setValue(fastForwardRatio);
}
connect(m_ui.fastForwardUnbounded, &QAbstractButton::toggled, [this](bool checked) {
m_ui.fastForwardRatio->setEnabled(!checked);
});
QString idleOptimization = loadSetting("idleOptimization");
if (idleOptimization == "ignore") {
m_ui.idleOptimization->setCurrentIndex(0);
@ -103,6 +116,12 @@ void SettingsView::updateConfig() {
saveSetting("allowOpposingDirections", m_ui.allowOpposingDirections);
saveSetting("suspendScreensaver", m_ui.suspendScreensaver);
if (m_ui.fastForwardUnbounded->isChecked()) {
saveSetting("fastForwardRatio", "-1");
} else {
saveSetting("fastForwardRatio", m_ui.fastForwardRatio);
}
switch (m_ui.idleOptimization->currentIndex() + IDLE_LOOP_IGNORE) {
case IDLE_LOOP_IGNORE:
saveSetting("idleOptimization", "ignore");

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>698</width>
<height>366</height>
<width>707</width>
<height>420</height>
</rect>
</property>
<property name="sizePolicy">
@ -380,21 +380,21 @@
</item>
</layout>
</item>
<item row="7" column="0" colspan="2">
<item row="10" column="0" colspan="2">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="11" column="1">
<widget class="QCheckBox" name="allowOpposingDirections">
<property name="text">
<string>Allow opposing input directions</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="12" column="1">
<widget class="QCheckBox" name="suspendScreensaver">
<property name="text">
<string>Suspend screensaver</string>
@ -404,14 +404,14 @@
</property>
</widget>
</item>
<item row="10" column="0">
<item row="13" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Idle loops</string>
</property>
</widget>
</item>
<item row="10" column="1">
<item row="13" column="1">
<widget class="QComboBox" name="idleOptimization">
<item>
<property name="text">
@ -430,6 +430,52 @@
</item>
</widget>
</item>
<item row="8" column="1">
<widget class="QDoubleSpinBox" name="fastForwardRatio">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string>×</string>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="maximum">
<double>20.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Fast forward speed</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QCheckBox" name="fastForwardUnbounded">
<property name="text">
<string>Unbounded</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>