src: added StartupProject setting to ApplicationSettings

This commit is contained in:
Eberhard Graether
2015-03-17 14:45:49 +01:00
parent ba48731c8c
commit c4ca420677
5 changed files with 22 additions and 4 deletions
@@ -6,6 +6,8 @@
<!-- COLOR: int int int int - rgba e.g. 125 125 125 255 -->
<config>
<StartupProject><!-- STRING: path to project settings xml file --></StartupProject>
<source>
<CompilerFlags>
<CompilerFlag><!-- STRING: compiler flag, including the dash e.g. -v --></CompilerFlag>
+11 -2
View File
@@ -12,7 +12,8 @@
std::shared_ptr<Application> Application::create(ViewFactory* viewFactory)
{
ApplicationSettings::getInstance()->load("data/ApplicationSettings.xml");
std::shared_ptr<ApplicationSettings> settings = ApplicationSettings::getInstance();
settings->load("data/ApplicationSettings.xml");
std::shared_ptr<Application> ptr(new Application());
@@ -26,7 +27,15 @@ std::shared_ptr<Application> Application::create(ViewFactory* viewFactory)
ptr->m_componentManager->setup(ptr->m_mainView.get());
ptr->m_mainView->loadLayout();
MessageLoadProject("data/ProjectSettings.xml").dispatch();
std::string startupProjectFilePath = settings->getStartupProjectFilePath();
if (startupProjectFilePath.size())
{
MessageLoadProject(startupProjectFilePath).dispatch();
}
else
{
LOG_WARNING("No StartupProject defined in ApplicationSettings");
}
return ptr;
}
+5
View File
@@ -16,6 +16,11 @@ ApplicationSettings::~ApplicationSettings()
{
}
std::string ApplicationSettings::getStartupProjectFilePath() const
{
return getValue<std::string>("StartupProject", "");
}
int ApplicationSettings::getCodeTabWidth() const
{
return getValue<int>("code/TabWidth", 4);
+2
View File
@@ -16,6 +16,8 @@ public:
static std::shared_ptr<ApplicationSettings> getInstance();
~ApplicationSettings();
std::string getStartupProjectFilePath() const;
// code
int getCodeTabWidth() const;
void setCodeTabWidth(int codeTabWidth);
+2 -2
View File
@@ -29,7 +29,7 @@ bool ConfigManager::getValue(const std::string& key, std::string& value) const
}
else
{
LOG_ERROR("value " + key + " is not present in config.");
LOG_WARNING("value " + key + " is not present in config.");
return false;
}
}
@@ -84,7 +84,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<std::string>&
}
else
{
LOG_ERROR("value " + key + " is not present in config.");
LOG_WARNING("value " + key + " is not present in config.");
return false;
}
}