mainwindow.h 2.77 KB
Newer Older
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
1 2 3
/*******************************************************************
 *
 * Copyright 2006 Dmitry Suzdalev <dimsuz@gmail.com>
Denis Kuplyakov's avatar
Denis Kuplyakov committed
4
 * Copyright 2013 Denis Kuplyakov <dener.kup@gmail.com>
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * This file is part of the KDE project "KReversi"
 *
 * KReversi is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * KReversi is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with KReversi; see the file COPYING.  If not, write to
 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 ********************************************************************/
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
24 25 26
#ifndef KREVERSI_MAIN_WINDOW_H
#define KREVERSI_MAIN_WINDOW_H

Denis Kuplyakov's avatar
Denis Kuplyakov committed
27 28

#include <QDockWidget>
29
#include <QListWidget>
Denis Kuplyakov's avatar
Denis Kuplyakov committed
30

Denis Kuplyakov's avatar
Denis Kuplyakov committed
31
#include <KSelectAction>
32 33
#include <KToggleAction>
#include <KXmlGuiWindow>
Denis Kuplyakov's avatar
Denis Kuplyakov committed
34

35 36
#include "preferences.h"
#include "startgamedialog.h"
37

38 39
#include "kreversigame.h"
#include "kreversiview.h"
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
40

41 42
#include <QLabel>

Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
43
class KReversiGame;
44
class KReversiView;
Laurent Montel's avatar
Laurent Montel committed
45
class QAction;
46

Kevin Ottens's avatar
Kevin Ottens committed
47
class KReversiMainWindow : public KXmlGuiWindow
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
48
{
49
    Q_OBJECT
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
50
public:
Laurent Montel's avatar
Laurent Montel committed
51
    explicit KReversiMainWindow(QWidget* parent = nullptr,  bool startDemo = false);
52
    ~KReversiMainWindow();
53
public Q_SLOTS:
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
54
    void slotNewGame();
55
    void levelChanged();
56
    void slotAnimSpeedChanged(int);
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
57
    void slotUndo();
58
    void slotMoveFinished();
59
    void slotGameOver();
60
    void slotUseColoredChips(bool);
61
    void slotToggleBoardLabels(bool);
62
    void slotHighscores();
63
    void slotDialogReady();
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
64
private:
65
    void showEvent(QShowEvent*) override;
66 67 68
    void setupActionsInit();
    void setupActionsStart();
    void setupActionsGame();
69
    void loadSettings();
70
    void updateStatusBar();
71
    void updateHistory();
72 73
    void startDemo();
    void clearPlayers();
Laurent Montel's avatar
Laurent Montel committed
74
    void receivedGameStartInformation(const GameStartInformation &info);
75 76
    KReversiPlayer *m_player[2];

77
    StartGameDialog *m_startDialog;
78 79
    GameStartInformation m_nowPlayingInfo;

80

81
    KReversiView  *m_view;
82
    KReversiGame  *m_game;
83
    QDockWidget   *m_historyDock;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
84
    QListWidget   *m_historyView;
85

86 87 88
    bool m_firstShow;
    bool m_startInDemoMode;

89 90
    KgThemeProvider *m_provider;

91 92 93 94
    QAction *m_undoAct;
    QAction *m_hintAct;
    KToggleAction *m_showLast;
    KToggleAction *m_showLegal;
95
    QAction *m_showMovesAct;
96 97
    KSelectAction *m_animSpeedAct;
    KToggleAction *m_coloredChipsAct;
98

99 100
    enum { common = 1, black, white };
    QLabel *m_statusBarLabel[4];
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
101 102
};
#endif