summaryrefslogtreecommitdiff
authordrw <drw>2005-05-18 00:07:05 (UTC)
committer drw <drw>2005-05-18 00:07:05 (UTC)
commit600f14a61969ec2edd6d89efecaac997b1c6464f (patch) (side-by-side diff)
tree3700d6b7a98f67f423e9316aad844d377377ab65
parent73738d14ca541eaa41b8ee81168e98826752a98c (diff)
downloadopie-600f14a61969ec2edd6d89efecaac997b1c6464f.zip
opie-600f14a61969ec2edd6d89efecaac997b1c6464f.tar.gz
opie-600f14a61969ec2edd6d89efecaac997b1c6464f.tar.bz2
Resource -> OResource, set application caption
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/go/gowidget.cpp34
1 files changed, 13 insertions, 21 deletions
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp
index ec03c1d..bc5d788 100644
--- a/noncore/games/go/gowidget.cpp
+++ b/noncore/games/go/gowidget.cpp
@@ -13,76 +13,76 @@
**
** 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 "gowidget.h"
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/oresource.h>
#include <qpe/config.h>
-#include <qpe/resource.h>
using namespace Opie::Core;
/* QT */
#include <qpainter.h>
#include <qtoolbar.h>
#include <qmenubar.h>
#include <qaction.h>
#include <qapplication.h> //processEvents()
#include <qlabel.h>
static const enum bVal computer_color = BLACK;
static int current_handicap = 1;
static QBrush *goBrush;
-//static QImage *newBlackStone;
-//static QImage *blackStone;
-//static QImage *whiteStone;
static QPixmap *newBlackStone;
static QPixmap *blackStone;
static QPixmap *whiteStone;
static bool smallStones = FALSE;
GoMainWidget::GoMainWidget( QWidget *parent, const char* name, WFlags fl) :
QMainWindow( parent, name, fl )
{
+ setCaption( tr( "Go" ) );
setToolBarsMovable( FALSE );
GoWidget *go = new GoWidget(this);
setCentralWidget(go);
toolbar = new QToolBar(this);
toolbar->setHorizontalStretchable( TRUE );
addToolBar(toolbar);
QMenuBar *mb = new QMenuBar( toolbar );
mb->setMargin(0);
QPopupMenu *file = new QPopupMenu( this );
QAction *a = new QAction( tr( "New Game" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), go, SLOT( newGame() ) );
a->addTo( file );
- a = new QAction( tr( "Pass" ), Resource::loadPixmap( "pass" ), QString::null, 0, this, 0 );
+ a = new QAction( tr( "Pass" ), Opie::Core::OResource::loadPixmap( "pass", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), go, SLOT( pass() ) );
a->addTo( file );
a->addTo( toolbar );
- a = new QAction( tr( "Resign" ), Resource::loadPixmap( "reset" ), QString::null, 0, this, 0 );
+ a = new QAction( tr( "Resign" ), Opie::Core::OResource::loadPixmap( "reset", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), go, SLOT( resign() ) );
a->addTo( file );
a = new QAction( tr( "Two player option" ), QString::null, 0, this, 0 );
a->setToggleAction( TRUE );
connect( a, SIGNAL( toggled(bool) ), go, SLOT( setTwoplayer(bool) ) );
a->addTo( file );
mb->insertItem( tr( "Game" ), file );
QLabel *turnLabel = new QLabel( toolbar );
turnLabel->setBackgroundMode( PaletteButton );
@@ -115,37 +115,29 @@ GoWidget *GoWidget::self = 0;
GoWidget::GoWidget( QWidget *parent, const char* name) :
QWidget( parent, name )
{
if ( self )
fatal( "Only one Go widget allowed" );
self = this;
twoplayer = FALSE;
d = bx = by = 1;
- QPixmap pix = Resource::loadPixmap( "go/pine" );
+ QPixmap pix = Opie::Core::OResource::loadPixmap( "go/pine" );
goBrush = new QBrush( black, pix );
- /*
- QString fn = Resource::findPixmap("Go-black");
- blackStone = new QImage( fn );
- fn = Resource::findPixmap("Go-black-highlight");
- newBlackStone = new QImage( fn );
- fn = Resource::findPixmap("Go-white");
- whiteStone = new QImage( fn );
- */
- blackStone = new QPixmap(Resource::loadPixmap( "Go-black" ));
- whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" ));
- newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" ));
+ blackStone = new QPixmap(Opie::Core::OResource::loadPixmap( "Go-black" ));
+ whiteStone = new QPixmap(Opie::Core::OResource::loadPixmap( "Go-white" ));
+ newBlackStone = new QPixmap(Opie::Core::OResource::loadPixmap( "Go-black-highlight" ));
init();
}
GoWidget::~GoWidget()
{
writeConfig();
}
void GoWidget::writeConfig()
{
Config cfg("Go");
@@ -195,27 +187,27 @@ void GoWidget::resizeEvent( QResizeEvent * )
d = QMIN(width(),height())/19;
// int r = (d/2-1);
bx = (width() - 18*d)/2 ;
by = (height() - 18*d)/2 ;
if ( d < 10 && !smallStones ) {
blackStone->convertFromImage( blackStone->convertToImage().smoothScale(8,8) );
whiteStone->convertFromImage( whiteStone->convertToImage().smoothScale(8,8) );
newBlackStone->convertFromImage( newBlackStone->convertToImage().smoothScale(8,8) );
smallStones = TRUE;
} else if ( d >= 10 && smallStones ) {
- blackStone = new QPixmap(Resource::loadPixmap( "Go-black" ));
- whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" ));
- newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" ));
+ blackStone = new QPixmap(Opie::Core::OResource::loadPixmap( "Go-black" ));
+ whiteStone = new QPixmap(Opie::Core::OResource::loadPixmap( "Go-white" ));
+ newBlackStone = new QPixmap(Opie::Core::OResource::loadPixmap( "Go-black-highlight" ));
smallStones = FALSE;
}
}
void GoWidget::init()
{
lastX = lastY = newX = newY = -1;
nPassed = 0;
for ( int i = 0; i < 19; i++ )
for ( int j = 0; j < 19; j++ )
board[i][j]=-1;
gameActive = TRUE;