diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-13 21:33:06 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-13 21:35:19 +0200 |
commit | 28bc8c0edb549cdbbe0832c4202630a039f738b1 (patch) | |
tree | 9989f31a5121f82af5aa264ebfe7096c5ea5030f /src/gui/setup_video.cpp | |
parent | 627e1bc7eee5b821d29b2161dec4991cae7bf9c0 (diff) | |
download | mana-28bc8c0edb549cdbbe0832c4202630a039f738b1.tar.gz mana-28bc8c0edb549cdbbe0832c4202630a039f738b1.tar.bz2 mana-28bc8c0edb549cdbbe0832c4202630a039f738b1.tar.xz mana-28bc8c0edb549cdbbe0832c4202630a039f738b1.zip |
Some cleanup of the Configuration interface
Mainly avoid all the convertions from integer to float and then to
string and also back from string to float and then to integer.
Diffstat (limited to 'src/gui/setup_video.cpp')
-rw-r--r-- | src/gui/setup_video.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 8f3d7399..8f358eda 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -109,7 +109,7 @@ Setup_Video::Setup_Video(): mFullScreenEnabled(config.getValue("screen", false)), mOpenGLEnabled(config.getValue("opengl", false)), mCustomCursorEnabled(config.getValue("customcursor", true)), - mVisibleNamesEnabled(config.getValue("visiblenames", 1)), + mVisibleNamesEnabled(config.getValue("visiblenames", true)), mParticleEffectsEnabled(config.getValue("particleeffects", true)), mNameEnabled(config.getValue("showownname", false)), mPickupChatEnabled(config.getValue("showpickupchat", true)), @@ -351,13 +351,13 @@ void Setup_Video::apply() _("Restart needed for changes to take effect.")); } #endif - config.setValue("screen", fullscreen ? true : false); + config.setValue("screen", fullscreen); } // OpenGL change if (mOpenGLCheckBox->isSelected() != mOpenGLEnabled) { - config.setValue("opengl", mOpenGLCheckBox->isSelected() ? true : false); + config.setValue("opengl", mOpenGLCheckBox->isSelected()); // OpenGL can currently only be changed by restarting, notify user. new OkDialog(_("Changing OpenGL"), @@ -370,7 +370,7 @@ void Setup_Video::apply() // We sync old and new values at apply time mFullScreenEnabled = config.getValue("screen", false); mCustomCursorEnabled = config.getValue("customcursor", true); - mVisibleNamesEnabled = config.getValue("visiblenames", 1); + mVisibleNamesEnabled = config.getValue("visiblenames", true); mParticleEffectsEnabled = config.getValue("particleeffects", true); mNameEnabled = config.getValue("showownname", false); mSpeechMode = (int) config.getValue("speech", 3); @@ -419,19 +419,18 @@ void Setup_Video::cancel() updateSlider(mScrollRadiusSlider, mScrollRadiusField, "ScrollRadius"); updateSlider(mScrollLazinessSlider, mScrollLazinessField, "ScrollLaziness"); - config.setValue("screen", mFullScreenEnabled ? true : false); - config.setValue("customcursor", mCustomCursorEnabled ? true : false); - config.setValue("visiblenames", mVisibleNamesEnabled ? 1 : 0); - config.setValue("particleeffects", mParticleEffectsEnabled ? true : false); + config.setValue("screen", mFullScreenEnabled); + config.setValue("customcursor", mCustomCursorEnabled); + config.setValue("visiblenames", mVisibleNamesEnabled); + config.setValue("particleeffects", mParticleEffectsEnabled); config.setValue("speech", mSpeechMode); - config.setValue("showownname", mNameEnabled ? true : false); + config.setValue("showownname", mNameEnabled); if (player_node) player_node->mUpdateName = true; config.setValue("guialpha", mOpacity); - config.setValue("opengl", mOpenGLEnabled ? true : false); - config.setValue("showpickupchat", mPickupChatEnabled ? true : false); - config.setValue("showpickupparticle", mPickupParticleEnabled ? - true : false); + config.setValue("opengl", mOpenGLEnabled); + config.setValue("showpickupchat", mPickupChatEnabled); + config.setValue("showpickupparticle", mPickupParticleEnabled); } void Setup_Video::action(const gcn::ActionEvent &event) @@ -455,31 +454,28 @@ void Setup_Video::action(const gcn::ActionEvent &event) } else if (event.getId() == "customcursor") { - config.setValue("customcursor", - mCustomCursorCheckBox->isSelected() ? true : false); + config.setValue("customcursor", mCustomCursorCheckBox->isSelected()); } else if (event.getId() == "visiblenames") { - config.setValue("visiblenames", - mVisibleNamesCheckBox->isSelected() ? 1 : 0); + config.setValue("visiblenames", mVisibleNamesCheckBox->isSelected()); } else if (event.getId() == "particleeffects") { config.setValue("particleeffects", - mParticleEffectsCheckBox->isSelected() ? true : false); + mParticleEffectsCheckBox->isSelected()); new OkDialog(_("Particle effect settings changed."), _("Restart your client or change maps " "for the change to take effect.")); } else if (event.getId() == "pickupchat") { - config.setValue("showpickupchat", mPickupChatCheckBox->isSelected() - ? true : false); + config.setValue("showpickupchat", mPickupChatCheckBox->isSelected()); } else if (event.getId() == "pickupparticle") { config.setValue("showpickupparticle", - mPickupParticleCheckBox->isSelected() ? true : false); + mPickupParticleCheckBox->isSelected()); } else if (event.getId() == "speech") { @@ -508,8 +504,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) // and requires an update if (player_node) player_node->mUpdateName = true; - config.setValue("showownname", - mNameCheckBox->isSelected() ? true : false); + config.setValue("showownname", mNameCheckBox->isSelected()); } else if (event.getId() == "fpslimitslider") { |