diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-11-13 16:31:03 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-13 12:01:00 -0800 |
commit | 10fecefddd809bddd46e50fcc7a7438d8257174d (patch) | |
tree | fa575ea4ca567b81ad9871e672564813ef66f7ad /qt-ui/models.h | |
parent | 148138261727c47360d603e603006b7e424632e1 (diff) | |
download | subsurface-10fecefddd809bddd46e50fcc7a7438d8257174d.tar.gz |
Move the filters code to it's own file.
We already have a bunch of filters, let's pack them together
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.h')
-rw-r--r-- | qt-ui/models.h | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/qt-ui/models.h b/qt-ui/models.h index 8a2d3dcb9..ad0d7b7c3 100644 --- a/qt-ui/models.h +++ b/qt-ui/models.h @@ -438,84 +438,4 @@ private: QStringList languages; }; -class MultiFilterInterface { -public: - MultiFilterInterface() : checkState(NULL){}; - virtual bool filterRow(int source_row, const QModelIndex &source_parent, QAbstractItemModel *sourceModel) const = 0; - virtual bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const = 0; - virtual void clearFilter() = 0; - bool *checkState; - bool anyChecked; -}; - -class TagFilterModel : public QStringListModel, public MultiFilterInterface{ - Q_OBJECT -public: - static TagFilterModel *instance(); - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual bool filterRow(int source_row, const QModelIndex &source_parent, QAbstractItemModel *sourceModel) const; - bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const; - void clearFilter(); -public -slots: - void repopulate(); - -private: - explicit TagFilterModel(QObject *parent = 0); -}; - -class BuddyFilterModel : public QStringListModel, public MultiFilterInterface{ - Q_OBJECT -public: - static BuddyFilterModel *instance(); - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual bool filterRow(int source_row, const QModelIndex &source_parent, QAbstractItemModel *sourceModel) const; - bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const; - void clearFilter(); -public -slots: - void repopulate(); - -private: - explicit BuddyFilterModel(QObject *parent = 0); -}; - -class LocationFilterModel : public QStringListModel, public MultiFilterInterface{ - Q_OBJECT -public: - static LocationFilterModel *instance(); - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual bool filterRow(int source_row, const QModelIndex &source_parent, QAbstractItemModel *sourceModel) const; - bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const; - void clearFilter(); -public -slots: - void repopulate(); - -private: - explicit LocationFilterModel(QObject *parent = 0); -}; - - -class MultiFilterSortModel : public QSortFilterProxyModel { - Q_OBJECT -public: - static MultiFilterSortModel *instance(); - virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; - void addFilterModel(MultiFilterInterface *model); - void removeFilterModel(MultiFilterInterface *model); -public slots: - void myInvalidate(); - void clearFilter(); -private: - MultiFilterSortModel(QObject *parent = 0); - QList<MultiFilterInterface*> models; - bool justCleared; -}; #endif // MODELS_H |