Commit b5edc14b authored by con's avatar con

Do lazy updating of the file list in AllProjectsFilter.

parent 9c038180
......@@ -40,16 +40,24 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe)
: m_projectExplorer(pe), m_filesUpToDate(false)
{
m_projectExplorer = pe;
connect(m_projectExplorer, SIGNAL(fileListChanged()),
this, SLOT(refreshInternally()));
this, SLOT(markFilesAsOutOfDate()));
setShortcutString("a");
setIncludedByDefault(true);
}
void AllProjectsFilter::refreshInternally()
void AllProjectsFilter::markFilesAsOutOfDate()
{
m_filesUpToDate = false;
}
void AllProjectsFilter::updateFiles()
{
if (m_filesUpToDate)
return;
m_filesUpToDate = true;
m_files.clear();
SessionManager *session = m_projectExplorer->session();
if (!session)
......@@ -64,7 +72,7 @@ void AllProjectsFilter::refresh(QFutureInterface<void> &future)
{
Q_UNUSED(future);
// invokeAsyncronouslyOnGuiThread
connect(this, SIGNAL(invokeRefresh()), this, SLOT(refreshInternally()));
connect(this, SIGNAL(invokeRefresh()), this, SLOT(markFilesAsOutOfDate()));
emit invokeRefresh();
disconnect(this, SIGNAL(invokeRefresh()), this, SLOT(refreshInternally()));
disconnect(this, SIGNAL(invokeRefresh()), this, SLOT(markFilesAsOutOfDate()));
}
......@@ -53,12 +53,16 @@ public:
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
void refresh(QFutureInterface<void> &future);
protected:
void updateFiles();
private slots:
void refreshInternally();
void markFilesAsOutOfDate();
signals:
void invokeRefresh();
private:
ProjectExplorerPlugin *m_projectExplorer;
bool m_filesUpToDate;
};
} // namespace Internal
......
......@@ -43,6 +43,7 @@ BaseFileFilter::BaseFileFilter()
QList<FilterEntry> BaseFileFilter::matchesFor(const QString &origEntry)
{
updateFiles();
QList<FilterEntry> matches;
QList<FilterEntry> badMatches;
QString needle = trimWildcards(origEntry);
......@@ -104,3 +105,7 @@ void BaseFileFilter::generateFileNames()
}
m_forceNewSearchList = true;
}
void BaseFileFilter::updateFiles()
{
}
......@@ -48,6 +48,7 @@ public:
void accept(QuickOpen::FilterEntry selection) const;
protected:
virtual void updateFiles();
void generateFileNames();
QStringList m_files;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment