|
1 /* |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation; version 2 of the License |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
17 */ |
|
18 |
|
19 #ifndef _GAME_SCHEME_MODEL_INCLUDED |
|
20 #define _GAME_SCHEME_MODEL_INCLUDED |
|
21 |
|
22 #include <QAbstractTableModel> |
|
23 #include <QStringList> |
|
24 #include <QList> |
|
25 |
|
26 class GameSchemeModel : public QAbstractTableModel |
|
27 { |
|
28 Q_OBJECT |
|
29 |
|
30 public: |
|
31 GameSchemeModel(QObject * parent, const QString & fileName); |
|
32 |
|
33 QVariant headerData(int section, Qt::Orientation orientation, int role) const; |
|
34 int rowCount(const QModelIndex & parent) const; |
|
35 int columnCount(const QModelIndex & parent) const; |
|
36 bool hasScheme(QString name); |
|
37 Qt::ItemFlags flags(const QModelIndex & index) const; |
|
38 bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); |
|
39 bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex()); |
|
40 bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex()); |
|
41 QVariant data(const QModelIndex &index, int role) const; |
|
42 |
|
43 int numberOfDefaultSchemes; |
|
44 QStringList predefSchemesNames; |
|
45 QStringList spNames; |
|
46 |
|
47 public slots: |
|
48 void Save(); |
|
49 |
|
50 protected: |
|
51 QList< QList<QVariant> > schemes; |
|
52 }; |
|
53 |
|
54 class NetGameSchemeModel : public QAbstractTableModel |
|
55 { |
|
56 Q_OBJECT |
|
57 |
|
58 public: |
|
59 NetGameSchemeModel(QObject * parent); |
|
60 |
|
61 QVariant headerData(int section, Qt::Orientation orientation, int role) const; |
|
62 int rowCount(const QModelIndex & parent) const; |
|
63 int columnCount(const QModelIndex & parent) const; |
|
64 QVariant data(const QModelIndex &index, int role) const; |
|
65 |
|
66 public slots: |
|
67 void setNetSchemeConfig(QStringList cfg); |
|
68 |
|
69 private: |
|
70 QList<QVariant> netScheme; |
|
71 }; |
|
72 |
|
73 #endif // _GAME_SCHEME_MODEL_INCLUDED |