From 6be207a68ace0940c16be57aa11dfdefef8eab2b Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Sun, 24 Apr 2016 22:47:39 +0200 Subject: [PATCH] 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 --- src/lib/Application.cpp | 91 ++++++++++++-- src/lib/Application.h | 1 + src/lib/Project.cpp | 112 +++++++++++++----- src/lib/Project.h | 18 ++- src/lib/component/view/MainView.cpp | 5 + src/lib/component/view/MainView.h | 4 + src/lib/data/SqliteStorage.cpp | 18 +-- src/lib/data/SqliteStorage.h | 7 +- src/lib/data/Storage.cpp | 11 +- src/lib/data/Storage.h | 3 +- src/lib/settings/ApplicationSettings.cpp | 16 ++- src/lib/settings/ApplicationSettings.h | 4 +- src/lib_gui/qt/view/QtMainView.cpp | 57 +++++++++ src/lib_gui/qt/view/QtMainView.h | 9 ++ .../project_wizzard/QtProjectWizzard.cpp | 45 ++++++- .../window/project_wizzard/QtProjectWizzard.h | 11 +- 16 files changed, 342 insertions(+), 70 deletions(-) diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp index fcc94e6d..c558cd96 100644 --- a/src/lib/Application.cpp +++ b/src/lib/Application.cpp @@ -92,7 +92,7 @@ bool Application::hasGUI() return m_hasGUI; } -void Application::loadProject(const FilePath& projectSettingsFilePath) +void Application::createAndLoadProject(const FilePath& projectSettingsFilePath) { MessageStatus("Loading Project: " + projectSettingsFilePath.str(), false, true).dispatch(); @@ -102,20 +102,63 @@ void Application::loadProject(const FilePath& projectSettingsFilePath) m_storageCache->clear(); m_project = Project::create(m_storageCache.get()); - m_project->load(projectSettingsFilePath); + loadProject(projectSettingsFilePath); if (m_hasGUI) { - m_mainView->setTitle( - "Coati - " + - projectSettingsFilePath.fileName()); - + m_mainView->setTitle("Coati - " + projectSettingsFilePath.fileName()); m_mainView->updateRecentProjectMenu(); m_mainView->hideStartScreen(); + m_componentManager->refreshViews(); } } +void Application::loadProject(const FilePath& projectSettingsFilePath) +{ + bool reparse = false; + + Project::ProjectState state = m_project->load(projectSettingsFilePath); + if (state == Project::PROJECT_OUTDATED) + { + if (m_hasGUI) + { + std::vector options; + options.push_back("Yes"); + options.push_back("No"); + int result = m_mainView->confirm( + "The project file was changed after the last analysis. The project needs to get fully reanalysed to " + "reflect the current project state. Do you want to reanalyze the project?", options); + + reparse = (result == 0); + } + } + else if (state == Project::PROJECT_OUTVERSIONED) + { + MessageStatus("Can't load project").dispatch(); + + reparse = true; + + if (m_hasGUI) + { + std::vector options; + options.push_back("Yes"); + options.push_back("No"); + int result = m_mainView->confirm( + "This project was analyzed with a different version of Coati. It needs to be fully reanalyzed to be used " + "with this version of Coati. Do you want to reanalyze the project?", options); + + reparse = (result == 0); + } + } + + if (reparse) + { + m_project->clearStorage(); + m_project->load(projectSettingsFilePath); + } +} + void Application::refreshProject() { MessageStatus("Refreshing Project").dispatch(); @@ -126,7 +169,12 @@ void Application::refreshProject() m_componentManager->refreshViews(); } - m_project->reload(); + Project::ProjectState state = m_project->reload(); + if (state != Project::PROJECT_LOADED) + { + MessageStatus("Can't refresh project").dispatch(); + loadProject(m_project->getProjectSettingsFilePath()); + } } void Application::saveProject(const FilePath& projectSettingsFilePath) @@ -156,18 +204,43 @@ void Application::handleMessage(MessageFinishedParsing* message) void Application::handleMessage(MessageLoadProject* message) { + FilePath projectSettingsFilePath(message->projectSettingsFilePath); + if (projectSettingsFilePath.empty()) + { + projectSettingsFilePath = m_project->getProjectSettingsFilePath(); + if (projectSettingsFilePath.empty()) + { + return; + } + } + if (message->forceRefresh) { + if (m_hasGUI) + { + std::vector options; + options.push_back("Yes"); + options.push_back("No"); + int result = m_mainView->confirm( + "Some settings were changed, the project needs to be fully reanalyzed. " + "Do you want to reanalyze the project?", options); + + if (result == 1) + { + return; + } + } + m_project->clearStorage(); } - else if (FilePath(message->projectSettingsFilePath) == m_project->getProjectSettingsFilePath()) + else if (projectSettingsFilePath == m_project->getProjectSettingsFilePath()) { return; } try { - loadProject(message->projectSettingsFilePath); + createAndLoadProject(projectSettingsFilePath); } catch (...) { diff --git a/src/lib/Application.h b/src/lib/Application.h index af5b4556..135812ea 100644 --- a/src/lib/Application.h +++ b/src/lib/Application.h @@ -33,6 +33,7 @@ public: ~Application(); + void createAndLoadProject(const FilePath& projectSettingsFilePath); void loadProject(const FilePath& projectSettingsFilePath); void refreshProject(); void saveProject(const FilePath& projectSettingsFilePath); diff --git a/src/lib/Project.cpp b/src/lib/Project.cpp index d0ed54dc..4a889350 100644 --- a/src/lib/Project.cpp +++ b/src/lib/Project.cpp @@ -30,29 +30,62 @@ const FilePath& Project::getProjectSettingsFilePath() const return m_projectSettingsFilepath; } -bool Project::load(const FilePath& projectSettingsFile) +Project::ProjectState Project::load(const FilePath& projectSettingsFile) { - bool success = ProjectSettings::getInstance()->load(projectSettingsFile); + m_state = PROJECT_NONE; + + bool success = true; + if (!projectSettingsFile.empty() && projectSettingsFile != m_projectSettingsFilepath) + { + success = ProjectSettings::getInstance()->load(projectSettingsFile); + } + if (success) { setProjectSettingsFilePath(projectSettingsFile); updateFileManager(); + + switch (m_state) + { + case PROJECT_NONE: + break; + + case PROJECT_EMPTY: + parseCode(); + break; + + case PROJECT_LOADED: + case PROJECT_OUTDATED: + m_storage->finishParsing(); + MessageFinishedParsing(0, 0, 0, true).dispatch(); + break; + + case PROJECT_OUTVERSIONED: + m_storage.reset(); + break; + } } - if (m_storageWasLoaded) + return m_state; +} + +Project::ProjectState Project::reload() +{ + if (m_state == PROJECT_LOADED && + FileSystem::getFileInfoForPath(m_projectSettingsFilepath).lastWriteTime > + FileSystem::getFileInfoForPath(m_storage->getDbFilePath()).lastWriteTime) { - m_storage->startParsing(); - m_storage->finishParsing(); - MessageFinishedParsing(0, 0, 0, true).dispatch(); + m_state = PROJECT_OUTDATED; } - else + else if (!m_projectSettingsFilepath.empty() && (m_state == PROJECT_EMPTY || m_state == PROJECT_LOADED)) { + ProjectSettings::getInstance()->load(m_projectSettingsFilepath); + updateFileManager(); + parseCode(); } - m_storageWasLoaded = true; - - return success; + return m_state; } bool Project::save(const FilePath& projectSettingsFile) @@ -74,25 +107,17 @@ bool Project::save(const FilePath& projectSettingsFile) return true; } -void Project::reload() -{ - if (!m_projectSettingsFilepath.empty()) - { - ProjectSettings::getInstance()->load(m_projectSettingsFilepath); - updateFileManager(); - - setProjectSettingsFilePath(m_projectSettingsFilepath); - } - - parseCode(); -} - void Project::clearStorage() { + if (m_state == PROJECT_OUTVERSIONED) + { + loadStorage(m_projectSettingsFilepath); + } + if (m_storage) { m_storage->clear(); - m_storageWasLoaded = false; + m_state = PROJECT_EMPTY; } } @@ -133,6 +158,8 @@ void Project::parseCode() )); Task::dispatch(taskGroup); + + m_state = PROJECT_LOADED; } void Project::logStats() const @@ -142,21 +169,33 @@ void Project::logStats() const void Project::setProjectSettingsFilePath(const FilePath& path) { - m_storageWasLoaded = false; - if (path.empty()) { m_storage.reset(); + m_state = PROJECT_NONE; } else { - FilePath dbPath = FilePath(path).replaceExtension("coatidb"); - m_storageWasLoaded = dbPath.exists(); + loadStorage(path); - if (!m_storage || !dbPath.exists()) + Version version = m_storage->getVersion(); + if (version.isEmpty()) { - m_storage = std::make_shared(dbPath); - m_storageWasLoaded = m_storage->init(); + m_state = PROJECT_EMPTY; + m_storage->init(); + } + else if (version.isDifferentStorageVersionThan(Version::getApplicationVersion())) + { + m_state = PROJECT_OUTVERSIONED; + m_storage.reset(); + } + else if (FileSystem::getFileInfoForPath(path).lastWriteTime > FileSystem::getFileInfoForPath(m_storage->getDbFilePath()).lastWriteTime) + { + m_state = PROJECT_OUTDATED; + } + else + { + m_state = PROJECT_LOADED; } } @@ -164,6 +203,15 @@ void Project::setProjectSettingsFilePath(const FilePath& path) m_projectSettingsFilepath = path; } +void Project::loadStorage(const FilePath& path) +{ + FilePath dbPath = FilePath(path).replaceExtension("coatidb"); + if (!m_storage || path != m_projectSettingsFilepath || !dbPath.exists()) + { + m_storage = std::make_shared(dbPath); + } +} + void Project::updateFileManager() { std::shared_ptr projSettings = ProjectSettings::getInstance(); @@ -226,6 +274,6 @@ Parser::Arguments Project::getParserArguments() const Project::Project(StorageAccessProxy* storageAccessProxy) : m_storageAccessProxy(storageAccessProxy) - , m_storageWasLoaded(false) + , m_state(PROJECT_NONE) { } diff --git a/src/lib/Project.h b/src/lib/Project.h index 32dbebbb..0f57feae 100644 --- a/src/lib/Project.h +++ b/src/lib/Project.h @@ -13,15 +13,25 @@ class StorageAccessProxy; class Project { public: + enum ProjectState + { + PROJECT_NONE, + PROJECT_EMPTY, + PROJECT_LOADED, + PROJECT_OUTDATED, + PROJECT_OUTVERSIONED + }; + static std::shared_ptr create(StorageAccessProxy* storageAccessProxy); ~Project(); const FilePath& getProjectSettingsFilePath() const; - bool load(const FilePath& projectSettingsFile); + ProjectState load(const FilePath& projectSettingsFile); + ProjectState reload(); + bool save(const FilePath& projectSettingsFile); - void reload(); void clearStorage(); @@ -35,17 +45,19 @@ private: void parseCode(); void setProjectSettingsFilePath(const FilePath& path); + void loadStorage(const FilePath& path); void updateFileManager(); Parser::Arguments getParserArguments() const; StorageAccessProxy* const m_storageAccessProxy; + ProjectState m_state; + FilePath m_projectSettingsFilepath; FileManager m_fileManager; std::shared_ptr m_storage; - bool m_storageWasLoaded; }; #endif // PROJECT_H diff --git a/src/lib/component/view/MainView.cpp b/src/lib/component/view/MainView.cpp index 046c0401..b5c8b400 100644 --- a/src/lib/component/view/MainView.cpp +++ b/src/lib/component/view/MainView.cpp @@ -7,3 +7,8 @@ MainView::MainView() MainView::~MainView() { } + +int MainView::confirm(const std::string& message) +{ + return confirm(message, std::vector()); +} diff --git a/src/lib/component/view/MainView.h b/src/lib/component/view/MainView.h index 3c32698c..f8a7c55a 100644 --- a/src/lib/component/view/MainView.h +++ b/src/lib/component/view/MainView.h @@ -2,6 +2,7 @@ #define MAIN_VIEW_H #include +#include #include "component/view/ViewLayout.h" @@ -16,6 +17,9 @@ public: virtual void setTitle(const std::string& title) = 0; virtual void activateWindow() = 0; virtual void updateRecentProjectMenu() = 0; + + virtual int confirm(const std::string& message); + virtual int confirm(const std::string& message, const std::vector& options) = 0; }; #endif // MAIN_VIEW_H diff --git a/src/lib/data/SqliteStorage.cpp b/src/lib/data/SqliteStorage.cpp index e2449dad..6579c2ce 100644 --- a/src/lib/data/SqliteStorage.cpp +++ b/src/lib/data/SqliteStorage.cpp @@ -10,9 +10,10 @@ #include "utility/utilityString.h" #include "utility/Version.h" -SqliteStorage::SqliteStorage(const std::string& dbFilePath) +SqliteStorage::SqliteStorage(const FilePath& dbFilePath) + : m_dbFilePath(dbFilePath) { - m_database.open(dbFilePath.c_str()); + m_database.open(m_dbFilePath.str().c_str()); m_database.execDML("PRAGMA foreign_keys=ON;"); } @@ -22,23 +23,17 @@ SqliteStorage::~SqliteStorage() m_database.close(); } -bool SqliteStorage::init() +void SqliteStorage::init() { Version version = getVersion(); if (version.isEmpty()) { setup(); - return false; } else if (version.isDifferentStorageVersionThan(Version::getApplicationVersion())) { clear(); - return false; - } - else - { - return true; } } @@ -71,6 +66,11 @@ void SqliteStorage::rollbackTransaction() m_database.execDML("ROLLBACK TRANSACTION;"); } +FilePath SqliteStorage::getDbFilePath() const +{ + return m_dbFilePath; +} + Version SqliteStorage::getVersion() const { std::string versionStr = getMetaValue("version"); diff --git a/src/lib/data/SqliteStorage.h b/src/lib/data/SqliteStorage.h index 7b02a4d1..29abf92f 100644 --- a/src/lib/data/SqliteStorage.h +++ b/src/lib/data/SqliteStorage.h @@ -20,10 +20,10 @@ class Version; class SqliteStorage { public: - SqliteStorage(const std::string& dbFilePath); + SqliteStorage(const FilePath& dbFilePath); ~SqliteStorage(); - bool init(); + void init(); void setup(); void clear(); @@ -31,6 +31,8 @@ public: void commitTransaction(); void rollbackTransaction(); + FilePath getDbFilePath() const; + Version getVersion() const; void setVersion(const Version& version); @@ -129,6 +131,7 @@ private: ResultType getFirstResult(const std::string& query) const; mutable CppSQLite3DB m_database; + FilePath m_dbFilePath; }; template diff --git a/src/lib/data/Storage.cpp b/src/lib/data/Storage.cpp index 6c478edd..66dc1fcb 100644 --- a/src/lib/data/Storage.cpp +++ b/src/lib/data/Storage.cpp @@ -25,7 +25,7 @@ #include "settings/ApplicationSettings.h" Storage::Storage(const FilePath& dbPath) - : m_sqliteStorage(dbPath.str()) + : m_sqliteStorage(dbPath) { } @@ -33,18 +33,23 @@ Storage::~Storage() { } +FilePath Storage::getDbFilePath() const +{ + return m_sqliteStorage.getDbFilePath(); +} + Version Storage::getVersion() const { return m_sqliteStorage.getVersion(); } -bool Storage::init() +void Storage::init() { m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ALL))); m_commandIndex.addNode(0, NameHierarchy(SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR))); m_commandIndex.finishSetup(); - return m_sqliteStorage.init(); + m_sqliteStorage.init(); } void Storage::clear() diff --git a/src/lib/data/Storage.h b/src/lib/data/Storage.h index 1d62e683..fbcf958b 100644 --- a/src/lib/data/Storage.h +++ b/src/lib/data/Storage.h @@ -22,9 +22,10 @@ public: Storage(const FilePath& dbPath); virtual ~Storage(); + FilePath getDbFilePath() const; Version getVersion() const; - bool init(); + void init(); void clear(); void clearCaches(); diff --git a/src/lib/settings/ApplicationSettings.cpp b/src/lib/settings/ApplicationSettings.cpp index b2db77fa..a4430cde 100644 --- a/src/lib/settings/ApplicationSettings.cpp +++ b/src/lib/settings/ApplicationSettings.cpp @@ -1,6 +1,7 @@ #include "settings/ApplicationSettings.h" #include "utility/ResourcePaths.h" +#include "utility/utility.h" std::shared_ptr ApplicationSettings::s_instance; @@ -14,10 +15,21 @@ std::shared_ptr ApplicationSettings::getInstance() return s_instance; } +ApplicationSettings::ApplicationSettings() +{ +} + ApplicationSettings::~ApplicationSettings() { } +bool ApplicationSettings::operator==(const ApplicationSettings& other) const +{ + return + utility::isPermutation(getHeaderSearchPaths(), other.getHeaderSearchPaths()) && + utility::isPermutation(getFrameworkSearchPaths(), other.getFrameworkSearchPaths()); +} + int ApplicationSettings::getMaxRecentProjectsCount() const { return 7; @@ -161,10 +173,6 @@ void ApplicationSettings::setCodeSnippetExpandRange(int range) setValue("code/snippet/expand_range", range); } -ApplicationSettings::ApplicationSettings() -{ -} - std::vector ApplicationSettings::getRecentProjects() const { std::vector recentProjects; diff --git a/src/lib/settings/ApplicationSettings.h b/src/lib/settings/ApplicationSettings.h index 71d18981..6e171e69 100644 --- a/src/lib/settings/ApplicationSettings.h +++ b/src/lib/settings/ApplicationSettings.h @@ -10,8 +10,11 @@ class ApplicationSettings { public: static std::shared_ptr getInstance(); + ApplicationSettings(); ~ApplicationSettings(); + bool operator==(const ApplicationSettings& other) const; + int getMaxRecentProjectsCount() const; // source @@ -77,7 +80,6 @@ public: void setLicenseCheck(const std::string& hash); private: - ApplicationSettings(); ApplicationSettings(const ApplicationSettings&); void operator=(const ApplicationSettings&); diff --git a/src/lib_gui/qt/view/QtMainView.cpp b/src/lib_gui/qt/view/QtMainView.cpp index a27013ec..69200a02 100644 --- a/src/lib_gui/qt/view/QtMainView.cpp +++ b/src/lib_gui/qt/view/QtMainView.cpp @@ -1,5 +1,10 @@ #include "qt/view/QtMainView.h" +#include +#include + +#include + #include "utility/logging/logging.h" #include "qt/window/QtMainWindow.h" @@ -12,6 +17,7 @@ QtMainView::QtMainView() , m_activateWindowFunctor(std::bind(&QtMainView::doActivateWindow, this)) , m_updateRecentProjectMenuFunctor(std::bind(&QtMainView::doUpdateRecentProjectMenu, this)) , m_forceLicenseScreenFunctor(std::bind(&QtMainView::doForceLicenseScreen, this, std::placeholders::_1)) + , m_confirmFunctor(std::bind(&QtMainView::doConfirm, this, std::placeholders::_1, std::placeholders::_2)) { m_window = std::make_shared(); m_window->show(); @@ -89,6 +95,30 @@ void QtMainView::updateRecentProjectMenu() m_updateRecentProjectMenuFunctor(); } +int QtMainView::confirm(const std::string& message, const std::vector& options) +{ + m_confirmDone = false; + + m_confirmFunctor(message, options); + + while (true) + { + { + std::lock_guard lock(m_confirmMutex); + + if (m_confirmDone) + { + break; + } + } + + const int SLEEP_TIME_MS = 25; + std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS)); + } + + return m_confirmResult; +} + void QtMainView::handleMessage(MessageForceEnterLicense* message) { m_forceLicenseScreenFunctor(message->licenseExpired); @@ -144,3 +174,30 @@ void QtMainView::doForceLicenseScreen(bool expired) { m_window->forceEnterLicense(expired); } + +void QtMainView::doConfirm(const std::string& message, const std::vector& options) +{ + QMessageBox msgBox; + msgBox.setText(message.c_str()); + + for (const std::string& option : options) + { + msgBox.addButton(option.c_str(), QMessageBox::AcceptRole); + } + + msgBox.exec(); + + m_confirmResult = -1; + + for (int i = 0; i < msgBox.buttons().size(); i++) + { + if (msgBox.clickedButton() == msgBox.buttons().at(i)) + { + m_confirmResult = i; + break; + } + } + + std::lock_guard lock(m_confirmMutex); + m_confirmDone = true; +} diff --git a/src/lib_gui/qt/view/QtMainView.h b/src/lib_gui/qt/view/QtMainView.h index 4a49a4be..9fbd813a 100644 --- a/src/lib_gui/qt/view/QtMainView.h +++ b/src/lib_gui/qt/view/QtMainView.h @@ -46,6 +46,8 @@ public: virtual void activateWindow(); virtual void updateRecentProjectMenu(); + virtual int confirm(const std::string& message, const std::vector& options); + private: void handleMessage(MessageForceEnterLicense* message); void handleMessage(MessageProjectNew* message); @@ -59,6 +61,8 @@ private: void doUpdateRecentProjectMenu(); void doForceLicenseScreen(bool expired); + void doConfirm(const std::string& message, const std::vector& options); + std::shared_ptr m_window; std::vector m_views; @@ -69,6 +73,11 @@ private: QtThreadedFunctor<> m_activateWindowFunctor; QtThreadedFunctor<> m_updateRecentProjectMenuFunctor; QtThreadedFunctor m_forceLicenseScreenFunctor; + + QtThreadedFunctor&> m_confirmFunctor; + std::mutex m_confirmMutex; + bool m_confirmDone; + int m_confirmResult; }; #endif // QT_MAIN_VIEW_H diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index 1330c23e..d718d0c5 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -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(); // 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 @@ -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(path, forceRefresh) + std::make_shared(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("", true) + ).dispatch(); + } + + cancelWizzard(); } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h index 3737441a..a93b9d30 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.h @@ -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 m_popup; + ProjectSettings m_settings; + ApplicationSettings m_appSettings; + + bool m_editing; std::shared_ptr 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<>