removed the need to refresh the game list

This commit is contained in:
Max-Wilhelm Bruker 2009-06-11 17:51:52 +02:00
parent 197bf0dc64
commit c00027f988
21 changed files with 211 additions and 215 deletions

View file

@ -5,19 +5,19 @@
#include <QList>
#include "servergame.h"
class GamesModel : public QAbstractListModel {
class GamesModel : public QAbstractTableModel {
Q_OBJECT
public:
GamesModel(QObject *parent = 0)
: QAbstractListModel(parent) { }
GamesModel(QObject *parent = 0) : QAbstractTableModel(parent) { }
~GamesModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const { return parent.isValid() ? 0 : gameList.size(); }
int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const { return 5; }
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
void setGameList(const QList<ServerGame *> &_gameList);
ServerGame *getGame(int row);
public slots:
void updateGameList(ServerGame *game);
private:
QList<ServerGame *> gameList;
void cleanList();