author | zecke <zecke> | 2004-02-06 12:14:56 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-06 12:14:56 (UTC) |
commit | 0c74629e8f5c12a9b5a282b817f884fa10dee491 (patch) (unidiff) | |
tree | 3294663b92023f8d24d68a01022e011a3c94002d /noncore/games/minesweep | |
parent | 46ce5afcfbe7be19f4d5ac0fed6886a0759f1a25 (diff) | |
download | opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.zip opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.gz opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.bz2 |
Merge from the 1.0.x release
-rw-r--r-- | noncore/games/minesweep/main.cpp | 11 | ||||
-rw-r--r-- | noncore/games/minesweep/minefield.cpp | 2 | ||||
-rw-r--r-- | noncore/games/minesweep/minesweep.cpp | 26 | ||||
-rw-r--r-- | noncore/games/minesweep/minesweep.h | 1 | ||||
-rw-r--r-- | noncore/games/minesweep/minesweep.pro | 28 | ||||
-rw-r--r-- | noncore/games/minesweep/opie-minesweep.control | 2 |
6 files changed, 32 insertions, 38 deletions
diff --git a/noncore/games/minesweep/main.cpp b/noncore/games/minesweep/main.cpp index 83de9a3..bd70f7c 100644 --- a/noncore/games/minesweep/main.cpp +++ b/noncore/games/minesweep/main.cpp | |||
@@ -20,15 +20,8 @@ | |||
20 | 20 | ||
21 | #include "minesweep.h" | 21 | #include "minesweep.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | int main( int argc, char** argv ) | 26 | OPIE_EXPORT_APP( OApplicationFactory<MineSweep> ) |
26 | { | ||
27 | QPEApplication a( argc, argv ); | ||
28 | 27 | ||
29 | MineSweep ms; | ||
30 | QPEApplication::setInputMethodHint( &ms, QPEApplication::AlwaysOff ); | ||
31 | a.showMainWidget( &ms ); | ||
32 | |||
33 | return a.exec(); | ||
34 | } | ||
diff --git a/noncore/games/minesweep/minefield.cpp b/noncore/games/minesweep/minefield.cpp index eca1a36..04cfb97 100644 --- a/noncore/games/minesweep/minefield.cpp +++ b/noncore/games/minesweep/minefield.cpp | |||
@@ -352,9 +352,9 @@ void MineField::setup( int level ) | |||
352 | numRows = 18; | 352 | numRows = 18; |
353 | minecount = 66 ; | 353 | minecount = 66 ; |
354 | break; | 354 | break; |
355 | } | 355 | } |
356 | mines = new (Mine*)[numRows*numCols]; | 356 | mines = new Mine*[numRows*numCols]; |
357 | for ( i = 0; i < numCols*numRows; i++ ) | 357 | for ( i = 0; i < numCols*numRows; i++ ) |
358 | mines[i] = new Mine( this ); | 358 | mines[i] = new Mine( this ); |
359 | 359 | ||
360 | 360 | ||
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp index 48644b3..7214a73 100644 --- a/noncore/games/minesweep/minesweep.cpp +++ b/noncore/games/minesweep/minesweep.cpp | |||
@@ -20,8 +20,9 @@ | |||
20 | 20 | ||
21 | #include "minesweep.h" | 21 | #include "minesweep.h" |
22 | #include "minefield.h" | 22 | #include "minefield.h" |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | ||
24 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
25 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
26 | 27 | ||
27 | #include <qpe/qpetoolbar.h> | 28 | #include <qpe/qpetoolbar.h> |
@@ -154,14 +155,14 @@ static const char * dead_xpm[] = { | |||
154 | 155 | ||
155 | 156 | ||
156 | class ResultIndicator : private QLabel | 157 | class ResultIndicator : private QLabel |
157 | { | 158 | { |
158 | public: | 159 | public: |
159 | static void showResult( QWidget *ref, bool won ); | 160 | static void showResult( QWidget *ref, bool won ); |
160 | private: | 161 | private: |
161 | ResultIndicator( QWidget *parent, const char *name, WFlags f) | 162 | ResultIndicator( QWidget *parent, const char *name, WFlags f) |
162 | :QLabel( parent, name, f ) {} | 163 | :QLabel( parent, name, f ) {} |
163 | 164 | ||
164 | void timerEvent( QTimerEvent *); | 165 | void timerEvent( QTimerEvent *); |
165 | void center(); | 166 | void center(); |
166 | bool twoStage; | 167 | bool twoStage; |
167 | int timerId; | 168 | int timerId; |
@@ -169,9 +170,9 @@ private: | |||
169 | 170 | ||
170 | void ResultIndicator::showResult( QWidget *ref, bool won ) | 171 | void ResultIndicator::showResult( QWidget *ref, bool won ) |
171 | { | 172 | { |
172 | ResultIndicator *r = new ResultIndicator( ref, 0, WStyle_Customize | WStyle_Tool | WType_TopLevel ); | 173 | ResultIndicator *r = new ResultIndicator( ref, 0, WStyle_Customize | WStyle_Tool | WType_TopLevel ); |
173 | 174 | ||
174 | r->setAlignment( AlignCenter ); | 175 | r->setAlignment( AlignCenter ); |
175 | r->setFrameStyle( Sunken|StyledPanel ); | 176 | r->setFrameStyle( Sunken|StyledPanel ); |
176 | if ( won ) { | 177 | if ( won ) { |
177 | r->setText( MineSweep::tr("You won!") ); | 178 | r->setText( MineSweep::tr("You won!") ); |
@@ -194,15 +195,15 @@ void ResultIndicator::showResult( QWidget *ref, bool won ) | |||
194 | void ResultIndicator::center() | 195 | void ResultIndicator::center() |
195 | { | 196 | { |
196 | QWidget *w = parentWidget(); | 197 | QWidget *w = parentWidget(); |
197 | 198 | ||
198 | QPoint pp = w->mapToGlobal( QPoint(0,0) ); | 199 | QPoint pp = w->mapToGlobal( QPoint(0,0) ); |
199 | QSize s = sizeHint()*3; | 200 | QSize s = sizeHint()*3; |
200 | pp = QPoint( pp.x() + w->width()/2 - s.width()/2, | 201 | pp = QPoint( pp.x() + w->width()/2 - s.width()/2, |
201 | pp.y() + w->height()/ 2 - s.height()/2 ); | 202 | pp.y() + w->height()/ 2 - s.height()/2 ); |
202 | 203 | ||
203 | setGeometry( QRect(pp, s) ); | 204 | setGeometry( QRect(pp, s) ); |
204 | 205 | ||
205 | } | 206 | } |
206 | 207 | ||
207 | void ResultIndicator::timerEvent( QTimerEvent *te ) | 208 | void ResultIndicator::timerEvent( QTimerEvent *te ) |
208 | { | 209 | { |
@@ -227,9 +228,9 @@ public: | |||
227 | void setField( MineField *f ) { field = f; } | 228 | void setField( MineField *f ) { field = f; } |
228 | protected: | 229 | protected: |
229 | void resizeEvent( QResizeEvent *e ) { | 230 | void resizeEvent( QResizeEvent *e ) { |
230 | field->setAvailableRect( contentsRect()); | 231 | field->setAvailableRect( contentsRect()); |
231 | QFrame::resizeEvent(e); | 232 | QFrame::resizeEvent(e); |
232 | } | 233 | } |
233 | private: | 234 | private: |
234 | MineField *field; | 235 | MineField *field; |
235 | }; | 236 | }; |
@@ -238,8 +239,9 @@ private: | |||
238 | 239 | ||
239 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | 240 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) |
240 | : QMainWindow( parent, name, f ) | 241 | : QMainWindow( parent, name, f ) |
241 | { | 242 | { |
243 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); | ||
242 | srand(::time(0)); | 244 | srand(::time(0)); |
243 | setCaption( tr("Mine Hunt") ); | 245 | setCaption( tr("Mine Hunt") ); |
244 | setIcon( Resource::loadPixmap( "minesweep_icon" ) ); | 246 | setIcon( Resource::loadPixmap( "minesweep_icon" ) ); |
245 | 247 | ||
@@ -253,16 +255,16 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | |||
253 | gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) ); | 255 | gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) ); |
254 | gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); | 256 | gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); |
255 | 257 | ||
256 | menuBar->insertItem( tr("Game"), gameMenu ); | 258 | menuBar->insertItem( tr("Game"), gameMenu ); |
257 | 259 | ||
258 | guessLCD = new QLCDNumber( toolBar ); | 260 | guessLCD = new QLCDNumber( toolBar ); |
259 | toolBar->setStretchableWidget( guessLCD ); | 261 | toolBar->setStretchableWidget( guessLCD ); |
260 | 262 | ||
261 | QPalette lcdPal( red ); | 263 | QPalette lcdPal( red ); |
262 | lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() ); | 264 | lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() ); |
263 | lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() ); | 265 | lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() ); |
264 | 266 | ||
265 | // guessLCD->setPalette( lcdPal ); | 267 | // guessLCD->setPalette( lcdPal ); |
266 | guessLCD->setSegmentStyle( QLCDNumber::Flat ); | 268 | guessLCD->setSegmentStyle( QLCDNumber::Flat ); |
267 | guessLCD->setFrameStyle( QFrame::NoFrame ); | 269 | guessLCD->setFrameStyle( QFrame::NoFrame ); |
268 | guessLCD->setNumDigits( 2 ); | 270 | guessLCD->setNumDigits( 2 ); |
@@ -270,16 +272,16 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | |||
270 | newGameButton = new QPushButton( toolBar ); | 272 | newGameButton = new QPushButton( toolBar ); |
271 | newGameButton->setPixmap( QPixmap( pix_new ) ); | 273 | newGameButton->setPixmap( QPixmap( pix_new ) ); |
272 | newGameButton->setFocusPolicy(QWidget::NoFocus); | 274 | newGameButton->setFocusPolicy(QWidget::NoFocus); |
273 | connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) ); | 275 | connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) ); |
274 | 276 | ||
275 | timeLCD = new QLCDNumber( toolBar ); | 277 | timeLCD = new QLCDNumber( toolBar ); |
276 | // timeLCD->setPalette( lcdPal ); | 278 | // timeLCD->setPalette( lcdPal ); |
277 | timeLCD->setSegmentStyle( QLCDNumber::Flat ); | 279 | timeLCD->setSegmentStyle( QLCDNumber::Flat ); |
278 | timeLCD->setFrameStyle( QFrame::NoFrame ); | 280 | timeLCD->setFrameStyle( QFrame::NoFrame ); |
279 | timeLCD->setNumDigits( 5 ); // "mm:ss" | 281 | timeLCD->setNumDigits( 5 ); // "mm:ss" |
280 | timeLCD->setBackgroundMode( PaletteButton ); | 282 | timeLCD->setBackgroundMode( PaletteButton ); |
281 | 283 | ||
282 | setToolBarsMovable ( FALSE ); | 284 | setToolBarsMovable ( FALSE ); |
283 | 285 | ||
284 | addToolBar( toolBar ); | 286 | addToolBar( toolBar ); |
285 | 287 | ||
@@ -295,9 +297,9 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | |||
295 | fnt.setBold( TRUE ); | 297 | fnt.setBold( TRUE ); |
296 | field->setFont( QFont( fnt ) ); | 298 | field->setFont( QFont( fnt ) ); |
297 | field->setFocus(); | 299 | field->setFocus(); |
298 | setCentralWidget( mainframe ); | 300 | setCentralWidget( mainframe ); |
299 | 301 | ||
300 | connect( field, SIGNAL( gameOver( bool ) ), this, SLOT( gameOver( bool ) ) ); | 302 | connect( field, SIGNAL( gameOver( bool ) ), this, SLOT( gameOver( bool ) ) ); |
301 | connect( field, SIGNAL( mineCount( int ) ), this, SLOT( setCounter( int ) ) ); | 303 | connect( field, SIGNAL( mineCount( int ) ), this, SLOT( setCounter( int ) ) ); |
302 | connect( field, SIGNAL( gameStarted()), this, SLOT( startPlaying() ) ); | 304 | connect( field, SIGNAL( gameStarted()), this, SLOT( startPlaying() ) ); |
303 | 305 | ||
diff --git a/noncore/games/minesweep/minesweep.h b/noncore/games/minesweep/minesweep.h index e860573..527dc9e 100644 --- a/noncore/games/minesweep/minesweep.h +++ b/noncore/games/minesweep/minesweep.h | |||
@@ -30,8 +30,9 @@ class QPushButton; | |||
30 | class MineSweep : public QMainWindow | 30 | class MineSweep : public QMainWindow |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | public: | 33 | public: |
34 | static QString appName() { return QString::fromLatin1("minesweep"); } | ||
34 | MineSweep( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); | 35 | MineSweep( QWidget* parent = 0, const char* name = 0, WFlags f = 0 ); |
35 | ~MineSweep(); | 36 | ~MineSweep(); |
36 | 37 | ||
37 | public slots: | 38 | public slots: |
diff --git a/noncore/games/minesweep/minesweep.pro b/noncore/games/minesweep/minesweep.pro index 8e4001e..9746651 100644 --- a/noncore/games/minesweep/minesweep.pro +++ b/noncore/games/minesweep/minesweep.pro | |||
@@ -1,15 +1,13 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | 2 | HEADERS = minefield.h \ |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | minesweep.h |
4 | HEADERS = minefield.h \ | 4 | SOURCES = main.cpp \ |
5 | minesweep.h | 5 | minefield.cpp \ |
6 | SOURCES = main.cpp \ | 6 | minesweep.cpp |
7 | minefield.cpp \ | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | minesweep.cpp | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | INCLUDEPATH += $(OPIEDIR)/include | 9 | LIBS += -lqpe |
10 | DEPENDPATH+= $(OPIEDIR)/include | 10 | INTERFACES= |
11 | LIBS += -lqpe | 11 | TARGET = minesweep |
12 | INTERFACES= | 12 | |
13 | TARGET = minesweep | 13 | include ( $(OPIEDIR)/include.pro ) |
14 | |||
15 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/games/minesweep/opie-minesweep.control b/noncore/games/minesweep/opie-minesweep.control index 32f0352..91343ea 100644 --- a/noncore/games/minesweep/opie-minesweep.control +++ b/noncore/games/minesweep/opie-minesweep.control | |||
@@ -1,6 +1,6 @@ | |||
1 | Package: opie-minesweep | 1 | Package: opie-minesweep |
2 | Files: bin/minesweep apps/Games/minesweep.desktop pics/minesweep | 2 | Files: plugins/application/libminesweep.so* bin/minesweep apps/Games/minesweep.desktop pics/minesweep |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 5 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
6 | Architecture: arm | 6 | Architecture: arm |