mainwindow.h 2.46 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>
27
#include <KGameDifficulty>
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
28

29
class KReversiScene;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
30
class KReversiGame;
31
class KReversiView;
32
class QAction;
Laurent Montel's avatar
Laurent Montel committed
33
class KAction;
34
class KSelectAction;
35
class KToggleAction;
36 37
class QListWidget;
class QLabel;
38

Kevin Ottens's avatar
Kevin Ottens committed
39
class KReversiMainWindow : public KXmlGuiWindow
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
40
{
41
    Q_OBJECT
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
42
public:
43
    explicit KReversiMainWindow(QWidget* parent=0,  bool startDemo=false );
44
public slots:
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
45
    void slotNewGame();
46
    void levelChanged(KGameDifficulty::standardLevel level);
47
    void slotAnimSpeedChanged(int);
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
48
    void slotUndo();
49
    void slotMoveFinished();
50
    void slotGameOver();
51
    void slotToggleDemoMode();
52
    void slotUseColoredChips(bool);
53
    void slotShowMovesHistory(bool);
54
    void slotHighscores();
55
    void slotSeats();
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
56
private:
57
    virtual void showEvent( QShowEvent* );
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
58
    void setupActions();
59
    void loadSettings();
60 61
    QString opponentName() const;
    void updateScores();
62

Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
63
    KReversiScene *m_scene;
64
    KReversiView  *m_view;
65 66
    KReversiGame  *m_game;
    QLabel        *m_historyLabel;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
67
    QListWidget   *m_historyView;
68

69 70 71
    bool m_firstShow;
    bool m_startInDemoMode;

72 73 74 75 76
    /**
     * 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.
     */
    int m_lowestSkill;

77 78 79
    QAction* m_undoAct;
    QAction* m_hintAct;
    QAction* m_demoAct;
Laurent Montel's avatar
Laurent Montel committed
80
    KAction* m_seatsAct;
81
    KSelectAction* m_animSpeedAct;
82
    KToggleAction* m_coloredChipsAct;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
83 84
};
#endif