diff options
-rw-r--r-- | src/plugins/projectexplorer/allprojectsfilter.cpp | 25 | ||||
-rw-r--r-- | src/plugins/projectexplorer/allprojectsfilter.h | 16 |
2 files changed, 7 insertions, 34 deletions
diff --git a/src/plugins/projectexplorer/allprojectsfilter.cpp b/src/plugins/projectexplorer/allprojectsfilter.cpp index 1fc9fe0b4b..42e110d350 100644 --- a/src/plugins/projectexplorer/allprojectsfilter.cpp +++ b/src/plugins/projectexplorer/allprojectsfilter.cpp @@ -26,10 +26,10 @@ AllProjectsFilter::AllProjectsFilter() "\"+<number>\" or \":<number>\" to jump to the column number as well.")); setDefaultShortcutString("a"); setDefaultIncludedByDefault(true); - setRefreshRecipe(Tasking::Sync([this] { invalidateCache(); })); + setRefreshRecipe(Tasking::Sync([this] { m_cache.invalidate(); })); connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::fileListChanged, - this, &AllProjectsFilter::invalidateCache); + this, [this] { m_cache.invalidate(); }); m_cache.setGeneratorProvider([] { // This body runs in main thread FilePaths filePaths; @@ -46,23 +46,4 @@ AllProjectsFilter::AllProjectsFilter() }); } -void AllProjectsFilter::prepareSearch(const QString &entry) -{ - Q_UNUSED(entry) - if (!fileIterator()) { - FilePaths paths; - for (Project *project : ProjectManager::projects()) - paths.append(project->files(Project::SourceFiles)); - Utils::sort(paths); - setFileIterator(new BaseFileFilter::ListIterator(paths)); - } - BaseFileFilter::prepareSearch(entry); -} - -void AllProjectsFilter::invalidateCache() -{ - m_cache.invalidate(); - setFileIterator(nullptr); -} - -} // ProjectExplorer::Internal +} // namespace ProjectExplorer::Internal diff --git a/src/plugins/projectexplorer/allprojectsfilter.h b/src/plugins/projectexplorer/allprojectsfilter.h index 4cf5bf0b78..6782ef4611 100644 --- a/src/plugins/projectexplorer/allprojectsfilter.h +++ b/src/plugins/projectexplorer/allprojectsfilter.h @@ -3,26 +3,18 @@ #pragma once -#include <coreplugin/locator/basefilefilter.h> +#include <coreplugin/locator/ilocatorfilter.h> -namespace ProjectExplorer { -namespace Internal { +namespace ProjectExplorer::Internal { -// TODO: Don't derive from BaseFileFilter, flatten the hierarchy -class AllProjectsFilter : public Core::BaseFileFilter +class AllProjectsFilter : public Core::ILocatorFilter { - Q_OBJECT - public: AllProjectsFilter(); - void prepareSearch(const QString &entry) override; private: Core::LocatorMatcherTasks matchers() final { return {m_cache.matcher()}; } - // TODO: Remove me, replace with direct "m_cache.invalidate()" call - void invalidateCache(); Core::LocatorFileCache m_cache; }; -} // namespace Internal -} // namespace ProjectExplorer +} // namespace ProjectExplorer::Internal |