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.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp
index c14609d..18449ff 100644
--- a/noncore/games/minesweep/minesweep.cpp
+++ b/noncore/games/minesweep/minesweep.cpp
@@ -1,73 +1,74 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "minesweep.h"
#include "minefield.h"
+#include <opie2/oresource.h>
+
#include <qtopia/qpeapplication.h>
-#include <qtopia/resource.h>
#include <qtopia/config.h>
#include <qtoolbar.h>
#include <qmenubar.h>
#include <qpushbutton.h>
#include <qlcdnumber.h>
#include <qtimer.h>
#include <qlabel.h>
#include <stdlib.h>
#include <time.h>
static const char *pix_new[]={
"20 20 3 1",
" c None",
"# c #00FF00",
". c #000000",
" ",
" ...... ",
" ..######.. ",
" .##########. ",
" .############. ",
" .##############. ",
" .##############. ",
" .################. ",
" .################. ",
" .################. ",
" .################. ",
" .################. ",
" .################. ",
" .##############. ",
" .##############. ",
" .############. ",
" .##########. ",
" ..######.. ",
" ...... ",
" "};
/* XPM */
static const char * happy_xpm[] = {
"20 20 3 1",
" c None",
". c #ffff3f ",
"# c #000000",
@@ -197,97 +198,97 @@ void ResultIndicator::center()
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 )
{
if ( te->timerId() != timerId )
return;
killTimer( timerId );
if ( twoStage ) {
center();
twoStage = FALSE;
timerId = startTimer( 1000 );
} else {
delete this;
}
}
class MineFrame : public QFrame
{
public:
MineFrame( QWidget *parent, const char *name = 0 )
:QFrame( parent, name ), field(0) {}
void setField( MineField *f ) {
field = f;
setMinimumSize( field->sizeHint() );
}
protected:
void resizeEvent( QResizeEvent *e ) {
field->setAvailableRect( contentsRect());
QFrame::resizeEvent(e);
}
private:
MineField *field;
};
MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
: QMainWindow( parent, name, f )
{
srand(::time(0));
setCaption( tr("Mine Sweep") );
QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff );
- setIcon( Resource::loadPixmap( "minesweep/MineSweep" ) );
+ setIcon( Opie::Core::OResource::loadPixmap( "minesweep/MineSweep" ) );
QToolBar *toolBar = new QToolBar( this );
toolBar->setHorizontalStretchable( TRUE );
QMenuBar *menuBar = new QMenuBar( toolBar );
QPopupMenu *gameMenu = new QPopupMenu( this );
gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) );
gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) );
if (qApp->desktop()->width() >= 240) {
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 );
guessLCD->setNumDigits( 2 );
guessLCD->setBackgroundMode( PaletteButton );
newGameButton = new QPushButton( toolBar );
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 );
MineFrame *mainframe = new MineFrame( this );
mainframe->setFrameShape( QFrame::Box );
mainframe->setFrameShadow( QFrame::Raised );