Enable and disable parser on demand

The new approach enables the parser as soon the Tests navigation
widget or the Tests results pane is visible.
If none is displayed parsing will be disabled.

This additionally fixes an issue of not parsing a project
when having a project opened already before triggering the
first Tests navigation widget to become visible.

Change-Id: I7163268d405e07e85814097d65ff34790a98a3d1
Reviewed-by: Andre Poenitz <andre.poenitz@theqtcompany.com>
This commit is contained in:
Christian Stenger
2015-02-12 15:48:24 +01:00
parent 213a687f45
commit 223b43e9e0
8 changed files with 109 additions and 29 deletions

View File

@@ -69,6 +69,15 @@ TestCodeParser::~TestCodeParser()
clearMaps();
}
void TestCodeParser::setState(State state)
{
m_parserState = state;
if (m_parserState == Disabled) {
m_pendingUpdate = m_fullUpdatePostPoned = m_partialUpdatePostPoned = false;
m_postPonedFiles.clear();
}
}
void TestCodeParser::emitUpdateTestTree()
{
QTimer::singleShot(1000, this, SLOT(updateTestTree()));
@@ -527,6 +536,9 @@ bool TestCodeParser::postponed(const QStringList &fileList)
m_partialUpdatePostPoned = true;
}
return true;
case Disabled:
qWarning("Checking for postponing but being disabled...");
return false;
}
QTC_ASSERT(false, return false); // should not happen at all
}
@@ -565,7 +577,8 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
m_parserState = Idle;
emit parsingFinished();
break;
case Idle:
default:
qWarning("I should not be here...");
break;
}
}