bump up
[mancala] / src / MainWindow.h
1 /*
2 Mancala - A Historical Board Game
3 Copyright (C) 2009-2010 A.H.M.Mahfuzur Rahman 65mahfuz90@gmail.com
4 Copyright (c) 2010 Reto Zingg g.d0b3rm4n@gmail.com
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of
9 the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef MAINWINDOW_H
21 #define MAINWINDOW_H
22
23 #include <QtCore>
24 #include <QSizeF>
25 #include <QRectF>
26 #include <QResizeEvent>
27 #include <QMainWindow>
28 #include <QLabel>
29 #include <QAction>
30 #include <QStackedWidget>
31
32 //#include <kxmlguiwindow.h>
33 //#include <kgamedifficulty.h>
34
35 #include "GameController.h"
36 #include "settingswidget.h"
37
38 class GameInfo;
39 class ThemeManager;
40 class GraphicsScene;
41 class GameController;
42 class QGraphicsView;
43 //class KSelectAction;
44 class QXmlStreamReader;
45 //class KGameClock;
46
47 class MainWindow : public QMainWindow{
48     Q_OBJECT
49
50     public:
51         MainWindow(QWidget *parent = 0);
52         ~MainWindow();
53
54         QString gameName(){ return m_gameName;}
55
56         QRectF windowRect(){ return this->rect();}
57
58         void setGameName(QString gameName);
59
60
61     private slots:
62         void newGame(int gameId);
63         void slotShowScore(int score,bool human);
64         void slotShowTurn(bool);
65         void slotShowGameOver();
66         void slotMessage(QString);
67         void slotPause();
68         // void slotChangeDifficulty(KGameDifficulty::standardLevel);
69         void slotChangeDifficulty(int level);
70         void slotStartGame();
71         void slotShowSettings();
72         void slotChangeGameName(int game);
73         void help();
74
75     signals:
76         void signalLoadTheme();
77         void signalGameDifficulty(GameController::Difficulty);
78
79     protected:
80         void resizeEvent(QResizeEvent *event);
81
82     private:
83         void setupGame();
84         void setupWidgets();
85         void startGame();
86         void setupActions();
87
88
89         void setGameName();
90         void parseXml(QIODevice *device);
91         void parseNames();
92
93         GraphicsScene *m_scene;
94         GameInfo* m_gameInfo;
95         ThemeManager* m_gameTheme;
96         GameController *m_gameController;
97         // KGameClock* m_gameClock;
98
99         QStringList m_gameNameList;
100         QString m_gameName;
101         int m_gameNameId;
102         QGraphicsView *m_view;
103 //        GraphicsView* m_view;
104
105         // KSelectAction* newGameAct;
106         QXmlStreamReader *reader;
107
108         QLabel *msgLabel;
109         QLabel *turnLabel;
110         QLabel *humanScore;
111         QLabel *aiScore;
112
113         enum Level {
114             Easy = 0,
115             Medium = 1,
116             Hard = 2
117         };
118
119         QMenu *mainMenu;
120         QMenu *newGameMenu;
121         QAction *newGameAction;
122         QAction *restartGameAction;
123         QAction *helpAction;
124
125         SettingsWidget *settings;
126         QStackedWidget *m_StackedWidget;
127
128     signals:
129         void resized(QSizeF size);
130 };
131
132 #endif // MAINWINDOW_H