1 | /* kmahjongg, the classic mahjongg game for KDE project |
2 | * |
3 | * Copyright (C) 1997 Mathias Mueller <in5y158@public.uni-hamburg.de> |
4 | * Copyright (C) 2006-2007 Mauricio Piacentini <mauricio@tabuleiro.com> |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (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, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | |
20 | #ifndef _KMAHJONGG_H |
21 | #define _KMAHJONGG_H |
22 | |
23 | |
24 | #include <kxmlguiwindow.h> |
25 | |
26 | #include "KmTypes.h" |
27 | #include "kmahjonggtileset.h" |
28 | #include "kmahjonggbackground.h" |
29 | #include "BoardLayout.h" |
30 | #include "boardwidget.h" |
31 | |
32 | |
33 | class QAction; |
34 | class KToggleAction; |
35 | class QLabel; |
36 | class KGameClock; |
37 | class Editor; |
38 | |
39 | /** |
40 | * @short Class Description |
41 | * |
42 | * @author Mathias */ |
43 | class KMahjongg : public KXmlGuiWindow |
44 | { |
45 | Q_OBJECT |
46 | |
47 | public: |
48 | /** |
49 | * Constructor |
50 | * |
51 | * @param parent */ |
52 | explicit KMahjongg(QWidget *parent = 0); |
53 | |
54 | /** |
55 | * Default Destructor */ |
56 | ~KMahjongg(); |
57 | |
58 | public slots: |
59 | /** |
60 | * Slot Description |
61 | * |
62 | * @param num */ |
63 | void startNewGame(int num = -1); |
64 | |
65 | /** |
66 | * Slot Description |
67 | * |
68 | * @param msg |
69 | * @param board */ |
70 | void showStatusText(const QString &msg, long board); |
71 | |
72 | /** |
73 | * Slot Description |
74 | * |
75 | * @param iMaximum |
76 | * @param iCurrent |
77 | * @param iLeft */ |
78 | void showTileNumber(int iMaximum, int iCurrent, int iLeft); |
79 | |
80 | /** |
81 | * Slot Description |
82 | * |
83 | * @param bActive */ |
84 | void demoModeChanged(bool bActive); |
85 | |
86 | /** |
87 | * Slot Description |
88 | * |
89 | * @param removed |
90 | * @param cheats */ |
91 | void gameOver(unsigned short removed, unsigned short cheats); |
92 | |
93 | /** |
94 | * Load BoardLayout from file |
95 | * |
96 | * @param file */ |
97 | // void loadBoardLayout(const QString &file); |
98 | |
99 | /** |
100 | * Slot Description */ |
101 | void setDisplayedWidth(); |
102 | |
103 | /** |
104 | * Slot Description */ |
105 | void newGame(); |
106 | |
107 | /** |
108 | * Slot Description */ |
109 | void timerReset(); |
110 | |
111 | protected: |
112 | /** |
113 | * Method Description */ |
114 | void setupKAction(); |
115 | |
116 | /** |
117 | * Method Description */ |
118 | void setupStatusBar(); |
119 | |
120 | /** |
121 | * Method Override */ |
122 | void changeEvent(QEvent *event); |
123 | |
124 | private slots: |
125 | void showSettings(); |
126 | void startNewNumeric(); |
127 | void saveGame(); |
128 | void loadGame(); |
129 | void restartGame(); |
130 | void undo(); |
131 | void redo(); |
132 | void pause(); |
133 | void demoMode(); |
134 | void displayTime(const QString& timestring); |
135 | void showHighscores(); |
136 | void slotBoardEditor(); |
137 | |
138 | private: |
139 | unsigned long gameElapsedTime; |
140 | bool bDemoModeActive; |
141 | bool mFinished; |
142 | |
143 | BoardWidget *bw; |
144 | |
145 | Editor *boardEditor; |
146 | |
147 | QLabel *; |
148 | QLabel *tilesLeftLabel; |
149 | QLabel *statusLabel; |
150 | QLabel *gameTimerLabel; |
151 | |
152 | QAction *undoAction; |
153 | QAction *redoAction; |
154 | |
155 | KGameClock *gameTimer; |
156 | |
157 | KToggleAction *pauseAction; |
158 | KToggleAction *demoAction; |
159 | }; |
160 | |
161 | |
162 | #endif |
163 | |