Cute Chess 0.1
gamedatabasemanager.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 GAME_DATABASE_MANAGER_H
20#define GAME_DATABASE_MANAGER_H
21
22#include <QObject>
23#include <QList>
24
25class PgnImporter;
26class PgnDatabase;
27
35{
36 Q_OBJECT
37
38 public:
40 GameDatabaseManager(QObject* parent = nullptr);
41 virtual ~GameDatabaseManager();
42
47
53 bool writeState(const QString& fileName);
59 bool readState(const QString& fileName);
60
62 bool isModified() const;
63
65 void setModified(bool modified);
66
67 public slots:
69 void addDatabase(PgnDatabase* database);
74 void removeDatabase(int index);
79 void importDatabaseAgain(int index);
87 void importPgnFile(const QString& fileName);
88 signals:
94 void databaseAdded(int index);
110
111 private:
112 QList<PgnDatabase*> m_databases;
113 bool m_modified;
114
115};
116
117#endif // GAME_DATABASE_MANAGER_H
bool writeState(const QString &fileName)
Definition gamedatabasemanager.cpp:51
void addDatabase(PgnDatabase *database)
Definition gamedatabasemanager.cpp:192
void importPgnFile(const QString &fileName)
Definition gamedatabasemanager.cpp:178
GameDatabaseManager(QObject *parent=nullptr)
Definition gamedatabasemanager.cpp:35
void setModified(bool modified)
Definition gamedatabasemanager.cpp:219
void importDatabaseAgain(int index)
Definition gamedatabasemanager.cpp:206
bool readState(const QString &fileName)
Definition gamedatabasemanager.cpp:86
QList< PgnDatabase * > databases() const
Definition gamedatabasemanager.cpp:46
bool isModified() const
Definition gamedatabasemanager.cpp:214
void databaseAdded(int index)
void databaseAboutToBeRemoved(int index)
void removeDatabase(int index)
Definition gamedatabasemanager.cpp:199
PGN database.
Definition pgndatabase.h:38
Reads PGN database in a separate thread.
Definition pgnimporter.h:32