diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
commit | 576eb4299a00bc053db35414406f46372a0f70f2 (patch) | |
tree | 4c030922d533821db464af566188e7d40cc8848c /ksnake | |
parent | 0718336b6017d1a4fc1d626544180a5a2a29ddec (diff) | |
download | tdegames-576eb4299a00bc053db35414406f46372a0f70f2.tar.gz tdegames-576eb4299a00bc053db35414406f46372a0f70f2.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksnake')
-rw-r--r-- | ksnake/basket.cpp | 10 | ||||
-rw-r--r-- | ksnake/basket.h | 2 | ||||
-rw-r--r-- | ksnake/board.cpp | 8 | ||||
-rw-r--r-- | ksnake/board.h | 4 | ||||
-rw-r--r-- | ksnake/game.cpp | 44 | ||||
-rw-r--r-- | ksnake/game.h | 2 | ||||
-rw-r--r-- | ksnake/level.cpp | 26 | ||||
-rw-r--r-- | ksnake/level.h | 4 | ||||
-rw-r--r-- | ksnake/levels.cpp | 14 | ||||
-rw-r--r-- | ksnake/levels.h | 6 | ||||
-rw-r--r-- | ksnake/pixServer.cpp | 54 | ||||
-rw-r--r-- | ksnake/pixServer.h | 24 | ||||
-rw-r--r-- | ksnake/progress.cpp | 2 | ||||
-rw-r--r-- | ksnake/progress.h | 2 | ||||
-rw-r--r-- | ksnake/rattler.cpp | 82 | ||||
-rw-r--r-- | ksnake/rattler.h | 24 | ||||
-rw-r--r-- | ksnake/snake.cpp | 2 | ||||
-rw-r--r-- | ksnake/snake.h | 2 | ||||
-rw-r--r-- | ksnake/startroom.cpp | 36 | ||||
-rw-r--r-- | ksnake/startroom.h | 8 | ||||
-rw-r--r-- | ksnake/view.cpp | 10 | ||||
-rw-r--r-- | ksnake/view.h | 8 |
22 files changed, 187 insertions, 187 deletions
diff --git a/ksnake/basket.cpp b/ksnake/basket.cpp index c03b1deb..138336cd 100644 --- a/ksnake/basket.cpp +++ b/ksnake/basket.cpp @@ -23,8 +23,8 @@ * Boston, MA 02110-1301, USA. */ -#include <qtimer.h> -#include <qptrlist.h> +#include <tqtimer.h> +#include <tqptrlist.h> #include "board.h" #include "basket.h" @@ -35,7 +35,7 @@ Kaffee::Kaffee(int pos, int r1, int r2) p = pos; t = Red; r = r2; - QTimer::singleShot( r1, this, SLOT(golden()) ); + TQTimer::singleShot( r1, this, TQT_SLOT(golden()) ); dirty = true; } @@ -43,14 +43,14 @@ void Kaffee::golden() { dirty = true; t = (t == Red ? Golden : Red); - QTimer::singleShot( r, this, SLOT(golden()) ); + TQTimer::singleShot( r, this, TQT_SLOT(golden()) ); } Basket::Basket(Board *b, PixServer *p) { board = b; pixServer = p; - list = new QPtrList<Kaffee>; + list = new TQPtrList<Kaffee>; list->setAutoDelete( true ); } diff --git a/ksnake/basket.h b/ksnake/basket.h index eb965e4a..56bc8020 100644 --- a/ksnake/basket.h +++ b/ksnake/basket.h @@ -63,7 +63,7 @@ signals: private: Board *board; PixServer *pixServer; - QPtrList<Kaffee> *list; + TQPtrList<Kaffee> *list; KRandomSequence random; }; diff --git a/ksnake/board.cpp b/ksnake/board.cpp index 9179dfb1..0959dee1 100644 --- a/ksnake/board.cpp +++ b/ksnake/board.cpp @@ -23,7 +23,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qrect.h> +#include <tqrect.h> #include "board.h" Pos::Pos(Pos *p, int i, int r) { @@ -117,7 +117,7 @@ void Pos::addList(Pos *np) { } Board::Board(int s) - :QMemArray<int> (s) + :TQMemArray<int> (s) { sz = s; samyIndex = -1; @@ -142,10 +142,10 @@ void Board::set(int i, Square sq) samyIndex = i; } -QRect Board::rect(int i) +TQRect Board::rect(int i) { index(i); - return (QRect(col*BRICKSIZE, row*BRICKSIZE, BRICKSIZE, BRICKSIZE)); + return (TQRect(col*BRICKSIZE, row*BRICKSIZE, BRICKSIZE, BRICKSIZE)); } bool Board::isEmpty(int i) diff --git a/ksnake/board.h b/ksnake/board.h index 0fa43d7e..0eece38d 100644 --- a/ksnake/board.h +++ b/ksnake/board.h @@ -63,12 +63,12 @@ private: bool inList; }; -class Board : public QMemArray<int> +class Board : public TQMemArray<int> { public: Board (int s); ~Board() {} - QRect rect(int i); + TQRect rect(int i); void set(int i, Square sq); diff --git a/ksnake/game.cpp b/ksnake/game.cpp index 0fa18df2..4817b3af 100644 --- a/ksnake/game.cpp +++ b/ksnake/game.cpp @@ -29,8 +29,8 @@ from KReversi. thanks. */ -#include <qdir.h> -#include <qregexp.h> +#include <tqdir.h> +#include <tqregexp.h> #include <klocale.h> @@ -54,7 +54,7 @@ #define SCORE 1 #define LIVES 2 -Game::Game(QWidget *parent, const char *name) : KMainWindow(parent,name) +Game::Game(TQWidget *parent, const char *name) : KMainWindow(parent,name) { // create statusbar statusBar()->insertItem(i18n("Score: 0"), SCORE); @@ -67,14 +67,14 @@ Game::Game(QWidget *parent, const char *name) : KMainWindow(parent,name) rattler->reloadRoomPixmap(); rattler->setFocus(); - connect(rattler, SIGNAL(setPoints(int)), this, SLOT(scoreChanged(int))); - connect(rattler, SIGNAL(setTrys(int)), this, SLOT(setTrys(int))); - connect(rattler, SIGNAL(rewind()), view->progress, SLOT(rewind())); - connect(rattler, SIGNAL(advance()), view->progress, SLOT(advance())); - connect(view->progress, SIGNAL(restart()), rattler, SLOT(restartTimer())); + connect(rattler, TQT_SIGNAL(setPoints(int)), this, TQT_SLOT(scoreChanged(int))); + connect(rattler, TQT_SIGNAL(setTrys(int)), this, TQT_SLOT(setTrys(int))); + connect(rattler, TQT_SIGNAL(rewind()), view->progress, TQT_SLOT(rewind())); + connect(rattler, TQT_SIGNAL(advance()), view->progress, TQT_SLOT(advance())); + connect(view->progress, TQT_SIGNAL(restart()), rattler, TQT_SLOT(restartTimer())); - connect(rattler, SIGNAL(togglePaused()), this, SLOT(togglePaused())); - connect(rattler, SIGNAL(setScore(int)), this, SLOT(gameEnd(int))); + connect(rattler, TQT_SIGNAL(togglePaused()), this, TQT_SLOT(togglePaused())); + connect(rattler, TQT_SIGNAL(setScore(int)), this, TQT_SLOT(gameEnd(int))); setCentralWidget(view); @@ -98,7 +98,7 @@ void Game::setTrys(int tries){ void Game::gameEnd(int score){ KScoreDialog di(KScoreDialog::Name | KScoreDialog::Score | KScoreDialog::Date, this); KScoreDialog::FieldInfo scoreInfo; - QString date = QDateTime::currentDateTime().toString(); + TQString date = TQDateTime::currentDateTime().toString(); scoreInfo.insert(KScoreDialog::Date, date); if (di.addScore(score, scoreInfo, true)) di.exec(); @@ -120,16 +120,16 @@ void Game::createMenu() actionCollection()->setAutoConnectShortcuts(true); rattler->setActionCollection(actionCollection()); - KStdGameAction::gameNew(rattler, SLOT(restart()), actionCollection()); - pause = KStdGameAction::pause(rattler, SLOT(pause()), actionCollection()); - KStdGameAction::highscores(this, SLOT(showHighScores()), actionCollection()); - KStdGameAction::quit( this, SLOT(close()), actionCollection()); + KStdGameAction::gameNew(rattler, TQT_SLOT(restart()), actionCollection()); + pause = KStdGameAction::pause(rattler, TQT_SLOT(pause()), actionCollection()); + KStdGameAction::highscores(this, TQT_SLOT(showHighScores()), actionCollection()); + KStdGameAction::quit( this, TQT_SLOT(close()), actionCollection()); - KStdAction::preferences(this, SLOT(showSettings()), actionCollection()); + KStdAction::preferences(this, TQT_SLOT(showSettings()), actionCollection()); // TODO change and make custom function that pauses game or // modify widget to pause when loosing focus and remove this - KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), + KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection()); } @@ -153,17 +153,17 @@ void Game::showSettings(){ Appearance *a = new Appearance(0, "Appearance"); - QStringList list; + TQStringList list; if (rattler->backgroundPixmaps.count() == 0) { list.append(i18n("none")); } else { - QStringList::ConstIterator it = rattler->backgroundPixmaps.begin(); + TQStringList::ConstIterator it = rattler->backgroundPixmaps.begin(); for(unsigned i = 0; it != rattler->backgroundPixmaps.end(); i++, it++) { // since the filename may contain underscore, they // are replaced with spaces in the menu entry - QString s = QFileInfo( *it ).baseName(); - s = s.replace(QRegExp("_"), " "); + TQString s = TQFileInfo( *it ).baseName(); + s = s.replace(TQRegExp("_"), " "); list.append(s); } } @@ -173,7 +173,7 @@ void Game::showSettings(){ dialog->addPage(a, i18n("Appearance"), "style"); dialog->addPage(new StartRoom(0, "StartRoom"), i18n("First Level"), "folder_home"); - connect(dialog, SIGNAL(settingsChanged()), rattler, SLOT(loadSettings())); + connect(dialog, TQT_SIGNAL(settingsChanged()), rattler, TQT_SLOT(loadSettings())); dialog->show(); } diff --git a/ksnake/game.h b/ksnake/game.h index f25ef127..0c9eb66b 100644 --- a/ksnake/game.h +++ b/ksnake/game.h @@ -38,7 +38,7 @@ class Game : public KMainWindow { Q_OBJECT public: - Game(QWidget *parent=0, const char *name=0); + Game(TQWidget *parent=0, const char *name=0); ~Game(); private slots: diff --git a/ksnake/level.cpp b/ksnake/level.cpp index 86360818..0ea100f0 100644 --- a/ksnake/level.cpp +++ b/ksnake/level.cpp @@ -23,8 +23,8 @@ * Boston, MA 02110-1301, USA. */ -#include <qbitmap.h> -#include <qimage.h> +#include <tqbitmap.h> +#include <tqimage.h> #include "level.h" #include "board.h" @@ -68,18 +68,18 @@ void Level::create(Img img) void Level::createRoom() { - QImage image = leV->getImage(level); + TQImage image = leV->getImage(level); initBoard(image); } void Level::makeImageFromData(const uchar *buf) { - QBitmap bitmap(BoardWidth, BoardWidth, buf, true); - QImage image = bitmap.convertToImage(); + TQBitmap bitmap(BoardWidth, BoardWidth, buf, true); + TQImage image = bitmap.convertToImage(); initBoard (image); } -void Level::initBoard(const QImage &image) +void Level::initBoard(const TQImage &image) { int index = 0; uchar *b; @@ -88,7 +88,7 @@ void Level::initBoard(const QImage &image) b = image.scanLine(y); for ( int x = 0;x < image.width();x++ ) { - if ( image.bitOrder() == QImage::BigEndian ) { + if ( image.bitOrder() == TQImage::BigEndian ) { if (((*b >> (7 - (x & 7))) & 1) == 1) board->set(index, brick); else board->set(index, empty); @@ -109,13 +109,13 @@ void Level::createBanner() { makeImageFromData(level_bits); - QString num; + TQString num; num.setNum(level); if(level < 10) num.insert(0,'0'); - QString left = num.left(1); - QString right = num.right(1); + TQString left = num.left(1); + TQString right = num.right(1); drawNumber ( 606, numbers[left.toInt()] ); drawNumber ( 614, numbers[right.toInt()] ); @@ -123,8 +123,8 @@ void Level::createBanner() void Level::drawNumber(int beginAt, const uchar *buf) { - QBitmap bitmap(7, 9, buf, true); - QImage image = bitmap.convertToImage(); + TQBitmap bitmap(7, 9, buf, true); + TQImage image = bitmap.convertToImage(); int index = beginAt; uchar *b; @@ -134,7 +134,7 @@ void Level::drawNumber(int beginAt, const uchar *buf) b = image.scanLine(y); for ( int x = 0;x < image.width();x++ ) { - if ( image.bitOrder() == QImage::BigEndian ) + if ( image.bitOrder() == TQImage::BigEndian ) { if (((*b >> (7 - (x & 7))) & 1) == 1) board->set(index, brick); diff --git a/ksnake/level.h b/ksnake/level.h index 51c86dc6..03398a60 100644 --- a/ksnake/level.h +++ b/ksnake/level.h @@ -41,10 +41,10 @@ public: private: Board *board; - QImage makeImage(char *); + TQImage makeImage(char *); void makeImageFromData(const uchar *buf); void drawNumber(int beginAt, const uchar *buf); - void initBoard(const QImage &image); + void initBoard(const TQImage &image); void createRoom(); void createBanner(); diff --git a/ksnake/levels.cpp b/ksnake/levels.cpp index c58aa895..fe85cb39 100644 --- a/ksnake/levels.cpp +++ b/ksnake/levels.cpp @@ -23,8 +23,8 @@ * Boston, MA 02110-1301, USA. */ -#include <qimage.h> -#include <qbitmap.h> +#include <tqimage.h> +#include <tqbitmap.h> #include <kstandarddirs.h> @@ -44,15 +44,15 @@ int Levels::max() return ( list.count() -1 ); } -QImage Levels::getImage(int at) +TQImage Levels::getImage(int at) { - QBitmap bitmap(*list.at(at)); - QImage image = bitmap.convertToImage(); + TQBitmap bitmap(*list.at(at)); + TQImage image = bitmap.convertToImage(); return image; } -QPixmap Levels::getPixmap(int at) +TQPixmap Levels::getPixmap(int at) { - return QPixmap(*list.at(at)); + return TQPixmap(*list.at(at)); } diff --git a/ksnake/levels.h b/ksnake/levels.h index e40f5602..c0ed0e0b 100644 --- a/ksnake/levels.h +++ b/ksnake/levels.h @@ -30,12 +30,12 @@ class Levels { public: Levels (); - QImage getImage(int); - QPixmap getPixmap(int); + TQImage getImage(int); + TQPixmap getPixmap(int); int max(); private: - QStringList list; + TQStringList list; }; diff --git a/ksnake/pixServer.cpp b/ksnake/pixServer.cpp index bdc281ea..ac25f9be 100644 --- a/ksnake/pixServer.cpp +++ b/ksnake/pixServer.cpp @@ -25,9 +25,9 @@ #include "pixServer.h" -#include <qimage.h> -#include <qpainter.h> -#include <qbitmap.h> +#include <tqimage.h> +#include <tqpainter.h> +#include <tqbitmap.h> #include <kstandarddirs.h> #include <klocale.h> @@ -50,24 +50,24 @@ void PixServer::erase(int pos) if (!board->isEmpty(pos)) return; - QRect rect = board->rect(pos); + TQRect rect = board->rect(pos); bitBlt( &cachePix, rect.x(), rect.y(), &backPix, rect.x(), rect.y(), rect.width(), rect.height()); } void PixServer::restore(int pos) { - QRect rect = board->rect(pos); + TQRect rect = board->rect(pos); bitBlt( &cachePix, rect.x(), rect.y(), &roomPix, rect.x(), rect.y(), rect.width(), rect.height()); } void PixServer::draw(int pos, PixMap pix, int i) { - QPixmap p; + TQPixmap p; p.resize(BRICKSIZE, BRICKSIZE); - QRect rect = board->rect(pos); + TQRect rect = board->rect(pos); if (! plainColor) bitBlt( &p, 0, 0, &backPix, @@ -94,40 +94,40 @@ void PixServer::draw(int pos, PixMap pix, int i) void PixServer::initPixmaps() { - QPixmap pm = QPixmap(locate("appdata", "pics/snake1.png")); - QImage qi = pm.convertToImage(); + TQPixmap pm = TQPixmap(locate("appdata", "pics/snake1.png")); + TQImage qi = pm.convertToImage(); qi=qi.smoothScale(BRICKSIZE*18,BRICKSIZE); - pm.convertFromImage(qi,QPixmap::AvoidDither); + pm.convertFromImage(qi,TQPixmap::AvoidDither); for (int x = 0 ; x < 18; x++){ compuSnakePix[x].resize(BRICKSIZE, BRICKSIZE); bitBlt(&compuSnakePix[x] ,0,0, &pm,x*BRICKSIZE, 0, BRICKSIZE, BRICKSIZE, Qt::CopyROP, true); compuSnakePix[x].setMask(compuSnakePix[x].createHeuristicMask()); } - pm = QPixmap(locate("appdata", "pics/snake2.png")); + pm = TQPixmap(locate("appdata", "pics/snake2.png")); qi = pm.convertToImage(); qi=qi.smoothScale(BRICKSIZE*18,BRICKSIZE); - pm.convertFromImage(qi,QPixmap::AvoidDither); + pm.convertFromImage(qi,TQPixmap::AvoidDither); for (int x = 0 ; x < 18; x++){ samyPix[x].resize(BRICKSIZE, BRICKSIZE); bitBlt(&samyPix[x] ,0,0, &pm,x*BRICKSIZE, 0, BRICKSIZE, BRICKSIZE, Qt::CopyROP, true); samyPix[x].setMask(samyPix[x].createHeuristicMask()); } - pm = QPixmap(locate("appdata", "pics/ball.png")); + pm = TQPixmap(locate("appdata", "pics/ball.png")); qi = pm.convertToImage(); qi=qi.smoothScale(BRICKSIZE*4,BRICKSIZE); - pm.convertFromImage(qi,QPixmap::AvoidDither); + pm.convertFromImage(qi,TQPixmap::AvoidDither); for (int x = 0 ; x < 4; x++){ ballPix[x].resize(BRICKSIZE, BRICKSIZE); bitBlt(&ballPix[x] ,0,0, &pm,x*BRICKSIZE, 0, BRICKSIZE, BRICKSIZE, Qt::CopyROP, true); ballPix[x].setMask(ballPix[x].createHeuristicMask()); } - pm = QPixmap(locate("appdata", "pics/apples.png")); + pm = TQPixmap(locate("appdata", "pics/apples.png")); qi = pm.convertToImage(); qi=qi.smoothScale(BRICKSIZE*2,BRICKSIZE); - pm.convertFromImage(qi,QPixmap::AvoidDither); + pm.convertFromImage(qi,TQPixmap::AvoidDither); for (int x = 0 ; x < 2; x++){ applePix[x].resize(BRICKSIZE, BRICKSIZE); bitBlt(&applePix[x] ,0,0, &pm,x*BRICKSIZE, 0, BRICKSIZE, BRICKSIZE, Qt::CopyROP, true); @@ -137,7 +137,7 @@ void PixServer::initPixmaps() void PixServer::initbackPixmaps() { - QString path; + TQString path; plainColor = false; if(Settings::bgcolor_enabled()){ @@ -145,19 +145,19 @@ void PixServer::initbackPixmaps() plainColor = true; } else if(Settings::bgimage_enabled()) { // A bit of a hack. - QStringList backgroundPixmaps = + TQStringList backgroundPixmaps = KGlobal::dirs()->findAllResources("appdata", "backgrounds/*.png"); path = backgroundPixmaps[(Settings::bgimage())]; } - QPixmap PIXMAP; + TQPixmap PIXMAP; int pw, ph; backPix.resize(MAPWIDTH, MAPHEIGHT); if (! plainColor) { - PIXMAP = QPixmap(path); + PIXMAP = TQPixmap(path); if (!PIXMAP.isNull()) { pw = PIXMAP.width(); @@ -169,7 +169,7 @@ void PixServer::initbackPixmaps() } else { kdDebug() << "error loading background image :" << path << endl; - backgroundColor = (QColor("black")); + backgroundColor = (TQColor("black")); plainColor = true; } } @@ -179,7 +179,7 @@ void PixServer::initbackPixmaps() void PixServer::initBrickPixmap() { - QPixmap pm = QPixmap(locate("appdata", "pics/brick.png")); + TQPixmap pm = TQPixmap(locate("appdata", "pics/brick.png")); if (pm.isNull()) { kdFatal() << i18n("error loading %1, aborting\n").arg("brick.png"); } @@ -194,7 +194,7 @@ void PixServer::initBrickPixmap() void PixServer::initRoomPixmap() { - QPainter paint; + TQPainter paint; roomPix.resize(MAPWIDTH, MAPHEIGHT); bitBlt(&roomPix,0,0, &backPix); @@ -210,18 +210,18 @@ void PixServer::initRoomPixmap() bitBlt(&cachePix,0,0, &roomPix); } -void PixServer::drawBrick(QPainter *p ,int i) +void PixServer::drawBrick(TQPainter *p ,int i) { //Note, ROOMPIC IS OUR 'TARGET' - QColor light(180,180,180); - QColor dark(100,100,100); + TQColor light(180,180,180); + TQColor dark(100,100,100); int topSq = board->getNext(N, i); //find 'address' of neighbouring squares int botSq = board->getNext(S, i); int rightSq = board->getNext(E ,i); int leftSq = board->getNext(W, i); - QRect rect = board->rect(i); //get our square's rect + TQRect rect = board->rect(i); //get our square's rect int x = rect.x(); int y = rect.y(); //Get x,y location of square??? diff --git a/ksnake/pixServer.h b/ksnake/pixServer.h index 783f7efa..c081a491 100644 --- a/ksnake/pixServer.h +++ b/ksnake/pixServer.h @@ -26,7 +26,7 @@ #ifndef PIXSERVER_H #define PIXSERVER_H -#include <qpixmap.h> +#include <tqpixmap.h> class Board; enum SnakePix {TailUp, TailDown, TailRight, TailLeft, @@ -41,7 +41,7 @@ class PixServer { public: PixServer (Board *); - QPixmap levelPix() const { return cachePix; } + TQPixmap levelPix() const { return cachePix; } void initRoomPixmap(); void initBrickPixmap(); @@ -55,20 +55,20 @@ public: private: Board *board; - void drawBrick(QPainter *, int); + void drawBrick(TQPainter *, int); - QPixmap samyPix[18]; - QPixmap compuSnakePix[18]; - QPixmap ballPix[4]; - QPixmap applePix[2]; + TQPixmap samyPix[18]; + TQPixmap compuSnakePix[18]; + TQPixmap ballPix[4]; + TQPixmap applePix[2]; - QPixmap roomPix; - QPixmap cachePix; - QPixmap offPix; - QPixmap backPix; + TQPixmap roomPix; + TQPixmap cachePix; + TQPixmap offPix; + TQPixmap backPix; bool plainColor; - QColor backgroundColor; + TQColor backgroundColor; }; diff --git a/ksnake/progress.cpp b/ksnake/progress.cpp index d6d88823..c5024a0f 100644 --- a/ksnake/progress.cpp +++ b/ksnake/progress.cpp @@ -25,7 +25,7 @@ #include "progress.h" -Progress::Progress(QWidget *parent, const char *name) +Progress::Progress(TQWidget *parent, const char *name) : KGameProgress(0, 300, 300, KGameProgress::Horizontal, parent, name) { setBarColor("green1"); diff --git a/ksnake/progress.h b/ksnake/progress.h index 4b902f26..311a2bcf 100644 --- a/ksnake/progress.h +++ b/ksnake/progress.h @@ -32,7 +32,7 @@ class Progress : public KGameProgress { Q_OBJECT public: - Progress( QWidget *parent=0, const char *name=0 ); + Progress( TQWidget *parent=0, const char *name=0 ); public slots: void advance(); diff --git a/ksnake/rattler.cpp b/ksnake/rattler.cpp index 8bea1c0c..1085d6f8 100644 --- a/ksnake/rattler.cpp +++ b/ksnake/rattler.cpp @@ -25,28 +25,28 @@ #include "rattler.h" -#include <qtimer.h> -#include <qlabel.h> +#include <tqtimer.h> +#include <tqlabel.h> #include <kapplication.h> #include <kstdgameaction.h> #include <kdebug.h> #include <klocale.h> #include <kmessagebox.h> -#include <qbitarray.h> +#include <tqbitarray.h> #include <kstandarddirs.h> #include "level.h" #include "basket.h" #include "settings.h" -QBitArray gameState(5); -QLabel *label = 0; +TQBitArray gameState(5); +TQLabel *label = 0; int speed[4] = { 130, 95, 55, 40 }; -Rattler::Rattler( QWidget *parent, const char *name ) - : QWidget( parent, name ) +Rattler::Rattler( TQWidget *parent, const char *name ) + : TQWidget( parent, name ) { - setFocusPolicy(QWidget::StrongFocus); + setFocusPolicy(TQWidget::StrongFocus); numBalls = Settings::balls(); ballsAI = Settings::ballsAI(); @@ -61,22 +61,22 @@ Rattler::Rattler( QWidget *parent, const char *name ) basket = new Basket(board, pix); samy = new SamySnake(board, pix); - computerSnakes = new QPtrList<CompuSnake>; + computerSnakes = new TQPtrList<CompuSnake>; computerSnakes->setAutoDelete( true ); - balls = new QPtrList<Ball>; + balls = new TQPtrList<Ball>; balls->setAutoDelete( true ); - connect( samy, SIGNAL(closeGate(int)), this, SLOT(closeGate(int))); - connect( samy, SIGNAL(score(bool, int)), this, SLOT(scoring(bool,int))); - connect( samy, SIGNAL(goingOut()), this, SLOT(speedUp())); - connect( basket, SIGNAL(openGate()), this, SLOT(openGate())); + connect( samy, TQT_SIGNAL(closeGate(int)), this, TQT_SLOT(closeGate(int))); + connect( samy, TQT_SIGNAL(score(bool, int)), this, TQT_SLOT(scoring(bool,int))); + connect( samy, TQT_SIGNAL(goingOut()), this, TQT_SLOT(speedUp())); + connect( basket, TQT_SIGNAL(openGate()), this, TQT_SLOT(openGate())); gameState.fill(false); gameState.setBit(Demo); timerCount = 0; - QTimer::singleShot( 2000, this, SLOT(demo()) ); // Why wait? + TQTimer::singleShot( 2000, this, TQT_SLOT(demo()) ); // Why wait? backgroundPixmaps = KGlobal::dirs()->findAllResources("appdata", "backgrounds/*.png"); @@ -106,13 +106,13 @@ void Rattler::loadSettings(){ reloadRoomPixmap(); } -void Rattler::paintEvent( QPaintEvent *e) +void Rattler::paintEvent( TQPaintEvent *e) { - QRect rect = e->rect(); + TQRect rect = e->rect(); if (rect.isEmpty()) return; - QPixmap levelPix = pix->levelPix(); + TQPixmap levelPix = pix->levelPix(); basket->repaint(true); @@ -120,7 +120,7 @@ void Rattler::paintEvent( QPaintEvent *e) &levelPix, rect.x(), rect.y(), rect.width(), rect.height()); } -void Rattler::timerEvent( QTimerEvent * ) +void Rattler::timerEvent( TQTimerEvent * ) { timerCount++; @@ -157,11 +157,11 @@ void Rattler::timerEvent( QTimerEvent * ) else if (state == out) levelUp(); - QPixmap levelPix = pix->levelPix(); + TQPixmap levelPix = pix->levelPix(); bitBlt(this, 0, 0, &levelPix, 0, 0, rect().width(), rect().height()); } -void Rattler::keyPressEvent( QKeyEvent *k ) +void Rattler::keyPressEvent( TQKeyEvent *k ) { if (gameState.testBit(Paused)) return; @@ -190,7 +190,7 @@ void Rattler::keyPressEvent( QKeyEvent *k ) k->accept(); } -void Rattler::mousePressEvent( QMouseEvent *e ) +void Rattler::mousePressEvent( TQMouseEvent *e ) { if (gameState.testBit(Paused)) return; @@ -310,12 +310,12 @@ void Rattler::pause() KAction* tempPauseAction = KStdGameAction::pause(); - label = new QLabel(this); - label->setFont( QFont( "Times", 14, QFont::Bold ) ); + label = new TQLabel(this); + label->setFont( TQFont( "Times", 14, TQFont::Bold ) ); label->setText(i18n("Game Paused\n Press %1 to resume\n") .arg(tempPauseAction->shortcutText())); label->setAlignment( AlignCenter ); - label->setFrameStyle( QFrame::Panel | QFrame::Raised ); + label->setFrameStyle( TQFrame::Panel | TQFrame::Raised ); label->setGeometry(182, 206, 198, 80); label->show(); @@ -345,7 +345,7 @@ void Rattler::restartDemo() return; int r = 50000+ (kapp->random() % 30000); - QTimer::singleShot( r, this, SLOT(restartDemo()) ); + TQTimer::singleShot( r, this, TQT_SLOT(restartDemo()) ); stop(); level->create(Intro); @@ -364,7 +364,7 @@ void Rattler::demo() stop(); - QTimer::singleShot( 60000, this, SLOT(restartDemo()) ); + TQTimer::singleShot( 60000, this, TQT_SLOT(restartDemo()) ); gameState.fill(false); gameState.setBit(Init); gameState.setBit(Demo); @@ -414,7 +414,7 @@ void Rattler::restart() cleanLabel(); repaint(); - QTimer::singleShot( 2000, this, SLOT(showRoom()) ); + TQTimer::singleShot( 2000, this, TQT_SLOT(showRoom()) ); } void Rattler::newTry() @@ -427,7 +427,7 @@ void Rattler::newTry() level->create(GameOver); pix->initRoomPixmap(); repaint(); - QTimer::singleShot( 5000, this, SLOT(demo()) ); + TQTimer::singleShot( 5000, this, TQT_SLOT(demo()) ); emit setScore(points); return; } @@ -440,7 +440,7 @@ void Rattler::newTry() pix->initRoomPixmap(); init(true); repaint(); - QTimer::singleShot( 1000, this, SLOT(run()) ); + TQTimer::singleShot( 1000, this, TQT_SLOT(run()) ); } void Rattler::levelUp() @@ -458,7 +458,7 @@ void Rattler::levelUp() pix->initRoomPixmap(); repaint(); - QTimer::singleShot( 2000, this, SLOT(showRoom()) ); + TQTimer::singleShot( 2000, this, TQT_SLOT(showRoom()) ); } /* this slot is called by the progressBar when value() == 0 @@ -494,7 +494,7 @@ void Rattler::showRoom() pix->initRoomPixmap(); init(true); repaint(); - QTimer::singleShot( 1000, this, SLOT(run()) ); + TQTimer::singleShot( 1000, this, TQT_SLOT(run()) ); } void Rattler::init(bool play) @@ -557,10 +557,10 @@ void Rattler::restartComputerSnakes(bool play) as = new KillerCompuSnake(board, pix); break; } - connect( as, SIGNAL(closeGate(int)), this, SLOT(closeGate(int))); - connect( as, SIGNAL(restartTimer()), this, SLOT(restartTimer())); - connect( as, SIGNAL(score(bool, int)), this, SLOT(scoring(bool,int))); - connect( as, SIGNAL(killed()), this, SLOT(killedComputerSnake())); + connect( as, TQT_SIGNAL(closeGate(int)), this, TQT_SLOT(closeGate(int))); + connect( as, TQT_SIGNAL(restartTimer()), this, TQT_SLOT(restartTimer())); + connect( as, TQT_SIGNAL(score(bool, int)), this, TQT_SLOT(scoring(bool,int))); + connect( as, TQT_SIGNAL(killed()), this, TQT_SLOT(killedComputerSnake())); computerSnakes->append(as); } } @@ -614,7 +614,7 @@ void Rattler::setBallsAI(int i) ballsAI = i; } -void Rattler::resizeEvent( QResizeEvent * ) +void Rattler::resizeEvent( TQResizeEvent * ) { pix->initPixmaps(); pix->initBrickPixmap(); @@ -643,10 +643,10 @@ void Rattler::setCompuSnakes(int i) as = new KillerCompuSnake(board, pix); break; } - connect( as, SIGNAL(closeGate(int)), this, SLOT(closeGate(int))); - connect( as, SIGNAL(restartTimer()), this, SLOT(restartTimer())); - connect( as, SIGNAL(score(bool, int)), this, SLOT(scoring(bool,int))); - connect( as, SIGNAL(killed()), this, SLOT(killedComputerSnake())); + connect( as, TQT_SIGNAL(closeGate(int)), this, TQT_SLOT(closeGate(int))); + connect( as, TQT_SIGNAL(restartTimer()), this, TQT_SLOT(restartTimer())); + connect( as, TQT_SIGNAL(score(bool, int)), this, TQT_SLOT(scoring(bool,int))); + connect( as, TQT_SIGNAL(killed()), this, TQT_SLOT(killedComputerSnake())); computerSnakes->append(as); i--; } diff --git a/ksnake/rattler.h b/ksnake/rattler.h index 2922dfe6..da0c13bd 100644 --- a/ksnake/rattler.h +++ b/ksnake/rattler.h @@ -26,7 +26,7 @@ #ifndef RATTLER_H #define RATTLER_H -#include <qwidget.h> +#include <tqwidget.h> #include <kaction.h> #include "ball.h" #include "snake.h" @@ -45,7 +45,7 @@ class Rattler : public QWidget Q_OBJECT public: - Rattler ( QWidget *parent=0, const char *name=0 ); + Rattler ( TQWidget *parent=0, const char *name=0 ); ~Rattler(); void setActionCollection(KActionCollection *a){ actionCollection = a;} @@ -59,7 +59,7 @@ public: void reloadRoomPixmap(); - QStringList backgroundPixmaps; + TQStringList backgroundPixmaps; public slots: void closeGate(int); @@ -101,12 +101,12 @@ signals: void advance(); protected: - void timerEvent( QTimerEvent * ); - void paintEvent( QPaintEvent * ); - void keyPressEvent( QKeyEvent * ); - void mousePressEvent( QMouseEvent * ); - void focusOutEvent( QFocusEvent * ) { ; } - void focusInEvent( QFocusEvent * ) { ; } + void timerEvent( TQTimerEvent * ); + void paintEvent( TQPaintEvent * ); + void keyPressEvent( TQKeyEvent * ); + void mousePressEvent( TQMouseEvent * ); + void focusOutEvent( TQFocusEvent * ) { ; } + void focusInEvent( TQFocusEvent * ) { ; } KActionCollection *actionCollection; private: @@ -125,12 +125,12 @@ private: int direction; - QPtrList<Ball> *balls; + TQPtrList<Ball> *balls; void restartBalls(bool); int numBalls; int ballsAI; - QPtrList<CompuSnake> *computerSnakes; + TQPtrList<CompuSnake> *computerSnakes; void restartComputerSnakes(bool); int numSnakes; int snakesAI; @@ -147,7 +147,7 @@ private: void score(int); void cleanLabel(); - void resizeEvent( QResizeEvent * ); + void resizeEvent( TQResizeEvent * ); }; diff --git a/ksnake/snake.cpp b/ksnake/snake.cpp index 33b3f027..c892452b 100644 --- a/ksnake/snake.cpp +++ b/ksnake/snake.cpp @@ -23,7 +23,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qwidget.h> +#include <tqwidget.h> #include "snake.h" diff --git a/ksnake/snake.h b/ksnake/snake.h index 863ec593..6ea2dac2 100644 --- a/ksnake/snake.h +++ b/ksnake/snake.h @@ -60,7 +60,7 @@ protected: int index; }; - QPtrList<Samy> list; + TQPtrList<Samy> list; KRandomSequence random; diff --git a/ksnake/startroom.cpp b/ksnake/startroom.cpp index 5bb4d989..24874ee9 100644 --- a/ksnake/startroom.cpp +++ b/ksnake/startroom.cpp @@ -24,44 +24,44 @@ */ #include "startroom.h" -#include <qlabel.h> -#include <qpixmap.h> -#include <qwmatrix.h> -#include <qspinbox.h> +#include <tqlabel.h> +#include <tqpixmap.h> +#include <tqwmatrix.h> +#include <tqspinbox.h> #include <klocale.h> -#include <qlayout.h> +#include <tqlayout.h> #include "levels.h" -StartRoom::StartRoom( QWidget *parent, const char *name) - : QWidget( parent, name ) +StartRoom::StartRoom( TQWidget *parent, const char *name) + : TQWidget( parent, name ) { - QGridLayout *Form1Layout = new QGridLayout( this, 1, 1, 11, 6, "Form1Layout"); - QSpacerItem* spacer = new QSpacerItem( 20, 61, QSizePolicy::Minimum, QSizePolicy::Expanding ); + TQGridLayout *Form1Layout = new TQGridLayout( this, 1, 1, 11, 6, "Form1Layout"); + TQSpacerItem* spacer = new TQSpacerItem( 20, 61, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); Form1Layout->addItem( spacer, 2, 1 ); - QHBoxLayout *layout1 = new QHBoxLayout( 0, 0, 6, "layout1"); - QSpacerItem* spacer_2 = new QSpacerItem( 91, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + TQHBoxLayout *layout1 = new TQHBoxLayout( 0, 0, 6, "layout1"); + TQSpacerItem* spacer_2 = new TQSpacerItem( 91, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); layout1->addItem( spacer_2 ); - picture = new QLabel( this, "picture" ); + picture = new TQLabel( this, "picture" ); layout1->addWidget( picture ); - QSpacerItem* spacer_3 = new QSpacerItem( 41, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + TQSpacerItem* spacer_3 = new TQSpacerItem( 41, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); layout1->addItem( spacer_3 ); Form1Layout->addMultiCellLayout( layout1, 0, 0, 0, 1 ); - roomRange = new QSpinBox( this, "kcfg_StartingRoom" ); + roomRange = new TQSpinBox( this, "kcfg_StartingRoom" ); roomRange->setMaxValue( 25 ); roomRange->setMinValue( 1 ); Form1Layout->addWidget( roomRange, 1, 1 ); - QLabel *textLabel = new QLabel( this, "textLabel" ); + TQLabel *textLabel = new TQLabel( this, "textLabel" ); textLabel->setText(i18n("First level:")); Form1Layout->addWidget( textLabel, 1, 0 ); - connect( roomRange, SIGNAL(valueChanged(int)), SLOT(loadLevel(int))); + connect( roomRange, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(loadLevel(int))); loadLevel(1); } @@ -70,8 +70,8 @@ void StartRoom::loadLevel(int level) if(level < 1 || level > leV->max()) return; - QPixmap pixmap = leV->getPixmap(level); - QWMatrix m; + TQPixmap pixmap = leV->getPixmap(level); + TQWMatrix m; m.scale( (double)7, (double)7 ); pixmap = pixmap.xForm( m ); picture->setPixmap(pixmap); diff --git a/ksnake/startroom.h b/ksnake/startroom.h index ef8cbbe0..683cd6e1 100644 --- a/ksnake/startroom.h +++ b/ksnake/startroom.h @@ -26,7 +26,7 @@ #ifndef STARTROOM_H #define STARTROOM_H -#include <qwidget.h> +#include <tqwidget.h> class QLabel; class QSpinBox; @@ -35,14 +35,14 @@ class StartRoom : public QWidget { Q_OBJECT public: - StartRoom( QWidget *parent=0, const char *name=0 ); + StartRoom( TQWidget *parent=0, const char *name=0 ); private slots: void loadLevel(int level); private: - QLabel *picture; - QSpinBox *roomRange; + TQLabel *picture; + TQSpinBox *roomRange; }; diff --git a/ksnake/view.cpp b/ksnake/view.cpp index 3db7d34f..a8503700 100644 --- a/ksnake/view.cpp +++ b/ksnake/view.cpp @@ -32,15 +32,15 @@ int MAPWIDTH = BRICKSIZE * 35; int MAPHEIGHT = MAPWIDTH; #define BAR_HEIGHT 12 -View::View( QWidget *parent, const char *name ) - : QWidget( parent, name ) +View::View( TQWidget *parent, const char *name ) + : TQWidget( parent, name ) { progress = new Progress(this); rattler = new Rattler( this); setMinimumSize(145,145+BAR_HEIGHT); } -void View::resizeEvent( QResizeEvent * ) +void View::resizeEvent( TQResizeEvent * ) { // These hard coded number really need to be documented BRICKSIZE= (int)16* ((width() < height() - BAR_HEIGHT) ? width() : height() - BAR_HEIGHT)/ 560; @@ -51,9 +51,9 @@ void View::resizeEvent( QResizeEvent * ) rattler->setGeometry(0, BAR_HEIGHT, width(), height()-BAR_HEIGHT); } -QSize View::sizeHint() const +TQSize View::sizeHint() const { - return QSize(490,502); + return TQSize(490,502); } #include "view.moc" diff --git a/ksnake/view.h b/ksnake/view.h index 3dff2dbb..68fd2412 100644 --- a/ksnake/view.h +++ b/ksnake/view.h @@ -25,7 +25,7 @@ #ifndef VIEW_H #define VIEW_H -#include <qwidget.h> +#include <tqwidget.h> class Progress; class Rattler; @@ -34,14 +34,14 @@ class View : public QWidget { Q_OBJECT public: - View ( QWidget *parent=0, const char *name=0 ); + View ( TQWidget *parent=0, const char *name=0 ); Progress *progress; Rattler *rattler; protected: - void resizeEvent( QResizeEvent * ); - virtual QSize sizeHint() const; + void resizeEvent( TQResizeEvent * ); + virtual TQSize sizeHint() const; }; #endif // VIEW_H |