From 9916c0a759604d71f454db7ce62bfec305a6b280 Mon Sep 17 00:00:00 2001 From: Claus Steuer Date: Sun, 16 Jul 2017 10:05:21 +0200 Subject: [PATCH] CMake: Do not check for changes if config was changed by the user When the cmake configuration changes, BuildDirManager checks whether the new configuration differs from the current configuration. In case of differences a dialog is opened and the user must decide if the changes shall be applied or rejected. When the user changes the cmake configuration in the projects page the dialog will open as well. This is unencessary since the user already decided to apply the changes. Let BuildDirManager not check for changes if the configuration was changed by the user via the projects page. Change-Id: I736ee7f4dee99fe707f2931c73b287231b1daa1d Reviewed-by: Tobias Hunger --- .../cmakeprojectmanager/builddirmanager.cpp | 17 ++++++++++++++--- .../cmakeprojectmanager/builddirmanager.h | 4 +++- .../cmakebuildconfiguration.cpp | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.cpp b/src/plugins/cmakeprojectmanager/builddirmanager.cpp index 71fccc5df8c..2a28093c1fc 100644 --- a/src/plugins/cmakeprojectmanager/builddirmanager.cpp +++ b/src/plugins/cmakeprojectmanager/builddirmanager.cpp @@ -125,13 +125,14 @@ void BuildDirManager::updateReaderData() m_reader->setParameters(p); } -void BuildDirManager::parseOnceReaderReady(bool force) +void BuildDirManager::parseOnceReaderReady(bool force, bool checkForChanges) { TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM); m_buildTargets.clear(); m_cmakeCache.clear(); - checkConfiguration(); + if (checkForChanges) + checkConfiguration(); m_reader->stop(); m_reader->parse(force); } @@ -223,6 +224,16 @@ void BuildDirManager::becameDirty() } void BuildDirManager::forceReparse() +{ + forceReparseImpl(true); +} + +void BuildDirManager::forceReparseWithoutCheckingForChanges() +{ + forceReparseImpl(false); +} + +void BuildDirManager::forceReparseImpl(bool checkForChanges) { QTC_ASSERT(!m_isHandlingError, return); @@ -233,7 +244,7 @@ void BuildDirManager::forceReparse() QTC_ASSERT(tool, return); m_reader.reset(); // Force reparse by forcing in a new reader - updateReaderType([this]() { parseOnceReaderReady(true); }); + updateReaderType([this, checkForChanges]() { parseOnceReaderReady(true, checkForChanges); }); } void BuildDirManager::resetData() diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.h b/src/plugins/cmakeprojectmanager/builddirmanager.h index f0381970ab8..489ca67ff7f 100644 --- a/src/plugins/cmakeprojectmanager/builddirmanager.h +++ b/src/plugins/cmakeprojectmanager/builddirmanager.h @@ -64,6 +64,7 @@ public: void clearCache(); void forceReparse(); + void forceReparseWithoutCheckingForChanges(); void maybeForceReparse(); // Only reparse if the configuration has changed... void resetData(); bool updateCMakeStateBeforeBuild(); @@ -96,7 +97,8 @@ private: void updateReaderType(std::function todo); void updateReaderData(); - void parseOnceReaderReady(bool force); + void forceReparseImpl(bool checkForChanges); + void parseOnceReaderReady(bool force, bool checkForChanges = true); void maybeForceReparseOnceReaderReady(); void parse(); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index b4113c53fdc..ef828919faa 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -346,7 +346,7 @@ void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QListforceReparse(); + m_buildDirManager->forceReparseWithoutCheckingForChanges(); } void CMakeBuildConfiguration::clearError(ForceEnabledChanged fec)