QmakeProject: Fix renaming waits 3s for reparse

Task-number: QTCREATORBUG-13176
Change-Id: Id19a08f254dfa844d4adff0baafa29986a515823
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Daniel Teske
2014-10-24 12:43:14 +02:00
parent 4b98dee0c5
commit 454096b9e3
4 changed files with 27 additions and 17 deletions

View File

@@ -358,7 +358,7 @@ QmakeProject::QmakeProject(QmakeManager *manager, const QString &fileName) :
setRequiredKitMatcher(QtSupport::QtKitInformation::qtVersionMatcher());
m_asyncUpdateTimer.setSingleShot(true);
m_asyncUpdateTimer.setInterval(0); // will be increased after first parse
m_asyncUpdateTimer.setInterval(3000);
connect(&m_asyncUpdateTimer, SIGNAL(timeout()), this, SLOT(asyncUpdate()));
connect(BuildManager::instance(), SIGNAL(buildQueueFinished(bool)),
@@ -430,7 +430,7 @@ bool QmakeProject::fromMap(const QVariantMap &map)
connect(this, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
this, SLOT(activeTargetWasChanged()));
scheduleAsyncUpdate();
scheduleAsyncUpdate(QmakeProFileNode::ParseNow);
return true;
}
@@ -665,7 +665,7 @@ void QmakeProject::updateRunConfigurations()
activeTarget()->updateDefaultRunConfigurations();
}
void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node)
void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode::AsyncUpdateDelay delay)
{
if (m_asyncUpdateState == ShuttingDown)
return;
@@ -688,7 +688,7 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node)
// Just postpone
if (debug)
qDebug()<<" full update pending, restarting timer";
m_asyncUpdateTimer.start();
startAsyncTimer(delay);
} else if (m_asyncUpdateState == AsyncPartialUpdatePending
|| m_asyncUpdateState == Base) {
if (debug)
@@ -717,11 +717,12 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node)
if (add)
m_partialEvaluate.append(node);
// and start the timer anew
m_asyncUpdateTimer.start();
// Cancel running code model update
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
@@ -732,11 +733,11 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node)
// even if that's not really needed
if (debug)
qDebug()<<" Async update in progress, scheduling new one afterwards";
scheduleAsyncUpdate();
scheduleAsyncUpdate(delay);
}
}
void QmakeProject::scheduleAsyncUpdate()
void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode::AsyncUpdateDelay delay)
{
if (debug)
qDebug()<<"scheduleAsyncUpdate";
@@ -765,12 +766,18 @@ void QmakeProject::scheduleAsyncUpdate()
enableActiveQmakeBuildConfiguration(activeTarget(), false);
m_rootProjectNode->setParseInProgressRecursive(true);
m_asyncUpdateState = AsyncFullUpdatePending;
m_asyncUpdateTimer.start();
// Cancel running code model update
m_codeModelFuture.cancel();
startAsyncTimer(delay);
}
void QmakeProject::startAsyncTimer(QmakeProFileNode::AsyncUpdateDelay delay)
{
m_asyncUpdateTimer.stop();
m_asyncUpdateTimer.setInterval(qMin(m_asyncUpdateTimer.interval(), delay == QmakeProFileNode::ParseLater ? 3000 : 0));
m_asyncUpdateTimer.start();
}
void QmakeProject::incrementPendingEvaluateFutures()
{
@@ -806,7 +813,7 @@ void QmakeProject::decrementPendingEvaluateFutures()
if (m_asyncUpdateState == AsyncFullUpdatePending || m_asyncUpdateState == AsyncPartialUpdatePending) {
if (debug)
qDebug()<<" Oh update is pending start the timer";
m_asyncUpdateTimer.start();
startAsyncTimer(QmakeProFileNode::ParseLater);
} else if (m_asyncUpdateState != ShuttingDown){
// After being done, we need to call:
m_asyncUpdateState = Base;
@@ -1190,7 +1197,7 @@ void QmakeProject::notifyChanged(const QString &name)
findProFile(name, rootQmakeProjectNode(), list);
foreach (QmakeProFileNode *node, list) {
QtSupport::ProFileCacheManager::instance()->discardFile(name);
node->scheduleUpdate();
node->scheduleUpdate(QmakeProFileNode::ParseNow);
}
}
}