logic: Ask user before reparsing the project
While the message box with the question is visible the ui is blocked. A message appears when: * when project was edited * when preferences were edited * when project file has more recent changes than db * when db has a different version than Coati
This commit is contained in:
@@ -30,10 +30,15 @@
|
||||
QtProjectWizzard::QtProjectWizzard(QWidget* parent)
|
||||
: QtWindowStackElement(parent)
|
||||
, m_windowStack(this)
|
||||
, m_editing(false)
|
||||
{
|
||||
connect(&m_windowStack, SIGNAL(push()), this, SLOT(windowStackChanged()));
|
||||
connect(&m_windowStack, SIGNAL(pop()), this, SLOT(windowStackChanged()));
|
||||
|
||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||
m_appSettings.setHeaderSearchPaths(appSettings->getHeaderSearchPaths());
|
||||
m_appSettings.setFrameworkSearchPaths(appSettings->getFrameworkSearchPaths());
|
||||
|
||||
m_parserManager = std::make_shared<SolutionParserManager>();
|
||||
|
||||
// wip
|
||||
@@ -166,6 +171,7 @@ void QtProjectWizzard::refreshProjectFromCompilationDatabase(const std::string&
|
||||
void QtProjectWizzard::editProject(const ProjectSettings& settings)
|
||||
{
|
||||
m_settings = settings;
|
||||
m_editing = true;
|
||||
|
||||
showSummary();
|
||||
|
||||
@@ -204,7 +210,7 @@ void QtProjectWizzard::showPreferences()
|
||||
}
|
||||
);
|
||||
|
||||
connect(window, SIGNAL(next()), this, SLOT(cancelWizzard()));
|
||||
connect(window, SIGNAL(next()), this, SLOT(savePreferences()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -304,6 +310,12 @@ void QtProjectWizzard::cancelWizzard()
|
||||
emit canceled();
|
||||
}
|
||||
|
||||
void QtProjectWizzard::finishWizzard()
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void QtProjectWizzard::windowStackChanged()
|
||||
{
|
||||
QWidget* window = m_windowStack.getTopWindow();
|
||||
@@ -602,12 +614,35 @@ void QtProjectWizzard::createProject()
|
||||
|
||||
m_settings.save(path);
|
||||
|
||||
bool forceRefresh = !(m_settings == *ProjectSettings::getInstance().get());
|
||||
bool edited = false;
|
||||
if (m_editing)
|
||||
{
|
||||
bool settingsChanged = !(m_settings == *ProjectSettings::getInstance().get());
|
||||
bool appSettingsChanged = !(m_appSettings == *ApplicationSettings::getInstance().get());
|
||||
|
||||
if (settingsChanged || appSettingsChanged)
|
||||
{
|
||||
edited = true;
|
||||
}
|
||||
}
|
||||
|
||||
MessageDispatchWhenLicenseValid(
|
||||
std::make_shared<MessageLoadProject>(path, forceRefresh)
|
||||
std::make_shared<MessageLoadProject>(path, edited)
|
||||
).dispatch();
|
||||
|
||||
m_windowStack.clearWindows();
|
||||
emit finished();
|
||||
finishWizzard();
|
||||
}
|
||||
|
||||
void QtProjectWizzard::savePreferences()
|
||||
{
|
||||
bool appSettingsChanged = !(m_appSettings == *ApplicationSettings::getInstance().get());
|
||||
|
||||
if (appSettingsChanged)
|
||||
{
|
||||
MessageDispatchWhenLicenseValid(
|
||||
std::make_shared<MessageLoadProject>("", true)
|
||||
).dispatch();
|
||||
}
|
||||
|
||||
cancelWizzard();
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSelect.h"
|
||||
#include "qt/window/QtWindowStack.h"
|
||||
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
#include "utility/solution/SolutionParserManager.h"
|
||||
|
||||
class ProjectSettings;
|
||||
class QtProjectWizzardContentSummary;
|
||||
class QtProjectWizzardWindow;
|
||||
|
||||
@@ -55,12 +57,18 @@ private:
|
||||
|
||||
QtWindowStack m_windowStack;
|
||||
std::shared_ptr<QtProjectWizzardWindow> m_popup;
|
||||
|
||||
ProjectSettings m_settings;
|
||||
ApplicationSettings m_appSettings;
|
||||
|
||||
bool m_editing;
|
||||
|
||||
std::shared_ptr<SolutionParserManager> m_parserManager;
|
||||
|
||||
private slots:
|
||||
void cancelWizzard();
|
||||
void finishWizzard();
|
||||
|
||||
void windowStackChanged();
|
||||
void popupClosed();
|
||||
|
||||
@@ -87,6 +95,7 @@ private slots:
|
||||
void showSummary();
|
||||
|
||||
void createProject();
|
||||
void savePreferences();
|
||||
};
|
||||
|
||||
template<>
|
||||
|
||||
Reference in New Issue
Block a user