Use CuteChessApplication as base for the GUI
[sloppygui.git] / projects / gui / src / movelistmodel.h
blob1529a509e55e025476e00e2aa89abef61419de49
1 /*
2 This file is part of Cute Chess.
4 Cute Chess is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 Cute Chess 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.
14 You should have received a copy of the GNU General Public License
15 along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef MOVE_LIST_MODEL_H
19 #define MOVE_LIST_MODEL_H
21 #include <QAbstractItemModel>
22 #include <QStringList>
24 class ChessGame;
26 /*!
27 * \brief Supplies chess move information to views.
29 class MoveListModel : public QAbstractItemModel
31 Q_OBJECT
33 public:
34 /*! Constructs a move list model with the given \a parent. */
35 MoveListModel(QObject* parent = 0);
36 /*! Associates \a game with this model. */
37 void setGame(ChessGame* game);
39 // Inherited from QAbstractItemModel
40 QModelIndex index(int row, int column,
41 const QModelIndex& parent = QModelIndex()) const;
42 QModelIndex parent(const QModelIndex& index) const;
43 bool hasChildren(const QModelIndex& parent = QModelIndex()) const;
44 int rowCount(const QModelIndex& parent = QModelIndex()) const;
45 int columnCount(const QModelIndex& parent = QModelIndex()) const;
46 QVariant data(const QModelIndex& index, int role) const;
47 QVariant headerData(int section, Qt::Orientation orientation,
48 int role = Qt::DisplayRole) const;
49 private slots:
50 void boardReset();
51 void onMoveMade();
53 private:
54 static const QStringList m_headers;
55 ChessGame* m_game;
59 #endif // MOVE_LIST_MODEL_H