Cute Chess  0.1
gamedatabasedlg.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_DIALOG_H
20 #define GAME_DATABASE_DIALOG_H
21 
22 #include <QDialog>
23 #include <QTimer>
24 #include <QItemSelection>
25 
26 #include <pgngame.h>
27 
29 class PgnDatabaseModel;
30 class PgnGameEntryModel;
31 class PgnDatabase;
32 class GameViewer;
33 
34 namespace Ui {
35  class GameDatabaseDialog;
36 }
37 
44 {
45  Q_OBJECT
46 
47  public:
50  QWidget* parent = nullptr);
52  virtual ~GameDatabaseDialog();
53 
54  private slots:
55  void databaseSelectionChanged(const QItemSelection& selected,
56  const QItemSelection& deselected);
57  void gameSelectionChanged(const QModelIndex& current,
58  const QModelIndex& previous);
59  void updateSearch(const QString& terms = QString());
60  void onSearchTimeout();
61  void onAdvancedSearch();
62  void exportPgn(const QString& filename);
63  void createOpeningBook();
64  void copyGame();
65  void copyFen();
66  void updateUi();
67 
68  private:
69  friend class PgnGameIterator;
70  int databaseIndexFromGame(int game) const;
71 
72  GameViewer* m_gameViewer;
73  PgnGame m_game;
75 
76  GameDatabaseManager* m_dbManager;
77  PgnDatabaseModel* m_pgnDatabaseModel;
78  PgnGameEntryModel* m_pgnGameEntryModel;
79  QMap<int, PgnDatabase*> m_selectedDatabases;
80 
81  QTimer m_searchTimer;
82  QString m_searchTerms;
83  Ui::GameDatabaseDialog* ui;
84 };
85 
86 #endif // GAME_DATABASE_DIALOG_H
Manages chess game databases.
Definition: gamedatabasemanager.h:34
Definition: engineconfigurationdlg.h:30
Supplies PGN database information to views.
Definition: pgndatabasemodel.h:33
A game of chess in PGN format.
Definition: pgngame.h:51
PGN database.
Definition: pgndatabase.h:37
Definition: gameviewer.h:39
Dialog for viewing game databases.
Definition: gamedatabasedlg.h:43
Supplies PGN game entry information to views.
Definition: pgngameentrymodel.h:32