Make framerate limit configurable in the launcher

pull/541/head
Capostrophic 6 years ago
parent 49c691d00a
commit b87b29eeb0

@ -44,6 +44,7 @@ Launcher::GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, Settings:
connect(fullScreenCheckBox, SIGNAL(stateChanged(int)), this, SLOT(slotFullScreenChanged(int)));
connect(standardRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotStandardToggled(bool)));
connect(screenComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(screenChanged(int)));
connect(framerateLimitCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotFramerateLimitToggled(bool)));
}
@ -121,6 +122,17 @@ bool Launcher::GraphicsPage::loadSettings()
customHeightSpinBox->setValue(height);
}
float fpsLimit = mEngineSettings.getFloat("framerate limit", "Video");
if (fpsLimit != 0)
{
framerateLimitCheckBox->setCheckState(Qt::Checked);
framerateLimitSpinBox->setValue(fpsLimit);
}
else
{
framerateLimitSpinBox->setEnabled(false);
}
return true;
}
@ -166,6 +178,17 @@ void Launcher::GraphicsPage::saveSettings()
int cScreen = screenComboBox->currentIndex();
if (cScreen != mEngineSettings.getInt("screen", "Video"))
mEngineSettings.setInt("screen", "Video", cScreen);
if (framerateLimitCheckBox->checkState())
{
float cFpsLimit = framerateLimitSpinBox->value();
if (cFpsLimit != mEngineSettings.getFloat("framerate limit", "Video"))
mEngineSettings.setFloat("framerate limit", "Video", cFpsLimit);
}
else if (mEngineSettings.getFloat("framerate limit", "Video") != 0)
{
mEngineSettings.setFloat("framerate limit", "Video", 0);
}
}
QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen)
@ -266,3 +289,8 @@ void Launcher::GraphicsPage::slotStandardToggled(bool checked)
customHeightSpinBox->setEnabled(true);
}
}
void Launcher::GraphicsPage::slotFramerateLimitToggled(bool checked)
{
framerateLimitSpinBox->setEnabled(checked);
}

@ -31,6 +31,7 @@ namespace Launcher
private slots:
void slotFullScreenChanged(int state);
void slotStandardToggled(bool checked);
void slotFramerateLimitToggled(bool checked);
private:
Files::ConfigurationManager &mCfgMgr;

@ -62,6 +62,13 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="framerateLimitCheckBox">
<property name="text">
<string>Framerate limit</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="antiAliasingComboBox">
<item>
@ -143,6 +150,28 @@
</item>
</layout>
</item>
<item row="6" column="1">
<widget class="QDoubleSpinBox" name="framerateLimitSpinBox">
<property name="suffix">
<string> FPS</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>1</double>
</property>
<property name="maximum">
<double>999</double>
</property>
<property name="singleStep">
<double>15</double>
</property>
<property name="value">
<double>300</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>

Loading…
Cancel
Save