summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2023-04-24 23:14:52 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2023-05-12 08:13:42 +0000
commit62c309eeda1002799caa1afd1163ff79cbcad51f (patch)
treecfdb9242aab8a4d8f78b3aadd2585e23fb9ebbb8
parenta1792c653ebeaa251523bddc0e66dbda70551bf7 (diff)
downloadqt-creator-62c309eeda1002799caa1afd1163ff79cbcad51f.tar.gz
AllProjectsFilter: Remove the old matchesFor() implementation
Change-Id: I9b5a0a1483e1dcd55d845ca2a5645ad9a4d05b52 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--src/plugins/projectexplorer/allprojectsfilter.cpp25
-rw-r--r--src/plugins/projectexplorer/allprojectsfilter.h16
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