summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-07-28 19:57:31 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-07-28 19:57:31 +0200
commit2b1c0dcf269d617de1f6c203df547166661f089e (patch)
tree5d247d694f28ddbeb6e2da26b9db02eeab5c7480 /src/gui
parent44d8856c777790449df46e3b5348a6a7433a75d8 (diff)
downloadmana-2b1c0dcf269d617de1f6c203df547166661f089e.tar.gz
mana-2b1c0dcf269d617de1f6c203df547166661f089e.tar.bz2
mana-2b1c0dcf269d617de1f6c203df547166661f089e.tar.xz
mana-2b1c0dcf269d617de1f6c203df547166661f089e.zip
Centralized configuration default values using the VariableData system.
Please note that I didn't turned all the getValue() call into new ones, simply because I have to have config object initiated which is not forcefully the case the branding file. Resolves: Manasource Mantis #170.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chat.cpp4
-rw-r--r--src/gui/emotepopup.cpp2
-rw-r--r--src/gui/gui.cpp6
-rw-r--r--src/gui/help.cpp4
-rw-r--r--src/gui/itempopup.cpp2
-rw-r--r--src/gui/npcdialog.cpp4
-rw-r--r--src/gui/serverdialog.cpp4
-rw-r--r--src/gui/setup_audio.cpp14
-rw-r--r--src/gui/setup_joystick.cpp2
-rw-r--r--src/gui/setup_players.cpp14
-rw-r--r--src/gui/setup_video.cpp68
-rw-r--r--src/gui/theme.cpp10
-rw-r--r--src/gui/updatewindow.cpp2
-rw-r--r--src/gui/viewport.cpp12
-rw-r--r--src/gui/widgets/button.cpp4
-rw-r--r--src/gui/widgets/chattab.cpp4
-rw-r--r--src/gui/widgets/checkbox.cpp4
-rw-r--r--src/gui/widgets/dropdown.cpp4
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp6
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp6
-rw-r--r--src/gui/widgets/listbox.cpp4
-rw-r--r--src/gui/widgets/playerbox.cpp6
-rw-r--r--src/gui/widgets/progressbar.cpp4
-rw-r--r--src/gui/widgets/radiobutton.cpp4
-rw-r--r--src/gui/widgets/resizegrip.cpp4
-rw-r--r--src/gui/widgets/scrollarea.cpp10
-rw-r--r--src/gui/widgets/shoplistbox.cpp4
-rw-r--r--src/gui/widgets/slider.cpp4
-rw-r--r--src/gui/widgets/tab.cpp4
-rw-r--r--src/gui/widgets/table.cpp4
-rw-r--r--src/gui/widgets/textfield.cpp6
-rw-r--r--src/gui/widgets/textpreview.cpp4
-rw-r--r--src/gui/widgets/window.cpp4
33 files changed, 118 insertions, 120 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 103a2647..86dc9d4d 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -110,7 +110,7 @@ ChatWindow::ChatWindow():
mChatInput->addKeyListener(this);
mCurHist = mHistory.end();
- mReturnToggles = config.getValue("ReturnToggles", "0") == "1";
+ mReturnToggles = config.getBoolValue("ReturnToggles");
mRecorder = new Recorder(this);
}
@@ -478,7 +478,7 @@ void ChatWindow::whisper(const std::string &nick,
if (i != mWhispers.end())
tab = i->second;
- else if (config.getValue("whispertab", true))
+ else if (config.getBoolValue("whispertab"))
tab = addWhisperTab(nick);
if (tab)
diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp
index 7c05e263..3e06fdcf 100644
--- a/src/gui/emotepopup.cpp
+++ b/src/gui/emotepopup.cpp
@@ -61,7 +61,7 @@ EmotePopup::EmotePopup():
if (!mSelectionImage)
logger->error("Unable to load selection.png");
- mSelectionImage->setAlpha(config.getValue("guialpha", 0.8));
+ mSelectionImage->setAlpha(config.getFloatValue("guialpha"));
addMouseListener(this);
recalculateSize();
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index df2ddadf..0fff3496 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -61,7 +61,7 @@ class GuiConfigListener : public ConfigListener
{
if (name == "customcursor")
{
- bool bCustomCursor = config.getValue("customcursor", 1) == 1;
+ bool bCustomCursor = config.getBoolValue("customcursor");
mGui->setUseCustomCursor(bCustomCursor);
}
}
@@ -104,7 +104,7 @@ Gui::Gui(Graphics *graphics):
ResourceManager *resman = ResourceManager::getInstance();
// Set global font
- const int fontSize = (int) config.getValue("fontSize", 11);
+ const int fontSize = config.getValue("fontSize", 11);
std::string fontFile = branding.getValue("font", "fonts/dejavusans.ttf");
std::string path = resman->getPath(fontFile);
@@ -135,7 +135,7 @@ Gui::Gui(Graphics *graphics):
gcn::Widget::setGlobalFont(mGuiFont);
// Initialize mouse cursor and listen for changes to the option
- setUseCustomCursor(config.getValue("customcursor", 1) == 1);
+ setUseCustomCursor(config.getBoolValue("customcursor"));
mConfigListener = new GuiConfigListener(this);
config.addListener("customcursor", mConfigListener);
}
diff --git a/src/gui/help.cpp b/src/gui/help.cpp
index f3c6a0af..aca036c1 100644
--- a/src/gui/help.cpp
+++ b/src/gui/help.cpp
@@ -94,9 +94,9 @@ void HelpWindow::loadHelp(const std::string &helpFile)
void HelpWindow::loadFile(const std::string &file)
{
ResourceManager *resman = ResourceManager::getInstance();
- std::string helpPath = branding.getValue("helpPath", "");
+ std::string helpPath = branding.getStringValue("helpPath");
if (helpPath.empty())
- helpPath = paths.getValue("help", "help/");
+ helpPath = paths.getStringValue("help");
std::vector<std::string> lines =
resman->loadTextFile(helpPath + file + ".txt");
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 03e6e380..5e7271ea 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -103,7 +103,7 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage)
{
ResourceManager *resman = ResourceManager::getInstance();
Image *image = resman->getImage(
- paths.getValue("itemIcons", "graphics/items/")
+ paths.getStringValue("itemIcons")
+ item.getDisplay().image);
mIcon->setImage(image);
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 4e9c0b01..828ed776 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -51,7 +51,7 @@ NpcDialog::DialogList NpcDialog::instances;
NpcDialog::NpcDialog(int npcId)
: Window(_("NPC")),
mNpcId(npcId),
- mLogInteraction(config.getValue("logNpcInGui", true)),
+ mLogInteraction(config.getBoolValue("logNpcInGui")),
mDefaultInt(0),
mInputState(NPC_INPUT_NONE),
mActionState(NPC_ACTION_WAIT)
@@ -369,7 +369,7 @@ void NpcDialog::optionChanged(const std::string &name)
{
if (name == "logNpcInGui")
{
- mLogInteraction = config.getValue("logNpcInGui", true);
+ mLogInteraction = config.getBoolValue("logNpcInGui");
}
}
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index ad8ab3c8..b1375ad0 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -485,10 +485,10 @@ void ServerDialog::setFieldsReadOnly(bool readOnly)
void ServerDialog::downloadServerList()
{
// Try to load the configuration value for the onlineServerList
- std::string listFile = branding.getValue("onlineServerList", std::string());
+ std::string listFile = branding.getStringValue("onlineServerList");
if (listFile.empty())
- listFile = config.getValue("onlineServerList", std::string());
+ listFile = config.getStringValue("onlineServerList");
// Fall back to manasource.org when neither branding nor config set it
if (listFile.empty())
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 2c6b89e8..8e9f5e98 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -35,10 +35,10 @@
#include "utils/gettext.h"
Setup_Audio::Setup_Audio():
- mMusicVolume((int)config.getValue("musicVolume", 60)),
- mSfxVolume((int)config.getValue("sfxVolume", 100)),
- mSoundEnabled(config.getValue("sound", 0)),
- mDownloadEnabled(config.getValue("download-music", false)),
+ mMusicVolume(config.getIntValue("musicVolume")),
+ mSfxVolume(config.getIntValue("sfxVolume")),
+ mSoundEnabled(config.getBoolValue("sound")),
+ mDownloadEnabled(config.getBoolValue("download-music")),
mSoundCheckBox(new CheckBox(_("Sound"), mSoundEnabled)),
mDownloadMusicCheckBox(new CheckBox(_("Download music"), mDownloadEnabled)),
mSfxSlider(new Slider(0, sound.getMaxVolume())),
@@ -82,14 +82,14 @@ void Setup_Audio::apply()
{
mSoundEnabled = mSoundCheckBox->isSelected();
mDownloadEnabled = mDownloadMusicCheckBox->isSelected();
- mSfxVolume = (int) config.getValue("sfxVolume", 100);
- mMusicVolume = (int) config.getValue("musicVolume", 60);
+ mSfxVolume = config.getIntValue("sfxVolume");
+ mMusicVolume = config.getIntValue("musicVolume");
config.setValue("sound", mSoundEnabled);
// Display a message if user has selected to download music,
// And if downloadmusic is not already enabled
- if (mDownloadEnabled && !config.getValue("download-music", false))
+ if (mDownloadEnabled && !config.getBoolValue("download-music"))
{
new OkDialog(_("Notice"),_("You may have to restart your client if you want to download new music"));
}
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 965f5712..7ac5b5ed 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -40,7 +40,7 @@ Setup_Joystick::Setup_Joystick():
{
setName(_("Joystick"));
- mOriginalJoystickEnabled = !config.getValue("joystickEnabled", false);
+ mOriginalJoystickEnabled = !config.getBoolValue("joystickEnabled");
mJoystickEnabled->setSelected(mOriginalJoystickEnabled);
mJoystickEnabled->addActionListener(this);
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index f7a39240..cbe0e264 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -227,11 +227,11 @@ Setup_Players::Setup_Players():
mDefaultWhisper(new CheckBox(_("Allow whispers"),
player_relations.getDefault() & PlayerRelation::WHISPER)),
mDeleteButton(new Button(_("Delete"), ACTION_DELETE, this)),
- mWhisperTab(config.getValue("whispertab", false)),
+ mWhisperTab(config.getBoolValue("whispertab")),
mWhisperTabCheckBox(new CheckBox(_("Put all whispers in tabs"), mWhisperTab)),
- mShowGender(config.getValue("showgender", false)),
+ mShowGender(config.getBoolValue("showgender")),
mShowGenderCheckBox(new CheckBox(_("Show gender"), mShowGender)),
- mEnableChatLog(config.getValue("enableChatLog", false)),
+ mEnableChatLog(config.getBoolValue("enableChatLog")),
mEnableChatLogCheckBox(new CheckBox(_("Enable Chat log"), mEnableChatLog))
{
setName(_("Players"));
@@ -348,7 +348,7 @@ void Setup_Players::apply()
PlayerRelation::WHISPER : 0));
config.setValue("whispertab", mWhisperTab);
- bool showGender = config.getValue("showgender", false);
+ bool showGender = config.getBoolValue("showgender");
config.setValue("showgender", mShowGender);
@@ -360,11 +360,11 @@ void Setup_Players::apply()
void Setup_Players::cancel()
{
- mWhisperTab = config.getValue("whispertab", false);
+ mWhisperTab = config.getBoolValue("whispertab");
mWhisperTabCheckBox->setSelected(mWhisperTab);
- mShowGender = config.getValue("showgender", false);
+ mShowGender = config.getBoolValue("showgender");
mShowGenderCheckBox->setSelected(mShowGender);
- mEnableChatLog = config.getValue("enableChatLog", false);
+ mEnableChatLog = config.getBoolValue("enableChatLog");
mEnableChatLogCheckBox->setSelected(mEnableChatLog);
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 81ce8107..bbfae738 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -171,7 +171,7 @@ static const char *speechModeToString(Being::Speech mode)
const char *Setup_Video::overlayDetailToString(int detail)
{
if (detail == -1)
- detail = config.getValue("OverlayDetail", -1);
+ detail = config.getIntValue("OverlayDetail");
switch (detail)
{
@@ -185,7 +185,7 @@ const char *Setup_Video::overlayDetailToString(int detail)
const char *Setup_Video::particleDetailToString(int detail)
{
if (detail == -1)
- detail = 3 - config.getValue("particleEmitterSkip", -1);
+ detail = 3 - config.getIntValue("particleEmitterSkip");
switch (detail)
{
@@ -198,21 +198,19 @@ const char *Setup_Video::particleDetailToString(int detail)
}
Setup_Video::Setup_Video():
- mFullScreenEnabled(config.getValue("screen", false)),
- mOpenGLEnabled(config.getValue("opengl", false)),
- mCustomCursorEnabled(config.getValue("customcursor", true)),
- mShowMonsterDamageEnabled(config.getValue("showMonstersTakedDamage",
- false)),
- mVisibleNamesEnabled(config.getValue("visiblenames", true)),
- mParticleEffectsEnabled(config.getValue("particleeffects", true)),
- mNameEnabled(config.getValue("showownname", false)),
- mNPCLogEnabled(config.getValue("logNpcInGui", true)),
- mPickupChatEnabled(config.getValue("showpickupchat", true)),
- mPickupParticleEnabled(config.getValue("showpickupparticle", false)),
- mOpacity(config.getValue("guialpha", 0.8)),
- mFps((int) config.getValue("fpslimit", 60)),
- mSpeechMode(static_cast<Being::Speech>(
- config.getValue("speech", Being::TEXT_OVERHEAD))),
+ mFullScreenEnabled(config.getBoolValue("screen")),
+ mOpenGLEnabled(config.getBoolValue("opengl")),
+ mCustomCursorEnabled(config.getBoolValue("customcursor")),
+ mShowMonsterDamageEnabled(config.getBoolValue("showMonstersTakedDamage")),
+ mVisibleNamesEnabled(config.getBoolValue("visiblenames")),
+ mParticleEffectsEnabled(config.getBoolValue("particleeffects")),
+ mNameEnabled(config.getBoolValue("showownname")),
+ mNPCLogEnabled(config.getBoolValue("logNpcInGui")),
+ mPickupChatEnabled(config.getBoolValue("showpickupchat")),
+ mPickupParticleEnabled(config.getBoolValue("showpickupparticle")),
+ mOpacity(config.getFloatValue("guialpha")),
+ mFps(config.getIntValue("fpslimit")),
+ mSpeechMode(static_cast<Being::Speech>(config.getIntValue("speech"))),
mModeListModel(new ModeListModel),
mModeList(new ListBox(mModeListModel)),
mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)),
@@ -237,13 +235,13 @@ Setup_Video::Setup_Video():
mFpsCheckBox(new CheckBox(_("FPS limit:"))),
mFpsSlider(new Slider(10, 120)),
mFpsLabel(new Label),
- mOverlayDetail((int) config.getValue("OverlayDetail", 2)),
+ mOverlayDetail(config.getIntValue("OverlayDetail")),
mOverlayDetailSlider(new Slider(0, 2)),
mOverlayDetailField(new Label),
- mParticleDetail(3 - (int) config.getValue("particleEmitterSkip", 1)),
+ mParticleDetail(3 - config.getIntValue("particleEmitterSkip")),
mParticleDetailSlider(new Slider(0, 3)),
mParticleDetailField(new Label),
- mFontSize((int) config.getValue("fontSize", 11))
+ mFontSize(config.getIntValue("fontSize"))
{
setName(_("Video"));
@@ -388,7 +386,7 @@ void Setup_Video::apply()
{
// Full screen changes
bool fullscreen = mFsCheckBox->isSelected();
- if (fullscreen != (config.getValue("screen", false) == 1))
+ if (fullscreen != config.getBoolValue("screen"))
{
/* The OpenGL test is only necessary on Windows, since switching
* to/from full screen works fine on Linux. On Windows we'd have to
@@ -399,7 +397,7 @@ void Setup_Video::apply()
#if defined(WIN32) || defined(__APPLE__)
// checks for opengl usage
- if (!(config.getValue("opengl", false) == 1))
+ if (!config.getBoolValue("opengl"))
{
#endif
if (!graphics->setFullscreen(fullscreen))
@@ -452,20 +450,20 @@ void Setup_Video::apply()
config.setValue("fontSize", mFontSizeDropDown->getSelected() + 10);
// We sync old and new values at apply time
- mFullScreenEnabled = config.getValue("screen", false);
- mCustomCursorEnabled = config.getValue("customcursor", true);
- mShowMonsterDamageEnabled = config.getValue("showMonstersTakedDamage", false);
- mVisibleNamesEnabled = config.getValue("visiblenames", true);
- mParticleEffectsEnabled = config.getValue("particleeffects", true);
- mNameEnabled = config.getValue("showownname", false);
- mNPCLogEnabled = config.getValue("logNpcInGui", true);
+ mFullScreenEnabled = config.getBoolValue("screen");
+ mCustomCursorEnabled = config.getBoolValue("customcursor");
+ mShowMonsterDamageEnabled = config.getBoolValue("showMonstersTakedDamage");
+ mVisibleNamesEnabled = config.getBoolValue("visiblenames");
+ mParticleEffectsEnabled = config.getBoolValue("particleeffects");
+ mNameEnabled = config.getBoolValue("showownname");
+ mNPCLogEnabled = config.getBoolValue("logNpcInGui");
mSpeechMode = static_cast<Being::Speech>(
- config.getValue("speech", Being::TEXT_OVERHEAD));
- mOpacity = config.getValue("guialpha", 0.8);
- mOverlayDetail = (int) config.getValue("OverlayDetail", 2);
- mOpenGLEnabled = config.getValue("opengl", false);
- mPickupChatEnabled = config.getValue("showpickupchat", true);
- mPickupParticleEnabled = config.getValue("showpickupparticle", false);
+ config.getIntValue("speech"));
+ mOpacity = config.getFloatValue("guialpha");
+ mOverlayDetail = config.getIntValue("OverlayDetail");
+ mOpenGLEnabled = config.getBoolValue("opengl");
+ mPickupChatEnabled = config.getBoolValue("showpickupchat");
+ mPickupParticleEnabled = config.getBoolValue("showpickupparticle");
}
void Setup_Video::cancel()
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 12de1f91..152bf773 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -48,7 +48,7 @@ Theme *Theme::mInstance = 0;
static void initDefaultThemePath()
{
ResourceManager *resman = ResourceManager::getInstance();
- defaultThemePath = branding.getValue("guiThemePath", "");
+ defaultThemePath = branding.getStringValue("guiThemePath");
if (!defaultThemePath.empty() && resman->isDirectory(defaultThemePath))
return;
@@ -81,8 +81,8 @@ Skin::~Skin()
void Skin::updateAlpha(float minimumOpacityAllowed)
{
- const float alpha = std::max((double)minimumOpacityAllowed,
- config.getValue("guialpha", 0.8f));
+ const float alpha = std::max(minimumOpacityAllowed,
+ config.getFloatValue("guialpha"));
for_each(mBorder.grid, mBorder.grid + 9,
std::bind2nd(std::mem_fun(&Image::setAlpha), alpha));
@@ -339,9 +339,9 @@ bool Theme::tryThemePath(std::string themePath)
void Theme::prepareThemePath()
{
// Try theme from settings
- if (!tryThemePath(config.getValue("theme", "")))
+ if (!tryThemePath(config.getStringValue("theme")))
// Try theme from branding
- if (!tryThemePath(branding.getValue("theme", "")))
+ if (!tryThemePath(branding.getStringValue("theme")))
// Use default
mThemePath = defaultThemePath;
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 7448a102..23d23b5e 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -476,7 +476,7 @@ void UpdaterWindow::logic()
// This statement checks to see if the file type is music, and if download-music is true
// If it fails, this statement returns true, and results in not downloading the file
// Else it will ignore the break, and download the file.
- if ( !(thisFile.type == "music" && config.getValue("download-music", false)) )
+ if ( !(thisFile.type == "music" && config.getBoolValue("download-music")) )
{
mUpdateIndex++;
break;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 120106cb..f1cd38e4 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -58,10 +58,10 @@ Viewport::Viewport():
setOpaque(false);
addMouseListener(this);
- mScrollLaziness = (int) config.getValue("ScrollLaziness", 16);
- mScrollRadius = (int) config.getValue("ScrollRadius", 0);
- mScrollCenterOffsetX = (int) config.getValue("ScrollCenterOffsetX", 0);
- mScrollCenterOffsetY = (int) config.getValue("ScrollCenterOffsetY", 0);
+ mScrollLaziness = config.getIntValue("ScrollLaziness");
+ mScrollRadius = config.getIntValue("ScrollRadius");
+ mScrollCenterOffsetX = config.getIntValue("ScrollCenterOffsetX");
+ mScrollCenterOffsetY = config.getIntValue("ScrollCenterOffsetY");
config.addListener("ScrollLaziness", this);
config.addListener("ScrollRadius", this);
@@ -481,8 +481,8 @@ void Viewport::closePopupMenu()
void Viewport::optionChanged(const std::string &name)
{
- mScrollLaziness = (int) config.getValue("ScrollLaziness", 32);
- mScrollRadius = (int) config.getValue("ScrollRadius", 32);
+ mScrollLaziness = config.getIntValue("ScrollLaziness");
+ mScrollRadius = config.getIntValue("ScrollRadius");
}
void Viewport::mouseMoved(gcn::MouseEvent &event)
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 26e0ad90..dbaa357c 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -125,8 +125,8 @@ Button::~Button()
void Button::updateAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8f),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
if (mAlpha != alpha)
{
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 03ff79d9..fbde2c9c 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -51,7 +51,7 @@ ChatTab::ChatTab(const std::string &name) : Tab()
mTextOutput = new BrowserBox(BrowserBox::AUTO_WRAP);
mTextOutput->setOpaque(false);
- mTextOutput->setMaxRow((int) config.getValue("ChatLogLength", 0));
+ mTextOutput->setMaxRow((int) config.getIntValue("ChatLogLength"));
mTextOutput->setLinkHandler(chatWindow->mItemLinkHandler);
mScrollArea = new ScrollArea(mTextOutput);
@@ -181,7 +181,7 @@ void ChatTab::chatLog(std::string line, Own own, bool ignoreRecord)
line = lineColor + timeStr.str() + tmp.nick + tmp.text;
- if (config.getValue("enableChatLog", false))
+ if (config.getBoolValue("enableChatLog"))
saveToLogFile(line);
// We look if the Vertical Scroll Bar is set at the max before
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index f9002166..64594940 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -92,8 +92,8 @@ void CheckBox::draw(gcn::Graphics* graphics)
void CheckBox::updateAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8f),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
if (mAlpha != alpha)
{
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 6c3417e7..e694137d 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -110,8 +110,8 @@ DropDown::~DropDown()
void DropDown::updateAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8f),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
if (mAlpha != alpha)
{
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 82fb9f8d..28727429 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -51,7 +51,7 @@ EmoteShortcutContainer::EmoteShortcutContainer():
mBackgroundImg = Theme::getImageFromTheme("item_shortcut_bgr.png");
- mBackgroundImg->setAlpha(config.getValue("guialpha", 0.8));
+ mBackgroundImg->setAlpha(config.getFloatValue("guialpha"));
// Setup emote sprites
for (int i = 0; i <= EmoteDB::getLast(); i++)
@@ -72,9 +72,9 @@ EmoteShortcutContainer::~EmoteShortcutContainer()
void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
{
- if (config.getValue("guialpha", 0.8) != mAlpha)
+ if (config.getFloatValue("guialpha") != mAlpha)
{
- mAlpha = config.getValue("guialpha", 0.8);
+ mAlpha = config.getFloatValue("guialpha");
mBackgroundImg->setAlpha(mAlpha);
}
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index b3cefc5f..869264f7 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -53,7 +53,7 @@ ItemShortcutContainer::ItemShortcutContainer():
mBackgroundImg = Theme::getImageFromTheme("item_shortcut_bgr.png");
mMaxItems = itemShortcut->getItemCount();
- mBackgroundImg->setAlpha(config.getValue("guialpha", 0.8));
+ mBackgroundImg->setAlpha(config.getFloatValue("guialpha"));
mBoxHeight = mBackgroundImg->getHeight();
mBoxWidth = mBackgroundImg->getWidth();
@@ -67,9 +67,9 @@ ItemShortcutContainer::~ItemShortcutContainer()
void ItemShortcutContainer::draw(gcn::Graphics *graphics)
{
- if (config.getValue("guialpha", 0.8) != mAlpha)
+ if (config.getFloatValue("guialpha") != mAlpha)
{
- mAlpha = config.getValue("guialpha", 0.8);
+ mAlpha = config.getFloatValue("guialpha");
mBackgroundImg->setAlpha(mAlpha);
}
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index ef591023..2193b888 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -45,8 +45,8 @@ ListBox::~ListBox()
void ListBox::updateAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
if (mAlpha != alpha)
mAlpha = alpha;
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 468c77f5..cc9e963e 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -57,7 +57,7 @@ PlayerBox::PlayerBox(const Being *being):
bggridx[x], bggridy[y],
bggridx[x + 1] - bggridx[x] + 1,
bggridy[y + 1] - bggridy[y] + 1);
- background.grid[a]->setAlpha(config.getValue("guialpha", 0.8));
+ background.grid[a]->setAlpha(config.getFloatValue("guialpha"));
a++;
}
}
@@ -91,11 +91,11 @@ void PlayerBox::draw(gcn::Graphics *graphics)
mBeing->drawSpriteAt(static_cast<Graphics*>(graphics), x, y);
}
- if (config.getValue("guialpha", 0.8) != mAlpha)
+ if (config.getFloatValue("guialpha") != mAlpha)
{
for (int a = 0; a < 9; a++)
{
- background.grid[a]->setAlpha(config.getValue("guialpha", 0.8));
+ background.grid[a]->setAlpha(config.getFloatValue("guialpha"));
}
}
}
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 028658ab..60c44fe2 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -123,8 +123,8 @@ void ProgressBar::logic()
void ProgressBar::updateAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
if (mAlpha != alpha)
{
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 96797225..4cbc22e7 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -78,9 +78,9 @@ RadioButton::~RadioButton()
void RadioButton::drawBox(gcn::Graphics* graphics)
{
- if (config.getValue("guialpha", 0.8) != mAlpha)
+ if (config.getFloatValue("guialpha") != mAlpha)
{
- mAlpha = config.getValue("guialpha", 0.8);
+ mAlpha = config.getFloatValue("guialpha");
radioNormal->setAlpha(mAlpha);
radioChecked->setAlpha(mAlpha);
radioDisabled->setAlpha(mAlpha);
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index f0c3691c..496e3727 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -59,9 +59,9 @@ ResizeGrip::~ResizeGrip()
void ResizeGrip::draw(gcn::Graphics *graphics)
{
- if (config.getValue("guialpha", 0.8) != mAlpha)
+ if (config.getFloatValue("guialpha") != mAlpha)
{
- mAlpha = config.getValue("guialpha", 0.8);
+ mAlpha = config.getFloatValue("guialpha");
gripImage->setAlpha(mAlpha);
}
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 0c7f4d7d..d8ffe5ab 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -108,7 +108,7 @@ void ScrollArea::init()
bggridx[x], bggridy[y],
bggridx[x + 1] - bggridx[x] + 1,
bggridy[y + 1] - bggridy[y] + 1);
- background.grid[a]->setAlpha(config.getValue("guialpha", 0.8));
+ background.grid[a]->setAlpha(config.getFloatValue("guialpha"));
a++;
}
}
@@ -135,8 +135,8 @@ void ScrollArea::init()
vsgridx[x], vsgridy[y],
vsgridx[x + 1] - vsgridx[x],
vsgridy[y + 1] - vsgridy[y]);
- vMarker.grid[a]->setAlpha(config.getValue("guialpha", 0.8));
- vMarkerHi.grid[a]->setAlpha(config.getValue("guialpha", 0.8));
+ vMarker.grid[a]->setAlpha(config.getFloatValue("guialpha"));
+ vMarkerHi.grid[a]->setAlpha(config.getFloatValue("guialpha"));
a++;
}
}
@@ -213,8 +213,8 @@ void ScrollArea::logic()
void ScrollArea::updateAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
if (alpha != mAlpha)
{
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 2f5fab34..b92ec6cb 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -71,8 +71,8 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
if (!mListModel)
return;
- if (config.getValue("guialpha", 0.8) != mAlpha)
- mAlpha = config.getValue("guialpha", 0.8);
+ if (config.getFloatValue("guialpha") != mAlpha)
+ mAlpha = config.getFloatValue("guialpha");
int alpha = (int)(mAlpha * 255.0f);
const gcn::Color* highlightColor =
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 6a9a5c7c..00a8e86f 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -126,8 +126,8 @@ void Slider::init()
void Slider::updateAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
if (alpha != mAlpha)
{
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 2ab126dd..503a8e55 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -118,8 +118,8 @@ void Tab::init()
void Tab::updateAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
// TODO We don't need to do this for every tab on every draw
// Maybe use a config listener to do it as the value changes.
diff --git a/src/gui/widgets/table.cpp b/src/gui/widgets/table.cpp
index f0887ed7..663d6d02 100644
--- a/src/gui/widgets/table.cpp
+++ b/src/gui/widgets/table.cpp
@@ -270,8 +270,8 @@ void GuiTable::draw(gcn::Graphics* graphics)
if (!mModel)
return;
- if (config.getValue("guialpha", 0.8) != mAlpha)
- mAlpha = config.getValue("guialpha", 0.8);
+ if (config.getFloatValue("guialpha") != mAlpha)
+ mAlpha = config.getFloatValue("guialpha");
if (mOpaque)
{
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 4453f522..f89f6239 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -65,7 +65,7 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab):
gridx[x], gridy[y],
gridx[x + 1] - gridx[x] + 1,
gridy[y + 1] - gridy[y] + 1);
- skin.grid[a]->setAlpha(config.getValue("guialpha", 0.8));
+ skin.grid[a]->setAlpha(config.getFloatValue("guialpha"));
a++;
}
}
@@ -86,8 +86,8 @@ TextField::~TextField()
void TextField::updateAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
if (alpha != mAlpha)
{
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 10426d7c..869ebd35 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -45,8 +45,8 @@ TextPreview::TextPreview(const std::string &text):
void TextPreview::draw(gcn::Graphics* graphics)
{
- if (config.getValue("guialpha", 0.8) != mAlpha)
- mAlpha = config.getValue("guialpha", 0.8);
+ if (config.getFloatValue("guialpha") != mAlpha)
+ mAlpha = config.getFloatValue("guialpha");
int alpha = (int) (mAlpha * 255.0f);
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 118ee7c0..dafaaeed 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -697,8 +697,8 @@ int Window::getResizeHandles(gcn::MouseEvent &event)
int Window::getGuiAlpha()
{
- float alpha = std::max(config.getValue("guialpha", 0.8),
- (double) Theme::instance()->getMinimumOpacity());
+ float alpha = std::max(config.getFloatValue("guialpha"),
+ Theme::instance()->getMinimumOpacity());
return (int) (alpha * 255.0f);
}