ui: removed 'Save Project' and 'Save Project As' actions

* removed save actions from menu in QtMainWindow
* removed MessageSaveProject and all Listeners
* updated project loading to ask whether old project and db file should be kept at old location
* fixed crash for missing include files
* fixed simple header search within source paths was broken
This commit is contained in:
Eberhard Graether
2016-06-28 15:59:22 +02:00
parent 2cf033d43a
commit 8ca54f2091
16 changed files with 123 additions and 202 deletions
+43 -26
View File
@@ -1,5 +1,6 @@
#include "Application.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/MessageQueue.h"
#include "utility/messaging/type/MessageActivateNodes.h"
@@ -201,18 +202,6 @@ void Application::refreshProject()
}
}
void Application::saveProject(const FilePath& projectSettingsFilePath)
{
if (!m_project->save(projectSettingsFilePath))
{
LOG_ERROR("No Project Settings File defined");
}
else
{
MessageStatus("Project saved").dispatch();
}
}
void Application::handleMessage(MessageActivateWindow* message)
{
if (m_hasGUI)
@@ -248,17 +237,50 @@ void Application::handleMessage(MessageLoadProject* message)
{
if (m_hasGUI)
{
std::vector<std::string> options;
options.push_back("Yes");
options.push_back("No");
int result = m_mainView->confirm(
"Some settings were changed, the project needs to be fully reindexed. "
"Do you want to reindex the project?", options);
FilePath path = projectSettingsFilePath;
FilePath oldPath = m_project->getProjectSettingsFilePath();
if (result == 1)
if (oldPath.exists() && oldPath != path)
{
m_project->load(projectSettingsFilePath);
return;
std::vector<std::string> options;
options.push_back("Yes");
options.push_back("No");
int result = m_mainView->confirm(
"You changed the project location. The project file (.coatiproject) and the database file (.coatidb) will "
"be moved to the new location. Do you want to keep a copy of the files in the previous location?"
, options);
FilePath dbPath = FilePath(path).replaceExtension("coatidb");
FilePath olddbPath = FilePath(oldPath).replaceExtension("coatidb");
m_project = Project::create(m_storageCache.get());
if (result == 0)
{
FileSystem::copyFile(olddbPath, dbPath);
}
else
{
FileSystem::remove(oldPath);
FileSystem::rename(olddbPath, dbPath);
}
}
else
{
std::vector<std::string> options;
options.push_back("Yes");
options.push_back("No");
int result = m_mainView->confirm(
"Some settings were changed, the project needs to be fully reindexed. "
"Do you want to reindex the project?", options);
if (result == 1)
{
m_project->load(projectSettingsFilePath);
updateRecentProjects(projectSettingsFilePath);
m_mainView->setTitle("Coati - " + projectSettingsFilePath.fileName());
return;
}
}
}
@@ -301,11 +323,6 @@ void Application::handleMessage(MessageRefresh* message)
}
}
void Application::handleMessage(MessageSaveProject* message)
{
saveProject(message->projectSettingsFilePath);
}
void Application::startMessagingAndScheduling()
{
TaskScheduler::getInstance()->startSchedulerLoopThreaded();