mainwindow.h 2.41 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();
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
55
private:
56
    virtual void showEvent( QShowEvent* );
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
57
    void setupActions();
58
    void loadSettings();
59 60
    QString opponentName() const;
    void updateScores();
61

Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
62
    KReversiScene *m_scene;
63
    KReversiView  *m_view;
64
    KReversiGame  *m_game;
65
    QDockWidget   *m_historyDock;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
66
    QListWidget   *m_historyView;
67

68 69 70
    bool m_firstShow;
    bool m_startInDemoMode;

71 72 73 74 75
    /**
     * 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;

76 77 78
    QAction* m_undoAct;
    QAction* m_hintAct;
    QAction* m_demoAct;
79
    KSelectAction* m_animSpeedAct;
80
    KToggleAction* m_coloredChipsAct;
Dmitry Suzdalev's avatar
Dmitry Suzdalev committed
81 82
};
#endif