From d2bd092b47c8d4f81855228d158cc1b81ead8c00 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 9 Nov 2009 13:53:28 +0100 Subject: Code model: Fix Windows issues (duplicate matches). Ensure the code model receives file names with clean paths ('/') and fix paths in the relevant places of the code model. Pass on clean paths from Cpp reference find and display them correctly in the search window tooltip. Reviewed-by: Roberto Raggi --- src/plugins/cpptools/cppmodelmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/cpptools/cppmodelmanager.cpp') diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 5adc395870..5cae6bdeaf 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -532,7 +532,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type, return; QString contents = tryIncludeFile(fileName, type); - + fileName = QDir::cleanPath(fileName); if (m_currentDoc) { m_currentDoc->addIncludeFile(fileName, line); -- cgit v1.2.1 From 7aa24116935249a840e1350a6f8de73bc794fb09 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 9 Nov 2009 15:57:56 +0100 Subject: Code model: Update on changes from the versioning system. Add state logic to CppCodeModelManagerInterface, making it aware whether an indexer is running, protect the update methods from another invocation while running. Add changed signals to IVersionControl and VCSManager and wire them to the update methods. Add a menu action for manually updating. Reviewed-by: Roberto Raggi Reviewed-by: con --- src/plugins/cpptools/cppmodelmanager.cpp | 41 +++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'src/plugins/cpptools/cppmodelmanager.cpp') diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 5cae6bdeaf..6a49051840 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -595,6 +595,8 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) void CppTools::CppModelManagerInterface::updateModifiedSourceFiles() { + if (isIndexing()) + return; const Snapshot snapshot = this->snapshot(); QStringList sourceFiles; @@ -630,7 +632,8 @@ CppTools::CppModelManagerInterface *CppTools::CppModelManagerInterface::instance */ CppModelManager::CppModelManager(QObject *parent) - : CppModelManagerInterface(parent) + : CppModelManagerInterface(parent), + m_indexing(false) { m_findReferences = new CppFindReferences(this); @@ -675,6 +678,11 @@ CppModelManager::CppModelManager(QObject *parent) connect(m_core->editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)), this, SLOT(editorAboutToClose(Core::IEditor *))); + + connect(m_core->progressManager(), SIGNAL(taskStarted(QString)), + this, SLOT(onTaskStarted(QString))); + connect(m_core->progressManager(), SIGNAL(allTasksFinished(QString)), + this, SLOT(onAllTasksFinished(QString))); } CppModelManager::~CppModelManager() @@ -871,7 +879,7 @@ QStringList CppModelManager::includesInPath(const QString &path) const QFuture CppModelManager::refreshSourceFiles(const QStringList &sourceFiles) { - if (! sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { + if (!m_indexing && !sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { const QMap workingCopy = buildWorkingCopyList(); CppPreprocessor *preproc = new CppPreprocessor(this); @@ -897,7 +905,7 @@ QFuture CppModelManager::refreshSourceFiles(const QStringList &sourceFiles m_synchronizer.addFuture(result); - if (sourceFiles.count() > 1) { + if (sourceFiles.count() > 1) { m_core->progressManager()->addTask(result, tr("Indexing"), CppTools::Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess); @@ -1391,4 +1399,31 @@ void CppModelManager::GC() protectSnapshot.unlock(); } +bool CppModelManager::isIndexing() const +{ + return m_indexing; +} + +void CppModelManager::setIndexing(bool v) +{ + if (m_indexing == v) + return; + m_indexing = v; + if (v) { + emit indexingStarted(); + } else { + emit indexingFinished(); + } +} + +void CppModelManager::onTaskStarted(const QString &type) +{ + if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) + setIndexing(true); +} +void CppModelManager::onAllTasksFinished(const QString &type) +{ + if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) + setIndexing(false); +} -- cgit v1.2.1 From 6a9e7ab0f4963eed3edec4985e24e4c005c43a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 10 Nov 2009 17:33:44 +0100 Subject: Fixed the direction in which include paths are traversed Reviewed-by: Roberto Raggi --- src/plugins/cpptools/cppmodelmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/cpptools/cppmodelmanager.cpp') diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 6a49051840..b0f3838a4e 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -379,8 +379,8 @@ QString CppPreprocessor::tryIncludeFile(QString &fileName, IncludeType type) } } - foreach (const QString &includePath, m_includePaths) { - QString path = includePath; + for (int i = m_includePaths.size() - 1; i != -1; --i) { + QString path = m_includePaths.at(i); path += QLatin1Char('/'); path += fileName; path = QDir::cleanPath(path); -- cgit v1.2.1 From e4b1a25dd2bb8233a02c7ae5a5476e88ac4f0451 Mon Sep 17 00:00:00 2001 From: con Date: Tue, 10 Nov 2009 18:02:42 +0100 Subject: Revert "Code model: Update on changes from the versioning system." This reverts commit 7aa24116935249a840e1350a6f8de73bc794fb09. It breaks the code model updates completely. So reverting this change until we have the right thing. Reviewed-by: Roberto Raggi --- src/plugins/cpptools/cppmodelmanager.cpp | 41 +++----------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) (limited to 'src/plugins/cpptools/cppmodelmanager.cpp') diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index b0f3838a4e..38c4e61c8a 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -595,8 +595,6 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) void CppTools::CppModelManagerInterface::updateModifiedSourceFiles() { - if (isIndexing()) - return; const Snapshot snapshot = this->snapshot(); QStringList sourceFiles; @@ -632,8 +630,7 @@ CppTools::CppModelManagerInterface *CppTools::CppModelManagerInterface::instance */ CppModelManager::CppModelManager(QObject *parent) - : CppModelManagerInterface(parent), - m_indexing(false) + : CppModelManagerInterface(parent) { m_findReferences = new CppFindReferences(this); @@ -678,11 +675,6 @@ CppModelManager::CppModelManager(QObject *parent) connect(m_core->editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)), this, SLOT(editorAboutToClose(Core::IEditor *))); - - connect(m_core->progressManager(), SIGNAL(taskStarted(QString)), - this, SLOT(onTaskStarted(QString))); - connect(m_core->progressManager(), SIGNAL(allTasksFinished(QString)), - this, SLOT(onAllTasksFinished(QString))); } CppModelManager::~CppModelManager() @@ -879,7 +871,7 @@ QStringList CppModelManager::includesInPath(const QString &path) const QFuture CppModelManager::refreshSourceFiles(const QStringList &sourceFiles) { - if (!m_indexing && !sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { + if (! sourceFiles.isEmpty() && qgetenv("QTCREATOR_NO_CODE_INDEXER").isNull()) { const QMap workingCopy = buildWorkingCopyList(); CppPreprocessor *preproc = new CppPreprocessor(this); @@ -905,7 +897,7 @@ QFuture CppModelManager::refreshSourceFiles(const QStringList &sourceFiles m_synchronizer.addFuture(result); - if (sourceFiles.count() > 1) { + if (sourceFiles.count() > 1) { m_core->progressManager()->addTask(result, tr("Indexing"), CppTools::Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess); @@ -1399,31 +1391,4 @@ void CppModelManager::GC() protectSnapshot.unlock(); } -bool CppModelManager::isIndexing() const -{ - return m_indexing; -} - -void CppModelManager::setIndexing(bool v) -{ - if (m_indexing == v) - return; - m_indexing = v; - if (v) { - emit indexingStarted(); - } else { - emit indexingFinished(); - } -} - -void CppModelManager::onTaskStarted(const QString &type) -{ - if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) - setIndexing(true); -} -void CppModelManager::onAllTasksFinished(const QString &type) -{ - if (type == QLatin1String(CppTools::Constants::TASK_INDEX)) - setIndexing(false); -} -- cgit v1.2.1