| 1 | // Version: $Id $ |
| 2 | /*************************************************************************** |
| 3 | * Copyright (C) 2002-2003 Andi Peredri * |
| 4 | * [email protected] * |
| 5 | * Copyright (C) 2004-2005 Artur Wiebe * |
| 6 | * [email protected] * |
| 7 | * * |
| 8 | * This program is free software; you can redistribute it and/or modify * |
| 9 | * it under the terms of the GNU General Public License as published by * |
| 10 | * the Free Software Foundation; either version 2 of the License, or * |
| 11 | * (at your option) any later version. * |
| 12 | * * |
| 13 | * This program is distributed in the hope that it will be useful, * |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 16 | * GNU General Public License for more details. * |
| 17 | * * |
| 18 | * You should have received a copy of the GNU General Public License * |
| 19 | * along with this program; if not, write to the * |
| 20 | * Free Software Foundation, Inc., * |
| 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 22 | ***************************************************************************/ |
| 23 | #ifndef _TOPLEVEL_H_ |
| 24 | #define _TOPLEVEL_H_ |
| 25 | |
| 26 | #include <QMainWindow> |
| 27 | #include <QAction> |
| 28 | #include <QMap> |
| 29 | #include <QTextEdit> |
| 30 | |
| 31 | #include "history.h" |
| 32 | |
| 33 | class myView; |
| 34 | class myNewGameDlg; |
| 35 | |
| 36 | |
| 37 | class myTopLevel : public QMainWindow |
| 38 | { |
| 39 | Q_OBJECT |
| 40 | |
| 41 | public: |
| 42 | myTopLevel(); |
| 43 | |
| 44 | void open(const QString& filename); |
| 45 | |
| 46 | myHistory* get_history() const; |
| 47 | void clear_log(); |
| 48 | void append_log(const QString&); |
| 49 | |
| 50 | protected: |
| 51 | void closeEvent(QCloseEvent*); |
| 52 | |
| 53 | private slots: |
| 54 | void slot_help(); |
| 55 | void slot_about(); |
| 56 | |
| 57 | void slot_new_game(); |
| 58 | void slot_open_game(); |
| 59 | void slot_save_game(); |
| 60 | void slot_next_round(); |
| 61 | |
| 62 | void slot_notation(bool); |
| 63 | void slot_notation_font(); |
| 64 | |
| 65 | void slot_working(bool); |
| 66 | |
| 67 | void set_theme(QAction*); |
| 68 | |
| 69 | void warning(const QString& text); |
| 70 | |
| 71 | |
| 72 | private: |
| 73 | void make_actions(); |
| 74 | void make_central_widget(); |
| 75 | void restore_settings(); |
| 76 | void store_settings(); |
| 77 | |
| 78 | void make_docks(); |
| 79 | QDockWidget* make_dock(const QString&, const QString&, Qt::DockWidgetArea, QWidget*); |
| 80 | |
| 81 | // add themes to this menu. |
| 82 | void read_themes(QActionGroup*, QMenu*, const QString& path); |
| 83 | |
| 84 | void information(const QString& caption, const QString& text); |
| 85 | |
| 86 | // returns true if the user wishes to keep current game |
| 87 | bool keep_game(); |
| 88 | |
| 89 | private: |
| 90 | QMenu* viewMenu; |
| 91 | // |
| 92 | QAction* gameNew; |
| 93 | QAction* gameStop; |
| 94 | QAction* gameOpen; |
| 95 | QAction* gameSave; |
| 96 | QAction* gameNextRound; |
| 97 | // |
| 98 | QAction* viewNotation; |
| 99 | QAction* viewNotationAbove; |
| 100 | // |
| 101 | QAction* settingsKeep; |
| 102 | QAction* settingsClearLog; |
| 103 | |
| 104 | QString filename; // PDN File Name |
| 105 | |
| 106 | myView* m_view; |
| 107 | myNewGameDlg* m_newgame; |
| 108 | |
| 109 | myHistory* m_history; |
| 110 | QTextEdit* m_log; |
| 111 | QDockWidget* m_history_dock; |
| 112 | QDockWidget* m_log_dock; |
| 113 | |
| 114 | typedef QMap<QAction*, QString> myThemeMap; |
| 115 | myThemeMap m_themes; |
| 116 | }; |
| 117 | |
| 118 | #endif |
| 119 |