Add 'Start time' column to game list

This commit is contained in:
Mitchell Rosen 2014-11-16 21:12:14 -08:00
parent 8c7aa41721
commit 93ab9f9691
5 changed files with 109 additions and 36 deletions

View file

@ -16,15 +16,27 @@ private:
QList<ServerInfo_Game> gameList;
QMap<int, QString> rooms;
QMap<int, GameTypeMap> gameTypes;
static const int NUM_COLS = 9;
public:
static const int SORT_ROLE = Qt::UserRole+1;
GamesModel(const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const { return parent.isValid() ? 0 : gameList.size(); }
int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const { return 8; }
int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const { return NUM_COLS; }
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
const ServerInfo_Game &getGame(int row);
/**
* Update game list with a (possibly new) game.
*/
void updateGameList(const ServerInfo_Game &game);
int roomColIndex() { return 0; }
int startTimeColIndex() { return 1; }
const QMap<int, GameTypeMap> &getGameTypes() { return gameTypes; }
};
@ -39,7 +51,7 @@ private:
int maxPlayersFilterMin, maxPlayersFilterMax;
public:
GamesProxyModel(QObject *parent = 0, ServerInfo_User *_ownUser = 0);
bool getUnavailableGamesVisible() const { return unavailableGamesVisible; }
void setUnavailableGamesVisible(bool _unavailableGamesVisible);
bool getPasswordProtectedGamesVisible() const { return passwordProtectedGamesVisible; }