mainwindow.h 3.02 KB
Newer Older
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*******************************************************************
 *
 * Copyright 2006 Dmitry Suzdalev <dimsuz@gmail.com>
 *
 * 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
23 24 25
#ifndef KREVERSI_MAIN_WINDOW_H
#define KREVERSI_MAIN_WINDOW_H

Kevin Ottens's avatar
Kevin Ottens committed
26
#include <kxmlguiwindow.h>
Denis Kuplyakov's avatar
Denis Kuplyakov committed
27 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
#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
55

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

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

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

95 96 97
    bool m_firstShow;
    bool m_startInDemoMode;

98
    /**
99 100 101
     * 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.
102 103 104
     */
    int m_lowestSkill;

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