locig: refresh after edit project
* implemented saving project settings force-refreshes the project if something has changed. * when nothing has changed while editing the project settings, the project is not refreshed anymore. * new project window is cleared now before it is displayed.
This commit is contained in:
@@ -42,7 +42,7 @@ std::shared_ptr<Application> Application::create(
|
||||
std::string startupProjectFilePath = ApplicationSettings::getInstance()->getStartupProjectFilePath();
|
||||
if (startupProjectFilePath.size())
|
||||
{
|
||||
MessageLoadProject(startupProjectFilePath).dispatch();
|
||||
MessageLoadProject(startupProjectFilePath, false).dispatch();
|
||||
ptr->m_mainView->hideStartScreen();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ Application::~Application()
|
||||
m_mainView->saveLayout();
|
||||
}
|
||||
|
||||
void Application::loadProject(const FilePath& projectSettingsFilePath)
|
||||
void Application::loadProject(const FilePath& projectSettingsFilePath, bool forceRefresh)
|
||||
{
|
||||
MessageStatus("Loading Project: " + projectSettingsFilePath.str()).dispatch();
|
||||
|
||||
@@ -88,7 +88,7 @@ void Application::loadProject(const FilePath& projectSettingsFilePath)
|
||||
m_componentManager->refreshViews();
|
||||
|
||||
m_project = Project::create(m_storageCache.get());
|
||||
m_project->loadProject(projectSettingsFilePath);
|
||||
m_project->load(projectSettingsFilePath, forceRefresh);
|
||||
|
||||
m_mainView->updateRecentProjectMenu();
|
||||
m_mainView->hideStartScreen();
|
||||
@@ -101,12 +101,12 @@ void Application::refreshProject()
|
||||
m_storageCache->clear();
|
||||
m_componentManager->refreshViews();
|
||||
|
||||
m_project->reloadProject();
|
||||
m_project->reload();
|
||||
}
|
||||
|
||||
void Application::saveProject(const FilePath& projectSettingsFilePath)
|
||||
{
|
||||
if (!m_project->saveProject(projectSettingsFilePath))
|
||||
if (!m_project->save(projectSettingsFilePath))
|
||||
{
|
||||
LOG_ERROR("No Project Settings File defined");
|
||||
}
|
||||
@@ -138,7 +138,7 @@ void Application::handleMessage(MessageFinishedParsing* message)
|
||||
|
||||
void Application::handleMessage(MessageLoadProject* message)
|
||||
{
|
||||
loadProject(message->projectSettingsFilePath);
|
||||
loadProject(message->projectSettingsFilePath, message->forceRefresh);
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageRefresh* message)
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
|
||||
~Application();
|
||||
|
||||
void loadProject(const FilePath& projectSettingsFilePath);
|
||||
void loadProject(const FilePath& projectSettingsFilePath, bool forceRefresh);
|
||||
void refreshProject();
|
||||
void saveProject(const FilePath& projectSettingsFilePath);
|
||||
|
||||
|
||||
+9
-3
@@ -25,7 +25,7 @@ Project::~Project()
|
||||
{
|
||||
}
|
||||
|
||||
bool Project::loadProject(const FilePath& projectSettingsFile)
|
||||
bool Project::load(const FilePath& projectSettingsFile, bool forceRefresh)
|
||||
{
|
||||
bool success = ProjectSettings::getInstance()->load(projectSettingsFile);
|
||||
if (success)
|
||||
@@ -34,6 +34,12 @@ bool Project::loadProject(const FilePath& projectSettingsFile)
|
||||
updateFileManager();
|
||||
}
|
||||
|
||||
if (forceRefresh)
|
||||
{
|
||||
clearStorage();
|
||||
m_storageWasLoaded = false;
|
||||
}
|
||||
|
||||
if (m_storageWasLoaded)
|
||||
{
|
||||
m_storage->startParsing();
|
||||
@@ -50,7 +56,7 @@ bool Project::loadProject(const FilePath& projectSettingsFile)
|
||||
return success;
|
||||
}
|
||||
|
||||
bool Project::saveProject(const FilePath& projectSettingsFile)
|
||||
bool Project::save(const FilePath& projectSettingsFile)
|
||||
{
|
||||
if (!projectSettingsFile.empty())
|
||||
{
|
||||
@@ -69,7 +75,7 @@ bool Project::saveProject(const FilePath& projectSettingsFile)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Project::reloadProject()
|
||||
void Project::reload()
|
||||
{
|
||||
if (!m_projectSettingsFilepath.empty())
|
||||
{
|
||||
|
||||
+3
-3
@@ -17,9 +17,9 @@ public:
|
||||
|
||||
~Project();
|
||||
|
||||
bool loadProject(const FilePath& projectSettingsFile);
|
||||
bool saveProject(const FilePath& projectSettingsFile);
|
||||
void reloadProject();
|
||||
bool load(const FilePath& projectSettingsFile, bool forceRefresh);
|
||||
bool save(const FilePath& projectSettingsFile);
|
||||
void reload();
|
||||
|
||||
void clearStorage();
|
||||
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
class MessageLoadProject: public Message<MessageLoadProject>
|
||||
{
|
||||
public:
|
||||
MessageLoadProject(const std::string& filePath)
|
||||
MessageLoadProject(const std::string& filePath, bool forceRefresh)
|
||||
: projectSettingsFilePath(filePath)
|
||||
, forceRefresh(forceRefresh)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -18,10 +19,11 @@ public:
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
{
|
||||
os << projectSettingsFilePath;
|
||||
os << projectSettingsFilePath << ", forceRefresh: " << std::boolalpha << forceRefresh;
|
||||
}
|
||||
|
||||
const std::string projectSettingsFilePath;
|
||||
const bool forceRefresh;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_LOAD_PROJECT_H
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef UTILITY_H
|
||||
#define UTILITY_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <set>
|
||||
#include <time.h>
|
||||
@@ -35,6 +36,12 @@ namespace utility
|
||||
template<typename T>
|
||||
std::vector<std::string> toStrings(const std::vector<T>& d);
|
||||
|
||||
template<typename T>
|
||||
bool isPermutation(const std::vector<T>& a, const std::vector<T>& b)
|
||||
{
|
||||
return std::is_permutation(a.begin(), a.end(), b.begin());
|
||||
}
|
||||
|
||||
bool intersectionPoint(Vec2f a1, Vec2f b1, Vec2f a2, Vec2f b2, Vec2f* i);
|
||||
|
||||
size_t digits(size_t n);
|
||||
|
||||
Reference in New Issue
Block a user