1 | /* |
2 | This file is part of the KDE games library |
3 | Copyright (C) 2001 Andreas Beckermann <b_mann@gmx.de> |
4 | Copyright (C) 2007 Simon Hürlimann <simon.huerlimann@huerlisi.ch> |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License version 2 as published by the Free Software Foundation. |
9 | |
10 | This library 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 GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | // this class was shamelessy stolen from kdelibs/kdeui/kstdction.[cpp|h] and |
21 | // after that just edited for our needs |
22 | #ifndef KSTANDARDGAMEACTION_H |
23 | #define KSTANDARDGAMEACTION_H |
24 | |
25 | #include <libkdegames_export.h> |
26 | |
27 | class KAction; |
28 | class KToggleAction; |
29 | class QObject; |
30 | class KRecentFilesAction; |
31 | class KSelectAction; |
32 | |
33 | /** |
34 | * Extension for KStandardAction in KDE Games |
35 | * |
36 | * This class is an extension to the usual KStandardAction class which provides |
37 | * easy access to often used KDE actions. |
38 | * |
39 | * Using these actions helps maintaining consistency among the games. |
40 | * |
41 | * Games often use different menu entries than other programs, e.g. games use |
42 | * the menu "game" instead of "file". This class provides the entries which |
43 | * differ from the usual KStandardAction entries. |
44 | * |
45 | * @see <tt>KStandardAction</tt> |
46 | * |
47 | * @author Andreas Beckermann <b_mann@gmx.de> |
48 | */ |
49 | namespace KStandardGameAction |
50 | { |
51 | /** |
52 | * The standard menubar and toolbar actions. |
53 | **/ |
54 | enum StandardGameAction { |
55 | // Game menu |
56 | New=1, Load, LoadRecent, Save, SaveAs, End, Pause, Highscores, Statistics, |
57 | Print, Quit, |
58 | // Move menu |
59 | Repeat, Undo, Redo, Roll, EndTurn, |
60 | // Settings menu |
61 | Carddecks, |
62 | ChooseGameType, |
63 | ConfigureHighscores, |
64 | ClearHighscores, |
65 | ClearStatistics, |
66 | Restart, |
67 | Hint, |
68 | Demo, |
69 | Solve, |
70 | ActionNone |
71 | }; |
72 | |
73 | /** |
74 | * Creates an action corresponding to the |
75 | * KStandardAction::StandardAction enum. |
76 | */ |
77 | KDEGAMES_EXPORT KAction* create( StandardGameAction id, const QObject *recvr, const char *slot, |
78 | QObject* parent ); |
79 | |
80 | |
81 | /** |
82 | * This will return the internal name of a given standard action. |
83 | */ |
84 | KDEGAMES_EXPORT const char* name( StandardGameAction id ); |
85 | |
86 | /** |
87 | * Start a new game. |
88 | **/ |
89 | KDEGAMES_EXPORT KAction *gameNew(const QObject *recvr, const char *slot, |
90 | QObject *parent ); |
91 | |
92 | /** |
93 | * Load a previousely saved game. |
94 | */ |
95 | KDEGAMES_EXPORT KAction *load(const QObject *recvr, const char *slot, |
96 | QObject *parent ); |
97 | |
98 | // FIXME why not to delete this and use just KStandardAction::openRecent??? |
99 | // loadRecent seems to mimic its behaviour |
100 | /** |
101 | * Load a recently loaded game. |
102 | * The signature of slot is of the form slotURLSelected(const KUrl&) |
103 | */ |
104 | KDEGAMES_EXPORT KRecentFilesAction *loadRecent(const QObject *recvr, const char *slot, |
105 | QObject *parent ); |
106 | |
107 | /** |
108 | * Save the current game. |
109 | */ |
110 | KDEGAMES_EXPORT KAction *save(const QObject *recvr, const char *slot, |
111 | QObject *parent); |
112 | |
113 | /** |
114 | * Save the current game under a different filename. |
115 | */ |
116 | KDEGAMES_EXPORT KAction *saveAs(const QObject *recvr, const char *slot, |
117 | QObject *parent ); |
118 | |
119 | /** |
120 | * Pause the game. |
121 | **/ |
122 | KDEGAMES_EXPORT KToggleAction *pause(const QObject *recvr, const char *slot, |
123 | QObject *parent ); |
124 | |
125 | /** |
126 | * Show the highscores. |
127 | */ |
128 | KDEGAMES_EXPORT KAction *highscores(const QObject *recvr, const char *slot, |
129 | QObject *parent ); |
130 | |
131 | /** |
132 | * Clear highscores. |
133 | */ |
134 | KDEGAMES_EXPORT KAction *clearHighscores(const QObject *recvr, const char *slot, |
135 | QObject *parent ); |
136 | |
137 | /** |
138 | * Show the statistics. |
139 | */ |
140 | KDEGAMES_EXPORT KAction *statistics(const QObject *recvr, const char *slot, |
141 | QObject *parent ); |
142 | |
143 | /** |
144 | * Clear statistics. |
145 | */ |
146 | KDEGAMES_EXPORT KAction *clearStatistics(const QObject *recvr, const char *slot, |
147 | QObject *parent ); |
148 | |
149 | |
150 | /** |
151 | * End the current game, but do not quit the program. |
152 | * Think of a "close" entry. |
153 | */ |
154 | KDEGAMES_EXPORT KAction *end(const QObject *recvr, const char *slot, |
155 | QObject *parent ); |
156 | |
157 | /** |
158 | * Print current game. |
159 | * Not useful in all games. |
160 | */ |
161 | KDEGAMES_EXPORT KAction *print(const QObject *recvr, const char *slot, |
162 | QObject *parent ); |
163 | |
164 | /** |
165 | * Quit the game. |
166 | */ |
167 | KDEGAMES_EXPORT KAction *quit(const QObject *recvr, const char *slot, |
168 | QObject *parent ); |
169 | |
170 | /** |
171 | * Repeat the last move. |
172 | **/ |
173 | KDEGAMES_EXPORT KAction *repeat(const QObject *recvr, const char *slot, |
174 | QObject *parent ); |
175 | |
176 | /** |
177 | * Undo the last move. |
178 | **/ |
179 | KDEGAMES_EXPORT KAction *undo(const QObject *recvr, const char *slot, |
180 | QObject *parent ); |
181 | |
182 | /** |
183 | * Redo the last move (which has been undone). |
184 | **/ |
185 | KDEGAMES_EXPORT KAction *redo(const QObject *recvr, const char *slot, |
186 | QObject *parent ); |
187 | |
188 | /** |
189 | * Roll die or dice. |
190 | **/ |
191 | KDEGAMES_EXPORT KAction *roll(const QObject *recvr, const char *slot, |
192 | QObject *parent ); |
193 | |
194 | /** |
195 | * End the current turn (not the game). |
196 | * Usually to let the next player start. |
197 | **/ |
198 | KDEGAMES_EXPORT KAction *endTurn(const QObject *recvr, const char *slot, |
199 | QObject *parent ); |
200 | |
201 | /** |
202 | * Display configure carddecks dialog. |
203 | */ |
204 | KDEGAMES_EXPORT KAction *carddecks(const QObject *recvr, const char *slot, |
205 | QObject *parent ); |
206 | |
207 | /** |
208 | * Display configure highscores dialog. |
209 | */ |
210 | KDEGAMES_EXPORT KAction *configureHighscores(const QObject *recvr, const char *slot, |
211 | QObject *parent ); |
212 | |
213 | /** |
214 | * Give an advice/hint. |
215 | */ |
216 | KDEGAMES_EXPORT KAction *hint(const QObject *recvr, const char *slot, |
217 | QObject *parent ); |
218 | |
219 | /** |
220 | * Show a demo. |
221 | */ |
222 | KDEGAMES_EXPORT KToggleAction *demo(const QObject *recvr, const char *slot, |
223 | QObject *parent ); |
224 | |
225 | /** |
226 | * Solve the game. |
227 | */ |
228 | KDEGAMES_EXPORT KAction *solve(const QObject *recvr, const char *slot, |
229 | QObject *parent ); |
230 | |
231 | /** |
232 | * Choose game type. |
233 | * The signature of slot is of the form slotGameTypeChosen(int) |
234 | */ |
235 | KDEGAMES_EXPORT KSelectAction *chooseGameType(const QObject *recvr, const char *slot, |
236 | QObject *parent ); |
237 | |
238 | /** |
239 | * Restart the game. |
240 | */ |
241 | KDEGAMES_EXPORT KAction *restart(const QObject *recvr, const char *slot, |
242 | QObject *parent ); |
243 | |
244 | } |
245 | |
246 | #endif |
247 | |