diff --git a/bin/app/data/projects/tictactoe/tictactoe.coatiproject b/bin/app/data/projects/tictactoe/tictactoe.coatiproject
index 2dc7a2d3..0d5532d0 100644
--- a/bin/app/data/projects/tictactoe/tictactoe.coatiproject
+++ b/bin/app/data/projects/tictactoe/tictactoe.coatiproject
@@ -6,7 +6,7 @@
- C:/Users/Manuel/FH/MSc/Masterproject/Project/bin/app/data/projects/tictactoe/src
+ ./src
diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp
index 0face452..061a34c1 100644
--- a/src/lib/Application.cpp
+++ b/src/lib/Application.cpp
@@ -88,8 +88,7 @@ void Application::loadProject(const FilePath& projectSettingsFilePath)
m_componentManager->refreshViews();
m_project = Project::create(m_storageCache.get());
- m_project->loadProjectSettings(projectSettingsFilePath);
- m_project->loadStorage();
+ m_project->loadProject(projectSettingsFilePath);
m_mainView->updateRecentProjectMenu();
}
@@ -101,13 +100,12 @@ void Application::refreshProject()
m_storageCache->clear();
m_componentManager->refreshViews();
- m_project->reloadProjectSettings();
- m_project->parseCode();
+ m_project->reloadProject();
}
void Application::saveProject(const FilePath& projectSettingsFilePath)
{
- if (!m_project->saveProjectSettings(projectSettingsFilePath))
+ if (!m_project->saveProject(projectSettingsFilePath))
{
LOG_ERROR("No Project Settings File defined");
}
diff --git a/src/lib/Project.cpp b/src/lib/Project.cpp
index e01a722c..2e6c25f1 100644
--- a/src/lib/Project.cpp
+++ b/src/lib/Project.cpp
@@ -25,7 +25,7 @@ Project::~Project()
{
}
-bool Project::loadProjectSettings(const FilePath& projectSettingsFile)
+bool Project::loadProject(const FilePath& projectSettingsFile)
{
bool success = ProjectSettings::getInstance()->load(projectSettingsFile);
if (success)
@@ -33,10 +33,24 @@ bool Project::loadProjectSettings(const FilePath& projectSettingsFile)
setProjectSettingsFilePath(projectSettingsFile);
updateFileManager();
}
+
+ if (m_storageWasLoaded)
+ {
+ m_storage->startParsing();
+ m_storage->finishParsing();
+ MessageFinishedParsing(0, 0, 0, m_storage->getErrorCount()).dispatch();
+ }
+ else
+ {
+ parseCode();
+ }
+
+ m_storageWasLoaded = true;
+
return success;
}
-bool Project::saveProjectSettings(const FilePath& projectSettingsFile)
+bool Project::saveProject(const FilePath& projectSettingsFile)
{
if (!projectSettingsFile.empty())
{
@@ -55,13 +69,17 @@ bool Project::saveProjectSettings(const FilePath& projectSettingsFile)
return true;
}
-void Project::reloadProjectSettings()
+void Project::reloadProject()
{
if (!m_projectSettingsFilepath.empty())
{
ProjectSettings::getInstance()->load(m_projectSettingsFilepath);
updateFileManager();
+
+ setProjectSettingsFilePath(m_projectSettingsFilepath);
}
+
+ parseCode();
}
void Project::clearStorage()
@@ -72,22 +90,6 @@ void Project::clearStorage()
}
}
-void Project::loadStorage()
-{
- if (m_storageWasLoaded)
- {
- m_storage->startParsing();
- m_storage->finishParsing();
- MessageFinishedParsing(0, 0, 0, m_storage->getErrorCount()).dispatch();
- }
- else
- {
- parseCode();
- }
-
- m_storageWasLoaded = true;
-}
-
void Project::parseCode()
{
if (m_projectSettingsFilepath.empty())
@@ -140,11 +142,18 @@ void Project::setProjectSettingsFilePath(const FilePath& path)
{
m_storage.reset();
}
- else if (m_projectSettingsFilepath != path)
+ else
{
FilePath dbPath = FilePath(path).replaceExtension("coatidb");
- m_storageWasLoaded = dbPath.exists();
- m_storage = std::make_shared(dbPath);
+
+ if (!m_storage || !dbPath.exists())
+ {
+ m_storage = std::make_shared(dbPath);
+ }
+ else
+ {
+ m_storageWasLoaded = true;
+ }
if (m_storageWasLoaded && m_storage->getVersion().isOlderStorageVersionThan(Version::getApplicationVersion()))
{
diff --git a/src/lib/Project.h b/src/lib/Project.h
index 2fe177e0..96a9fe93 100644
--- a/src/lib/Project.h
+++ b/src/lib/Project.h
@@ -17,14 +17,11 @@ public:
~Project();
- bool loadProjectSettings(const FilePath& projectSettingsFile);
- bool saveProjectSettings(const FilePath& projectSettingsFile);
- void reloadProjectSettings();
+ bool loadProject(const FilePath& projectSettingsFile);
+ bool saveProject(const FilePath& projectSettingsFile);
+ void reloadProject();
void clearStorage();
- void loadStorage();
-
- void parseCode();
void logStats() const;
@@ -33,6 +30,8 @@ private:
Project(const Project&);
Project operator=(const Project&);
+ void parseCode();
+
void setProjectSettingsFilePath(const FilePath& path);
void updateFileManager();