mainwindow.h 3.24 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

Kevin Ottens's avatar
Kevin Ottens committed
27
#include <kxmlguiwindow.h>
Denis Kuplyakov's avatar
Denis Kuplyakov committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
#include "preferences.h"

#include <QApplication>
#include <QListWidget>
#include <QDockWidget>
#include <QLabel>
#include <QDesktopWidget>

#include <KAction>
#include <kactioncollection.h>
#include <ktoggleaction.h>
#include <kdebug.h>
#include <kexthighscore.h>
#include <kicon.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#include <kstatusbar.h>
#include <kstandardaction.h>
#include <kstandardgameaction.h>
#include <kselectaction.h>
#include <ktoolinvocation.h>
#include <KgDifficulty>
#include "kreversihumanplayer.h"
#include "kreversicomputerplayer.h"

54 55
#include "startgamedialog.h"

Denis Kuplyakov's avatar
Denis Kuplyakov committed
56 57
#include "kreversigame.h"
#include "kreversiview.h"
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
58

Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
59
class KReversiGame;
60
class KReversiView;
61
class QAction;
Laurent Montel's avatar
Laurent Montel committed
62
class KAction;
63
class KSelectAction;
64
class KToggleAction;
65 66
class QListWidget;
class QLabel;
67

Kevin Ottens's avatar
Kevin Ottens committed
68
class KReversiMainWindow : public KXmlGuiWindow
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
69
{
70
    Q_OBJECT
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
71
public:
72
    explicit KReversiMainWindow(QWidget* parent = 0,  bool startDemo = false);
73
    ~KReversiMainWindow();
74
public slots:
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
75
    void slotNewGame();
76
    void levelChanged();
77
    void slotAnimSpeedChanged(int);
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
78
    void slotUndo();
79
    void slotMoveFinished();
80
    void slotGameOver();
81
    void slotUseColoredChips(bool);
82
    void slotShowMovesHistory(bool);
83
    void slotHighscores();
84
    void slotDialogReady();
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
85
private:
86
    virtual void showEvent(QShowEvent*);
87 88 89
    void setupActionsInit();
    void setupActionsStart();
    void setupActionsGame();
90
    void loadSettings();
91
    void updateStatusBar();
92
    void updateHistory();
93 94 95 96 97
    void startDemo();
    void clearPlayers();
    void receivedGameStartInformation(GameStartInformation info);
    KReversiPlayer *m_player[2];

98
    StartGameDialog *m_startDialog;
99 100
    GameStartInformation m_nowPlayingInfo;

101

102
    KReversiView  *m_view;
103
    KReversiGame  *m_game;
104
    QDockWidget   *m_historyDock;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
105
    QListWidget   *m_historyView;
106

107 108 109
    bool m_firstShow;
    bool m_startInDemoMode;

110 111
    KgThemeProvider *m_provider;

112 113
    QAction *m_undoAct;
    QAction *m_hintAct;
114
//    QAction *m_demoAct;
115 116 117 118 119
    KToggleAction *m_showLast;
    KToggleAction *m_showLegal;
    KToggleAction *m_showMovesAct;
    KSelectAction *m_animSpeedAct;
    KToggleAction *m_coloredChipsAct;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
120 121
};
#endif