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 <KComboBox> 16 17 #include "soundfactory.h" 18 #include "playground.h" 19 20 class QActionGroup; 21 class PlayGround; 22 23 class TopLevel : public KXmlGuiWindow, public SoundFactoryCallbacks, public PlayGroundCallbacks 24 { 25 Q_OBJECT 26 27 public: 28 29 TopLevel(); 30 ~TopLevel(); 31 32 void open(const QUrl &url); 33 void registerGameboard(const QString& menuText, const QString& boardFile, const QPixmap& pixmap) override; 34 void registerLanguage(const QString &code, const QString &soundFile, bool enabled) override; 35 void changeLanguage(const QString &langCode); 36 void playSound(const QString &ref) override; 37 38 bool isSoundEnabled() const override; 39 40 void changeGameboard(const QString &gameboard) override final; 41 42 protected: 43 void readOptions(QString &board, QString &language); 44 void writeOptions(); 45 void setupKAction(); 46 47 protected slots: 48 void saveNewToolbarConfig() override; 49 50 private slots: 51 52 void fileNew(); 53 void fileOpen(); 54 void fileSave(); 55 void filePicture(); 56 void filePrint(); 57 void editCopy(); 58 void soundOff(); 59 void changeGameboardFromCombo(int index); 60 void toggleFullScreen(); 61 void lockAspectRatio(bool lock); 62 63 private: 64 bool upload(const QString &src, const QUrl &target); 65 66 int // Menu items identificators 67 newID, openID, saveID, pictureID, printID, quitID, 68 copyID, undoID, redoID, 69 gameboardID, speechID; 70 enum { // Tool bar buttons identificators 71 ID_NEW, ID_OPEN, ID_SAVE, ID_PRINT, 72 ID_UNDO, ID_REDO, 73 ID_HELP }; 74 enum { BOARD_THEME = Qt::UserRole + 1}; 75 76 77 QActionGroup *playgroundsGroup, *languagesGroup; 78 KComboBox *playgroundCombo; 79 80 PlayGround *playGround; // Play ground central widget 81 SoundFactory *soundFactory; // Speech organ 82 QMap<QString, QString> sounds; // language code, file 83 }; 84 85 #endif 86