diff options
Diffstat (limited to 'plugins/autotest/testtreemodel.cpp')
-rw-r--r-- | plugins/autotest/testtreemodel.cpp | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 0b21ec3cea..e707aaa052 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -51,8 +51,7 @@ TestTreeModel::TestTreeModel(QObject *parent) : m_autoTestRootItem(new TestTreeItem(tr("Auto Tests"), QString(), TestTreeItem::ROOT, m_rootItem)), m_quickTestRootItem(new TestTreeItem(tr("Qt Quick Tests"), QString(), TestTreeItem::ROOT, m_rootItem)), m_parser(new TestCodeParser(this)), - m_connectionsInitialized(false), - m_initializationCounter(0) + m_connectionsInitialized(false) { m_rootItem->appendChild(m_autoTestRootItem); m_rootItem->appendChild(m_quickTestRootItem); @@ -103,13 +102,10 @@ TestTreeModel::~TestTreeModel() void TestTreeModel::enableParsing() { - ++m_initializationCounter; - + m_parser->setState(TestCodeParser::Idle); if (m_connectionsInitialized) return; - m_parser->setState(TestCodeParser::Idle); - ProjectExplorer::SessionManager *sm = ProjectExplorer::SessionManager::instance(); connect(sm, &ProjectExplorer::SessionManager::startupProjectChanged, m_parser, &TestCodeParser::emitUpdateTestTree); @@ -126,35 +122,11 @@ void TestTreeModel::enableParsing() connect(qmlJsMM, &QmlJS::ModelManagerInterface::aboutToRemoveFiles, m_parser, &TestCodeParser::removeFiles, Qt::QueuedConnection); m_connectionsInitialized = true; - m_parser->updateTestTree(); } void TestTreeModel::disableParsing() { - if (!m_connectionsInitialized) - return; - if (--m_initializationCounter != 0) - return; - - ProjectExplorer::SessionManager *sm = ProjectExplorer::SessionManager::instance(); - disconnect(sm, &ProjectExplorer::SessionManager::startupProjectChanged, - m_parser, &TestCodeParser::emitUpdateTestTree); - - CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance(); - disconnect(cppMM, &CppTools::CppModelManager::documentUpdated, - m_parser, &TestCodeParser::onCppDocumentUpdated); - disconnect(cppMM, &CppTools::CppModelManager::aboutToRemoveFiles, - m_parser, &TestCodeParser::removeFiles); - - QmlJS::ModelManagerInterface *qmlJsMM = QmlJS::ModelManagerInterface::instance(); - disconnect(qmlJsMM, &QmlJS::ModelManagerInterface::documentUpdated, - m_parser, &TestCodeParser::onQmlDocumentUpdated); - disconnect(qmlJsMM, &QmlJS::ModelManagerInterface::aboutToRemoveFiles, - m_parser, &TestCodeParser::removeFiles); - m_parser->setState(TestCodeParser::Disabled); - - m_connectionsInitialized = false; } QModelIndex TestTreeModel::index(int row, int column, const QModelIndex &parent) const |