File indexing completed on 2024-10-06 03:45:02

0001 /*
0002     SPDX-FileCopyrightText: 2008 Mathias Kraus <k.hias@gmx.de>
0003     SPDX-FileCopyrightText: 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
0004     SPDX-FileCopyrightText: 2007-2008 Pierre-Benoit Bessse <besse@gmail.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef MAINWINDOW_H
0010 #define MAINWINDOW_H
0011 
0012 #include <KXmlGuiWindow>
0013 
0014 class Game;
0015 class GameView;
0016 class GameScene;
0017 class PlayerSettings;
0018 class KGameThemeProvider;
0019 class KConfigDialog;
0020 
0021 /**
0022  * @brief This class enables to create the main window for Granatier.
0023  */
0024 class MainWindow : public KXmlGuiWindow {
0025 
0026 Q_OBJECT
0027 
0028 private :
0029 
0030     /** The GameView instance that manages the game drawing and the collisions */
0031     GameView* m_view;
0032 
0033     GameScene* m_scene;
0034 
0035     /** The Game instance that manages the main loop and events */
0036     Game* m_game;
0037 
0038     /** The PlayerSettings instance for player name, shortcuts ...  */
0039     PlayerSettings* m_playerSettings;
0040 
0041     /** The KGameThemeProvider instance */
0042     KGameThemeProvider* m_themeProvider;
0043     QString m_currentThemeIdentifier;
0044 
0045     /**  */
0046     QStringList m_tempRandomArenaModeArenaList;
0047 
0048     KConfigDialog* m_settingsDialog;
0049 
0050 public:
0051 
0052     /**
0053       * Creates a new MainWindow instance.
0054       */
0055     MainWindow();
0056 
0057     /**
0058       * Deletes the MainWindow instance.
0059       */
0060     ~MainWindow() override;
0061 
0062 private Q_SLOTS:
0063 
0064     /**
0065       * Initializes the MainWindow for a new game.
0066       * Creates a new Game instance and a new GameView instance that displays the game.
0067       */
0068     void initGame();
0069 
0070     /**
0071       * Starts a new game.
0072       */
0073     void newGame();
0074 
0075     /**
0076       * Sets the sounds enabled / disabled.
0077       * @param p_enabled if true the sounds will be enabled, otherwise they will be disabled
0078       */
0079     void setSoundsEnabled(bool p_enabled);
0080 
0081     /**
0082       * Shows the settings dialog.
0083       */
0084     void showSettings();
0085 
0086     /**
0087       * Applies the new settings.
0088       */
0089     void applyNewSettings();
0090 
0091     /**
0092       * Cancel at settings dialog clicked.
0093       */
0094     void settingsDialogCanceled();
0095 
0096     /**
0097       * Closes the MainWindow.
0098       */
0099     void close();
0100 };
0101 
0102 #endif
0103