forked from qt-creator/qt-creator
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:
@@ -26,10 +26,10 @@ AllProjectsFilter::AllProjectsFilter()
|
|||||||
"\"+<number>\" or \":<number>\" to jump to the column number as well."));
|
"\"+<number>\" or \":<number>\" to jump to the column number as well."));
|
||||||
setDefaultShortcutString("a");
|
setDefaultShortcutString("a");
|
||||||
setDefaultIncludedByDefault(true);
|
setDefaultIncludedByDefault(true);
|
||||||
setRefreshRecipe(Tasking::Sync([this] { invalidateCache(); }));
|
setRefreshRecipe(Tasking::Sync([this] { m_cache.invalidate(); }));
|
||||||
|
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::fileListChanged,
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::fileListChanged,
|
||||||
this, &AllProjectsFilter::invalidateCache);
|
this, [this] { m_cache.invalidate(); });
|
||||||
m_cache.setGeneratorProvider([] {
|
m_cache.setGeneratorProvider([] {
|
||||||
// This body runs in main thread
|
// This body runs in main thread
|
||||||
FilePaths filePaths;
|
FilePaths filePaths;
|
||||||
@@ -46,23 +46,4 @@ AllProjectsFilter::AllProjectsFilter()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllProjectsFilter::prepareSearch(const QString &entry)
|
} // namespace ProjectExplorer::Internal
|
||||||
{
|
|
||||||
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
|
|
||||||
|
|||||||
@@ -3,26 +3,18 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <coreplugin/locator/basefilefilter.h>
|
#include <coreplugin/locator/ilocatorfilter.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
// TODO: Don't derive from BaseFileFilter, flatten the hierarchy
|
class AllProjectsFilter : public Core::ILocatorFilter
|
||||||
class AllProjectsFilter : public Core::BaseFileFilter
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AllProjectsFilter();
|
AllProjectsFilter();
|
||||||
void prepareSearch(const QString &entry) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::LocatorMatcherTasks matchers() final { return {m_cache.matcher()}; }
|
Core::LocatorMatcherTasks matchers() final { return {m_cache.matcher()}; }
|
||||||
// TODO: Remove me, replace with direct "m_cache.invalidate()" call
|
|
||||||
void invalidateCache();
|
|
||||||
Core::LocatorFileCache m_cache;
|
Core::LocatorFileCache m_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace ProjectExplorer::Internal
|
||||||
} // namespace ProjectExplorer
|
|
||||||
|
|||||||
Reference in New Issue
Block a user