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 <tobias.hunger@qt.io>
This commit is contained in:
Claus Steuer
2017-07-16 10:05:21 +02:00
parent bf10378992
commit 9916c0a759
3 changed files with 18 additions and 5 deletions

View File

@@ -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()

View File

@@ -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<void()> todo);
void updateReaderData();
void parseOnceReaderReady(bool force);
void forceReparseImpl(bool checkForChanges);
void parseOnceReaderReady(bool force, bool checkForChanges = true);
void maybeForceReparseOnceReaderReady();
void parse();

View File

@@ -346,7 +346,7 @@ void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QList<ConfigMod
const CMakeConfig config = cmakeConfiguration() + newConfig;
setCMakeConfiguration(config);
m_buildDirManager->forceReparse();
m_buildDirManager->forceReparseWithoutCheckingForChanges();
}
void CMakeBuildConfiguration::clearError(ForceEnabledChanged fec)