File indexing completed on 2024-10-13 06:43:32

0001 /*
0002     SPDX-FileCopyrightText: 2006 Dmitry Suzdalev <dimsuz@gmail.com>
0003     SPDX-FileCopyrightText: 2013 Denis Kuplyakov <dener.kup@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KREVERSI_MAIN_WINDOW_H
0009 #define KREVERSI_MAIN_WINDOW_H
0010 
0011 
0012 #include <QDockWidget>
0013 #include <QListWidget>
0014 
0015 #include <KSelectAction>
0016 #include <KToggleAction>
0017 #include <KXmlGuiWindow>
0018 
0019 #include "preferences.h"
0020 #include "startgamedialog.h"
0021 
0022 #include "kreversigame.h"
0023 #include "kreversiview.h"
0024 
0025 #include <QLabel>
0026 
0027 class KReversiGame;
0028 class KReversiView;
0029 class QAction;
0030 
0031 class KReversiMainWindow : public KXmlGuiWindow
0032 {
0033     Q_OBJECT
0034 public:
0035     explicit KReversiMainWindow(QWidget* parent = nullptr,  bool startDemo = false);
0036     ~KReversiMainWindow() override;
0037 public Q_SLOTS:
0038     void slotNewGame();
0039     void levelChanged();
0040     void slotAnimSpeedChanged(int);
0041     void slotUndo();
0042     void slotMoveFinished();
0043     void slotGameOver();
0044     void slotUseColoredChips(bool);
0045     void slotToggleBoardLabels(bool);
0046     void slotHighscores();
0047     void slotDialogReady();
0048 private:
0049     void showEvent(QShowEvent*) override;
0050     void setupActionsInit();
0051     void setupActionsStart();
0052     void setupActionsGame();
0053     void loadSettings();
0054     void updateStatusBar();
0055     void updateHistory();
0056     void startDemo();
0057     void clearPlayers();
0058     void receivedGameStartInformation(const GameStartInformation &info);
0059     KReversiPlayer *m_player[2];
0060 
0061     StartGameDialog *m_startDialog;
0062     GameStartInformation m_nowPlayingInfo;
0063 
0064 
0065     KReversiView  *m_view;
0066     KReversiGame  *m_game;
0067     QDockWidget   *m_historyDock;
0068     QListWidget   *m_historyView;
0069 
0070     bool m_firstShow;
0071     bool m_startInDemoMode;
0072 
0073     KGameThemeProvider *m_provider;
0074 
0075     QAction *m_undoAct;
0076     QAction *m_hintAct;
0077     KToggleAction *m_showLast;
0078     KToggleAction *m_showLegal;
0079     QAction *m_showMovesAct;
0080     KSelectAction *m_animSpeedAct;
0081     KToggleAction *m_coloredChipsAct;
0082 
0083     enum { common = 1, black, white };
0084     QLabel *m_statusBarLabel[4];
0085 };
0086 #endif