aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/currentprojectfilter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/projectexplorer/currentprojectfilter.cpp')
-rw-r--r--src/plugins/projectexplorer/currentprojectfilter.cpp51
1 files changed, 14 insertions, 37 deletions
diff --git a/src/plugins/projectexplorer/currentprojectfilter.cpp b/src/plugins/projectexplorer/currentprojectfilter.cpp
index 69b88ddf46..d0f9ed99b0 100644
--- a/src/plugins/projectexplorer/currentprojectfilter.cpp
+++ b/src/plugins/projectexplorer/currentprojectfilter.cpp
@@ -7,42 +7,28 @@
#include "projectexplorertr.h"
#include "projecttree.h"
-#include <utils/algorithm.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"));
- setDescription(Tr::tr("Matches all files from the current document's project. Append \"+<number>\" "
- "or \":<number>\" to jump to the given line number. Append another "
- "\"+<number>\" or \":<number>\" to jump to the column number as well."));
+ setDescription(Tr::tr("Locates files from the current document's project. Append \"+<number>\" "
+ "or \":<number>\" to jump to the given line number. Append another "
+ "\"+<number>\" or \":<number>\" to jump to the column number as well."));
setDefaultShortcutString("p");
- setDefaultIncludedByDefault(false);
+ setRefreshRecipe(Tasking::Sync([this] { invalidate(); }));
connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
this, &CurrentProjectFilter::currentProjectChanged);
-}
-
-void CurrentProjectFilter::markFilesAsOutOfDate()
-{
- setFileIterator(nullptr);
-}
-void CurrentProjectFilter::prepareSearch(const QString &entry)
-{
- Q_UNUSED(entry)
- if (!fileIterator()) {
- Utils::FilePaths paths;
- if (m_project)
- paths = m_project->files(Project::SourceFiles);
- setFileIterator(new BaseFileFilter::ListIterator(paths));
- }
- BaseFileFilter::prepareSearch(entry);
+ m_cache.setGeneratorProvider([this] {
+ const FilePaths paths = m_project ? m_project->files(Project::SourceFiles) : FilePaths();
+ return LocatorFileCache::filePathsGenerator(paths);
+ });
}
void CurrentProjectFilter::currentProjectChanged()
@@ -50,21 +36,12 @@ void CurrentProjectFilter::currentProjectChanged()
Project *project = ProjectTree::currentProject();
if (project == m_project)
return;
- if (m_project)
- disconnect(m_project, &Project::fileListChanged,
- this, &CurrentProjectFilter::markFilesAsOutOfDate);
-
- if (project)
- connect(project, &Project::fileListChanged,
- this, &CurrentProjectFilter::markFilesAsOutOfDate);
+ if (m_project)
+ disconnect(m_project, &Project::fileListChanged, this, &CurrentProjectFilter::invalidate);
m_project = project;
- markFilesAsOutOfDate();
-}
+ if (m_project)
+ connect(m_project, &Project::fileListChanged, this, &CurrentProjectFilter::invalidate);
-void CurrentProjectFilter::refresh(QFutureInterface<void> &future)
-{
- Q_UNUSED(future)
- QMetaObject::invokeMethod(this, &CurrentProjectFilter::markFilesAsOutOfDate,
- Qt::QueuedConnection);
+ invalidate();
}