summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/locator/basefilefilter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/coreplugin/locator/basefilefilter.h')
-rw-r--r--src/plugins/coreplugin/locator/basefilefilter.h55
1 files changed, 41 insertions, 14 deletions
diff --git a/src/plugins/coreplugin/locator/basefilefilter.h b/src/plugins/coreplugin/locator/basefilefilter.h
index 052d26f222..fefc6a1d39 100644
--- a/src/plugins/coreplugin/locator/basefilefilter.h
+++ b/src/plugins/coreplugin/locator/basefilefilter.h
@@ -33,34 +33,61 @@
#include "ilocatorfilter.h"
+#include <QSharedPointer>
#include <QStringList>
namespace Core {
-class CORE_EXPORT BaseFileFilter : public Core::ILocatorFilter
+namespace Internal { class BaseFileFilterPrivate; }
+
+class CORE_EXPORT BaseFileFilter : public ILocatorFilter
{
Q_OBJECT
public:
+ class Iterator {
+ public:
+ virtual ~Iterator() { }
+ virtual void toFront() = 0;
+ virtual bool hasNext() const = 0;
+ virtual QString next() = 0;
+ virtual QString filePath() const = 0;
+ virtual QString fileName() const = 0;
+ };
+
+ class CORE_EXPORT ListIterator : public Iterator {
+ public:
+ ListIterator(const QStringList &filePaths);
+ ListIterator(const QStringList &filePaths, const QStringList &fileNames);
+
+ void toFront();
+ bool hasNext() const;
+ QString next();
+ QString filePath() const;
+ QString fileName() const;
+
+ private:
+ QStringList m_filePaths;
+ QStringList m_fileNames;
+ QStringList::const_iterator m_pathPosition;
+ QStringList::const_iterator m_namePosition;
+ };
+
BaseFileFilter();
- QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry);
- void accept(Core::LocatorFilterEntry selection) const;
+ ~BaseFileFilter();
+ void prepareSearch(const QString &entry);
+ QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry);
+ void accept(LocatorFilterEntry selection) const;
protected:
- /* Generates the file names from the list of file paths in m_files. */
- void generateFileNames();
+ void setFileIterator(Iterator *iterator);
+ QSharedPointer<Iterator> fileIterator();
- /* Subclasses should update the file list latest in their prepareSearch method. */
- inline QStringList &files() { return m_files; }
- inline const QStringList &files() const { return m_files; }
+private slots:
+ void updatePreviousResultData();
private:
- QStringList m_files;
- QStringList m_fileNames;
- QStringList m_previousResultPaths;
- QStringList m_previousResultNames;
- bool m_forceNewSearchList;
- QString m_previousEntry;
+ Internal::BaseFileFilterPrivate *d;
};
} // namespace Core