Cute Chess  0.1
gamedatabasemanager.h
1 /*
2  This file is part of Cute Chess.
3 
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.
8 
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.
13 
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/>.
16 */
17 
18 #ifndef GAME_DATABASE_MANAGER_H
19 #define GAME_DATABASE_MANAGER_H
20 
21 #include <QObject>
22 #include <QList>
23 
24 class PgnImporter;
25 class PgnDatabase;
26 
34 {
35  Q_OBJECT
36 
37  public:
39  GameDatabaseManager(QObject* parent = nullptr);
40  virtual ~GameDatabaseManager();
41 
46 
52  bool writeState(const QString& fileName);
58  bool readState(const QString& fileName);
59 
61  bool isModified() const;
62 
64  void setModified(bool modified);
65 
66  public slots:
68  void addDatabase(PgnDatabase* database);
73  void removeDatabase(int index);
78  void importDatabaseAgain(int index);
86  void importPgnFile(const QString& fileName);
87  signals:
93  void databaseAdded(int index);
101  void databaseAboutToBeRemoved(int index);
108  void databasesReset();
109 
110  private:
111  QList<PgnDatabase*> m_databases;
112  bool m_modified;
113 
114 };
115 
116 #endif // GAME_DATABASE_MANAGER_H
bool isModified() const
Definition: gamedatabasemanager.cpp:214
Manages chess game databases.
Definition: gamedatabasemanager.h:33
GameDatabaseManager(QObject *parent=nullptr)
Definition: gamedatabasemanager.cpp:34
QList< PgnDatabase * > databases() const
Definition: gamedatabasemanager.cpp:45
bool readState(const QString &fileName)
Definition: gamedatabasemanager.cpp:86
void databaseAdded(int index)
void setModified(bool modified)
Definition: gamedatabasemanager.cpp:219
void databaseAboutToBeRemoved(int index)
PGN database.
Definition: pgndatabase.h:36
Reads PGN database in a separate thread.
Definition: pgnimporter.h:30
void importDatabaseAgain(int index)
Definition: gamedatabasemanager.cpp:206
void addDatabase(PgnDatabase *database)
Definition: gamedatabasemanager.cpp:192
void removeDatabase(int index)
Definition: gamedatabasemanager.cpp:199
bool writeState(const QString &fileName)
Definition: gamedatabasemanager.cpp:50
void importPgnFile(const QString &fileName)
Definition: gamedatabasemanager.cpp:178