mainwindow.h 3.1 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 54 55
#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"

#include "kreversigame.h"
#include "kreversiview.h"
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
56

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

Kevin Ottens's avatar
Kevin Ottens committed
66
class KReversiMainWindow : public KXmlGuiWindow
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
67
{
68
    Q_OBJECT
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
69
public:
70
    explicit KReversiMainWindow(QWidget* parent = 0,  bool startDemo = false);
71
public slots:
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
72
    void slotNewGame();
73
    void levelChanged();
74
    void slotAnimSpeedChanged(int);
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
75
    void slotUndo();
76
    void slotMoveFinished();
77
    void slotGameOver();
78
    void slotToggleDemoMode();
79
    void slotUseColoredChips(bool);
80
    void slotShowMovesHistory(bool);
81
    void slotHighscores();
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
82
private:
83
    virtual void showEvent(QShowEvent*);
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
84
    void setupActions();
85
    void loadSettings();
86 87
    QString opponentName() const;
    void updateScores();
88
    void updateHistory();
Denis Kuplyakov's avatar
Denis Kuplyakov committed
89 90
    KReversiHumanPlayer *human;
    KReversiComputerPlayer *computer;
91

92
    KReversiView  *m_view;
93
    KReversiGame  *m_game;
94
    QDockWidget   *m_historyDock;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
95
    QListWidget   *m_historyView;
96

97 98 99
    bool m_firstShow;
    bool m_startInDemoMode;

100
    /**
101 102 103
     * Used for the high scores: if the player changes the difficulty level
     * during a running game, we'll keep the lowest computer skill corresponding
     * to the levels chosen.
104 105 106
     */
    int m_lowestSkill;

107 108 109
    QAction* m_undoAct;
    QAction* m_hintAct;
    QAction* m_demoAct;
110
    KSelectAction* m_animSpeedAct;
111
    KToggleAction* m_coloredChipsAct;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
112 113
};
#endif