AutoTest: Fix handling of enabled state for code parser

Avoid unintentional re-enabling of the code parser.
Handling of the enabled state broke several times before,
therefore separate it from other states of the parser to
avoid breaking it again when not taking enough care while
refactoring or adding features related to states.

Change-Id: If1eb0dd649225f10bfc3bf06f09851649da75983
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2016-11-08 16:00:21 +01:00
parent b5f587efb5
commit f967545c5a
5 changed files with 18 additions and 22 deletions

View File

@@ -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;