From 6008c5f6732aa211cf9c305f97680f57b778a910 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 27 May 2021 10:54:10 +0200 Subject: [PATCH] Core: filepathify LocatorFilterEntry Change-Id: I279af30f6b57e8d1279d96e5cbae4025cf4ef473 Reviewed-by: Christian Stenger --- src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp | 2 +- src/plugins/coreplugin/locator/basefilefilter.cpp | 10 +++++----- src/plugins/coreplugin/locator/filesystemfilter.cpp | 7 +++---- src/plugins/coreplugin/locator/ilocatorfilter.h | 5 +++-- src/plugins/coreplugin/locator/locatorwidget.cpp | 4 ++-- src/plugins/coreplugin/locator/opendocumentsfilter.cpp | 4 ++-- src/plugins/cpptools/cppclassesfilter.cpp | 2 +- .../projectexplorer/jsonwizard/jsonfieldpage.cpp | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp index d9cf133fea5..1081fad8b48 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp @@ -87,7 +87,7 @@ void CMakeTargetLocatorFilter::prepareSearch(const QString &entry) Core::LocatorFilterEntry filterEntry(this, target.title, extraData); filterEntry.extraInfo = path.shortNativePath(); filterEntry.highlightInfo = {index, int(entry.length())}; - filterEntry.fileName = path.toString(); + filterEntry.filePath = path; m_result.append(filterEntry); } diff --git a/src/plugins/coreplugin/locator/basefilefilter.cpp b/src/plugins/coreplugin/locator/basefilefilter.cpp index d75424b69aa..dc4a76c0426 100644 --- a/src/plugins/coreplugin/locator/basefilefilter.cpp +++ b/src/plugins/coreplugin/locator/basefilefilter.cpp @@ -180,7 +180,7 @@ QList BaseFileFilter::matchesFor(QFutureInterface 0) { const QString postfix = selection.internalData.toString().right(postfixLength); int postfixPos = -1; const LineColumn lineColumn = LineColumn::extractFromFileName(postfix, postfixPos); if (postfixPos >= 0) { - EditorManager::openEditorAt(Link(selectedPath, lineColumn.line, lineColumn.column)); + const Link link(selection.filePath, lineColumn.line, lineColumn.column); + EditorManager::openEditorAt(link); return; } } - EditorManager::openEditor(selectedPath); + EditorManager::openEditor(selection.filePath); } /*! diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp index 76d41029342..a8ed356c288 100644 --- a/src/plugins/coreplugin/locator/filesystemfilter.cpp +++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp @@ -123,7 +123,7 @@ QList FileSystemFilter::matchesFor(QFutureInterface FileSystemFilter::matchesFor(QFutureInterface +#include #include #include @@ -91,8 +92,8 @@ struct LocatorFilterEntry QVariant internalData; /* icon to display along with the entry */ Utils::optional displayIcon; - /* file name, if the entry is related to a file, is used e.g. for resolving a file icon */ - QString fileName; + /* file path, if the entry is related to a file, is used e.g. for resolving a file icon */ + Utils::FilePath filePath; /* highlighting support */ HighlightInfo highlightInfo{0, 0}; diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index f70550bd5fe..7116b3650fd 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -209,8 +209,8 @@ QVariant LocatorModel::data(const QModelIndex &index, int role) const case Qt::DecorationRole: if (index.column() == DisplayNameColumn) { LocatorFilterEntry &entry = mEntries[index.row()]; - if (!entry.displayIcon && !entry.fileName.isEmpty()) - entry.displayIcon = FileIconProvider::icon(QFileInfo(entry.fileName)); + if (!entry.displayIcon && !entry.filePath.isEmpty()) + entry.displayIcon = FileIconProvider::icon(entry.filePath.toFileInfo()); return entry.displayIcon ? entry.displayIcon.value() : QIcon(); } break; diff --git a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp index bdd1ca78a6f..e6aced8d00a 100644 --- a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp @@ -80,8 +80,8 @@ QList OpenDocumentsFilter::matchesFor(QFutureInterfacesymbolScope().isEmpty() ? info->shortNativeFilePath() : info->symbolScope(); - filterEntry.fileName = info->fileName(); + filterEntry.filePath = Utils::FilePath::fromString(info->fileName()); return filterEntry; } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp index 6638422bcbc..43e1a01e5a1 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp @@ -645,7 +645,7 @@ void LineEditField::setupCompletion(FancyLineEdit *lineEdit) classes << (entry.extraInfo + "::" + entry.displayName); if (m_completion == Completion::Namespaces) { if (!project - || entry.fileName.startsWith(project->projectDirectory().toString())) { + || entry.filePath.startsWith(project->projectDirectory().toString())) { namespaces << entry.extraInfo; } }