QTfrontend/ammoSchemeModel.h
author unc0rr
Fri, 13 Mar 2009 21:39:59 +0000
changeset 1890 de5cfe3beb22
parent 1884 40e59e9f82ce
child 1897 e9dcb47013c7
permissions -rw-r--r--
Scheme options work now Things left: save/load schemes, pass schemes via net, make nice-looking scheme edit page, add more options
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1881
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
     1
/*
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2009 Andrey Korotaev <unC0Rr@gmail.com>
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
     4
 *
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
     8
 *
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    13
 *
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    17
 */
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    18
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    19
#ifndef _AMMO_SCHEME_MODEL_INCLUDED
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    20
#define _AMMO_SCHEME_MODEL_INCLUDED
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    21
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    22
#include <QAbstractTableModel>
1890
de5cfe3beb22 Scheme options work now
unc0rr
parents: 1884
diff changeset
    23
#include <QList>
1881
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    24
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    25
class AmmoSchemeModel : public QAbstractTableModel
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    26
{
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    27
	Q_OBJECT
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    28
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    29
public:
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    30
	AmmoSchemeModel(QObject *parent = 0);
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    31
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    32
	QVariant headerData(int section, Qt::Orientation orientation, int role) const;
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    33
	int rowCount(const QModelIndex & parent) const;
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    34
	int columnCount(const QModelIndex & parent) const;
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    35
	Qt::ItemFlags flags(const QModelIndex & index) const;
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    36
	bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
1884
40e59e9f82ce Continue work on new schemes implementation
unc0rr
parents: 1881
diff changeset
    37
	bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
40e59e9f82ce Continue work on new schemes implementation
unc0rr
parents: 1881
diff changeset
    38
	bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
40e59e9f82ce Continue work on new schemes implementation
unc0rr
parents: 1881
diff changeset
    39
	QVariant data(const QModelIndex &index, int role) const;
1881
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    40
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    41
signals:
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    42
	void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    43
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    44
protected:
1890
de5cfe3beb22 Scheme options work now
unc0rr
parents: 1884
diff changeset
    45
	QList< QList<QVariant> > schemes;
1884
40e59e9f82ce Continue work on new schemes implementation
unc0rr
parents: 1881
diff changeset
    46
40e59e9f82ce Continue work on new schemes implementation
unc0rr
parents: 1881
diff changeset
    47
private:
1890
de5cfe3beb22 Scheme options work now
unc0rr
parents: 1884
diff changeset
    48
	QList<QVariant> defaultScheme;
1881
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    49
};
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    50
9b62d68c7b92 Stub for ammo schemes model
unc0rr
parents:
diff changeset
    51
#endif // _AMMO_SCHEME_MODEL_INCLUDED