mainwindow.h 2.79 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 29

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

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

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

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

42 43
#include <QLabel>

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

Kevin Ottens's avatar
Kevin Ottens committed
48
class KReversiMainWindow : public KXmlGuiWindow
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
49
{
50
    Q_OBJECT
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
51
public:
52
    explicit KReversiMainWindow(QWidget* parent = 0,  bool startDemo = false);
53
    ~KReversiMainWindow();
54
public slots:
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
55
    void slotNewGame();
56
    void levelChanged();
57
    void slotAnimSpeedChanged(int);
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
58
    void slotUndo();
59
    void slotMoveFinished();
60
    void slotGameOver();
61
    void slotUseColoredChips(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 74 75 76
    void startDemo();
    void clearPlayers();
    void receivedGameStartInformation(GameStartInformation info);
    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 101

    QPointer<QLabel> black = new QLabel;
    QPointer<QLabel> white = new QLabel;
    QPointer<QLabel> common = new QLabel;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
102 103
};
#endif