QTfrontend/model/roomslistmodel.h
author sheepluva
Mon, 30 Apr 2012 20:12:43 +0200
changeset 6966 eda4f63bec41
parent 6733 5abbc345a82f
child 6973 582ca7e8e338
permissions -rw-r--r--
add missing copyright headers to roomslistmodel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6966
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
     1
/*
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
     2
 * Hedgewars, a free turn based strategy game
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
     4
 *
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
     8
 *
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    12
 * GNU General Public License for more details.
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    13
 *
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    14
 * You should have received a copy of the GNU General Public License
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    15
 * along with this program; if not, write to the Free Software
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    17
 */
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    18
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    19
/**
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    20
 * @file
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    21
 * @brief RoomsListModel class definition
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    22
 */
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    23
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    24
#ifndef HEDGEWARS_ROOMSLISTMODEL_H
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    25
#define HEDGEWARS_ROOMSLISTMODEL_H
6732
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    26
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    27
#include <QAbstractTableModel>
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    28
#include <QStringList>
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    29
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    30
class RoomsListModel : public QAbstractTableModel
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    31
{
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    32
    Q_OBJECT
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    33
public:
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    34
    explicit RoomsListModel(QObject *parent = 0);
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    35
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    36
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    37
    int rowCount(const QModelIndex & parent) const;
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    38
    int columnCount(const QModelIndex & parent) const;
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    39
    QVariant data(const QModelIndex &index, int role) const;
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    40
6733
5abbc345a82f Handle ROOM* commands in rooms list model
unc0rr
parents: 6732
diff changeset
    41
public slots:
5abbc345a82f Handle ROOM* commands in rooms list model
unc0rr
parents: 6732
diff changeset
    42
    void setRoomsList(const QStringList & rooms);
5abbc345a82f Handle ROOM* commands in rooms list model
unc0rr
parents: 6732
diff changeset
    43
    void addRoom(const QStringList & info);
5abbc345a82f Handle ROOM* commands in rooms list model
unc0rr
parents: 6732
diff changeset
    44
    void removeRoom(const QString & name);
5abbc345a82f Handle ROOM* commands in rooms list model
unc0rr
parents: 6732
diff changeset
    45
    void updateRoom(const QString & name, const QStringList & info);
5abbc345a82f Handle ROOM* commands in rooms list model
unc0rr
parents: 6732
diff changeset
    46
6732
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    47
private:
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    48
    QList<QStringList> m_data;
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    49
    QStringList m_headerData;
6733
5abbc345a82f Handle ROOM* commands in rooms list model
unc0rr
parents: 6732
diff changeset
    50
5abbc345a82f Handle ROOM* commands in rooms list model
unc0rr
parents: 6732
diff changeset
    51
    QStringList roomInfo2RoomRecord(const QStringList & info);
6732
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    52
};
c906dc78091f Start switching to rooms list model. To be continued.
unc0rr
parents:
diff changeset
    53
6966
eda4f63bec41 add missing copyright headers to roomslistmodel
sheepluva
parents: 6733
diff changeset
    54
#endif // HEDGEWARS_ROOMSLISTMODEL_H