summaryrefslogtreecommitdiff
path: root/src/configuration.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-24 05:32:41 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-24 05:32:41 +0300
commit65d6e86c20604e76ac0de46e54bf5571c570fd53 (patch)
treea9487422a0a2e1a7be8db5a1ade415b8011dfe0f /src/configuration.cpp
parentccb35758a391807322265994b1712c8d7ed2d16c (diff)
downloadmanaverse-65d6e86c20604e76ac0de46e54bf5571c570fd53.tar.gz
manaverse-65d6e86c20604e76ac0de46e54bf5571c570fd53.tar.bz2
manaverse-65d6e86c20604e76ac0de46e54bf5571c570fd53.tar.xz
manaverse-65d6e86c20604e76ac0de46e54bf5571c570fd53.zip
Add reset yellow bar command to bars context menu.
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r--src/configuration.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 6755e0a4f..04acbce28 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -196,6 +196,30 @@ int Configuration::getIntValue(const std::string &key) const
return defaultValue;
}
+int Configuration::resetIntValue(const std::string &key)
+{
+ GETLOG();
+ int defaultValue = 0;
+ if (mDefaultsData)
+ {
+ DefaultsData::const_iterator itdef = mDefaultsData->find(key);
+
+ if (itdef != mDefaultsData->end() && itdef->second
+ && itdef->second->getType() == Mana::VariableData::DATA_INT)
+ {
+ defaultValue = (static_cast<Mana::IntData*>(
+ itdef->second))->getData();
+ }
+ else
+ {
+ logger->log("%s: No integer value in registry for key %s",
+ mConfigPath.c_str(), key.c_str());
+ }
+ }
+ setValue(key, defaultValue);
+ return defaultValue;
+}
+
std::string Configuration::getStringValue(const std::string &key) const
{
GETLOG();
@@ -291,6 +315,31 @@ bool Configuration::getBoolValue(const std::string &key) const
return defaultValue;
}
+bool Configuration::resetBoolValue(const std::string &key)
+{
+ GETLOG();
+ bool defaultValue = false;
+ if (mDefaultsData)
+ {
+ DefaultsData::const_iterator itdef = mDefaultsData->find(key);
+
+ if (itdef != mDefaultsData->end() && itdef->second
+ && itdef->second->getType() == Mana::VariableData::DATA_BOOL)
+ {
+ defaultValue = (static_cast<Mana::BoolData*>(
+ itdef->second))->getData();
+ }
+ else
+ {
+ logger->log("%s: No boolean value in registry for key %s",
+ mConfigPath.c_str(), key.c_str());
+ }
+ }
+
+ setValue(key, defaultValue);
+ return defaultValue;
+}
+
void ConfigurationObject::initFromXML(xmlNodePtr parent_node)
{
clear();