Cute Chess 0.1
pgndatabasemodel.h
1/*
2 This file is part of Cute Chess.
3 Copyright (C) 2008-2018 Cute Chess authors
4
5 Cute Chess 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, either version 3 of the License, or
8 (at your option) any later version.
9
10 Cute Chess is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef PGN_DATABASE_MODEL_H
20#define PGN_DATABASE_MODEL_H
21
22#include <QAbstractItemModel>
23#include <QList>
24
25#include "pgndatabase.h"
26#include "gamedatabasemanager.h"
27
29
34{
35 Q_OBJECT
36
37 public:
42 PgnDatabaseModel(GameDatabaseManager* gameDatabaseManager,
43 QObject* parent = nullptr);
44
45 // Inherited from QAbstractItemModel
46 virtual QModelIndex index(int row, int column,
47 const QModelIndex& parent = QModelIndex()) const;
48 virtual QModelIndex parent(const QModelIndex& index) const;
49 virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
50 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
51 virtual QVariant data(const QModelIndex& index, int role) const;
52 virtual QVariant headerData(int section, Qt::Orientation orientation,
53 int role = Qt::DisplayRole) const;
54 virtual Qt::ItemFlags flags(const QModelIndex& index) const;
55 virtual bool setData(const QModelIndex& index, const QVariant& value,
56 int role = Qt::EditRole);
57
58 private slots:
59 void onDatabaseAdded(int index);
60 void onDatabaseAboutToBeRemoved(int index);
61 void onDatabasesReset();
62
63 private:
64 GameDatabaseManager* m_gameDatabaseManager;
65};
66
67#endif // PGN_DATABASE_MODEL_H
68
Manages chess game databases.
Definition gamedatabasemanager.h:35
PgnDatabaseModel(GameDatabaseManager *gameDatabaseManager, QObject *parent=nullptr)
Definition pgndatabasemodel.cpp:22