author | schurig <schurig> | 2004-09-13 13:54:56 (UTC) |
---|---|---|
committer | schurig <schurig> | 2004-09-13 13:54:56 (UTC) |
commit | 5880f51e9d6a4ad2c670f7679e874fc0610d850a (patch) (unidiff) | |
tree | 50f251b078dc63588f0a521e9ccea014dabc0ca7 | |
parent | 79c99fb1b7317ad104e3b54bcbcf726f6413e8be (diff) | |
download | opie-5880f51e9d6a4ad2c670f7679e874fc0610d850a.zip opie-5880f51e9d6a4ad2c670f7679e874fc0610d850a.tar.gz opie-5880f51e9d6a4ad2c670f7679e874fc0610d850a.tar.bz2 |
Renamed 'Mine Hunt' to 'Mine Sweep', both in title and icon name
-rw-r--r-- | apps/Games/minesweep.desktop | 2 | ||||
-rw-r--r-- | noncore/games/minesweep/minesweep.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/apps/Games/minesweep.desktop b/apps/Games/minesweep.desktop index 3a74b46..b630647 100644 --- a/apps/Games/minesweep.desktop +++ b/apps/Games/minesweep.desktop | |||
@@ -1,27 +1,27 @@ | |||
1 | [Desktop Entry] | 1 | [Desktop Entry] |
2 | Exec=minesweep | 2 | Exec=minesweep |
3 | Icon=minesweep/MineHunt | 3 | Icon=minesweep/MineSweep |
4 | Type=Application | 4 | Type=Application |
5 | Name=Mine Hunt | 5 | Name=Mine Hunt |
6 | Comment=Find the mines | 6 | Comment=Find the mines |
7 | Name[fr]=Démineur | 7 | Name[fr]=Démineur |
8 | Comment[fr]=Jeu de déminage | 8 | Comment[fr]=Jeu de déminage |
9 | Name[de]=Minenjagd | 9 | Name[de]=Minenjagd |
10 | Comment[de]=Finde die Minen | 10 | Comment[de]=Finde die Minen |
11 | Name[es]=Busca Minas | 11 | Name[es]=Busca Minas |
12 | Comment[es]=Busca las minas | 12 | Comment[es]=Busca las minas |
13 | Name[fr]=Démineur | 13 | Name[fr]=Démineur |
14 | Name[hu]=Aknakeresõ | 14 | Name[hu]=Aknakeresõ |
15 | Name[it]=Campo Minato | 15 | Name[it]=Campo Minato |
16 | Comment[it]=Campo Minato | 16 | Comment[it]=Campo Minato |
17 | Name[no]=Minesøk | 17 | Name[no]=Minesøk |
18 | Name[pt]=Minas | 18 | Name[pt]=Minas |
19 | Comment[pt]=Procura as minas | 19 | Comment[pt]=Procura as minas |
20 | Name[pt_BR]=Caça-Minas | 20 | Name[pt_BR]=Caça-Minas |
21 | Comment[pt_BR]=Caça as minas | 21 | Comment[pt_BR]=Caça as minas |
22 | Name[zh_TW]=踩地雷 | 22 | Name[zh_TW]=踩地雷 |
23 | Name[sl]=Minolovec | 23 | Name[sl]=Minolovec |
24 | Comment[sl]=Najdi mine | 24 | Comment[sl]=Najdi mine |
25 | Name[nl]=Mijnenveger | 25 | Name[nl]=Mijnenveger |
26 | Name[ru]=Сапер | 26 | Name[ru]=Сапер |
27 | Comment[ru]=Отыщите мины | 27 | Comment[ru]=Отыщите мины |
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp index 4a6a92c..c14609d 100644 --- a/noncore/games/minesweep/minesweep.cpp +++ b/noncore/games/minesweep/minesweep.cpp | |||
@@ -115,259 +115,259 @@ static const char * worried_xpm[] = { | |||
115 | " #....######....# ", | 115 | " #....######....# ", |
116 | " #..............# ", | 116 | " #..............# ", |
117 | " #............# ", | 117 | " #............# ", |
118 | " #..........# ", | 118 | " #..........# ", |
119 | " ##......## ", | 119 | " ##......## ", |
120 | " ###### ", | 120 | " ###### ", |
121 | " "}; | 121 | " "}; |
122 | 122 | ||
123 | 123 | ||
124 | /* XPM */ | 124 | /* XPM */ |
125 | static const char * dead_xpm[] = { | 125 | static const char * dead_xpm[] = { |
126 | "20 20 3 1", | 126 | "20 20 3 1", |
127 | " c None", | 127 | " c None", |
128 | ".c #ffff3f", | 128 | ".c #ffff3f", |
129 | "#c #000000", | 129 | "#c #000000", |
130 | " ", | 130 | " ", |
131 | " ###### ", | 131 | " ###### ", |
132 | " ##......## ", | 132 | " ##......## ", |
133 | " #..........# ", | 133 | " #..........# ", |
134 | " #............# ", | 134 | " #............# ", |
135 | " #..............# ", | 135 | " #..............# ", |
136 | " #..#.#...#.#...# ", | 136 | " #..#.#...#.#...# ", |
137 | " #....#.....#.....# ", | 137 | " #....#.....#.....# ", |
138 | " #...#.#...#.#....# ", | 138 | " #...#.#...#.#....# ", |
139 | " #................# ", | 139 | " #................# ", |
140 | " #................# ", | 140 | " #................# ", |
141 | " #................# ", | 141 | " #................# ", |
142 | " #......####......# ", | 142 | " #......####......# ", |
143 | " #....# #....# ", | 143 | " #....# #....# ", |
144 | " #...#......#...# ", | 144 | " #...#......#...# ", |
145 | " #............# ", | 145 | " #............# ", |
146 | " #..........# ", | 146 | " #..........# ", |
147 | " ##......## ", | 147 | " ##......## ", |
148 | " ###### ", | 148 | " ###### ", |
149 | " "}; | 149 | " "}; |
150 | 150 | ||
151 | 151 | ||
152 | class ResultIndicator : private QLabel | 152 | class ResultIndicator : private QLabel |
153 | { | 153 | { |
154 | public: | 154 | public: |
155 | static void showResult( QWidget *ref, bool won ); | 155 | static void showResult( QWidget *ref, bool won ); |
156 | private: | 156 | private: |
157 | ResultIndicator( QWidget *parent, const char *name, WFlags f) | 157 | ResultIndicator( QWidget *parent, const char *name, WFlags f) |
158 | :QLabel( parent, name, f ) {} | 158 | :QLabel( parent, name, f ) {} |
159 | 159 | ||
160 | void timerEvent( QTimerEvent *); | 160 | void timerEvent( QTimerEvent *); |
161 | void center(); | 161 | void center(); |
162 | bool twoStage; | 162 | bool twoStage; |
163 | int timerId; | 163 | int timerId; |
164 | }; | 164 | }; |
165 | 165 | ||
166 | void ResultIndicator::showResult( QWidget *ref, bool won ) | 166 | void ResultIndicator::showResult( QWidget *ref, bool won ) |
167 | { | 167 | { |
168 | ResultIndicator *r = new ResultIndicator( ref, 0, WStyle_Customize | WStyle_Tool | WType_TopLevel ); | 168 | ResultIndicator *r = new ResultIndicator( ref, 0, WStyle_Customize | WStyle_Tool | WType_TopLevel ); |
169 | 169 | ||
170 | r->setAlignment( AlignCenter ); | 170 | r->setAlignment( AlignCenter ); |
171 | r->setFrameStyle( Sunken|StyledPanel ); | 171 | r->setFrameStyle( Sunken|StyledPanel ); |
172 | if ( won ) { | 172 | if ( won ) { |
173 | r->setText( MineSweep::tr("You won!") ); | 173 | r->setText( MineSweep::tr("You won!") ); |
174 | r->center(); | 174 | r->center(); |
175 | r->show(); | 175 | r->show(); |
176 | r->twoStage = FALSE; | 176 | r->twoStage = FALSE; |
177 | r->timerId = r->startTimer(1500); | 177 | r->timerId = r->startTimer(1500); |
178 | } else { | 178 | } else { |
179 | QPalette p( red ); | 179 | QPalette p( red ); |
180 | r->setPalette( p ); | 180 | r->setPalette( p ); |
181 | r->setText( MineSweep::tr("You exploded!") ); | 181 | r->setText( MineSweep::tr("You exploded!") ); |
182 | r->resize( ref->size() ); | 182 | r->resize( ref->size() ); |
183 | r->move( ref->mapToGlobal(QPoint(0,0)) ); | 183 | r->move( ref->mapToGlobal(QPoint(0,0)) ); |
184 | r->show(); | 184 | r->show(); |
185 | r->twoStage = TRUE; | 185 | r->twoStage = TRUE; |
186 | r->timerId =r->startTimer(200); | 186 | r->timerId =r->startTimer(200); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | void ResultIndicator::center() | 190 | void ResultIndicator::center() |
191 | { | 191 | { |
192 | QWidget *w = parentWidget(); | 192 | QWidget *w = parentWidget(); |
193 | 193 | ||
194 | QPoint pp = w->mapToGlobal( QPoint(0,0) ); | 194 | QPoint pp = w->mapToGlobal( QPoint(0,0) ); |
195 | QSize s = sizeHint()*3; | 195 | QSize s = sizeHint()*3; |
196 | s.setWidth( QMIN(s.width(), w->width()) ); | 196 | s.setWidth( QMIN(s.width(), w->width()) ); |
197 | pp = QPoint( pp.x() + w->width()/2 - s.width()/2, | 197 | pp = QPoint( pp.x() + w->width()/2 - s.width()/2, |
198 | pp.y() + w->height()/ 2 - s.height()/2 ); | 198 | pp.y() + w->height()/ 2 - s.height()/2 ); |
199 | 199 | ||
200 | setGeometry( QRect(pp, s) ); | 200 | setGeometry( QRect(pp, s) ); |
201 | 201 | ||
202 | } | 202 | } |
203 | 203 | ||
204 | void ResultIndicator::timerEvent( QTimerEvent *te ) | 204 | void ResultIndicator::timerEvent( QTimerEvent *te ) |
205 | { | 205 | { |
206 | if ( te->timerId() != timerId ) | 206 | if ( te->timerId() != timerId ) |
207 | return; | 207 | return; |
208 | killTimer( timerId ); | 208 | killTimer( timerId ); |
209 | if ( twoStage ) { | 209 | if ( twoStage ) { |
210 | center(); | 210 | center(); |
211 | twoStage = FALSE; | 211 | twoStage = FALSE; |
212 | timerId = startTimer( 1000 ); | 212 | timerId = startTimer( 1000 ); |
213 | } else { | 213 | } else { |
214 | delete this; | 214 | delete this; |
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | class MineFrame : public QFrame | 219 | class MineFrame : public QFrame |
220 | { | 220 | { |
221 | public: | 221 | public: |
222 | MineFrame( QWidget *parent, const char *name = 0 ) | 222 | MineFrame( QWidget *parent, const char *name = 0 ) |
223 | :QFrame( parent, name ), field(0) {} | 223 | :QFrame( parent, name ), field(0) {} |
224 | void setField( MineField *f ) { | 224 | void setField( MineField *f ) { |
225 | field = f; | 225 | field = f; |
226 | setMinimumSize( field->sizeHint() ); | 226 | setMinimumSize( field->sizeHint() ); |
227 | } | 227 | } |
228 | protected: | 228 | protected: |
229 | void resizeEvent( QResizeEvent *e ) { | 229 | void resizeEvent( QResizeEvent *e ) { |
230 | field->setAvailableRect( contentsRect()); | 230 | field->setAvailableRect( contentsRect()); |
231 | QFrame::resizeEvent(e); | 231 | QFrame::resizeEvent(e); |
232 | } | 232 | } |
233 | private: | 233 | private: |
234 | MineField *field; | 234 | MineField *field; |
235 | }; | 235 | }; |
236 | 236 | ||
237 | 237 | ||
238 | 238 | ||
239 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | 239 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) |
240 | : QMainWindow( parent, name, f ) | 240 | : QMainWindow( parent, name, f ) |
241 | { | 241 | { |
242 | srand(::time(0)); | 242 | srand(::time(0)); |
243 | setCaption( tr("Mine Hunt") ); | 243 | setCaption( tr("Mine Sweep") ); |
244 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); | 244 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); |
245 | setIcon( Resource::loadPixmap( "minesweep/MineHunt" ) ); | 245 | setIcon( Resource::loadPixmap( "minesweep/MineSweep" ) ); |
246 | 246 | ||
247 | QToolBar *toolBar = new QToolBar( this ); | 247 | QToolBar *toolBar = new QToolBar( this ); |
248 | toolBar->setHorizontalStretchable( TRUE ); | 248 | toolBar->setHorizontalStretchable( TRUE ); |
249 | 249 | ||
250 | QMenuBar *menuBar = new QMenuBar( toolBar ); | 250 | QMenuBar *menuBar = new QMenuBar( toolBar ); |
251 | 251 | ||
252 | QPopupMenu *gameMenu = new QPopupMenu( this ); | 252 | QPopupMenu *gameMenu = new QPopupMenu( this ); |
253 | gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) ); | 253 | gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) ); |
254 | gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) ); | 254 | gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) ); |
255 | 255 | ||
256 | if (qApp->desktop()->width() >= 240) { | 256 | if (qApp->desktop()->width() >= 240) { |
257 | gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); | 257 | gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); |
258 | } | 258 | } |
259 | 259 | ||
260 | menuBar->insertItem( tr("Game"), gameMenu ); | 260 | menuBar->insertItem( tr("Game"), gameMenu ); |
261 | 261 | ||
262 | guessLCD = new QLCDNumber( toolBar ); | 262 | guessLCD = new QLCDNumber( toolBar ); |
263 | toolBar->setStretchableWidget( guessLCD ); | 263 | toolBar->setStretchableWidget( guessLCD ); |
264 | 264 | ||
265 | QPalette lcdPal( red ); | 265 | QPalette lcdPal( red ); |
266 | lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() ); | 266 | lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() ); |
267 | lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() ); | 267 | lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() ); |
268 | 268 | ||
269 | // guessLCD->setPalette( lcdPal ); | 269 | // guessLCD->setPalette( lcdPal ); |
270 | guessLCD->setSegmentStyle( QLCDNumber::Flat ); | 270 | guessLCD->setSegmentStyle( QLCDNumber::Flat ); |
271 | guessLCD->setFrameStyle( QFrame::NoFrame ); | 271 | guessLCD->setFrameStyle( QFrame::NoFrame ); |
272 | guessLCD->setNumDigits( 2 ); | 272 | guessLCD->setNumDigits( 2 ); |
273 | guessLCD->setBackgroundMode( PaletteButton ); | 273 | guessLCD->setBackgroundMode( PaletteButton ); |
274 | newGameButton = new QPushButton( toolBar ); | 274 | newGameButton = new QPushButton( toolBar ); |
275 | newGameButton->setPixmap( QPixmap( pix_new ) ); | 275 | newGameButton->setPixmap( QPixmap( pix_new ) ); |
276 | newGameButton->setFocusPolicy(QWidget::NoFocus); | 276 | newGameButton->setFocusPolicy(QWidget::NoFocus); |
277 | connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) ); | 277 | connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) ); |
278 | 278 | ||
279 | timeLCD = new QLCDNumber( toolBar ); | 279 | timeLCD = new QLCDNumber( toolBar ); |
280 | // timeLCD->setPalette( lcdPal ); | 280 | // timeLCD->setPalette( lcdPal ); |
281 | timeLCD->setSegmentStyle( QLCDNumber::Flat ); | 281 | timeLCD->setSegmentStyle( QLCDNumber::Flat ); |
282 | timeLCD->setFrameStyle( QFrame::NoFrame ); | 282 | timeLCD->setFrameStyle( QFrame::NoFrame ); |
283 | timeLCD->setNumDigits( 5 ); // "mm:ss" | 283 | timeLCD->setNumDigits( 5 ); // "mm:ss" |
284 | timeLCD->setBackgroundMode( PaletteButton ); | 284 | timeLCD->setBackgroundMode( PaletteButton ); |
285 | 285 | ||
286 | setToolBarsMovable ( FALSE ); | 286 | setToolBarsMovable ( FALSE ); |
287 | 287 | ||
288 | addToolBar( toolBar ); | 288 | addToolBar( toolBar ); |
289 | 289 | ||
290 | MineFrame *mainframe = new MineFrame( this ); | 290 | MineFrame *mainframe = new MineFrame( this ); |
291 | mainframe->setFrameShape( QFrame::Box ); | 291 | mainframe->setFrameShape( QFrame::Box ); |
292 | mainframe->setFrameShadow( QFrame::Raised ); | 292 | mainframe->setFrameShadow( QFrame::Raised ); |
293 | 293 | ||
294 | mainframe->setLineWidth(2); | 294 | mainframe->setLineWidth(2); |
295 | 295 | ||
296 | field = new MineField( mainframe ); | 296 | field = new MineField( mainframe ); |
297 | mainframe->setField( field ); | 297 | mainframe->setField( field ); |
298 | QFont fnt = field->font(); | 298 | QFont fnt = field->font(); |
299 | fnt.setBold( TRUE ); | 299 | fnt.setBold( TRUE ); |
300 | field->setFont( QFont( fnt ) ); | 300 | field->setFont( QFont( fnt ) ); |
301 | field->setFocus(); | 301 | field->setFocus(); |
302 | setCentralWidget( mainframe ); | 302 | setCentralWidget( mainframe ); |
303 | 303 | ||
304 | connect( field, SIGNAL( gameOver(bool) ), this, SLOT( gameOver(bool) ) ); | 304 | connect( field, SIGNAL( gameOver(bool) ), this, SLOT( gameOver(bool) ) ); |
305 | connect( field, SIGNAL( mineCount(int) ), this, SLOT( setCounter(int) ) ); | 305 | connect( field, SIGNAL( mineCount(int) ), this, SLOT( setCounter(int) ) ); |
306 | connect( field, SIGNAL( gameStarted()), this, SLOT( startPlaying() ) ); | 306 | connect( field, SIGNAL( gameStarted()), this, SLOT( startPlaying() ) ); |
307 | 307 | ||
308 | timer = new QTimer( this ); | 308 | timer = new QTimer( this ); |
309 | connect( timer, SIGNAL( timeout() ), this, SLOT( updateTime() ) ); | 309 | connect( timer, SIGNAL( timeout() ), this, SLOT( updateTime() ) ); |
310 | 310 | ||
311 | readConfig(); | 311 | readConfig(); |
312 | } | 312 | } |
313 | 313 | ||
314 | MineSweep::~MineSweep() | 314 | MineSweep::~MineSweep() |
315 | { | 315 | { |
316 | writeConfig(); | 316 | writeConfig(); |
317 | } | 317 | } |
318 | 318 | ||
319 | void MineSweep::gameOver( bool won ) | 319 | void MineSweep::gameOver( bool won ) |
320 | { | 320 | { |
321 | field->showMines(); | 321 | field->showMines(); |
322 | if ( won ) { | 322 | if ( won ) { |
323 | newGameButton->setPixmap( QPixmap( happy_xpm ) ); | 323 | newGameButton->setPixmap( QPixmap( happy_xpm ) ); |
324 | } else { | 324 | } else { |
325 | newGameButton->setPixmap( QPixmap( dead_xpm ) ); | 325 | newGameButton->setPixmap( QPixmap( dead_xpm ) ); |
326 | } | 326 | } |
327 | ResultIndicator::showResult( this, won ); | 327 | ResultIndicator::showResult( this, won ); |
328 | timer->stop(); | 328 | timer->stop(); |
329 | } | 329 | } |
330 | 330 | ||
331 | void MineSweep::newGame() | 331 | void MineSweep::newGame() |
332 | { | 332 | { |
333 | newGame(field->level()); | 333 | newGame(field->level()); |
334 | } | 334 | } |
335 | 335 | ||
336 | void MineSweep::newGame(int level) | 336 | void MineSweep::newGame(int level) |
337 | { | 337 | { |
338 | timeLCD->display( "0:00" ); | 338 | timeLCD->display( "0:00" ); |
339 | field->setup( level ); | 339 | field->setup( level ); |
340 | newGameButton->setPixmap( QPixmap( pix_new ) ); | 340 | newGameButton->setPixmap( QPixmap( pix_new ) ); |
341 | timer->stop(); | 341 | timer->stop(); |
342 | } | 342 | } |
343 | 343 | ||
344 | void MineSweep::startPlaying() | 344 | void MineSweep::startPlaying() |
345 | { | 345 | { |
346 | newGameButton->setPixmap( QPixmap( worried_xpm ) ); | 346 | newGameButton->setPixmap( QPixmap( worried_xpm ) ); |
347 | starttime = QDateTime::currentDateTime(); | 347 | starttime = QDateTime::currentDateTime(); |
348 | timer->start( 1000 ); | 348 | timer->start( 1000 ); |
349 | } | 349 | } |
350 | 350 | ||
351 | void MineSweep::beginner() | 351 | void MineSweep::beginner() |
352 | { | 352 | { |
353 | newGame(1); | 353 | newGame(1); |
354 | } | 354 | } |
355 | 355 | ||
356 | void MineSweep::advanced() | 356 | void MineSweep::advanced() |
357 | { | 357 | { |
358 | newGame(2); | 358 | newGame(2); |
359 | } | 359 | } |
360 | 360 | ||
361 | void MineSweep::expert() | 361 | void MineSweep::expert() |
362 | { | 362 | { |
363 | newGame(3); | 363 | newGame(3); |
364 | } | 364 | } |
365 | 365 | ||
366 | void MineSweep::setCounter( int c ) | 366 | void MineSweep::setCounter( int c ) |
367 | { | 367 | { |
368 | if ( !guessLCD ) | 368 | if ( !guessLCD ) |
369 | return; | 369 | return; |
370 | 370 | ||
371 | guessLCD->display( c ); | 371 | guessLCD->display( c ); |
372 | } | 372 | } |
373 | 373 | ||