QTfrontend/model/roomslistmodel.h
author unc0rr
Wed, 29 Feb 2012 23:44:49 +0400
changeset 6753 e95b1f62d0de
parent 6733 5abbc345a82f
child 6966 eda4f63bec41
permissions -rw-r--r--
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others. This should fix problems with ghost teams in frontend. Not tested at all, successfully built on first attempt, which is considered as a bad sign :D Server still thinks game proceeds, so restart isn't possible.

#ifndef ROOMSLISTMODEL_H
#define ROOMSLISTMODEL_H

#include <QAbstractTableModel>
#include <QStringList>

class RoomsListModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    explicit RoomsListModel(QObject *parent = 0);

    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    int rowCount(const QModelIndex & parent) const;
    int columnCount(const QModelIndex & parent) const;
    QVariant data(const QModelIndex &index, int role) const;

public slots:
    void setRoomsList(const QStringList & rooms);
    void addRoom(const QStringList & info);
    void removeRoom(const QString & name);
    void updateRoom(const QString & name, const QStringList & info);

private:
    QList<QStringList> m_data;
    QStringList m_headerData;

    QStringList roomInfo2RoomRecord(const QStringList & info);
};

#endif // ROOMSLISTMODEL_H