File indexing completed on 2024-04-21 04:03:17

0001 /*
0002     SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef PLAYFIELD_H
0008 #define PLAYFIELD_H
0009 
0010 #include <QWidget>
0011 
0012 #include <KGameDifficulty>
0013 
0014 #include "sea.h"
0015 #include "ships.h"
0016 
0017 class SeaView;
0018 class Controller;
0019 class AudioPlayer;
0020 class ChatWidget;
0021 class SimpleMenu;
0022 class QStatusBar;
0023 
0024 class PlayField : public QWidget
0025 {
0026 Q_OBJECT
0027     SeaView* m_seaView;
0028     Controller* m_controller;
0029     AudioPlayer* m_player;
0030     ChatWidget* m_chat;
0031     SimpleMenu* m_menu;
0032     QStatusBar* m_status_bar;
0033     bool m_show_endofgame_message;
0034     BattleShipsConfiguration m_battle_ships_configuration;
0035 
0036     void startGame();
0037     void endGame();
0038     Controller* createController();
0039     SimpleMenu* createAuxMenu();
0040 public:
0041     PlayField(QWidget* parent, QStatusBar*);
0042     ~PlayField() override;
0043     void createClientWithUrl(const QUrl& url);
0044 public Q_SLOTS:
0045     void highscores();
0046     void gameOver(Sea::Player winner);
0047     void setupController();
0048 
0049     void newGame();
0050     void restart();
0051     void changeNick();
0052     void toggleSounds(bool);
0053     void toggleAdjacent(bool);
0054     void toggleMultiple(bool);
0055     void restartRequested();
0056     void startPlacingShips();
0057     void restartPlacingShips(Sea::Player player);
0058     void setCompatibility(int);
0059     void updateNick(int, const QString&);
0060     void changeTurn(int);
0061     void playerReady(int);
0062     void levelChanged();
0063 
0064     void auxMenuDone();
0065     void localGame();
0066     void createServer();
0067     void createClient();
0068 
0069     void toggleEndOfGameMessage(bool show);
0070     void toggleLeftGrid(bool show);
0071     void toggleRightGrid(bool show);
0072 Q_SIGNALS:
0073     void gameFinished();
0074     void abortGame(Sea::Player player);
0075     void welcomeScreen();
0076     void placeShips();
0077 };
0078 
0079 #endif // PLAYFIELD_H
0080