forked from qt-creator/qt-creator
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 <roberto.raggi@nokia.com>
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QBitArray>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QtDebug>
|
||||
|
||||
/*!
|
||||
@@ -108,7 +109,7 @@ private:
|
||||
|
||||
|
||||
Document::Document(const QString &fileName)
|
||||
: _fileName(fileName),
|
||||
: _fileName(QDir::cleanPath(fileName)),
|
||||
_globalNamespace(0),
|
||||
_revision(0)
|
||||
{
|
||||
@@ -173,7 +174,7 @@ QStringList Document::includedFiles() const
|
||||
|
||||
void Document::addIncludeFile(const QString &fileName, unsigned line)
|
||||
{
|
||||
_includes.append(Include(fileName, line));
|
||||
_includes.append(Include(QDir::cleanPath(fileName), line));
|
||||
}
|
||||
|
||||
void Document::appendMacro(const Macro ¯o)
|
||||
@@ -569,3 +570,8 @@ QStringList Snapshot::dependsOn(const QString &fileName) const
|
||||
|
||||
return deps;
|
||||
}
|
||||
|
||||
Document::Ptr Snapshot::value(const QString &fileName) const
|
||||
{
|
||||
return QMap<QString, Document::Ptr>::value(QDir::cleanPath(fileName));
|
||||
}
|
||||
|
||||
@@ -341,6 +341,7 @@ public:
|
||||
QStringList dependsOn(const QString &fileName) const;
|
||||
|
||||
void insert(Document::Ptr doc);
|
||||
Document::Ptr value(const QString &fileName) const;
|
||||
|
||||
using _Base::insert;
|
||||
|
||||
|
||||
@@ -121,8 +121,7 @@ void FindUsages::reportResult(unsigned tokenIndex)
|
||||
const int len = tk.f.length;
|
||||
|
||||
if (_future) {
|
||||
const QString path = QDir::toNativeSeparators(_doc->fileName());
|
||||
_future->reportResult(Usage(path, line, lineText, col, len));
|
||||
_future->reportResult(Usage(_doc->fileName(), line, lineText, col, len));
|
||||
}
|
||||
|
||||
_references.append(tokenIndex);
|
||||
|
||||
Reference in New Issue
Block a user