all repos — mgba @ 1b8fe1aa09563444903cd5609dde104222a80ec6

mGBA Game Boy Advance Emulator

Qt: Add fast forward cap to settings
Jeffrey Pfau jeffrey@endrift.com
Sun, 12 Jul 2015 12:27:15 -0700
commit

1b8fe1aa09563444903cd5609dde104222a80ec6

parent

712b0ccb84a9e532b8725276365de7780a875d0f

2 files changed, 72 insertions(+), 7 deletions(-)

jump to
M src/platform/qt/SettingsView.cppsrc/platform/qt/SettingsView.cpp

@@ -36,6 +36,19 @@ loadSetting("resampleVideo", m_ui.resampleVideo);

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);

@@ -102,6 +115,12 @@ saveSetting("rewindBufferCapacity", m_ui.rewindCapacity);

saveSetting("resampleVideo", m_ui.resampleVideo); 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:
M src/platform/qt/SettingsView.uisrc/platform/qt/SettingsView.ui

@@ -6,8 +6,8 @@ <property name="geometry">

<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 @@ </widget>

</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 @@ <bool>true</bool>

</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">

@@ -428,6 +428,52 @@ <property name="text">

<string>Detect and remove</string> </property> </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>