#pragma once #include "cmodlist.h" #include #include namespace ModFields { enum EModFields { STATUS_ENABLED, STATUS_UPDATE, TYPE, NAME, VERSION, SIZE, AUTHOR, COUNT }; } class CModListModel : public QAbstractTableModel, public CModList { Q_OBJECT QVector indexToName; void endResetModel(); QVariant getTextAlign(int field) const; QVariant getValue(const CModEntry & mod, int field) const; QVariant getText(const CModEntry & mod, int field) const; QVariant getIcon(const CModEntry & mod, int field) const; public: /// CModListContainer overrides void resetRepositories(); void addRepository(QVariantMap data); void setLocalModList(QVariantMap data); void setModSettings(QVariant data); QString modIndexToName(int index) const; explicit CModListModel(QObject *parent = 0); QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; Qt::ItemFlags flags(const QModelIndex &index) const; signals: public slots: }; class CModFilterModel : public QSortFilterProxyModel { CModListModel * base; int filteredType; int filterMask; bool filterMatches(int modIndex) const; bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; public: void setTypeFilter(int filteredType, int filterMask); CModFilterModel(CModListModel * model, QObject *parent = 0); };