QmakeProjectManager: Improve signalling of parser state

Correctly signal when parsing of a qmake project starts and stops via
the build- and runconfigurations.

The buildconfigurations are in the picture since they disable the run buttons
when the user has selected to build before deploy and deploy before run.

Task-number: QTCREATORBUG-16172
Task-number: QTCREATORBUG-15583
Change-Id: I44b5f5ce8e145cb93dc0022f66e1edcc202875e4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Tobias Hunger
2016-11-02 12:10:18 +01:00
parent 4ed00a348b
commit 0f1f595a12
7 changed files with 54 additions and 32 deletions

View File

@@ -71,25 +71,6 @@ using namespace Utils;
enum { debug = 0 };
// -----------------------------------------------------------------------
// Helpers:
// -----------------------------------------------------------------------
namespace {
QmakeBuildConfiguration *enableActiveQmakeBuildConfiguration(Target *t, bool enabled)
{
if (!t)
return 0;
QmakeBuildConfiguration *bc = static_cast<QmakeBuildConfiguration *>(t->activeBuildConfiguration());
if (!bc)
return 0;
bc->setEnabled(enabled);
return bc;
}
} // namespace
namespace QmakeProjectManager {
namespace Internal {
@@ -603,7 +584,8 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode:
return;
}
enableActiveQmakeBuildConfiguration(activeTarget(), false);
node->setParseInProgressRecursive(true);
setAllBuildConfigurationsEnabled(false);
if (m_asyncUpdateState == AsyncFullUpdatePending) {
// Just postpone
@@ -643,7 +625,6 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode:
m_codeModelFuture.cancel();
startAsyncTimer(delay);
} else if (m_asyncUpdateState == AsyncUpdateInProgress) {
// A update is in progress
// And this slot only gets called if a file changed on disc
@@ -671,21 +652,21 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode::AsyncUpdateDelay delay)
qDebug()<<" canceling is in progress, doing nothing";
return;
}
rootProjectNode()->setParseInProgressRecursive(true);
setAllBuildConfigurationsEnabled(false);
if (m_asyncUpdateState == AsyncUpdateInProgress) {
if (debug)
qDebug()<<" update in progress, canceling and setting state to full update pending";
m_cancelEvaluate = true;
m_asyncUpdateState = AsyncFullUpdatePending;
enableActiveQmakeBuildConfiguration(activeTarget(), false);
rootProjectNode()->setParseInProgressRecursive(true);
return;
}
if (debug)
qDebug()<<" starting timer for full update, setting state to full update pending";
m_partialEvaluate.clear();
enableActiveQmakeBuildConfiguration(activeTarget(), false);
rootProjectNode()->setParseInProgressRecursive(true);
m_asyncUpdateState = AsyncFullUpdatePending;
// Cancel running code model update
@@ -734,11 +715,14 @@ void QmakeProject::decrementPendingEvaluateFutures()
if (m_asyncUpdateState == AsyncFullUpdatePending || m_asyncUpdateState == AsyncPartialUpdatePending) {
if (debug)
qDebug()<<" Oh update is pending start the timer";
rootProjectNode()->setParseInProgressRecursive(true);
setAllBuildConfigurationsEnabled(false);
startAsyncTimer(QmakeProFileNode::ParseLater);
} else if (m_asyncUpdateState != ShuttingDown){
// After being done, we need to call:
setAllBuildConfigurationsEnabled(true);
m_asyncUpdateState = Base;
enableActiveQmakeBuildConfiguration(activeTarget(), true);
updateFileList();
updateCodeModels();
updateBuildSystemData();
@@ -1071,6 +1055,17 @@ void QmakeProject::activeTargetWasChanged()
scheduleAsyncUpdate();
}
void QmakeProject::setAllBuildConfigurationsEnabled(bool enabled)
{
foreach (Target *t, targets()) {
foreach (BuildConfiguration *bc, t->buildConfigurations()) {
auto qmakeBc = qobject_cast<QmakeBuildConfiguration *>(bc);
if (qmakeBc)
qmakeBc->setEnabled(enabled);
}
}
}
bool QmakeProject::hasSubNode(QmakePriFileNode *root, const FileName &path)
{
if (root->filePath() == path)