diff options
author | Tametomo <irarice@gmail.com> | 2010-02-13 13:25:21 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-13 14:53:30 +0100 |
commit | 65f71d884b688697494aa36c865e04dc92c066c1 (patch) | |
tree | 292e521aea0e4c689d5a8375c2be034490aae3a0 /src/gui/setup_video.cpp | |
parent | 5cb317f177b3c8f9571eef75a7f7c8c486107586 (diff) | |
download | mana-65f71d884b688697494aa36c865e04dc92c066c1.tar.gz mana-65f71d884b688697494aa36c865e04dc92c066c1.tar.bz2 mana-65f71d884b688697494aa36c865e04dc92c066c1.tar.xz mana-65f71d884b688697494aa36c865e04dc92c066c1.zip |
Fixed the FPS checkbox, field, and slider not updating properly on
cancel events.
Signed-off-by: Tametomo <irarice@gmail.com>
Diffstat (limited to 'src/gui/setup_video.cpp')
-rw-r--r-- | src/gui/setup_video.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 20ad23e0..38206a13 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -248,7 +248,7 @@ Setup_Video::Setup_Video(): mAlphaSlider->setValue(mOpacity); mAlphaSlider->setWidth(90); - mFpsField->setText(toString(mFps)); + mFpsField->setText(mFps > 0 ? toString(mFps) : ""); mFpsField->setEnabled(mFps > 0); mFpsField->setWidth(30); mFpsSlider->setValue(mFps); @@ -413,9 +413,11 @@ void Setup_Video::apply() _("Applying change to OpenGL requires restart.")); } + mFps = mFpsCheckBox->isSelected() ? (int) mFpsSlider->getValue() : 0; + mFpsSlider->setEnabled(mFps > 0); + // FPS change config.setValue("fpslimit", mFps); - config.setValue("fontSize", mFontSizeDropDown->getSelected() + 10); // We sync old and new values at apply time @@ -436,17 +438,22 @@ void Setup_Video::apply() void Setup_Video::cancel() { + mFpsCheckBox->setSelected(mFps > 0); mFsCheckBox->setSelected(mFullScreenEnabled); mOpenGLCheckBox->setSelected(mOpenGLEnabled); mCustomCursorCheckBox->setSelected(mCustomCursorEnabled); mShowMonsterDamageCheckBox->setSelected(mShowMonsterDamageEnabled); mVisibleNamesCheckBox->setSelected(mVisibleNamesEnabled); mParticleEffectsCheckBox->setSelected(mParticleEffectsEnabled); + mFpsSlider->setValue(mFps); + mFpsSlider->setEnabled(mFps > 0); mSpeechSlider->setValue(mSpeechMode); mNameCheckBox->setSelected(mNameEnabled); mAlphaSlider->setValue(mOpacity); mOverlayDetailSlider->setValue(mOverlayDetail); mParticleDetailSlider->setValue(mParticleDetail); + std::string text = mFpsCheckBox->isSelected() ? toString(mFps) : ""; + mFpsField->setText(text); config.setValue("screen", mFullScreenEnabled); config.setValue("customcursor", mCustomCursorEnabled); @@ -541,8 +548,10 @@ void Setup_Video::action(const gcn::ActionEvent &event) } else if (event.getId() == "fpslimitslider") { - mFps = (int) mFpsSlider->getValue(); - mFpsField->setText(toString(mFps)); + const int fps = (int) mFpsSlider->getValue(); + std::string text = mFpsCheckBox->isSelected() ? toString(fps) : ""; + + mFpsField->setText(text); } else if (event.getId() == "overlaydetailslider") { @@ -559,16 +568,13 @@ void Setup_Video::action(const gcn::ActionEvent &event) } else if (event.getId() == "fpslimitcheckbox") { - if (mFpsCheckBox->isSelected()) - { - mFps = (int) mFpsSlider->getValue(); - } - else - { - mFps = 0; - } + int fps = (int) mFpsSlider->getValue(); + fps = fps > 0 ? fps : mFpsSlider->getScaleStart(); + mFps = mFpsCheckBox->isSelected() ? fps : 0; + std::string text = mFps > 0 ? toString(mFps) : ""; + mFpsField->setEnabled(mFps > 0); - mFpsField->setText(toString(mFps)); + mFpsField->setText(text); mFpsSlider->setValue(mFps); mFpsSlider->setEnabled(mFps > 0); } |