summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/kpacman/kpacman.cpp4
-rw-r--r--noncore/games/kpacman/kpacman.h4
-rw-r--r--noncore/games/kpacman/kpacman.pro4
-rw-r--r--noncore/games/kpacman/main.cpp27
-rw-r--r--noncore/games/kpacman/opie-kpacman.control2
5 files changed, 9 insertions, 32 deletions
diff --git a/noncore/games/kpacman/kpacman.cpp b/noncore/games/kpacman/kpacman.cpp
index 9820e5a..4a3b870 100644
--- a/noncore/games/kpacman/kpacman.cpp
+++ b/noncore/games/kpacman/kpacman.cpp
@@ -1,363 +1,363 @@
1 1
2#include "portable.h" 2#include "portable.h"
3 3
4#if defined( KDE2_PORT ) 4#if defined( KDE2_PORT )
5#include <kpacman.h> 5#include <kpacman.h>
6#include <kpacman.moc> 6#include <kpacman.moc>
7#include <kcolordlg.h> 7#include <kcolordlg.h>
8#elif defined( QPE_PORT ) 8#elif defined( QPE_PORT )
9#include <qmenubar.h> 9#include <qmenubar.h>
10#include <qpe/config.h> 10#include <qpe/config.h>
11#include <qapplication.h> 11#include <qapplication.h>
12#include "kpacman.h" 12#include "kpacman.h"
13#endif 13#endif
14 14
15 15
16Kpacman::Kpacman(QWidget *parent, const char *name) 16Kpacman::Kpacman(QWidget *parent, const char *name, WFlags fl)
17 : KTMainWindow(parent, name) 17 : KTMainWindow(parent, name,fl)
18{ 18{
19 schemesPopup = new QList<QPopupMenu>; 19 schemesPopup = new QList<QPopupMenu>;
20 schemesPopup->setAutoDelete(TRUE); 20 schemesPopup->setAutoDelete(TRUE);
21 21
22 menu(); 22 menu();
23 23
24 m_view = new QWidget( this, "m_view" ); 24 m_view = new QWidget( this, "m_view" );
25 m_view->setBackgroundColor( black ); 25 m_view->setBackgroundColor( black );
26 m_layout = new QGridLayout( m_view ); 26 m_layout = new QGridLayout( m_view );
27 m_layout->setMargin( 7 ); 27 m_layout->setMargin( 7 );
28 28
29 view = new KpacmanWidget( this, QString(name)+"widget"); 29 view = new KpacmanWidget( this, QString(name)+"widget");
30 m_layout->addWidget( view, 0, 0 ); 30 m_layout->addWidget( view, 0, 0 );
31 31
32 setCaption( tr("KPacman") ); 32 setCaption( tr("KPacman") );
33 33
34 view->referee->setFocus(); 34 view->referee->setFocus();
35 35
36 connect(view->referee, SIGNAL(setScore(int,int)), 36 connect(view->referee, SIGNAL(setScore(int,int)),
37 view->score, SLOT(setScore(int,int))); 37 view->score, SLOT(setScore(int,int)));
38 connect(view->referee, SIGNAL(setPoints(int)), 38 connect(view->referee, SIGNAL(setPoints(int)),
39 view->score, SLOT(set(int))); 39 view->score, SLOT(set(int)));
40 connect(view->referee, SIGNAL(setLifes(int)), 40 connect(view->referee, SIGNAL(setLifes(int)),
41 view->status, SLOT(setLifes(int))); 41 view->status, SLOT(setLifes(int)));
42 connect(view->referee, SIGNAL(setLevel(int)), 42 connect(view->referee, SIGNAL(setLevel(int)),
43 view->status, SLOT(setLevel(int))); 43 view->status, SLOT(setLevel(int)));
44 connect(view->referee, SIGNAL(forcedHallOfFame(bool)), 44 connect(view->referee, SIGNAL(forcedHallOfFame(bool)),
45 this, SLOT(forcedHallOfFame(bool))); 45 this, SLOT(forcedHallOfFame(bool)));
46 connect(view->referee, SIGNAL(togglePaused()), this, SLOT(togglePaused())); 46 connect(view->referee, SIGNAL(togglePaused()), this, SLOT(togglePaused()));
47 connect(view->referee, SIGNAL(toggleNew()), this, SLOT(toggleNew())); 47 connect(view->referee, SIGNAL(toggleNew()), this, SLOT(toggleNew()));
48 48
49 connect(view->score, SIGNAL(toggleNew()), this, SLOT(toggleNew())); 49 connect(view->score, SIGNAL(toggleNew()), this, SLOT(toggleNew()));
50 connect(view->score, SIGNAL(forcedHallOfFame(bool)), 50 connect(view->score, SIGNAL(forcedHallOfFame(bool)),
51 this, SLOT(forcedHallOfFame(bool))); 51 this, SLOT(forcedHallOfFame(bool)));
52 52
53 APP_CONFIG_BEGIN( cfg ); 53 APP_CONFIG_BEGIN( cfg );
54 focusOutPause = !cfg->readBoolEntry("FocusOutPause", TRUE); 54 focusOutPause = !cfg->readBoolEntry("FocusOutPause", TRUE);
55 focusInContinue = !cfg->readBoolEntry("FocusInContinue", TRUE); 55 focusInContinue = !cfg->readBoolEntry("FocusInContinue", TRUE);
56 hideMouseCursor = !cfg->readBoolEntry("HideMouseCursor", TRUE); 56 hideMouseCursor = !cfg->readBoolEntry("HideMouseCursor", TRUE);
57 APP_CONFIG_END( cfg ); 57 APP_CONFIG_END( cfg );
58 58
59 toggleFocusOutPause(); 59 toggleFocusOutPause();
60 toggleFocusInContinue(); 60 toggleFocusInContinue();
61 toggleHideMouseCursor(); 61 toggleHideMouseCursor();
62 62
63 setCentralWidget( m_view ); 63 setCentralWidget( m_view );
64} 64}
65 65
66Kpacman::~Kpacman() 66Kpacman::~Kpacman()
67{ 67{
68 /* APP_CONFIG_BEGIN( cfg ); 68 /* APP_CONFIG_BEGIN( cfg );
69 cfg->writeEntry("FocusOutPause", focusOutPause); 69 cfg->writeEntry("FocusOutPause", focusOutPause);
70 cfg->writeEntry("FocusInContinue", focusInContinue); 70 cfg->writeEntry("FocusInContinue", focusInContinue);
71 cfg->writeEntry("HideMouseCursor", hideMouseCursor); 71 cfg->writeEntry("HideMouseCursor", hideMouseCursor);
72 APP_CONFIG_END( cfg ); 72 APP_CONFIG_END( cfg );
73 */ 73 */
74 delete _menuBar; 74 delete _menuBar;
75} 75}
76 76
77void Kpacman::menu() 77void Kpacman::menu()
78{ 78{
79 gamePopup = new QPopupMenu(); 79 gamePopup = new QPopupMenu();
80 CHECK_PTR( gamePopup ); 80 CHECK_PTR( gamePopup );
81 newID = gamePopup->insertItem(tr("&New"), this, SLOT(newKpacman()),Key_F2); 81 newID = gamePopup->insertItem(tr("&New"), this, SLOT(newKpacman()),Key_F2);
82 pauseID = gamePopup->insertItem(tr("&Pause"), 82 pauseID = gamePopup->insertItem(tr("&Pause"),
83 this, SLOT(pauseKpacman()), Key_F3); 83 this, SLOT(pauseKpacman()), Key_F3);
84 hofID = gamePopup->insertItem(tr("&Hall of fame"), 84 hofID = gamePopup->insertItem(tr("&Hall of fame"),
85 this, SLOT(toggleHallOfFame()), Key_F4); 85 this, SLOT(toggleHallOfFame()), Key_F4);
86 gamePopup->insertSeparator(); 86 gamePopup->insertSeparator();
87 gamePopup->insertItem(tr("&Quit"), this, SLOT(quitKpacman()), CTRL+Key_Q); 87 gamePopup->insertItem(tr("&Quit"), this, SLOT(quitKpacman()), CTRL+Key_Q);
88 gamePopup->setCheckable(TRUE); 88 gamePopup->setCheckable(TRUE);
89 89
90 optionsPopup = new QPopupMenu(); 90 optionsPopup = new QPopupMenu();
91 CHECK_PTR(optionsPopup); 91 CHECK_PTR(optionsPopup);
92 92
93 modesPopup = new QPopupMenu(); 93 modesPopup = new QPopupMenu();
94 CHECK_PTR(modesPopup); 94 CHECK_PTR(modesPopup);
95 95
96 hideMouseCursorID = optionsPopup->insertItem(tr("&Hide Mousecursor"), 96 hideMouseCursorID = optionsPopup->insertItem(tr("&Hide Mousecursor"),
97 this, SLOT(toggleHideMouseCursor()), 97 this, SLOT(toggleHideMouseCursor()),
98 CTRL+Key_H); 98 CTRL+Key_H);
99 optionsPopup->insertSeparator(); 99 optionsPopup->insertSeparator();
100 100
101 if (lookupSchemes() > 0) { 101 if (lookupSchemes() > 0) {
102 optionsPopup->insertItem(tr("&Select graphic scheme"), modesPopup); 102 optionsPopup->insertItem(tr("&Select graphic scheme"), modesPopup);
103 optionsPopup->insertSeparator(); 103 optionsPopup->insertSeparator();
104 } 104 }
105 105
106 focusOutPauseID = optionsPopup->insertItem(tr("&Pause in Background"), 106 focusOutPauseID = optionsPopup->insertItem(tr("&Pause in Background"),
107 this, SLOT(toggleFocusOutPause())); 107 this, SLOT(toggleFocusOutPause()));
108 focusInContinueID = optionsPopup->insertItem(tr("&Continue in Foreground"), 108 focusInContinueID = optionsPopup->insertItem(tr("&Continue in Foreground"),
109 this, SLOT(toggleFocusInContinue())); 109 this, SLOT(toggleFocusInContinue()));
110 optionsPopup->insertSeparator(); 110 optionsPopup->insertSeparator();
111 111
112 optionsPopup->insertItem(tr("Change &keys..."), this, SLOT(confKeys())); 112 optionsPopup->insertItem(tr("Change &keys..."), this, SLOT(confKeys()));
113 113
114#ifndef QPE_PORT 114#ifndef QPE_PORT
115 QString aboutText = tr("@PACKAGE@ - @VERSION@\n\n" 115 QString aboutText = tr("@PACKAGE@ - @VERSION@\n\n"
116 "Joerg Thoennissen (joe@dsite.de)\n\n" 116 "Joerg Thoennissen (joe@dsite.de)\n\n"
117 "A pacman game for the KDE Desktop\n\n" 117 "A pacman game for the KDE Desktop\n\n"
118 "The program based on the source of ksnake\n" 118 "The program based on the source of ksnake\n"
119 "by Michel Filippi (mfilippi@sade.rhein-main.de).\n" 119 "by Michel Filippi (mfilippi@sade.rhein-main.de).\n"
120 "The design was strongly influenced by the pacman\n" 120 "The design was strongly influenced by the pacman\n"
121 "(c) 1980 MIDWAY MFG.CO.\n\n" 121 "(c) 1980 MIDWAY MFG.CO.\n\n"
122 "I like to thank my girlfriend Elke Krueers for\n" 122 "I like to thank my girlfriend Elke Krueers for\n"
123 "the last 10 years of her friendship.\n"); 123 "the last 10 years of her friendship.\n");
124 aboutText.replace(QRegExp("@PACKAGE@"), PACKAGE); 124 aboutText.replace(QRegExp("@PACKAGE@"), PACKAGE);
125 aboutText.replace(QRegExp("@VERSION@"), VERSION); 125 aboutText.replace(QRegExp("@VERSION@"), VERSION);
126 QPopupMenu *helpPopup = helpMenu(aboutText, FALSE); 126 QPopupMenu *helpPopup = helpMenu(aboutText, FALSE);
127#endif 127#endif
128 128
129 //_menuBar = new KMenuBar(this); 129 //_menuBar = new KMenuBar(this);
130 //CHECK_PTR( _menuBar ); 130 //CHECK_PTR( _menuBar );
131 //_menuBar->insertItem(tr("&Game"), gamePopup); 131 //_menuBar->insertItem(tr("&Game"), gamePopup);
132 //_menuBar->insertItem(tr("&Options"), optionsPopup); 132 //_menuBar->insertItem(tr("&Options"), optionsPopup);
133 //_menuBar->insertSeparator(); 133 //_menuBar->insertSeparator();
134#ifndef QPE_PORT 134#ifndef QPE_PORT
135 _menuBar->insertItem(tr("&Help"), helpPopup); 135 _menuBar->insertItem(tr("&Help"), helpPopup);
136#endif 136#endif
137} 137}
138 138
139int Kpacman::lookupSchemes() 139int Kpacman::lookupSchemes()
140{ 140{
141 APP_CONFIG_BEGIN( cfg ); 141 APP_CONFIG_BEGIN( cfg );
142 int ModeCount = cfg->readNumEntry("ModeCount", 0); 142 int ModeCount = cfg->readNumEntry("ModeCount", 0);
143 int Mode = cfg->readNumEntry("Mode", 0); 143 int Mode = cfg->readNumEntry("Mode", 0);
144 int SchemeCount = cfg->readNumEntry("SchemeCount", 0); 144 int SchemeCount = cfg->readNumEntry("SchemeCount", 0);
145 int Scheme = cfg->readNumEntry("Scheme", 0); 145 int Scheme = cfg->readNumEntry("Scheme", 0);
146 146
147 /* 147 /*
148 if (SchemeCount == 0 || Scheme == -1) { 148 if (SchemeCount == 0 || Scheme == -1) {
149 QMessageBox::warning(this, tr("Configuration Error"), 149 QMessageBox::warning(this, tr("Configuration Error"),
150 tr("There are no schemes defined,\n" 150 tr("There are no schemes defined,\n"
151 "or no scheme is selected.")); 151 "or no scheme is selected."));
152 APP_CONFIG_END( cfg ); 152 APP_CONFIG_END( cfg );
153 return 0; 153 return 0;
154 } 154 }
155 */ 155 */
156 156
157 connect(modesPopup, SIGNAL(activated(int)), this, SLOT(schemeChecked(int))); 157 connect(modesPopup, SIGNAL(activated(int)), this, SLOT(schemeChecked(int)));
158 modeID.resize(ModeCount > 0 ? ModeCount : 0); 158 modeID.resize(ModeCount > 0 ? ModeCount : 0);
159 159
160 if (!schemesPopup->isEmpty()) 160 if (!schemesPopup->isEmpty())
161 schemesPopup->clear(); 161 schemesPopup->clear();
162 162
163 SAVE_CONFIG_GROUP( cfg, oldgroup ); 163 SAVE_CONFIG_GROUP( cfg, oldgroup );
164 164
165 QString ModeGroup; 165 QString ModeGroup;
166 QString ModeName; 166 QString ModeName;
167 167
168 for (int m = 0; m < ModeCount; m++) { 168 for (int m = 0; m < ModeCount; m++) {
169 ModeGroup.sprintf("Mode %d", m); 169 ModeGroup.sprintf("Mode %d", m);
170 cfg->setGroup(ModeGroup); 170 cfg->setGroup(ModeGroup);
171 171
172 ModeName = cfg->readEntry("Description", ModeGroup); 172 ModeName = cfg->readEntry("Description", ModeGroup);
173 173
174 QPopupMenu *p = new QPopupMenu; 174 QPopupMenu *p = new QPopupMenu;
175 p->setCheckable(TRUE); 175 p->setCheckable(TRUE);
176 connect(p, SIGNAL(activated(int)), this, SLOT(schemeChecked(int))); 176 connect(p, SIGNAL(activated(int)), this, SLOT(schemeChecked(int)));
177 schemesPopup->append(p); 177 schemesPopup->append(p);
178 178
179 modeID[m] = modesPopup->insertItem(ModeName, schemesPopup->at(m)); 179 modeID[m] = modesPopup->insertItem(ModeName, schemesPopup->at(m));
180 modesPopup->setItemEnabled(modeID[m], FALSE); 180 modesPopup->setItemEnabled(modeID[m], FALSE);
181 modesPopup->setItemChecked(modeID[m], m == Mode); 181 modesPopup->setItemChecked(modeID[m], m == Mode);
182 } 182 }
183 183
184 schemeID.resize(SchemeCount); 184 schemeID.resize(SchemeCount);
185 schemeMode.resize(SchemeCount); 185 schemeMode.resize(SchemeCount);
186 186
187 QString SchemeGroup; 187 QString SchemeGroup;
188 QString SchemeName; 188 QString SchemeName;
189 int SchemeMode; 189 int SchemeMode;
190 190
191 for (int i = 0; i < SchemeCount; i++) { 191 for (int i = 0; i < SchemeCount; i++) {
192 SchemeGroup.sprintf("Scheme %d", i); 192 SchemeGroup.sprintf("Scheme %d", i);
193 cfg->setGroup(SchemeGroup); 193 cfg->setGroup(SchemeGroup);
194 194
195 SchemeName = cfg->readEntry("Description", SchemeGroup); 195 SchemeName = cfg->readEntry("Description", SchemeGroup);
196 SchemeMode = cfg->readNumEntry("Mode", -1); 196 SchemeMode = cfg->readNumEntry("Mode", -1);
197 197
198 schemeMode[i] = SchemeMode; 198 schemeMode[i] = SchemeMode;
199 if (SchemeMode == -1) { 199 if (SchemeMode == -1) {
200 schemeID[i] = modesPopup->insertItem(SchemeName); 200 schemeID[i] = modesPopup->insertItem(SchemeName);
201 modesPopup->setItemChecked(schemeID[i], i == Scheme); 201 modesPopup->setItemChecked(schemeID[i], i == Scheme);
202 } else { 202 } else {
203 schemeID[i] = schemesPopup->at(SchemeMode)->insertItem(SchemeName); 203 schemeID[i] = schemesPopup->at(SchemeMode)->insertItem(SchemeName);
204 schemesPopup->at(SchemeMode)-> 204 schemesPopup->at(SchemeMode)->
205 setItemChecked(schemeID[i], i == Scheme); 205 setItemChecked(schemeID[i], i == Scheme);
206 modesPopup->setItemEnabled(modeID[SchemeMode], TRUE); 206 modesPopup->setItemEnabled(modeID[SchemeMode], TRUE);
207 } 207 }
208 } 208 }
209 209
210 RESTORE_CONFIG_GROUP( cfg, oldgroup ); 210 RESTORE_CONFIG_GROUP( cfg, oldgroup );
211 211
212 APP_CONFIG_END( cfg ); 212 APP_CONFIG_END( cfg );
213 return SchemeCount; 213 return SchemeCount;
214} 214}
215 215
216void Kpacman::quitKpacman() 216void Kpacman::quitKpacman()
217{ 217{
218 APP_QUIT(); 218 APP_QUIT();
219} 219}
220 220
221void Kpacman::newKpacman() 221void Kpacman::newKpacman()
222{ 222{
223 if (!gamePopup->isItemEnabled(hofID)) 223 if (!gamePopup->isItemEnabled(hofID))
224 gamePopup->setItemEnabled(hofID, TRUE); 224 gamePopup->setItemEnabled(hofID, TRUE);
225 225
226 if (gamePopup->isItemChecked(hofID)) 226 if (gamePopup->isItemChecked(hofID))
227 toggleHallOfFame(); 227 toggleHallOfFame();
228 228
229 if (gamePopup->isItemChecked(pauseID)) 229 if (gamePopup->isItemChecked(pauseID))
230 pauseKpacman(); 230 pauseKpacman();
231 231
232 view->referee->play(); 232 view->referee->play();
233} 233}
234 234
235void Kpacman::pauseKpacman() 235void Kpacman::pauseKpacman()
236{ 236{
237 view->referee->pause(); 237 view->referee->pause();
238 view->score->setPause(gamePopup->isItemChecked(pauseID)); 238 view->score->setPause(gamePopup->isItemChecked(pauseID));
239} 239}
240 240
241void Kpacman::toggleHallOfFame() 241void Kpacman::toggleHallOfFame()
242{ 242{
243 gamePopup->setItemChecked(hofID, !gamePopup->isItemChecked(hofID)); 243 gamePopup->setItemChecked(hofID, !gamePopup->isItemChecked(hofID));
244 view->referee->toggleHallOfFame(); 244 view->referee->toggleHallOfFame();
245 245
246 if (gamePopup->isItemChecked(hofID)) { 246 if (gamePopup->isItemChecked(hofID)) {
247 view->referee->lower(); 247 view->referee->lower();
248 view->status->lower(); 248 view->status->lower();
249 } else { 249 } else {
250 view->status->raise(); 250 view->status->raise();
251 view->referee->raise(); 251 view->referee->raise();
252 view->referee->setFocus(); 252 view->referee->setFocus();
253 } 253 }
254} 254}
255 255
256/* 256/*
257 * Disable or enable the "Hall of fame"-menuitem if the referee says so. 257 * Disable or enable the "Hall of fame"-menuitem if the referee says so.
258 * This is done, to disable turning off the "hall of fame"-display, in the automated 258 * This is done, to disable turning off the "hall of fame"-display, in the automated
259 * sequence of displaying the introduction, the demonstration (or playing) and the 259 * sequence of displaying the introduction, the demonstration (or playing) and the
260 * hall of fame. 260 * hall of fame.
261 * If on == TRUE then also lower the referee and the status widgets. 261 * If on == TRUE then also lower the referee and the status widgets.
262 */ 262 */
263void Kpacman::forcedHallOfFame(bool on) 263void Kpacman::forcedHallOfFame(bool on)
264{ 264{
265 if (!on && !gamePopup->isItemChecked(hofID)) 265 if (!on && !gamePopup->isItemChecked(hofID))
266 return; 266 return;
267 267
268 gamePopup->setItemEnabled(hofID, !on); 268 gamePopup->setItemEnabled(hofID, !on);
269 gamePopup->setItemChecked(hofID, on); 269 gamePopup->setItemChecked(hofID, on);
270 270
271 view->referee->toggleHallOfFame(); 271 view->referee->toggleHallOfFame();
272 if (on) { 272 if (on) {
273 view->referee->lower(); 273 view->referee->lower();
274 view->status->lower(); 274 view->status->lower();
275 } else { 275 } else {
276 view->status->raise(); 276 view->status->raise();
277 view->referee->raise(); 277 view->referee->raise();
278 view->referee->setFocus(); 278 view->referee->setFocus();
279 view->referee->intro(); 279 view->referee->intro();
280 } 280 }
281} 281}
282 282
283void Kpacman::togglePaused() 283void Kpacman::togglePaused()
284{ 284{
285 static bool checked = FALSE; 285 static bool checked = FALSE;
286 checked = !checked; 286 checked = !checked;
287 gamePopup->setItemChecked( pauseID, checked ); 287 gamePopup->setItemChecked( pauseID, checked );
288 view->score->setPause(gamePopup->isItemChecked(pauseID)); 288 view->score->setPause(gamePopup->isItemChecked(pauseID));
289} 289}
290 290
291/* 291/*
292 * This disables the "New Game" menuitem to prevent interruptions of the current 292 * This disables the "New Game" menuitem to prevent interruptions of the current
293 * play. 293 * play.
294 */ 294 */
295void Kpacman::toggleNew() 295void Kpacman::toggleNew()
296{ 296{
297 gamePopup->setItemEnabled(newID, !gamePopup->isItemEnabled(newID)); 297 gamePopup->setItemEnabled(newID, !gamePopup->isItemEnabled(newID));
298} 298}
299 299
300void Kpacman::toggleHideMouseCursor() 300void Kpacman::toggleHideMouseCursor()
301{ 301{
302 hideMouseCursor = !hideMouseCursor; 302 hideMouseCursor = !hideMouseCursor;
303 optionsPopup->setItemChecked(hideMouseCursorID, hideMouseCursor); 303 optionsPopup->setItemChecked(hideMouseCursorID, hideMouseCursor);
304 if (hideMouseCursor) 304 if (hideMouseCursor)
305 view->setCursor(blankCursor); 305 view->setCursor(blankCursor);
306 else 306 else
307 view->setCursor(arrowCursor); 307 view->setCursor(arrowCursor);
308} 308}
309 309
310void Kpacman::toggleFocusOutPause() 310void Kpacman::toggleFocusOutPause()
311{ 311{
312 focusOutPause = !focusOutPause; 312 focusOutPause = !focusOutPause;
313 optionsPopup->setItemChecked(focusOutPauseID, focusOutPause); 313 optionsPopup->setItemChecked(focusOutPauseID, focusOutPause);
314 view->referee->setFocusOutPause(focusOutPause); 314 view->referee->setFocusOutPause(focusOutPause);
315} 315}
316 316
317void Kpacman::toggleFocusInContinue() 317void Kpacman::toggleFocusInContinue()
318{ 318{
319 focusInContinue = !focusInContinue; 319 focusInContinue = !focusInContinue;
320 optionsPopup->setItemChecked(focusInContinueID, focusInContinue); 320 optionsPopup->setItemChecked(focusInContinueID, focusInContinue);
321 view->referee->setFocusInContinue(focusInContinue); 321 view->referee->setFocusInContinue(focusInContinue);
322} 322}
323 323
324void Kpacman::confKeys() 324void Kpacman::confKeys()
325{ 325{
326 Keys *keys = new Keys(); 326 Keys *keys = new Keys();
327 if (keys->exec() == QDialog::Accepted) { 327 if (keys->exec() == QDialog::Accepted) {
328 view->referee->initKeys(); 328 view->referee->initKeys();
329 view->score->initKeys(); 329 view->score->initKeys();
330 } 330 }
331 delete keys; 331 delete keys;
332} 332}
333 333
334void Kpacman::schemeChecked(int id) 334void Kpacman::schemeChecked(int id)
335{ 335{
336 int mode = 0, scheme = -1; 336 int mode = 0, scheme = -1;
337 337
338 for (uint s = 0; s < schemeID.size(); s++) { 338 for (uint s = 0; s < schemeID.size(); s++) {
339 if (schemeID[s] == id) { 339 if (schemeID[s] == id) {
340 scheme = s; 340 scheme = s;
341 mode = schemeMode[s]; 341 mode = schemeMode[s];
342 } 342 }
343 if (schemeMode[s] == -1) { 343 if (schemeMode[s] == -1) {
344 modesPopup->setItemChecked(schemeID[s], schemeID[s] == id); 344 modesPopup->setItemChecked(schemeID[s], schemeID[s] == id);
345 } else { 345 } else {
346 modesPopup->setItemChecked(modeID[schemeMode[s]], schemeMode[s] == mode); 346 modesPopup->setItemChecked(modeID[schemeMode[s]], schemeMode[s] == mode);
347 schemesPopup->at(schemeMode[s])->setItemChecked(schemeID[s], schemeID[s] == id); 347 schemesPopup->at(schemeMode[s])->setItemChecked(schemeID[s], schemeID[s] == id);
348 } 348 }
349 } 349 }
350 /* 350 /*
351 APP_CONFIG_BEGIN( cfg ); 351 APP_CONFIG_BEGIN( cfg );
352 cfg->writeEntry("Scheme", scheme); 352 cfg->writeEntry("Scheme", scheme);
353 cfg->writeEntry("Mode", mode); 353 cfg->writeEntry("Mode", mode);
354 APP_CONFIG_END( cfg ); 354 APP_CONFIG_END( cfg );
355 */ 355 */
356 356
357 view->setScheme(scheme, mode); 357 view->setScheme(scheme, mode);
358 view->updateGeometry(); 358 view->updateGeometry();
359 updateGeometry(); 359 updateGeometry();
360 update(); 360 update();
361 repaint(TRUE); 361 repaint(TRUE);
362 show(); 362 show();
363} 363}
diff --git a/noncore/games/kpacman/kpacman.h b/noncore/games/kpacman/kpacman.h
index 2c1de70..829714a 100644
--- a/noncore/games/kpacman/kpacman.h
+++ b/noncore/games/kpacman/kpacman.h
@@ -1,83 +1,85 @@
1#ifndef KPACMAN_H 1#ifndef KPACMAN_H
2#define KPACMAN_H 2#define KPACMAN_H
3 3
4#ifdef HAVE_CONFIG_H 4#ifdef HAVE_CONFIG_H
5#include <config.h> 5#include <config.h>
6#endif 6#endif
7 7
8#include "portable.h" 8#include "portable.h"
9 9
10#include <qmainwindow.h> 10#include <qmainwindow.h>
11class QMenuBar; 11class QMenuBar;
12#include <qregexp.h> 12#include <qregexp.h>
13 13
14#include "kpacmanwidget.h" 14#include "kpacmanwidget.h"
15 15
16#include <qpopmenu.h> 16#include <qpopmenu.h>
17 17
18#include <qlist.h> 18#include <qlist.h>
19#include <qfileinf.h> 19#include <qfileinf.h>
20#include <qlayout.h> 20#include <qlayout.h>
21 21
22#include "referee.h" 22#include "referee.h"
23#include "status.h" 23#include "status.h"
24#include "score.h" 24#include "score.h"
25#include "keys.h" 25#include "keys.h"
26 26
27class Kpacman : public KTMainWindow 27class Kpacman : public KTMainWindow
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30public: 30public:
31 Kpacman(QWidget *parent = 0, const char *name = 0); 31 Kpacman(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
32 static QString appName() { return QString::fromLatin1("kpacman"); }
33
32 virtual ~Kpacman(); 34 virtual ~Kpacman();
33 35
34public slots: 36public slots:
35 void forcedHallOfFame(bool); 37 void forcedHallOfFame(bool);
36 38
37private slots: 39private slots:
38 void newKpacman(); 40 void newKpacman();
39 void pauseKpacman(); 41 void pauseKpacman();
40 void toggleHallOfFame(); 42 void toggleHallOfFame();
41 void toggleNew(); 43 void toggleNew();
42 void togglePaused(); 44 void togglePaused();
43 void quitKpacman(); 45 void quitKpacman();
44 46
45 void schemeChecked(int); 47 void schemeChecked(int);
46 void toggleFocusOutPause(); 48 void toggleFocusOutPause();
47 void toggleFocusInContinue(); 49 void toggleFocusInContinue();
48 void toggleHideMouseCursor(); 50 void toggleHideMouseCursor();
49 void confKeys(); 51 void confKeys();
50 52
51protected: 53protected:
52 54
53private: 55private:
54 KpacmanWidget *view; 56 KpacmanWidget *view;
55 57
56 void menu(); 58 void menu();
57 59
58 int lookupSchemes(); 60 int lookupSchemes();
59 61
60 QGridLayout *m_layout; 62 QGridLayout *m_layout;
61 QWidget *m_view; 63 QWidget *m_view;
62 KMenuBar *_menuBar; 64 KMenuBar *_menuBar;
63 QPopupMenu *gamePopup; 65 QPopupMenu *gamePopup;
64 QPopupMenu *optionsPopup; 66 QPopupMenu *optionsPopup;
65 QPopupMenu *modesPopup; 67 QPopupMenu *modesPopup;
66 QList<QPopupMenu> *schemesPopup; 68 QList<QPopupMenu> *schemesPopup;
67 69
68 int newID; 70 int newID;
69 int pauseID; 71 int pauseID;
70 int hofID; 72 int hofID;
71 QArray<int> modeID; 73 QArray<int> modeID;
72 QArray<int> schemeID; 74 QArray<int> schemeID;
73 QArray<int> schemeMode; 75 QArray<int> schemeMode;
74 int focusOutPauseID; 76 int focusOutPauseID;
75 int focusInContinueID; 77 int focusInContinueID;
76 int hideMouseCursorID; 78 int hideMouseCursorID;
77 79
78 bool focusOutPause; 80 bool focusOutPause;
79 bool focusInContinue; 81 bool focusInContinue;
80 bool hideMouseCursor; 82 bool hideMouseCursor;
81}; 83};
82 84
83#endif // KPACMAN_H 85#endif // KPACMAN_H
diff --git a/noncore/games/kpacman/kpacman.pro b/noncore/games/kpacman/kpacman.pro
index 45314f9..a231b01 100644
--- a/noncore/games/kpacman/kpacman.pro
+++ b/noncore/games/kpacman/kpacman.pro
@@ -1,39 +1,37 @@
1 TEMPLATE= app 1 CONFIG = qt quick-app
2 CONFIG = qt warn_on
3 HEADERS = kpacmanwidget.h \ 2 HEADERS = kpacmanwidget.h \
4 referee.h \ 3 referee.h \
5 status.h \ 4 status.h \
6 painter.h \ 5 painter.h \
7 score.h \ 6 score.h \
8 pacman.h \ 7 pacman.h \
9 monster.h \ 8 monster.h \
10 keys.h \ 9 keys.h \
11 fruit.h \ 10 fruit.h \
12 energizer.h \ 11 energizer.h \
13 board.h \ 12 board.h \
14 bitfont.h \ 13 bitfont.h \
15 kpacman.h \ 14 kpacman.h \
16 bitmaps.h \ 15 bitmaps.h \
17 colors.h \ 16 colors.h \
18 portable.h 17 portable.h
19 SOURCES = kpacmanwidget.cpp \ 18 SOURCES = kpacmanwidget.cpp \
20 referee.cpp \ 19 referee.cpp \
21 status.cpp \ 20 status.cpp \
22 painter.cpp \ 21 painter.cpp \
23 score.cpp \ 22 score.cpp \
24 pacman.cpp \ 23 pacman.cpp \
25 monster.cpp \ 24 monster.cpp \
26 keys.cpp \ 25 keys.cpp \
27 fruit.cpp \ 26 fruit.cpp \
28 energizer.cpp \ 27 energizer.cpp \
29 board.cpp \ 28 board.cpp \
30 bitfont.cpp \ 29 bitfont.cpp \
31 kpacman.cpp \ 30 kpacman.cpp \
32 main.cpp 31 main.cpp
33 INCLUDEPATH+= $(OPIEDIR)/include 32 INCLUDEPATH+= $(OPIEDIR)/include
34 DEPENDPATH+= $(OPIEDIR)/include 33 DEPENDPATH+= $(OPIEDIR)/include
35LIBS += -lqpe -lopiecore2 34LIBS += -lqpe -lopiecore2
36DESTDIR = $(OPIEDIR)/bin
37 TARGET = kpacman 35 TARGET = kpacman
38 36
39include ( $(OPIEDIR)/include.pro ) 37include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/kpacman/main.cpp b/noncore/games/kpacman/main.cpp
index 76afb57..2906d2a 100644
--- a/noncore/games/kpacman/main.cpp
+++ b/noncore/games/kpacman/main.cpp
@@ -1,66 +1,43 @@
1/*************************************************************************** 1/***************************************************************************
2 main.cpp - description 2 main.cpp - description
3 ------------------- 3 -------------------
4 begin : Sam Jan 19 13:37:57 CET 2002 4 begin : Sam Jan 19 13:37:57 CET 2002
5 copyright : (C) 2002 by Jörg Thönnissen 5 copyright : (C) 2002 by Jörg Thönnissen
6 email : joe@dsite.de 6 email : joe@dsite.de
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "portable.h" 18#include "portable.h"
19 19
20#if defined( KDE2_PORT ) 20#if defined( KDE2_PORT )
21#include <kcmdlineargs.h> 21#include <kcmdlineargs.h>
22#include <kaboutdata.h> 22#include <kaboutdata.h>
23#include <klocale.h> 23#include <klocale.h>
24#elif defined( QPE_PORT ) 24#elif defined( QPE_PORT )
25#include <qpe/qpeapplication.h> 25#include <opie2/oapplicationfactory.h>
26#endif 26#endif
27 27
28#include "kpacman.h" 28#include "kpacman.h"
29 29
30#ifdef KDE2_PORT 30#ifdef KDE2_PORT
31static const char *description = 31static const char *description =
32 I18N_NOOP("Kpacman"); 32 I18N_NOOP("Kpacman");
33// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE 33// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
34 34
35 35
36static KCmdLineOptions options[] = 36static KCmdLineOptions options[] =
37{ 37{
38 { 0, 0, 0 } 38 { 0, 0, 0 }
39 // INSERT YOUR COMMANDLINE OPTIONS HERE 39 // INSERT YOUR COMMANDLINE OPTIONS HERE
40}; 40};
41#endif 41#endif
42 42
43int main(int argc, char *argv[]) 43OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<Kpacman> )
44{
45#if defined( KDE2_PORT )
46 KAboutData aboutData( "kpacman", I18N_NOOP("Kpacman"),
47 VERSION, description, KAboutData::License_GPL,
48 "(c) 2002, Jörg Thönnissen", 0, 0, "joe@dsite.de");
49 aboutData.addAuthor("Jörg Thönnissen",0, "joe@dsite.de");
50 KCmdLineArgs::init( argc, argv, &aboutData );
51 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
52 KApplication a;
53#elif defined( QPE_PORT )
54 QPEApplication a( argc, argv );
55#endif
56 Kpacman *kpacman = new Kpacman( NULL, "Kpacman" );
57 a.setMainWidget(kpacman);
58#if defined( KDE2_PORT )
59 a.setTopWidget(kpacman);
60 kpacman->show();
61#elif defined( QPE_PORT )
62 kpacman->showMaximized();
63#endif
64
65 return a.exec();
66}
diff --git a/noncore/games/kpacman/opie-kpacman.control b/noncore/games/kpacman/opie-kpacman.control
index 15e3056..68487ec 100644
--- a/noncore/games/kpacman/opie-kpacman.control
+++ b/noncore/games/kpacman/opie-kpacman.control
@@ -1,11 +1,11 @@
1Package: opie-kpacman 1Package: opie-kpacman
2Files: bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman 2Files: plugins/applications/libkpacman.so* bin/kpacman apps/Games/kpacman.desktop pics/kpacman/kpacman.png share/kpacman
3Version: 0.3.1-$SUB_VERSION 3Version: 0.3.1-$SUB_VERSION
4Depends: task-opie-minimal 4Depends: task-opie-minimal
5Priority: optional 5Priority: optional
6Section: opie/games 6Section: opie/games
7Maintainer: Catalin Climov <catalin@climov.com> 7Maintainer: Catalin Climov <catalin@climov.com>
8Architecture: arm 8Architecture: arm
9License: GPL 9License: GPL
10Description: Kpacman 10Description: Kpacman
11 A Pacman clone for Qtopia. 11 A Pacman clone for Qtopia.