aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/autotest/autotestplugin.cpp1
-rw-r--r--src/plugins/autotest/testcodeparser.cpp26
-rw-r--r--src/plugins/autotest/testcodeparser.h6
-rw-r--r--src/plugins/autotest/testnavigationwidget.cpp2
-rw-r--r--src/plugins/autotest/testtreemodel.cpp5
5 files changed, 18 insertions, 22 deletions
diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp
index 976bee11c8..f6e12685fb 100644
--- a/src/plugins/autotest/autotestplugin.cpp
+++ b/src/plugins/autotest/autotestplugin.cpp
@@ -178,6 +178,7 @@ void AutotestPlugin::onRunSelectedTriggered()
void AutotestPlugin::updateMenuItemsEnabledState()
{
const bool enabled = !TestRunner::instance()->isTestRunning()
+ && TestTreeModel::instance()->parser()->enabled()
&& TestTreeModel::instance()->parser()->state() == TestCodeParser::Idle;
const bool hasTests = TestTreeModel::instance()->hasTests();
diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp
index bc0845411b..dadae37de8 100644
--- a/src/plugins/autotest/testcodeparser.cpp
+++ b/src/plugins/autotest/testcodeparser.cpp
@@ -81,7 +81,7 @@ TestCodeParser::~TestCodeParser()
void TestCodeParser::setState(State state)
{
- if (m_parserState == Shutdown)
+ if (m_parserState == Shutdown || !m_enabled)
return;
qCDebug(LOG) << "setState(" << state << "), currentState:" << m_parserState;
// avoid triggering parse before code model parsing has finished, but mark as dirty
@@ -91,17 +91,13 @@ void TestCodeParser::setState(State state)
return;
}
- if ((state == Disabled || state == Idle)
- && (m_parserState == PartialParse || m_parserState == FullParse)) {
+ if ((state == Idle) && (m_parserState == PartialParse || m_parserState == FullParse)) {
qCDebug(LOG) << "Not setting state, parse is running";
return;
}
m_parserState = state;
- if (m_parserState == Disabled) {
- m_fullUpdatePostponed = m_partialUpdatePostponed = false;
- m_postponedFiles.clear();
- } else if (m_parserState == Idle && ProjectExplorer::SessionManager::startupProject()) {
+ if (m_parserState == Idle && ProjectExplorer::SessionManager::startupProject()) {
if (m_fullUpdatePostponed || m_dirty) {
emitUpdateTestTree();
} else if (m_partialUpdatePostponed) {
@@ -115,7 +111,7 @@ void TestCodeParser::setState(State state)
void TestCodeParser::syncTestFrameworks(const QVector<Core::Id> &frameworkIds)
{
- if (m_parserState != Disabled && m_parserState != Idle) {
+ if (m_enabled && m_parserState != Idle) {
// there's a running parse
m_fullUpdatePostponed = m_partialUpdatePostponed = false;
m_postponedFiles.clear();
@@ -129,7 +125,7 @@ void TestCodeParser::syncTestFrameworks(const QVector<Core::Id> &frameworkIds)
QTC_ASSERT(testParser, continue);
m_testCodeParsers.append(testParser);
}
- if (m_parserState != Disabled)
+ if (m_enabled)
updateTestTree();
}
@@ -211,7 +207,7 @@ void TestCodeParser::onProjectPartsUpdated(ProjectExplorer::Project *project)
{
if (project != ProjectExplorer::SessionManager::startupProject())
return;
- if (m_codeModelParsing || m_parserState == Disabled)
+ if (m_codeModelParsing || !m_enabled)
m_fullUpdatePostponed = true;
else
emitUpdateTestTree();
@@ -276,7 +272,6 @@ bool TestCodeParser::postponed(const QStringList &fileList)
m_partialUpdatePostponed = true;
}
return true;
- case Disabled:
case Shutdown:
break;
}
@@ -297,7 +292,9 @@ static void parseFileForTests(const QVector<ITestParser *> &parsers,
void TestCodeParser::scanForTests(const QStringList &fileList)
{
- if (m_parserState == Disabled || m_parserState == Shutdown) {
+ if (m_parserState == Shutdown)
+ return;
+ if (!m_enabled) {
m_dirty = true;
if (fileList.isEmpty()) {
m_fullUpdatePostponed = true;
@@ -419,11 +416,6 @@ void TestCodeParser::onFinished()
}
m_dirty = false;
break;
- case Disabled: // can happen if all Test related widgets become hidden while parsing
- qCDebug(LOG) << "emitting parsingFinished (onFinished, Disabled)";
- emit parsingFinished();
- qCDebug(LOG) << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << "ParsingFin";
- break;
case Shutdown:
qCDebug(LOG) << "Shutdown complete - not emitting parsingFinished (onFinished)";
break;
diff --git a/src/plugins/autotest/testcodeparser.h b/src/plugins/autotest/testcodeparser.h
index 9967c3d08b..2c68d143f2 100644
--- a/src/plugins/autotest/testcodeparser.h
+++ b/src/plugins/autotest/testcodeparser.h
@@ -49,7 +49,6 @@ public:
Idle,
PartialParse,
FullParse,
- Disabled,
Shutdown
};
@@ -57,6 +56,8 @@ public:
virtual ~TestCodeParser();
void setState(State state);
State state() const { return m_parserState; }
+ void setEnabled(bool enabled) { m_enabled = enabled; }
+ bool enabled() const { return m_enabled; }
bool isParsing() const { return m_parserState == PartialParse || m_parserState == FullParse; }
void setDirty() { m_dirty = true; }
void syncTestFrameworks(const QVector<Core::Id> &frameworkIds);
@@ -95,6 +96,7 @@ private:
TestTreeModel *m_model;
+ bool m_enabled = false;
bool m_codeModelParsing = false;
bool m_fullUpdatePostponed = false;
bool m_partialUpdatePostponed = false;
@@ -102,7 +104,7 @@ private:
bool m_singleShotScheduled = false;
bool m_reparseTimerTimedOut = false;
QSet<QString> m_postponedFiles;
- State m_parserState = Disabled;
+ State m_parserState = Idle;
QFutureWatcher<TestParseResultPtr> m_futureWatcher;
QVector<ITestParser *> m_testCodeParsers; // ptrs are still owned by TestFrameworkManager
QTimer m_reparseTimer;
diff --git a/src/plugins/autotest/testnavigationwidget.cpp b/src/plugins/autotest/testnavigationwidget.cpp
index 4618520019..1972638714 100644
--- a/src/plugins/autotest/testnavigationwidget.cpp
+++ b/src/plugins/autotest/testnavigationwidget.cpp
@@ -115,7 +115,7 @@ TestNavigationWidget::~TestNavigationWidget()
void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
{
const bool enabled = !TestRunner::instance()->isTestRunning()
- && m_model->parser()->state() == TestCodeParser::Idle;
+ && m_model->parser()->enabled() && m_model->parser()->state() == TestCodeParser::Idle;
const bool hasTests = m_model->hasTests();
QMenu menu;
diff --git a/src/plugins/autotest/testtreemodel.cpp b/src/plugins/autotest/testtreemodel.cpp
index 62b801d503..6aba8e413c 100644
--- a/src/plugins/autotest/testtreemodel.cpp
+++ b/src/plugins/autotest/testtreemodel.cpp
@@ -90,6 +90,7 @@ void TestTreeModel::setupParsingConnections()
if (!m_connectionsInitialized)
m_parser->setDirty();
+ m_parser->setEnabled(true);
m_parser->setState(TestCodeParser::Idle);
if (m_connectionsInitialized)
return;
@@ -117,13 +118,13 @@ void TestTreeModel::setupParsingConnections()
void TestTreeModel::disableParsing()
{
if (!m_refCounter.deref() && !AutotestPlugin::instance()->settings()->alwaysParse)
- m_parser->setState(TestCodeParser::Disabled);
+ m_parser->setEnabled(false);
}
void TestTreeModel::disableParsingFromSettings()
{
if (!m_refCounter.load())
- m_parser->setState(TestCodeParser::Disabled);
+ m_parser->setEnabled(false);
}
bool TestTreeModel::setData(const QModelIndex &index, const QVariant &value, int role)