Commit aebcc3c7 authored by Daniel Teske's avatar Daniel Teske
Browse files

Fix proFileUpdated signal

Make sure it is always emitted if the parseInProgress state changes

Change-Id: I0e8dc6df5c68f14bd51885c078e909be10af8efa
Task-Nr: QTCREATORBUG-6057
Reviewed-on: http://codereview.qt-project.org/4657

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 649b8057
......@@ -1424,7 +1424,6 @@ Qt4ProFileNode::Qt4ProFileNode(Qt4Project *project,
m_readerExact(0),
m_readerCumulative(0)
{
if (parent)
setParent(parent);
......@@ -1490,7 +1489,7 @@ QStringList Qt4ProFileNode::variableValue(const Qt4Variable var) const
return m_varValues.value(var);
}
void Qt4ProFileNode::emitProFileUpdated()
void Qt4ProFileNode::emitProFileUpdatedRecursive()
{
foreach (ProjectExplorer::NodesWatcher *watcher, watchers())
if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher))
......@@ -1498,26 +1497,36 @@ void Qt4ProFileNode::emitProFileUpdated()
foreach (ProjectNode *subNode, subProjectNodes()) {
if (Qt4ProFileNode *node = qobject_cast<Qt4ProFileNode *>(subNode)) {
node->emitProFileUpdated();
node->emitProFileUpdatedRecursive();
}
}
}
bool Qt4ProFileNode::validParse() const
void Qt4ProFileNode::setParseInProgressRecursive(bool b)
{
return m_validParse;
}
void Qt4ProFileNode::setParseInProgressRecursive()
{
m_parseInProgress = true;
setParseInProgress(b);
foreach (ProjectNode *subNode, subProjectNodes()) {
if (Qt4ProFileNode *node = qobject_cast<Qt4ProFileNode *>(subNode)) {
node->setParseInProgressRecursive();
node->setParseInProgressRecursive(b);
}
}
}
void Qt4ProFileNode::setParseInProgress(bool b)
{
if (m_parseInProgress == b)
return;
m_parseInProgress = b;
foreach (ProjectExplorer::NodesWatcher *watcher, watchers())
if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher))
emit qt4Watcher->proFileUpdated(this, m_validParse, m_parseInProgress);
}
bool Qt4ProFileNode::validParse() const
{
return m_validParse;
}
bool Qt4ProFileNode::parseInProgress() const
{
return m_parseInProgress;
......@@ -1525,8 +1534,7 @@ bool Qt4ProFileNode::parseInProgress() const
void Qt4ProFileNode::scheduleUpdate()
{
setParseInProgressRecursive();
emitProFileUpdated();
setParseInProgressRecursive(true);
m_project->scheduleAsyncUpdate(this);
}
......@@ -1541,11 +1549,7 @@ void Qt4ProFileNode::asyncUpdate()
void Qt4ProFileNode::update()
{
m_parseInProgress = true;
foreach (ProjectExplorer::NodesWatcher *watcher, watchers())
if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher))
emit qt4Watcher->proFileUpdated(this, m_validParse, m_parseInProgress);
setParseInProgressRecursive(true);
setupReader();
EvalResult evalResult = evaluate();
applyEvaluate(evalResult, false);
......@@ -1601,9 +1605,7 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async)
m_project->proFileParseError(tr("Error while parsing file %1. Giving up.").arg(m_projectFilePath));
invalidate();
}
foreach (ProjectExplorer::NodesWatcher *watcher, watchers())
if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher))
emit qt4Watcher->proFileUpdated(this, false, false);
setParseInProgressRecursive(false);
return;
}
......@@ -1857,15 +1859,11 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async)
}
} // evalResult == EvalOk
m_parseInProgress = false;
setParseInProgress(false);
createUiCodeModelSupport();
updateUiFiles();
foreach (ProjectExplorer::NodesWatcher *watcher, watchers())
if (Internal::Qt4NodesWatcher *qt4Watcher = qobject_cast<Internal::Qt4NodesWatcher*>(watcher))
emit qt4Watcher->proFileUpdated(this, true, false);
m_project->destroyProFileReader(m_readerExact);
m_project->destroyProFileReader(m_readerCumulative);
......
......@@ -358,14 +358,14 @@ public:
void update();
void scheduleUpdate();
void emitProFileUpdated();
bool validParse() const;
bool parseInProgress() const;
bool hasBuildTargets(Qt4ProjectType projectType) const;
void setParseInProgressRecursive();
void setParseInProgress(bool b);
void setParseInProgressRecursive(bool b);
void emitProFileUpdatedRecursive();
public slots:
void asyncUpdate();
......
......@@ -74,7 +74,7 @@ using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using namespace ProjectExplorer;
enum { debug = 0 };
enum { debug = 1 };
namespace Qt4ProjectManager {
namespace Internal {
......@@ -405,7 +405,7 @@ bool Qt4Project::fromMap(const QVariantMap &map)
this, SIGNAL(proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *,bool,bool)));
// Now we emit update once :)
m_rootProjectNode->emitProFileUpdated();
m_rootProjectNode->emitProFileUpdatedRecursive();
// Setup Qt versions supported (== possible targets).
......@@ -656,7 +656,7 @@ void Qt4Project::scheduleAsyncUpdate(Qt4ProFileNode *node)
return;
if (debug)
qDebug()<<"schduleAsyncUpdate (node)";
qDebug()<<"schduleAsyncUpdate (node)"<<node->path();
Q_ASSERT(m_asyncUpdateState != NoState);
if (m_cancelEvaluate) {
......@@ -692,10 +692,10 @@ void Qt4Project::scheduleAsyncUpdate(Qt4ProFileNode *node)
add = false;
break;
} else if (node->isParent(*it)) { // We already have the parent in the list, nothing to do
it = m_partialEvaluate.erase(it);
} else if ((*it)->isParent(node)) { // The node is the parent of a child already in the list
add = false;
break;
} else if ((*it)->isParent(node)) { // The node is the parent of a child already in the list
it = m_partialEvaluate.erase(it);
} else {
++it;
}
......@@ -739,8 +739,7 @@ void Qt4Project::scheduleAsyncUpdate()
m_cancelEvaluate = true;
m_asyncUpdateState = AsyncFullUpdatePending;
activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
m_rootProjectNode->setParseInProgressRecursive();
m_rootProjectNode->emitProFileUpdated();
m_rootProjectNode->setParseInProgressRecursive(true);
return;
}
......@@ -748,8 +747,7 @@ void Qt4Project::scheduleAsyncUpdate()
qDebug()<<" starting timer for full update, setting state to full update pending";
m_partialEvaluate.clear();
activeTarget()->activeQt4BuildConfiguration()->setEnabled(false);
m_rootProjectNode->setParseInProgressRecursive();
m_rootProjectNode->emitProFileUpdated();
m_rootProjectNode->setParseInProgressRecursive(true);
m_asyncUpdateState = AsyncFullUpdatePending;
m_asyncUpdateTimer.start();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment