aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeeraj Kumar2010-07-24 22:32:08 +0000
committerNeeraj Kumar2010-07-24 22:32:08 +0000
commit184b704ddfeb9ad687c51cfa125108fcbdec863b (patch)
treef9b5c67fc49c08a77b16ef9199bb3b113d6f69c0
parentc675c1fe296f3fad5e11fca8671fa4c6cd11c3be (diff)
downloadscummvm-rg350-184b704ddfeb9ad687c51cfa125108fcbdec863b.tar.gz
scummvm-rg350-184b704ddfeb9ad687c51cfa125108fcbdec863b.tar.bz2
scummvm-rg350-184b704ddfeb9ad687c51cfa125108fcbdec863b.zip
TESTBED: removed unnecessary code from config file implementation
svn-id: r51267
-rw-r--r--engines/testbed/config.cpp52
-rw-r--r--engines/testbed/config.h2
2 files changed, 10 insertions, 44 deletions
diff --git a/engines/testbed/config.cpp b/engines/testbed/config.cpp
index 5226b63eb3..16194d90ce 100644
--- a/engines/testbed/config.cpp
+++ b/engines/testbed/config.cpp
@@ -127,50 +127,19 @@ void TestbedOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd,
}
}
-void TestbedConfigManager::initConfigFile(Common::WriteStream *ws) {
- Common::String wStr;
- // Global Params
- wStr = "[Global]\n";
- ws->writeString(wStr);
- wStr = "isSessionInteractive";
- wStr += "=";
- wStr += "true\n";
- ws->writeString(wStr);
- ws->writeString("\n");
-
- for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i < _testsuiteList.end(); i++) {
- // Construct the string
- wStr = "[";
- wStr += (*i)->getName();
- wStr += "]\n";
- ws->writeString(wStr);
- wStr = "this";
- wStr += "=";
- wStr += boolToString((*i)->isEnabled());
- wStr += "\n";
- ws->writeString(wStr);
-
- const Common::Array<Test *> &testList = (*i)->getTestList();
- for (Common::Array<Test *>::const_iterator j = testList.begin(); j != testList.end(); j++) {
- wStr = (*j)->featureName;
- wStr += "=";
- wStr += boolToString((*j)->enabled);
- wStr += "\n";
- ws->writeString(wStr);
- }
- ws->writeString("\n");
- }
+void TestbedConfigManager::initDefaultConfiguration() {
+ // Default Configuration
+ // Add Global configuration Parameters here.
+ _configFileInterface.setKey("isSessionInteractive", "Global", "true");
}
void TestbedConfigManager::writeTestbedConfigToStream(Common::WriteStream *ws) {
Common::String wStr;
for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i < _testsuiteList.end(); i++) {
- if (_configFileInterface.hasSection((*i)->getName())) {
- _configFileInterface.setKey("this", (*i)->getName(), boolToString((*i)->isEnabled()));
- const Common::Array<Test *> &testList = (*i)->getTestList();
- for (Common::Array<Test *>::const_iterator j = testList.begin(); j != testList.end(); j++) {
- _configFileInterface.setKey((*j)->featureName, (*i)->getName(), boolToString((*j)->enabled));
- }
+ _configFileInterface.setKey("this", (*i)->getName(), boolToString((*i)->isEnabled()));
+ const Common::Array<Test *> &testList = (*i)->getTestList();
+ for (Common::Array<Test *>::const_iterator j = testList.begin(); j != testList.end(); j++) {
+ _configFileInterface.setKey((*j)->featureName, (*i)->getName(), boolToString((*j)->enabled));
}
}
_configFileInterface.saveToStream(*ws);
@@ -191,10 +160,6 @@ Common::WriteStream *TestbedConfigManager::getConfigWriteStream() {
Common::FSNode gameRoot(path);
Common::FSNode config = gameRoot.getChild(_configFileName);
ws = config.createWriteStream();
- if (!config.exists()) {
- Testsuite::logPrintf("Info! No config file found, creating new one\n");
- initConfigFile(ws);
- }
return ws;
}
@@ -203,6 +168,7 @@ void TestbedConfigManager::parseConfigFile() {
if (!rs) {
Testsuite::logPrintf("Info! No config file found, using default configuration.\n");
+ initDefaultConfiguration();
return;
}
_configFileInterface.loadFromStream(*rs);
diff --git a/engines/testbed/config.h b/engines/testbed/config.h
index 8fbed858d1..2ecbf44930 100644
--- a/engines/testbed/config.h
+++ b/engines/testbed/config.h
@@ -59,7 +59,7 @@ public:
Testsuite *getTestsuiteByName(const Common::String &name);
bool stringToBool(const Common::String str) { return str.equalsIgnoreCase("true") ? true : false; }
Common::String boolToString(bool val) { return val ? "true" : "false"; }
- void initConfigFile(Common::WriteStream *ws);
+ void initDefaultConfiguration();
private:
Common::Array<Testsuite *> &_testsuiteList;
Common::String _configFileName;