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>
This commit is contained in:
Jarek Kobus
2023-04-24 23:14:52 +02:00
parent a1792c653e
commit 62c309eeda
2 changed files with 7 additions and 34 deletions

View File

@@ -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

View File

@@ -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