summaryrefslogtreecommitdiff
path: root/noncore/games/minesweep
authorzecke <zecke>2004-02-06 12:14:56 (UTC)
committer zecke <zecke>2004-02-06 12:14:56 (UTC)
commit0c74629e8f5c12a9b5a282b817f884fa10dee491 (patch) (side-by-side diff)
tree3294663b92023f8d24d68a01022e011a3c94002d /noncore/games/minesweep
parent46ce5afcfbe7be19f4d5ac0fed6886a0759f1a25 (diff)
downloadopie-0c74629e8f5c12a9b5a282b817f884fa10dee491.zip
opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.gz
opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.bz2
Merge from the 1.0.x release
Diffstat (limited to 'noncore/games/minesweep') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/minesweep/main.cpp11
-rw-r--r--noncore/games/minesweep/minefield.cpp2
-rw-r--r--noncore/games/minesweep/minesweep.cpp26
-rw-r--r--noncore/games/minesweep/minesweep.h1
-rw-r--r--noncore/games/minesweep/minesweep.pro28
-rw-r--r--noncore/games/minesweep/opie-minesweep.control2
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
@@ -21,14 +21,7 @@
#include "minesweep.h"
#include <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
-int main( int argc, char** argv )
-{
- QPEApplication a( argc, argv );
+OPIE_EXPORT_APP( OApplicationFactory<MineSweep> )
- MineSweep ms;
- QPEApplication::setInputMethodHint( &ms, QPEApplication::AlwaysOff );
- a.showMainWidget( &ms );
-
- return a.exec();
-}
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
@@ -353,7 +353,7 @@ void MineField::setup( int level )
minecount = 66 ;
break;
}
- mines = new (Mine*)[numRows*numCols];
+ mines = new Mine*[numRows*numCols];
for ( i = 0; i < numCols*numRows; i++ )
mines[i] = new Mine( this );
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
@@ -21,6 +21,7 @@
#include "minesweep.h"
#include "minefield.h"
+#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/config.h>
@@ -155,12 +156,12 @@ static const char * dead_xpm[] = {
class ResultIndicator : private QLabel
{
-public:
+public:
static void showResult( QWidget *ref, bool won );
-private:
+private:
ResultIndicator( QWidget *parent, const char *name, WFlags f)
:QLabel( parent, name, f ) {}
-
+
void timerEvent( QTimerEvent *);
void center();
bool twoStage;
@@ -170,7 +171,7 @@ private:
void ResultIndicator::showResult( QWidget *ref, bool won )
{
ResultIndicator *r = new ResultIndicator( ref, 0, WStyle_Customize | WStyle_Tool | WType_TopLevel );
-
+
r->setAlignment( AlignCenter );
r->setFrameStyle( Sunken|StyledPanel );
if ( won ) {
@@ -195,13 +196,13 @@ void ResultIndicator::center()
{
QWidget *w = parentWidget();
- QPoint pp = w->mapToGlobal( QPoint(0,0) );
+ QPoint pp = w->mapToGlobal( QPoint(0,0) );
QSize s = sizeHint()*3;
pp = QPoint( pp.x() + w->width()/2 - s.width()/2,
pp.y() + w->height()/ 2 - s.height()/2 );
setGeometry( QRect(pp, s) );
-
+
}
void ResultIndicator::timerEvent( QTimerEvent *te )
@@ -228,7 +229,7 @@ public:
protected:
void resizeEvent( QResizeEvent *e ) {
field->setAvailableRect( contentsRect());
- QFrame::resizeEvent(e);
+ QFrame::resizeEvent(e);
}
private:
MineField *field;
@@ -239,6 +240,7 @@ private:
MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
: QMainWindow( parent, name, f )
{
+ QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff );
srand(::time(0));
setCaption( tr("Mine Hunt") );
setIcon( Resource::loadPixmap( "minesweep_icon" ) );
@@ -254,14 +256,14 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) );
menuBar->insertItem( tr("Game"), gameMenu );
-
+
guessLCD = new QLCDNumber( toolBar );
toolBar->setStretchableWidget( guessLCD );
QPalette lcdPal( red );
lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() );
lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() );
-
+
// guessLCD->setPalette( lcdPal );
guessLCD->setSegmentStyle( QLCDNumber::Flat );
guessLCD->setFrameStyle( QFrame::NoFrame );
@@ -271,14 +273,14 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
newGameButton->setPixmap( QPixmap( pix_new ) );
newGameButton->setFocusPolicy(QWidget::NoFocus);
connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) );
-
+
timeLCD = new QLCDNumber( toolBar );
// timeLCD->setPalette( lcdPal );
timeLCD->setSegmentStyle( QLCDNumber::Flat );
timeLCD->setFrameStyle( QFrame::NoFrame );
timeLCD->setNumDigits( 5 ); // "mm:ss"
timeLCD->setBackgroundMode( PaletteButton );
-
+
setToolBarsMovable ( FALSE );
addToolBar( toolBar );
@@ -296,7 +298,7 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
field->setFont( QFont( fnt ) );
field->setFocus();
setCentralWidget( mainframe );
-
+
connect( field, SIGNAL( gameOver( bool ) ), this, SLOT( gameOver( bool ) ) );
connect( field, SIGNAL( mineCount( int ) ), this, SLOT( setCounter( int ) ) );
connect( field, SIGNAL( gameStarted()), this, SLOT( startPlaying() ) );
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
@@ -31,6 +31,7 @@ class MineSweep : public QMainWindow
{
Q_OBJECT
public:
+ static QString appName() { return QString::fromLatin1("minesweep"); }
MineSweep( QWidget* parent = 0, const char* name = 0, WFlags f = 0 );
~MineSweep();
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 @@
-TEMPLATE = app
-CONFIG = qt warn_on release
-DESTDIR = $(OPIEDIR)/bin
-HEADERS = minefield.h \
- minesweep.h
-SOURCES = main.cpp \
- minefield.cpp \
- minesweep.cpp
-INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe
-INTERFACES =
-TARGET = minesweep
-
-include ( $(OPIEDIR)/include.pro )
+CONFIG = qt warn_on release quick-app
+HEADERS = minefield.h \
+ minesweep.h
+SOURCES = main.cpp \
+ minefield.cpp \
+ minesweep.cpp
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDPATH += $(OPIEDIR)/include
+LIBS += -lqpe
+INTERFACES =
+TARGET = minesweep
+
+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,5 +1,5 @@
Package: opie-minesweep
-Files: bin/minesweep apps/Games/minesweep.desktop pics/minesweep
+Files: plugins/application/libminesweep.so* bin/minesweep apps/Games/minesweep.desktop pics/minesweep
Priority: optional
Section: opie/games
Maintainer: Martin Imobersteg <imm@gmx.ch>