diff options
Diffstat (limited to 'src/modlistsortproxy.h')
| -rw-r--r-- | src/modlistsortproxy.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/modlistsortproxy.h b/src/modlistsortproxy.h index 3e18ea4e..c04ba28d 100644 --- a/src/modlistsortproxy.h +++ b/src/modlistsortproxy.h @@ -32,6 +32,13 @@ class ModListSortProxy : public QSortFilterProxyModel public: + enum FilterMode { + FILTER_AND, + FILTER_OR + }; + +public: + explicit ModListSortProxy(Profile *profile, QObject *parent = 0); void setProfile(Profile *profile); @@ -52,8 +59,26 @@ public: **/ void disableAllVisible(); + /** + * @brief tests if a filtere matches for a mod + * @param info mod information + * @param enabled true if the mod is currently active + * @return true if current active filters match for the specified mod + */ bool filterMatchesMod(ModInfo::Ptr info, bool enabled) const; + /** + * @return true if a filter is currently active + */ + bool isFilterActive() const { return m_FilterActive; } + + void setFilterMode(FilterMode mode); + + /** + * @brief tests if the specified index has child nodes + * @param parent the node to test + * @return true if there are child nodes + */ virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const { return rowCount(parent) > 0; } @@ -77,6 +102,8 @@ private: bool hasConflictFlag(const std::vector<ModInfo::EFlag> &flags) const; void updateFilterActive(); + bool filterMatchesModAnd(ModInfo::Ptr info, bool enabled) const; + bool filterMatchesModOr(ModInfo::Ptr info, bool enabled) const; private: @@ -86,6 +113,9 @@ private: std::bitset<ModList::COL_LASTCOLUMN + 1> m_EnabledColumns; QString m_CurrentFilter; + bool m_FilterActive; + FilterMode m_FilterMode; + }; #endif // MODLISTSORTPROXY_H |
