File indexing completed on 2024-04-21 04:04:58

0001 /*
0002     SPDX-FileCopyrightText: 2006 Matthew Williams <matt@milliams.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KSQUARESWINDOW_H
0008 #define KSQUARESWINDOW_H
0009 
0010 #include <KXmlGuiWindow>
0011 
0012 #include "ksquaresgame.h"
0013 #include "ui_prefs_ai.h"
0014 #include "ui_prefs_display.h"
0015 
0016 class GameBoardView;
0017 class GameBoardScene;
0018 class QLabel;
0019 /**
0020  * @short Mainwindow class
0021  *
0022  * Sets actions, controls the creation of the game class and the GameBoardScene
0023  *
0024  * @author Matt Williams <matt@milliams.com>
0025  */
0026 
0027 class KSquaresWindow : public KXmlGuiWindow
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     ///Constructor
0033     KSquaresWindow();
0034     ~KSquaresWindow() override;
0035 
0036 public Q_SLOTS:
0037     void  showHighscores();
0038     //void  configureHighscores();
0039     ///Launch the new game dialog and create a new game
0040     void gameNew();
0041     ///Start a new game with the same settings (read from KConfig Settings)
0042     void gameReset();
0043 
0044 private Q_SLOTS:
0045     void aiChooseLine(); // testing only
0046     void initObject();
0047     void optionsPreferences();
0048     void playerTakeTurn(KSquaresPlayer *currentPlayer);
0049     void gameOver(const QList<KSquaresPlayer> &_playerList);  //when KSquaresGame says the game is over. Display score board
0050 
0051 private:
0052 
0053     //void setupAccel();
0054     void setupActions();
0055     Ui::prefs_ai ui_prefs_ai;
0056     Ui::prefs_display ui_prefs_display;
0057     ///The game board view
0058     GameBoardView *m_view;
0059     ///The game scene
0060     GameBoardScene *m_scene;
0061     ///The game controller
0062     KSquaresGame *sGame;
0063     // Remember last network move
0064     int m_lastx1, m_lasty1, m_lastx2, m_lasty2;
0065     QLabel *m_player;
0066 };
0067 
0068 #endif // KSQUARESWINDOW_H