1 | /*************************************************************************** |
2 | * Copyright (C) 1999-2006 by Éric Bischoff <ebischoff@nerim.net> * |
3 | * Copyright (C) 2007 by Albert Astals Cid <aacid@kde.org> * |
4 | * * |
5 | * This program 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 2 of the License, or * |
8 | * (at your option) any later version. * |
9 | ***************************************************************************/ |
10 | |
11 | #ifndef _TOPLEVEL_H_ |
12 | #define _TOPLEVEL_H_ |
13 | |
14 | #include <kxmlguiwindow.h> |
15 | #include <kurl.h> |
16 | #include <kcombobox.h> |
17 | |
18 | class QActionGroup; |
19 | class PlayGround; |
20 | class SoundFactory; |
21 | |
22 | class TopLevel : public KXmlGuiWindow |
23 | { |
24 | Q_OBJECT |
25 | |
26 | public: |
27 | |
28 | TopLevel(); |
29 | ~TopLevel(); |
30 | |
31 | void open(const KUrl &url); |
32 | void registerGameboard(const QString& , const QString& boardFile, const QPixmap& pixmap); |
33 | void registerLanguage(const QString &code, const QString &soundFile, bool enabled); |
34 | void changeLanguage(const QString &langCode); |
35 | void playSound(const QString &ref) const; |
36 | |
37 | bool isSoundEnabled() const; |
38 | |
39 | void changeGameboard(const QString &gameboard); |
40 | |
41 | protected: |
42 | void readOptions(QString &board, QString &language); |
43 | void writeOptions(); |
44 | void setupKAction(); |
45 | |
46 | protected slots: |
47 | void saveNewToolbarConfig(); |
48 | |
49 | private slots: |
50 | |
51 | void fileNew(); |
52 | void fileOpen(); |
53 | void fileSave(); |
54 | void filePicture(); |
55 | void filePrint(); |
56 | void editCopy(); |
57 | void soundOff(); |
58 | void changeGameboardFromCombo(int index); |
59 | void changeGameboard(); |
60 | void changeLanguage(); |
61 | void toggleFullScreen(); |
62 | void lockAspectRatio(bool lock); |
63 | |
64 | private: |
65 | int // Menu items identificators |
66 | newID, openID, saveID, pictureID, printID, quitID, |
67 | copyID, undoID, redoID, |
68 | gameboardID, speechID; |
69 | enum { // Tool bar buttons identificators |
70 | ID_NEW, ID_OPEN, ID_SAVE, ID_PRINT, |
71 | ID_UNDO, ID_REDO, |
72 | ID_HELP }; |
73 | enum { BOARD_THEME = Qt::UserRole + 1}; |
74 | |
75 | |
76 | QActionGroup *playgroundsGroup, *languagesGroup; |
77 | KComboBox *playgroundCombo; |
78 | |
79 | PlayGround *playGround; // Play ground central widget |
80 | SoundFactory *soundFactory; // Speech organ |
81 | QMap<QString, QString> sounds; // language code, file |
82 | }; |
83 | |
84 | #endif |
85 | |