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