~ubuntu-branches/ubuntu/vivid/kapman/vivid-proposed

« back to all changes in this revision

Viewing changes to kapmanmainwindow.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-12-07 17:37:19 UTC
  • Revision ID: package-import@ubuntu.com-20121207173719-5973b949kqub4zup
Tags: upstream-4.9.90
ImportĀ upstreamĀ versionĀ 4.9.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
 
3
 * Copyright 2007-2008 Pierre-Benoit Bessse <besse@gmail.com>
 
4
 * 
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License as
 
7
 * published by the Free Software Foundation; either version 2 of 
 
8
 * the License, or (at your option) any later version.
 
9
 * 
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 * 
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#ifndef KAPMANMAINWINDOW_H
 
20
#define KAPMANMAINWINDOW_H
 
21
 
 
22
#include "game.h"
 
23
#include "gameview.h"
 
24
 
 
25
#include <KXmlGuiWindow>
 
26
#include <QGraphicsView>
 
27
 
 
28
static const int initLives = 3;
 
29
 
 
30
class KStatusBar;
 
31
 
 
32
/**
 
33
 * @brief This class enables to create the main window for Kapman.
 
34
 */
 
35
class KapmanMainWindow : public KXmlGuiWindow {
 
36
 
 
37
        Q_OBJECT
 
38
 
 
39
        private :
 
40
                
 
41
                /** The GameView instance that manages the game drawing and the collisions */
 
42
                GameView* m_view;
 
43
 
 
44
                /** The Game instance that manages the main loop and events */
 
45
                Game* m_game;
 
46
 
 
47
                KStatusBar* m_statusBar;
 
48
                
 
49
        public:
 
50
 
 
51
                /**
 
52
                 * Creates a new KapmanMainWindow instance.
 
53
                 */
 
54
                KapmanMainWindow();
 
55
 
 
56
                /**
 
57
                 * Deletes the KapmanMainWindow instance.
 
58
                 */
 
59
                ~KapmanMainWindow();
 
60
 
 
61
        private slots:
 
62
 
 
63
                /**
 
64
                 * Initializes the KapmanMainWindow for a new game.
 
65
                 * Creates a new Game instance and a new GameView instance that displays the game.
 
66
                 */
 
67
                void initGame();
 
68
 
 
69
                /**
 
70
                 * Starts a new game.
 
71
                 * @param p_gameOver true if the game was over, false if a game is running
 
72
                 */
 
73
                void newGame(const bool p_gameOver = false);
 
74
 
 
75
                /**
 
76
                 * Shows the highscores dialog.
 
77
                 */
 
78
                void showHighscores();
 
79
 
 
80
                /**
 
81
                 * Shows a dialog enabling to change the current level.
 
82
                 */
 
83
                void changeLevel();
 
84
 
 
85
                /**
 
86
                 * Sets the sounds enabled / disabled.
 
87
                 * @param p_enabled if true the sounds will be enabled, otherwise they will be disabled
 
88
                 */
 
89
                void setSoundsEnabled(bool p_enabled);
 
90
 
 
91
                /**
 
92
                 * Shows the settings dialog.
 
93
                 */
 
94
                void showSettings();
 
95
 
 
96
                /**
 
97
                 * Loads the settings.
 
98
                 */
 
99
                void loadSettings();
 
100
 
 
101
                /**
 
102
                 * Closes the KapmanMainWindow.
 
103
                 */
 
104
                void close();
 
105
                
 
106
                /**
 
107
                 * Refreshes new level value on Status Bar.
 
108
                 * @param p_level is level value
 
109
                 */
 
110
                void displayLevel( unsigned int p_level );
 
111
                
 
112
                /**
 
113
                 * Refreshes new score value on Status Bar.
 
114
                 * @param p_score is score value
 
115
                 */
 
116
                void displayScore( unsigned int p_score );
 
117
                
 
118
                /**
 
119
                 * Refreshes new lives value on Status Bar.
 
120
                 * @param p_lives is lives value
 
121
                 */
 
122
                void displayLives( unsigned int p_lives );
 
123
 
 
124
                /**
 
125
                 * Resets the status bar values altogether for convenience.
 
126
                 */
 
127
                void resetStatusBar();
 
128
};
 
129
 
 
130
#endif
 
131