#ifndef GAMESMODEL_H #define GAMESMODEL_H #include #include #include #include "gametypemap.h" class ServerInfo_Game; class GamesModel : public QAbstractTableModel { Q_OBJECT private: QList gameList; QMap rooms; QMap gameTypes; public: GamesModel(const QMap &_rooms, const QMap &_gameTypes, QObject *parent = 0); ~GamesModel(); int rowCount(const QModelIndex &parent = QModelIndex()) const { return parent.isValid() ? 0 : gameList.size(); } int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const { return 8; } QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; ServerInfo_Game *getGame(int row); void updateGameList(ServerInfo_Game *game); }; class GamesProxyModel : public QSortFilterProxyModel { Q_OBJECT private: bool fullGamesVisible; bool runningGamesVisible; public: GamesProxyModel(QObject *parent = 0); void setFullGamesVisible(bool _fullGamesVisible); void setRunningGamesVisible(bool _runningGamesVisible); protected: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; }; #endif