author | zecke <zecke> | 2004-03-13 20:51:18 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-13 20:51:18 (UTC) |
commit | a3304e23c7f8576a4584475ef0cf49d0e588671e (patch) (side-by-side diff) | |
tree | 854fa06307ad13c403a5be06caa2c9da305dd9b6 | |
parent | 8ff0f6a5875346302d62b52621f9e6189d683dd9 (diff) | |
download | opie-a3304e23c7f8576a4584475ef0cf49d0e588671e.zip opie-a3304e23c7f8576a4584475ef0cf49d0e588671e.tar.gz opie-a3304e23c7f8576a4584475ef0cf49d0e588671e.tar.bz2 |
convert to Opie2 namespace
most of them are only using namespace Opie::Core in the main
remove <qpe/qpetoolbar.h>
-rw-r--r-- | noncore/games/bounce/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/buzzword/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/fifteen/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/go/gowidget.cpp | 2 | ||||
-rw-r--r-- | noncore/games/go/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/kcheckers/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/minesweep/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/parashoot/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/qasteroids/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/snake/interface.cpp | 2 | ||||
-rw-r--r-- | noncore/games/snake/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/solitaire/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/tetrix/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/tictac/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/wordgame/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/wordgame/wordgame.cpp | 2 | ||||
-rw-r--r-- | noncore/games/zlines/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/zsame/ZSameWidget.cpp | 1 |
18 files changed, 18 insertions, 3 deletions
diff --git a/noncore/games/bounce/main.cpp b/noncore/games/bounce/main.cpp index eb8d561..bec4a86 100644 --- a/noncore/games/bounce/main.cpp +++ b/noncore/games/bounce/main.cpp @@ -1,24 +1,25 @@ /* * Copyright (C) 2000 Stefan Schimanski <schimmi@kde.org> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "kbounce.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<KJezzball> ) diff --git a/noncore/games/buzzword/main.cpp b/noncore/games/buzzword/main.cpp index 596cf16..a95e91a 100644 --- a/noncore/games/buzzword/main.cpp +++ b/noncore/games/buzzword/main.cpp @@ -1,23 +1,24 @@ /* * Copyright (C) 2002 Martin Imobersteg <imm@gmx.ch> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License,Life or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <opie2/oapplicationfactory.h> #include "buzzword.h" +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<BuzzWord> ) diff --git a/noncore/games/fifteen/main.cpp b/noncore/games/fifteen/main.cpp index ed74a47..800a270 100644 --- a/noncore/games/fifteen/main.cpp +++ b/noncore/games/fifteen/main.cpp @@ -1,23 +1,24 @@ /********************************************************************** ** Copyright (C) 2004 Holger Freyther. All rights reserved. ** ** This file is part of Opie 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. ** **********************************************************************/ #include "fifteen.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<FifteenMainWindow> ) diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp index 79820b1..d134540 100644 --- a/noncore/games/go/gowidget.cpp +++ b/noncore/games/go/gowidget.cpp @@ -1,219 +1,219 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "gowidget.h" #include <qpe/config.h> #include <qpe/resource.h> #include <qpainter.h> -#include <qpe/qpetoolbar.h> +#include <qtoolbar.h> #include <qmenubar.h> #include <qaction.h> #include <qapplication.h> //processEvents() #include <qlabel.h> //#include <stdio.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 ) { 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 ); 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 ); 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 ); connect( go, SIGNAL(showTurn(const QPixmap&)), turnLabel, SLOT(setPixmap(const QPixmap&)) ); QLabel * scoreLabel = new QLabel( toolbar ); scoreLabel->setBackgroundMode( PaletteButton ); connect( go, SIGNAL(showScore(const QString&)), scoreLabel, SLOT(setText(const QString&)) ); toolbar->setStretchableWidget( scoreLabel ); go->readConfig(); } void GoMainWidget::resizeEvent( QResizeEvent * ) { //### this won't work because of the text label... /* if ( width() > height() ) moveToolBar( toolbar, Left ); else moveToolBar( toolbar, Top ); */ } 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" ); 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" )); init(); } GoWidget::~GoWidget() { writeConfig(); } void GoWidget::writeConfig() { Config cfg("Go"); cfg.setGroup("Game"); cfg.writeEntry("TwoPlayer", twoplayer); cfg.writeEntry("CurrentPlayer", currentPlayer); cfg.writeEntry("NPassed", nPassed); QString b; for (int i=0; i<19; i++) for (int j=0; j<19; j++) b += board[i][j] == BLACK ? 'B' : board[i][j] == WHITE ? 'W' : '.'; cfg.writeEntry("Board", b); cfg.writeEntry("LastX", lastX); cfg.writeEntry("LastY", lastY); extern int blackPrisoners, whitePrisoners; cfg.writeEntry("BlackPrisoners", blackPrisoners); cfg.writeEntry("WhitePrisoners", whitePrisoners); } void GoWidget::readConfig() { init(); Config cfg("Go"); cfg.setGroup("Game"); twoplayer = cfg.readBoolEntry("TwoPlayer"); currentPlayer = (bVal)cfg.readNumEntry("CurrentPlayer",1); nPassed = cfg.readNumEntry("NPassed",0); QString b = cfg.readEntry("Board"); if ( b.length() == 19*19 ) for (int i=0; i<19; i++) for (int j=0; j<19; j++) { QChar ch = b[j+19*i]; if ( ch != '.' ) GoPlaceStone( ch == 'B' ? BLACK : WHITE, i, j ); } lastX = cfg.readNumEntry("LastX"); lastY = cfg.readNumEntry("LastY"); extern int blackPrisoners, whitePrisoners; blackPrisoners = cfg.readNumEntry("BlackPrisoners",0); whitePrisoners = cfg.readNumEntry("WhitePrisoners",0); reportPrisoners(blackPrisoners,whitePrisoners); emit showTurn( currentPlayer == WHITE ? *whiteStone : *blackStone ); } 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" )); 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; diff --git a/noncore/games/go/main.cpp b/noncore/games/go/main.cpp index 46817d1..f6bb813 100644 --- a/noncore/games/go/main.cpp +++ b/noncore/games/go/main.cpp @@ -1,27 +1,28 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "gowidget.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<GoMainWidget> ) diff --git a/noncore/games/kcheckers/main.cpp b/noncore/games/kcheckers/main.cpp index 79b5ac7..8c708e2 100644 --- a/noncore/games/kcheckers/main.cpp +++ b/noncore/games/kcheckers/main.cpp @@ -1,9 +1,10 @@ #include "kcheckers.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<KCheckers> ) diff --git a/noncore/games/minesweep/main.cpp b/noncore/games/minesweep/main.cpp index f3070f5..629afbf 100644 --- a/noncore/games/minesweep/main.cpp +++ b/noncore/games/minesweep/main.cpp @@ -1,26 +1,27 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<MineSweep> ) diff --git a/noncore/games/parashoot/main.cpp b/noncore/games/parashoot/main.cpp index 81d513d..da21c25 100644 --- a/noncore/games/parashoot/main.cpp +++ b/noncore/games/parashoot/main.cpp @@ -1,26 +1,27 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "interface.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<ParaShoot> ) diff --git a/noncore/games/qasteroids/main.cpp b/noncore/games/qasteroids/main.cpp index 33e4729..6ddb238 100644 --- a/noncore/games/qasteroids/main.cpp +++ b/noncore/games/qasteroids/main.cpp @@ -1,26 +1,27 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "toplevel.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<KAstTopLevel> ) diff --git a/noncore/games/snake/interface.cpp b/noncore/games/snake/interface.cpp index b5fb5bf..9d9550a 100644 --- a/noncore/games/snake/interface.cpp +++ b/noncore/games/snake/interface.cpp @@ -1,217 +1,217 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "interface.h" #include <qpe/resource.h> -#include <qpe/qpetoolbar.h> +#include <qtoolbar.h> #include <qtoolbutton.h> SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : QMainWindow(parent,name,f), canvas(232, 258) { setCaption( tr("Snake") ); QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); QPixmap bg = Resource::loadPixmap("snake/grass"); canvas.setBackgroundPixmap(bg); canvas.setUpdatePeriod(100); snake = 0; cv = new QCanvasView(&canvas, this); pauseTimer = new QTimer(this); connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); setToolBarsMovable( FALSE ); QToolBar* toolbar = new QToolBar( this); toolbar->setHorizontalStretchable( TRUE ); QPixmap newicon = Resource::loadPixmap("ksnake"); setIcon(newicon); (void)new QToolButton(newicon, tr("New Game"), 0, this, SLOT(newGame()), toolbar, "New Game"); scorelabel = new QLabel(toolbar); showScore(0); scorelabel->setBackgroundMode( PaletteButton ); scorelabel->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); toolbar->setStretchableWidget( scorelabel ); setFocusPolicy(StrongFocus); setCentralWidget(cv); QTimer::singleShot( 16, this, SLOT(welcomescreen()) ); gamestopped = true; waitover = true; } SnakeGame::~SnakeGame() { delete snake; } void SnakeGame::resizeEvent(QResizeEvent *) { QSize s = centralWidget()->size(); int fw = style().defaultFrameWidth(); canvas.resize( s.width() - fw - 2, s.height() - fw - 2); } void SnakeGame::welcomescreen() { QCanvasText* title = new QCanvasText(tr("SNAKE!"), &canvas); title->setColor(yellow); title->setFont( QFont("times", 18, QFont::Bold) ); int w = title->boundingRect().width(); title->move(canvas.width()/2 -w/2, canvas.height()/2-110); title->show(); QCanvasPixmapArray* titlearray = new QCanvasPixmapArray(Resource::findPixmap("snake/title")); QCanvasSprite* titlepic = new QCanvasSprite(titlearray, &canvas); titlepic->move(canvas.width()/2 - 33, canvas.height()/2-85); titlepic->show(); QCanvasText* instr = new QCanvasText(tr("Use the arrow keys to guide the\n" "snake to eat the mouse. You must not\n" "crash into the walls, edges or its tail."), &canvas); w = instr->boundingRect().width(); instr->move(canvas.width()/2-w/2, canvas.height()/2-20); instr->setColor(white); instr->show(); QCanvasText* cont = new QCanvasText(tr("Press any key to start"), &canvas); w = cont->boundingRect().width(); cont->move(canvas.width()/2-w/2, canvas.height()-20); cont->setColor(yellow); cont->show(); } void SnakeGame::newGame() { clear(); snake = new Snake(&canvas); connect(snake, SIGNAL(dead()), this, SLOT(gameOver()) ); connect(snake, SIGNAL(targethit()), this, SLOT(levelUp()) ); connect(snake, SIGNAL(scorechanged()), this, SLOT(scoreInc()) ); connect(this, SIGNAL(moveFaster()), snake, SLOT(increaseSpeed()) ); last = 0; targetamount = 1; notargets = 1; level = 1; stage = 1; showScore(0); gamestopped = false; waitover = true; int y = canvas.height()-50; (void)new Obstacle(&canvas, 32); (void)new Obstacle(&canvas, y); createTargets(); } void SnakeGame::showScore(int score) { scorelabel->setText(tr(" Score : %1 ").arg(score) ); } void SnakeGame::scoreInc() { showScore( snake->getScore() ); } void SnakeGame::levelUp() { notargets--; if (notargets == 0) { stage++; if (stage == 3) { level++; emit moveFaster(); targetamount++; stage = 0; } createTargets(); } } void SnakeGame::createTargets() { for (int i = 0; i < targetamount; i++) (void)new Target(&canvas); notargets = targetamount; } void SnakeGame::clear() { delete snake; snake = 0; QCanvasItemList l = canvas.allItems(); for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { delete *it; } } void SnakeGame::gameOver() { int score = snake->getScore(); QString scoreoutput=""; scoreoutput.setNum(score); QCanvasText* gameover = new QCanvasText(tr("GAME OVER!\n Your Score: %1").arg( scoreoutput), &canvas); gameover->setZ(100); gameover->setColor(yellow); gameover->setFont( QFont("times", 18, QFont::Bold) ); int w = gameover->boundingRect().width(); gameover->move(canvas.width()/2 -w/2, canvas.height()/2 -50); gameover->show(); gamestopped = true; waitover = false; pauseTimer->start(1500); } void SnakeGame::wait() { waitover = true; pauseTimer->stop(); QCanvasText* cont = new QCanvasText(tr("Press any key to begin a new game."), &canvas); cont->setZ(100); cont->setColor(white); int w = cont->boundingRect().width(); cont->move(canvas.width()/2 -w/2, canvas.height()/2); cont->show(); } void SnakeGame::keyPressEvent(QKeyEvent* event) { if (gamestopped) { if (waitover) newGame(); else return; } else { int newkey = event->key(); snake->go(newkey); } diff --git a/noncore/games/snake/main.cpp b/noncore/games/snake/main.cpp index 44f742f..81eb9ee 100644 --- a/noncore/games/snake/main.cpp +++ b/noncore/games/snake/main.cpp @@ -1,28 +1,29 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "interface.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<SnakeGame> ) diff --git a/noncore/games/solitaire/main.cpp b/noncore/games/solitaire/main.cpp index d4f6673..c8d4040 100644 --- a/noncore/games/solitaire/main.cpp +++ b/noncore/games/solitaire/main.cpp @@ -1,25 +1,26 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "canvascardwindow.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<CanvasCardWindow> )
\ No newline at end of file diff --git a/noncore/games/tetrix/main.cpp b/noncore/games/tetrix/main.cpp index 147d13d..6194bbf 100644 --- a/noncore/games/tetrix/main.cpp +++ b/noncore/games/tetrix/main.cpp @@ -1,27 +1,28 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "qtetrix.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<QTetrix> ) diff --git a/noncore/games/tictac/main.cpp b/noncore/games/tictac/main.cpp index b8193f7..f3df375 100644 --- a/noncore/games/tictac/main.cpp +++ b/noncore/games/tictac/main.cpp @@ -1,13 +1,14 @@ /**************************************************************************** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #include "tictac.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<TicTacToe> ) diff --git a/noncore/games/wordgame/main.cpp b/noncore/games/wordgame/main.cpp index 7fd5f50..c388775 100644 --- a/noncore/games/wordgame/main.cpp +++ b/noncore/games/wordgame/main.cpp @@ -1,27 +1,28 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "wordgame.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<WordGame> ) diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp index 43a54f8..a80bd35 100644 --- a/noncore/games/wordgame/wordgame.cpp +++ b/noncore/games/wordgame/wordgame.cpp @@ -1,228 +1,228 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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 "wordgame.h" #include <qpe/global.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qapplication.h> #include <qmessagebox.h> #include <qcombobox.h> #include <qdir.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qtextstream.h> #include <qtimer.h> -#include <qpe/qpetoolbar.h> +#include <qtoolbar.h> #include <qtoolbutton.h> #include <qvbox.h> #include <qwidgetstack.h> #include <qlayout.h> #include <stdlib.h> #include <unistd.h> #include <pwd.h> #include <sys/types.h> enum RuleEffects { Multiplier=15, MultiplyAll=64, Start=128 }; static int tile_smallw = 16; static int tile_smallh = 16; static int tile_bigw = 22; static int tile_bigh = 22; static int tile_stweak = -2; static int tile_btweak = -1; static const int rack_tiles=7; const char* sampleWGR= "wordgame_shapes\n" "15 15\n" "400001040100004\n" "030000000000030\n" "002002000200200\n" "000300020003000\n" "000020000020000\n" "102001000100201\n" "000000202000000\n" "400200050002004\n" "000000202000000\n" "102001000100201\n" "000020000020000\n" "000300020003000\n" "002002000200200\n" "030000000000030\n" "400001040100004\n" "1 2 3 66 67 194 100 0\n" "1 j 8\n" "1 q 7\n" "1 x 6\n" "1 z 6\n" "1 w 4\n" "1 k 4\n" "1 v 3\n" "1 f 3\n" "2 y 3\n" "2 h 2\n" "2 b 2\n" "2 m 2\n" "3 p 2\n" "3 g 2\n" "3 u 2\n" "4 d 2\n" "4 c 2\n" "5 l 1\n" "5 o 1\n" "7 t 1\n" "7 n 1\n" "7 a 1\n" "7 r 1\n" "8 s 1\n" "8 i 1\n" "11 e 1\n" "0\n"; WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) : QMainWindow(parent, name, fl) { if ( qApp->desktop()->width() < 240 ) { tile_smallw = 10; tile_smallh = 10; tile_bigw = 16; tile_bigh = 16; tile_stweak = 0; tile_btweak = 0; } setIcon( Resource::loadPixmap( "wordgame/WordGame.png" ) ); setCaption( tr("Word Game") ); setToolBarsMovable( FALSE ); vbox = new QVBox(this); setCentralWidget(vbox); toolbar = new QToolBar(this); addToolBar(toolbar, Bottom); reset = new QToolButton(Resource::loadPixmap("back"), tr("Back"), "", this, SLOT(resetTurn()), toolbar); done = new QToolButton(Resource::loadPixmap("done"), tr("Done"), "", this, SLOT(endTurn()), toolbar); scoreinfo = new ScoreInfo(toolbar); scoreinfo->setFont(QFont("Helvetica",10)); new QToolButton(Resource::loadPixmap("finish"), tr("Close"), "", this, SLOT(endGame()), toolbar); toolbar->setStretchableWidget(scoreinfo); cpu = 0; board = 0; bag = 0; racks = 0; aiheart = new QTimer(this); connect(aiheart, SIGNAL(timeout()), this, SLOT(think())); readConfig(); } WordGame::~WordGame() { writeConfig(); } void WordGame::writeConfig() { Config cfg("WordGame"); cfg.setGroup("Game"); cfg.writeEntry("NameList",namelist,';'); cfg.writeEntry("CurrentPlayer",gameover ? 0 : player+1); if ( !gameover ) { cfg.writeEntry("Rules",rules); bag->writeConfig(cfg); board->writeConfig(cfg); scoreinfo->writeConfig(cfg); } for (int p=0; p<nplayers; p++) { cfg.setGroup("Player"+QString::number(p+1)); if ( gameover ) cfg.clearGroup(); else rack(p)->writeConfig(cfg); } } void WordGame::readConfig() { Config cfg("WordGame"); cfg.setGroup("Game"); int currentplayer = cfg.readNumEntry("CurrentPlayer",0); QStringList pnames = cfg.readListEntry("NameList",';'); if ( currentplayer ) { gameover = FALSE; rules = cfg.readEntry("Rules"); if ( rules.find("x-wordgamerules") >= 0 ) { // rules files moved rules = "Sample.rules"; } if ( loadRules(rules) ) { startGame(pnames); bag->readConfig(cfg); board->readConfig(cfg); scoreinfo->readConfig(cfg); for (int p=0; p<nplayers; p++) { cfg.setGroup("Player"+QString::number(p+1)); rack(p)->readConfig(cfg); } player=currentplayer-1; readyRack(player); return; } } // fall-back openGameSelector(pnames); } void WordGame::openGameSelector(const QStringList& initnames) { toolbar->hide(); gameover = FALSE; delete board; board = 0; delete racks; racks = 0; delete cpu; cpu = 0; newgame = new NewGame(vbox); //Rules rules(this); //connect(game.editrules, SIGNAL(clicked()), &rules, SLOT(editRules())); //connect(&rules, SIGNAL(rulesChanged()), &game, SLOT(updateRuleSets())); struct passwd* n = getpwuid(getuid()); QString playername = n ? n->pw_name : ""; if ( playername.isEmpty() ) { playername = "Player"; } newgame->player0->changeItem(playername,0); newgame->player1->setCurrentItem(1); newgame->updateRuleSets(); newgame->show(); diff --git a/noncore/games/zlines/main.cpp b/noncore/games/zlines/main.cpp index d1709e4..8d80bae 100644 --- a/noncore/games/zlines/main.cpp +++ b/noncore/games/zlines/main.cpp @@ -1,28 +1,29 @@ /*************************************************************************** main.cpp - description ------------------- begin : Fri May 19 2000 copyright : (C) 2000 by Roman Merzlyakov email : roman@sbrf.barrt.ru copyright : (C) 2000 by Roman Razilov email : Roman.Razilov@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ /* * Roman Razilov 2000-05-19 debug dummmy * Roman Razilov 2000-05-21 qimgio */ #include "klines.h" #include <opie2/oapplicationfactory.h> +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<KLines> ) diff --git a/noncore/games/zsame/ZSameWidget.cpp b/noncore/games/zsame/ZSameWidget.cpp index 3c58c93..4fab0f6 100644 --- a/noncore/games/zsame/ZSameWidget.cpp +++ b/noncore/games/zsame/ZSameWidget.cpp @@ -1,234 +1,235 @@ /* Yo Emacs, this is -*- C++ -*- */ /* * ksame 0.4 - simple Game * Copyright (C) 1997,1998 Marcus Kreutzberger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #include <stdio.h> #include <opie2/oapplicationfactory.h> #include <qpe/resource.h> #include <qtoolbar.h> #include <qmenubar.h> #include <qapplication.h> #include <qaction.h> #include <qmessagebox.h> #include <kapplication.h> #include "ZSameWidget.h" static int default_colors=3; #define i18n tr +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<ZSameWidget> ) ZSameWidget::ZSameWidget( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { setCaption(tr("ZSame")); setToolBarsMovable( false ); QToolBar* con = new QToolBar( this ); con->setHorizontalStretchable( true ); QMenuBar* mb = new QMenuBar( con ); QToolBar* tb = new QToolBar( this ); QPopupMenu* fileMenu = new QPopupMenu( this ); QAction* a = new QAction(tr("New Game"), Resource::loadIconSet("new") , QString::null, 0, this, "new_icon"); a->addTo( fileMenu ); a->addTo( tb ); connect(a, SIGNAL(activated()), this, SLOT(m_new())); a = new QAction(tr("Restart This Board"), Resource::loadIconSet("redo"), QString::null, 0, this, "restart_board" ); a->addTo( fileMenu ); connect( a, SIGNAL(activated()), this, SLOT(m_restart())); restart = a; a = new QAction( tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this, "undo_action" ); a->addTo( fileMenu ); a->addTo( tb ); connect( a, SIGNAL(activated()), this, SLOT(m_undo())); a = new QAction(tr("Quit"), Resource::loadIconSet("quit_icon"), QString::null, 0, this, "quit_action"); a->addTo( fileMenu ); a->addTo( tb ); connect(a, SIGNAL(activated()), this, SLOT(m_quit())); mb->insertItem(tr("Game" ), fileMenu ); int foo[2]; desktop_widget(foo); stone = new StoneWidget(this,foo[0],foo[1]); connect( stone, SIGNAL(s_gameover()), this, SLOT(gameover())); connect( stone, SIGNAL(s_colors(int)), this, SLOT(setColors(int))); connect( stone, SIGNAL(s_board(int)), this, SLOT(setBoard(int))); connect( stone, SIGNAL(s_marked(int)), this, SLOT(setMarked(int))); connect( stone, SIGNAL(s_score(int)), this, SLOT(setScore(int))); connect( stone, SIGNAL(s_remove(int,int)), this, SLOT(stonesRemoved(int,int))); connect(stone, SIGNAL(s_sizechanged()), this, SLOT(sizeChanged())); sizeChanged(); setCentralWidget(stone); setScore(0); } ZSameWidget::~ZSameWidget() { } void ZSameWidget::readProperties(Config *conf) { /* Q_ASSERT(conf); stone->readProperties(conf); */ } void ZSameWidget::saveProperties(Config *conf) { /* Q_ASSERT(conf); stone->saveProperties(conf); conf->sync(); */ } void ZSameWidget::sizeChanged() { // stone->setFixedSize(stone->sizeHint()); } void ZSameWidget::newGame(unsigned int board,int colors) { while (board>=1000000) board-=1000000; // kdDebug() << "newgame board " << board << " colors " << colors << endl; stone->newGame(board,colors); setScore(0); } bool ZSameWidget::confirmAbort() { return stone->isGameover() || stone->isOriginalBoard() || (QMessageBox::warning(this, i18n("Resign"), i18n("<qt>Do you want to resign?</qt>"), QMessageBox::Yes, QMessageBox::No|QMessageBox::Default|QMessageBox::Escape, 0) == QMessageBox::Yes ); } void ZSameWidget::m_new() { if (confirmAbort()) newGame(_random(),default_colors); } void ZSameWidget::m_restart() { if (confirmAbort()) newGame(stone->board(),default_colors); } void ZSameWidget::m_load() { // kdDebug() << "menu load not supported" << endl; } void ZSameWidget::m_save() { // kdDebug() << "menu save not supported" << endl; } void ZSameWidget::m_undo() { // Q_ASSERT(stone); stone->undo(); } void ZSameWidget::m_showhs() { /* Q_ASSERT(stone); stone->unmark(); KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this); d.addField(Board, i18n("Board"), "Board"); d.exec(); */ } void ZSameWidget::m_quit() { // Q_ASSERT(stone); stone->unmark(); qApp->quit(); // delete this; } void ZSameWidget::m_tglboard() { // kdDebug() << "toggled" << endl; } void ZSameWidget::setColors(int colors) { // status->changeItem(i18n("%1 Colors").arg(colors),1); } void ZSameWidget::setBoard(int board) { // status->changeItem(i18n("Board: %1").arg(board, 6), 2); } void ZSameWidget::setMarked(int m) { // status->changeItem(i18n("Marked: %1").arg(m, 6),3); } void ZSameWidget::stonesRemoved(int,int) { // KNotifyClient::event("stones removed", // i18n("%1 stones removed.").arg(stone->marked())); } void ZSameWidget::setScore(int score) { // status->changeItem(i18n("Score: %1").arg(score, 6),4); // undo->setEnabled(stone->undoPossible()); // restart->setEnabled(!stone->isOriginalBoard()); } void ZSameWidget::gameover() { // kdDebug() << "GameOver" << endl; if (stone->hasBonus()) { QMessageBox::information(this,i18n("Game won"), i18n("<qt>You even removed the last stone, great job! " "This gave you a score of %1 in total.</qt>").arg(stone->score())); } else { QMessageBox::information(this,i18n("Game over"), i18n("<qt>There are no more removeable stones. " "You got a score of %1 in total.</qt>").arg(stone->score())); } stone->unmark(); } void ZSameWidget::desktop_widget(int *f)const{ QWidget* wid = QApplication::desktop(); /* width > height landscape mode */ if ( wid->width() > wid->height() ) { f[0]=15; f[1]=9; |