Commit b5edc14b authored by con's avatar con
Browse files

Do lazy updating of the file list in AllProjectsFilter.

parent 9c038180
...@@ -40,16 +40,24 @@ using namespace ProjectExplorer; ...@@ -40,16 +40,24 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal; using namespace ProjectExplorer::Internal;
AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe) AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe)
: m_projectExplorer(pe), m_filesUpToDate(false)
{ {
m_projectExplorer = pe;
connect(m_projectExplorer, SIGNAL(fileListChanged()), connect(m_projectExplorer, SIGNAL(fileListChanged()),
this, SLOT(refreshInternally())); this, SLOT(markFilesAsOutOfDate()));
setShortcutString("a"); setShortcutString("a");
setIncludedByDefault(true); setIncludedByDefault(true);
} }
void AllProjectsFilter::refreshInternally() void AllProjectsFilter::markFilesAsOutOfDate()
{ {
m_filesUpToDate = false;
}
void AllProjectsFilter::updateFiles()
{
if (m_filesUpToDate)
return;
m_filesUpToDate = true;
m_files.clear(); m_files.clear();
SessionManager *session = m_projectExplorer->session(); SessionManager *session = m_projectExplorer->session();
if (!session) if (!session)
...@@ -64,7 +72,7 @@ void AllProjectsFilter::refresh(QFutureInterface<void> &future) ...@@ -64,7 +72,7 @@ void AllProjectsFilter::refresh(QFutureInterface<void> &future)
{ {
Q_UNUSED(future); Q_UNUSED(future);
// invokeAsyncronouslyOnGuiThread // invokeAsyncronouslyOnGuiThread
connect(this, SIGNAL(invokeRefresh()), this, SLOT(refreshInternally())); connect(this, SIGNAL(invokeRefresh()), this, SLOT(markFilesAsOutOfDate()));
emit invokeRefresh(); emit invokeRefresh();
disconnect(this, SIGNAL(invokeRefresh()), this, SLOT(refreshInternally())); disconnect(this, SIGNAL(invokeRefresh()), this, SLOT(markFilesAsOutOfDate()));
} }
...@@ -53,12 +53,16 @@ public: ...@@ -53,12 +53,16 @@ public:
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; } QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
void refresh(QFutureInterface<void> &future); void refresh(QFutureInterface<void> &future);
protected:
void updateFiles();
private slots: private slots:
void refreshInternally(); void markFilesAsOutOfDate();
signals: signals:
void invokeRefresh(); void invokeRefresh();
private: private:
ProjectExplorerPlugin *m_projectExplorer; ProjectExplorerPlugin *m_projectExplorer;
bool m_filesUpToDate;
}; };
} // namespace Internal } // namespace Internal
......
...@@ -43,6 +43,7 @@ BaseFileFilter::BaseFileFilter() ...@@ -43,6 +43,7 @@ BaseFileFilter::BaseFileFilter()
QList<FilterEntry> BaseFileFilter::matchesFor(const QString &origEntry) QList<FilterEntry> BaseFileFilter::matchesFor(const QString &origEntry)
{ {
updateFiles();
QList<FilterEntry> matches; QList<FilterEntry> matches;
QList<FilterEntry> badMatches; QList<FilterEntry> badMatches;
QString needle = trimWildcards(origEntry); QString needle = trimWildcards(origEntry);
...@@ -104,3 +105,7 @@ void BaseFileFilter::generateFileNames() ...@@ -104,3 +105,7 @@ void BaseFileFilter::generateFileNames()
} }
m_forceNewSearchList = true; m_forceNewSearchList = true;
} }
void BaseFileFilter::updateFiles()
{
}
...@@ -48,6 +48,7 @@ public: ...@@ -48,6 +48,7 @@ public:
void accept(QuickOpen::FilterEntry selection) const; void accept(QuickOpen::FilterEntry selection) const;
protected: protected:
virtual void updateFiles();
void generateFileNames(); void generateFileNames();
QStringList m_files; 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