summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-18 14:37:36 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-18 14:49:53 +0300
commitbe7d563ba1e0b20cfe397f2cf4da6f7e3df78d22 (patch)
treef26591cf82914d30853a1a0d556742c5ec801de8
parent9f89a15fbcaf3f24f4c941b7061979e424d6384a (diff)
downloadplus-be7d563ba1e0b20cfe397f2cf4da6f7e3df78d22.tar.gz
plus-be7d563ba1e0b20cfe397f2cf4da6f7e3df78d22.tar.bz2
plus-be7d563ba1e0b20cfe397f2cf4da6f7e3df78d22.tar.xz
plus-be7d563ba1e0b20cfe397f2cf4da6f7e3df78d22.zip
Simplify reading values from config.
-rw-r--r--src/client.cpp2
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/ministatuswindow.cpp2
-rw-r--r--src/gui/setup_theme.cpp7
-rw-r--r--src/gui/theme.cpp8
-rw-r--r--src/utils/langs.cpp6
6 files changed, 11 insertions, 15 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 02e4b54df..cb947ea53 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -320,7 +320,7 @@ void Client::gameInit()
storeSafeParameters();
#ifdef ENABLE_NLS
- std::string lang = config.getValue("lang", "");
+ std::string lang = config.getStringValue("lang");
#ifdef WIN32
if (lang.empty())
lang = std::string(_nl_locale_name_default());
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 0d24f0a0b..a020fbe1f 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -266,6 +266,7 @@ DefaultsData* getConfigDefaults()
AddDEF("npcfontSize", 13);
AddDEF("useAtlases", true);
AddDEF("useTextureSampler", false);
+ AddDEF("ministatussaved", 0);
return configData;
}
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 5aa22800b..6309f10c1 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -421,7 +421,7 @@ void MiniStatusWindow::showBar(const std::string &name, const bool visible)
void MiniStatusWindow::loadBars()
{
- if (!config.getValue("ministatussaved", 0))
+ if (!config.getIntValue("ministatussaved"))
{
if (mWeightBar)
mWeightBar->setVisible(false);
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index 5d34066e1..1886405be 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -163,7 +163,7 @@ Setup_Theme::Setup_Theme() :
mThemeLabel(new Label(_("Gui theme"))),
mThemesModel(new ThemesModel),
mThemeDropDown(new DropDown(mThemesModel)),
- mTheme(config.getValue("theme", config.getValue("selectedSkin", ""))),
+ mTheme(config.getStringValue("theme")),
mFontsModel(new FontsModel),
mFontLabel(new Label(_("Main Font"))),
mFontDropDown(new DropDown(mFontsModel)),
@@ -344,7 +344,7 @@ void Setup_Theme::action(const gcn::ActionEvent &event)
void Setup_Theme::cancel()
{
- mTheme = config.getValue("theme", config.getValue("selectedSkin", ""));
+ mTheme = config.getStringValue("theme");
mLang = config.getStringValue("lang");
mFont = getFileName(config.getStringValue("font"));
mBoldFont = getFileName(config.getStringValue("boldFont"));
@@ -356,8 +356,7 @@ void Setup_Theme::cancel()
void Setup_Theme::apply()
{
- if (config.getValue("theme",
- config.getValue("selectedSkin", "")) != mTheme)
+ if (config.getStringValue("theme") != mTheme)
{
new OkDialog(_("Theme Changed"), _("Restart your client for "
"the change to take effect."));
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index d13f04656..4abf76eb6 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -632,15 +632,11 @@ void Theme::prepareThemePath()
mThemeName = "";
// Try theme from settings
- if (tryThemePath(config.getValue("selectedSkin", "")))
- return;
-
- // Try theme from settings
- if (tryThemePath(config.getValue("theme", "")))
+ if (tryThemePath(config.getStringValue("theme")))
return;
// Try theme from branding
- if (tryThemePath(branding.getValue("theme", "")))
+ if (tryThemePath(branding.getStringValue("theme")))
return;
if (mThemePath.empty())
diff --git a/src/utils/langs.cpp b/src/utils/langs.cpp
index bc2837a27..0b97921fa 100644
--- a/src/utils/langs.cpp
+++ b/src/utils/langs.cpp
@@ -34,7 +34,7 @@ LangVect getLang()
{
LangVect langs;
- std::string lang = config.getValue("lang", "").c_str();
+ std::string lang = config.getStringValue("lang").c_str();
if (lang.empty())
{
const char *const lng = getenv("LANG");
@@ -55,7 +55,7 @@ LangVect getLang()
std::string getLangSimple()
{
- std::string lang = config.getValue("lang", "").c_str();
+ std::string lang = config.getStringValue("lang").c_str();
if (lang.empty())
{
const char *const lng = getenv("LANG");
@@ -68,7 +68,7 @@ std::string getLangSimple()
std::string getLangShort()
{
- std::string lang = config.getValue("lang", "").c_str();
+ std::string lang = config.getStringValue("lang").c_str();
if (lang.empty())
{
const char *const lng = getenv("LANG");