File indexing completed on 2024-10-06 03:47:48
0001 /* 0002 SPDX-FileCopyrightText: 1999-2006 Éric Bischoff <ebischoff@nerim.net> 0003 SPDX-FileCopyrightText: 2007 Albert Astals Cid <aacid@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef _TOPLEVEL_H_ 0009 #define _TOPLEVEL_H_ 0010 0011 #include <kxmlguiwindow.h> 0012 #include <KComboBox> 0013 0014 #include "soundfactory.h" 0015 #include "playground.h" 0016 0017 class QActionGroup; 0018 class PlayGround; 0019 0020 class TopLevel : public KXmlGuiWindow, public SoundFactoryCallbacks, public PlayGroundCallbacks 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 0026 TopLevel(); 0027 ~TopLevel() override; 0028 0029 void open(const QUrl &url); 0030 void registerGameboard(const QString& menuText, const QString& boardFile, const QPixmap& pixmap) override; 0031 void registerLanguage(const QString &code, const QString &soundFile, bool enabled) override; 0032 void changeLanguage(const QString &langCode); 0033 void playSound(const QString &ref) override; 0034 0035 bool isSoundEnabled() const override; 0036 0037 void changeGameboard(const QString &gameboard) final; 0038 0039 protected: 0040 void readOptions(QString &board, QString &language); 0041 void writeOptions(); 0042 void setupKAction(); 0043 0044 protected Q_SLOTS: 0045 void saveNewToolbarConfig() override; 0046 0047 private Q_SLOTS: 0048 0049 void fileNew(); 0050 void fileOpen(); 0051 void fileSave(); 0052 void filePicture(); 0053 void filePrint(); 0054 void editCopy(); 0055 void soundOff(); 0056 void changeGameboardFromCombo(int index); 0057 void toggleFullScreen(); 0058 void lockAspectRatio(bool lock); 0059 0060 private: 0061 bool upload(const QString &src, const QUrl &target); 0062 0063 int // Menu items identificators 0064 newID, openID, saveID, pictureID, printID, quitID, 0065 copyID, undoID, redoID, 0066 gameboardID, speechID; 0067 enum { // Tool bar buttons identificators 0068 ID_NEW, ID_OPEN, ID_SAVE, ID_PRINT, 0069 ID_UNDO, ID_REDO, 0070 ID_HELP }; 0071 enum { BOARD_THEME = Qt::UserRole + 1}; 0072 0073 0074 QActionGroup *playgroundsGroup, *languagesGroup; 0075 KComboBox *playgroundCombo; 0076 0077 PlayGround *playGround; // Play ground central widget 0078 SoundFactory *soundFactory; // Speech organ 0079 QMap<QString, QString> sounds; // language code, file 0080 }; 0081 0082 #endif