summaryrefslogtreecommitdiff
path: root/noncore/games/minesweep/minesweep.cpp
Side-by-side diff
Diffstat (limited to 'noncore/games/minesweep/minesweep.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/minesweep/minesweep.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp
index 7214a73..d707dab 100644
--- a/noncore/games/minesweep/minesweep.cpp
+++ b/noncore/games/minesweep/minesweep.cpp
@@ -1,6 +1,6 @@
/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
+** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
-** This file is part of Qtopia Environment.
+** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
@@ -22,9 +22,9 @@
#include "minefield.h"
-#include <qpe/qpeapplication.h>
-#include <qpe/resource.h>
-#include <qpe/config.h>
+#include <qtopia/qpeapplication.h>
+#include <qtopia/resource.h>
+#include <qtopia/config.h>
-#include <qpe/qpetoolbar.h>
+#include <qtoolbar.h>
#include <qmenubar.h>
#include <qpopupmenu.h>
@@ -199,4 +199,5 @@ void ResultIndicator::center()
QPoint pp = w->mapToGlobal( QPoint(0,0) );
QSize s = sizeHint()*3;
+ s.setWidth( QMIN(s.width(), w->width()) );
pp = QPoint( pp.x() + w->width()/2 - s.width()/2,
pp.y() + w->height()/ 2 - s.height()/2 );
@@ -225,6 +226,9 @@ class MineFrame : public QFrame
public:
MineFrame( QWidget *parent, const char *name = 0 )
- :QFrame( parent, name ) {}
- void setField( MineField *f ) { field = f; }
+ :QFrame( parent, name ), field(0) {}
+ void setField( MineField *f ) {
+ field = f;
+ setMinimumSize( field->sizeHint() );
+ }
protected:
void resizeEvent( QResizeEvent *e ) {
@@ -241,8 +245,8 @@ 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" ) );
+ QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff );
+ setIcon( Resource::loadPixmap( "minesweep/MineHunt" ) );
QToolBar *toolBar = new QToolBar( this );
@@ -254,5 +258,8 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) );
gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) );
- gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) );
+
+ if (qApp->desktop()->width() >= 240) {
+ gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) );
+ }
menuBar->insertItem( tr("Game"), gameMenu );
@@ -300,10 +307,9 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
setCentralWidget( mainframe );
- connect( field, SIGNAL( gameOver( bool ) ), this, SLOT( gameOver( bool ) ) );
- connect( field, SIGNAL( mineCount( int ) ), this, SLOT( setCounter( int ) ) );
+ 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() ) );
timer = new QTimer( this );
-
connect( timer, SIGNAL( timeout() ), this, SLOT( updateTime() ) );