diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-04-24 23:39:51 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-05-15 07:46:53 +0000 |
commit | 681627cac38c577a577fdc337dac0c81515b18f2 (patch) | |
tree | 6151ec289ed3721a238510c69ee12917b8bc6791 | |
parent | 9c2fa5c975d3a416d858d2635b718d6e5afaaecc (diff) | |
download | qt-creator-681627cac38c577a577fdc337dac0c81515b18f2.tar.gz |
CurrentProjectFilter: Remove the old matchesFor() implementation
Change-Id: I2bd960c14056907e6735002120900b6252ea3989
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r-- | src/plugins/projectexplorer/currentprojectfilter.cpp | 34 | ||||
-rw-r--r-- | src/plugins/projectexplorer/currentprojectfilter.h | 20 |
2 files changed, 12 insertions, 42 deletions
diff --git a/src/plugins/projectexplorer/currentprojectfilter.cpp b/src/plugins/projectexplorer/currentprojectfilter.cpp index 5b5c34fe44..d42ab82e96 100644 --- a/src/plugins/projectexplorer/currentprojectfilter.cpp +++ b/src/plugins/projectexplorer/currentprojectfilter.cpp @@ -7,16 +7,12 @@ #include "projectexplorertr.h" #include "projecttree.h" -#include <utils/algorithm.h> -#include <utils/tasktree.h> - using namespace Core; using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; using namespace Utils; CurrentProjectFilter::CurrentProjectFilter() - : BaseFileFilter() { setId("Files in current project"); setDisplayName(Tr::tr("Files in Current Project")); @@ -25,7 +21,7 @@ CurrentProjectFilter::CurrentProjectFilter() "\"+<number>\" or \":<number>\" to jump to the column number as well.")); setDefaultShortcutString("p"); setDefaultIncludedByDefault(false); - setRefreshRecipe(Tasking::Sync([this] { invalidateCache(); })); + setRefreshRecipe(Tasking::Sync([this] { invalidate(); })); connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged, this, &CurrentProjectFilter::currentProjectChanged); @@ -36,35 +32,17 @@ CurrentProjectFilter::CurrentProjectFilter() }); } -void CurrentProjectFilter::prepareSearch(const QString &entry) -{ - Q_UNUSED(entry) - if (!fileIterator()) { - const FilePaths paths = m_project ? m_project->files(Project::SourceFiles) : FilePaths(); - setFileIterator(new BaseFileFilter::ListIterator(paths)); - } - BaseFileFilter::prepareSearch(entry); -} - void CurrentProjectFilter::currentProjectChanged() { Project *project = ProjectTree::currentProject(); if (project == m_project) return; - if (m_project) - disconnect(m_project, &Project::fileListChanged, - this, &CurrentProjectFilter::invalidateCache); - - if (project) - connect(project, &Project::fileListChanged, - this, &CurrentProjectFilter::invalidateCache); + if (m_project) + disconnect(m_project, &Project::fileListChanged, this, &CurrentProjectFilter::invalidate); m_project = project; - invalidateCache(); -} + if (m_project) + connect(m_project, &Project::fileListChanged, this, &CurrentProjectFilter::invalidate); -void CurrentProjectFilter::invalidateCache() -{ - m_cache.invalidate(); - setFileIterator(nullptr); + invalidate(); } diff --git a/src/plugins/projectexplorer/currentprojectfilter.h b/src/plugins/projectexplorer/currentprojectfilter.h index 6aef305058..6c50070790 100644 --- a/src/plugins/projectexplorer/currentprojectfilter.h +++ b/src/plugins/projectexplorer/currentprojectfilter.h @@ -3,32 +3,24 @@ #pragma once -#include <coreplugin/locator/basefilefilter.h> +#include <coreplugin/locator/ilocatorfilter.h> -namespace ProjectExplorer { +namespace ProjectExplorer { class Project; } -class Project; +namespace ProjectExplorer::Internal { -namespace Internal { - -// TODO: Don't derive from BaseFileFilter, flatten the hierarchy -class CurrentProjectFilter : public Core::BaseFileFilter +class CurrentProjectFilter : public Core::ILocatorFilter { - Q_OBJECT - public: CurrentProjectFilter(); - void prepareSearch(const QString &entry) override; private: Core::LocatorMatcherTasks matchers() final { return {m_cache.matcher()}; } void currentProjectChanged(); - // TODO: Remove me, replace with direct "m_cache.invalidate()" call - void invalidateCache(); + void invalidate() { m_cache.invalidate(); } Core::LocatorFileCache m_cache; Project *m_project = nullptr; }; -} // namespace Internal -} // namespace ProjectExplorer +} // namespace ProjectExplorer::Internal |