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 /ksmiletris | |
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 'ksmiletris')
-rw-r--r-- | ksmiletris/gamewidget.cpp | 40 | ||||
-rw-r--r-- | ksmiletris/gamewidget.h | 14 | ||||
-rw-r--r-- | ksmiletris/gamewindow.cpp | 40 | ||||
-rw-r--r-- | ksmiletris/gamewindow.h | 4 | ||||
-rw-r--r-- | ksmiletris/mirrorwidget.cpp | 18 | ||||
-rw-r--r-- | ksmiletris/mirrorwidget.h | 12 | ||||
-rw-r--r-- | ksmiletris/npiecewidget.cpp | 18 | ||||
-rw-r--r-- | ksmiletris/npiecewidget.h | 12 | ||||
-rw-r--r-- | ksmiletris/screenwidget.cpp | 20 | ||||
-rw-r--r-- | ksmiletris/screenwidget.h | 12 |
10 files changed, 95 insertions, 95 deletions
diff --git a/ksmiletris/gamewidget.cpp b/ksmiletris/gamewidget.cpp index 7bead2f7..f10f9b36 100644 --- a/ksmiletris/gamewidget.cpp +++ b/ksmiletris/gamewidget.cpp @@ -26,10 +26,10 @@ this software. #include <kaudioplayer.h> #include <kapplication.h> #include <kstandarddirs.h> -#include <qbitmap.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qtimer.h> +#include <tqbitmap.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqtimer.h> #ifdef HAVE_USLEEP #include <unistd.h> #endif @@ -43,8 +43,8 @@ this software. #include <kmessagebox.h> #include <klocale.h> -GameWidget::GameWidget(QWidget *parent, const char *name) - : QWidget(parent, name) +GameWidget::GameWidget(TQWidget *parent, const char *name) + : TQWidget(parent, name) { in_game = false; in_pause = false; @@ -69,8 +69,8 @@ GameWidget::GameWidget(QWidget *parent, const char *name) next->move(278, 10); next->setNextPieceSprites(next_piece); - timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(timeout())); + timer = new TQTimer(this); + connect(timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout())); } GameWidget::~GameWidget() @@ -85,7 +85,7 @@ void GameWidget::playSound(Sound s) if (!do_sounds) return; - QString name; + TQString name; switch (s) { case Sound_Break: name = "break.wav"; @@ -95,12 +95,12 @@ void GameWidget::playSound(Sound s) break; } - KAudioPlayer::play(locate("data", QString("ksmiletris/sounds/") + name)); + KAudioPlayer::play(locate("data", TQString("ksmiletris/sounds/") + name)); } void GameWidget::setPieces(PiecesType type) { - QString prefix; + TQString prefix; switch (type) { case Pieces_Smiles: @@ -117,13 +117,13 @@ void GameWidget::setPieces(PiecesType type) } for (int i = 0; i < num_blocks; ++i) { - QString n; + TQString n; n.setNum(i + 1); loadSprite((Sprite)(Sprite_Block1 + i), prefix + n + ".bmp"); } - QPixmap pm(32, 32); + TQPixmap pm(32, 32); for (int i = 0; i < num_blocks; ++i) { - QPainter p; + TQPainter p; p.begin(&pm); p.drawPixmap(0, 0, sprites[Sprite_Block1 + i]); p.drawPixmap(0, 0, sprites[Sprite_Broken]); @@ -156,18 +156,18 @@ void GameWidget::loadSprites() loadMaskedSprite(Sprite_Broken, "broken.bmp", "broken-mask.bmp"); } -void GameWidget::loadSprite(Sprite spr, const QString & path) +void GameWidget::loadSprite(Sprite spr, const TQString & path) { - if (!sprites[spr].load(locate("appdata", QString("data/") + path))) + if (!sprites[spr].load(locate("appdata", TQString("data/") + path))) qFatal("Cannot open data files.\nHave you correctly installed KSmiletris?"); } -void GameWidget::loadMaskedSprite(Sprite spr, const QString & path1, const QString & path2) +void GameWidget::loadMaskedSprite(Sprite spr, const TQString & path1, const TQString & path2) { - QBitmap bmp; - if (!sprites[spr].load(locate("appdata", QString("data/") + path1))) + TQBitmap bmp; + if (!sprites[spr].load(locate("appdata", TQString("data/") + path1))) qFatal("Cannot open data files.\nHave you correctly installed KSmiletris?"); - if (!bmp.load(locate("appdata", QString("data/") + path2))) + if (!bmp.load(locate("appdata", TQString("data/") + path2))) qFatal("Cannot open data files.\nHave you correctly installed KSmiletris?"); sprites[spr].setMask(bmp); } diff --git a/ksmiletris/gamewidget.h b/ksmiletris/gamewidget.h index 49901650..ca826395 100644 --- a/ksmiletris/gamewidget.h +++ b/ksmiletris/gamewidget.h @@ -24,7 +24,7 @@ this software. #ifndef GAMEWIDGET_H #define GAMEWIDGET_H -#include <qwidget.h> +#include <tqwidget.h> #include <krandomsequence.h> #include "ksmiletris.h" @@ -34,7 +34,7 @@ class MirrorWidget; class NextPieceWidget; class QTimer; -class GameWidget : public QWidget { +class GameWidget : public TQWidget { Q_OBJECT signals: @@ -47,7 +47,7 @@ public: int num_level; int num_points; - GameWidget(QWidget *parent=0, const char *name=0); + GameWidget(TQWidget *parent=0, const char *name=0); ~GameWidget(); void setPieces(PiecesType type); @@ -65,7 +65,7 @@ public: void repaintChilds(); private: - QPixmap *sprites; + TQPixmap *sprites; ScreenWidget *screen; MirrorWidget *mirror; NextPieceWidget *next; @@ -77,15 +77,15 @@ private: Sprite bg_sprite; int timer_interval; bool fast_mode; - QTimer *timer; + TQTimer *timer; KRandomSequence random; int num_pieces_level; void playSound(Sound s); void loadSprites(); - void loadSprite(Sprite spr, const QString & path); - void loadMaskedSprite(Sprite spr, const QString & path1, const QString & path2); + void loadSprite(Sprite spr, const TQString & path); + void loadMaskedSprite(Sprite spr, const TQString & path1, const TQString & path2); void newBlock(); void putPiece(); void getPiece(); diff --git a/ksmiletris/gamewindow.cpp b/ksmiletris/gamewindow.cpp index 60973530..991ff1c3 100644 --- a/ksmiletris/gamewindow.cpp +++ b/ksmiletris/gamewindow.cpp @@ -42,37 +42,37 @@ this software. const int default_width = 362; const int default_height = 460; -GameWindow::GameWindow(QWidget *, const char *name) +GameWindow::GameWindow(TQWidget *, const char *name) : KMainWindow(0, name) { //New Games (void)KStdGameAction::gameNew(this, - SLOT(menu_newGame()), + TQT_SLOT(menu_newGame()), actionCollection()); //Pause Game (void)KStdGameAction::pause(this, - SLOT(menu_pause()), + TQT_SLOT(menu_pause()), actionCollection()); //End Game (void)KStdGameAction::end(this, - SLOT(menu_endGame()), + TQT_SLOT(menu_endGame()), actionCollection()); //Highscores (void)KStdGameAction::highscores(this, - SLOT(menu_highScores()), + TQT_SLOT(menu_highScores()), actionCollection()); //Quit (void)KStdGameAction::quit(this, - SLOT(close()), + TQT_SLOT(close()), actionCollection()); - QStringList list; + TQStringList list; KSelectAction* piecesAct = - new KSelectAction(i18n("&Pieces"), 0, this, SLOT(menu_pieces()), + new KSelectAction(i18n("&Pieces"), 0, this, TQT_SLOT(menu_pieces()), actionCollection(), "settings_pieces"); list.append(i18n("&Smiles")); list.append(i18n("S&ymbols")); @@ -80,14 +80,14 @@ GameWindow::GameWindow(QWidget *, const char *name) piecesAct->setItems(list); (void)new KToggleAction(i18n("&Sounds"), 0, this, - SLOT(menu_sounds()), actionCollection(), "settings_sounds"); + TQT_SLOT(menu_sounds()), actionCollection(), "settings_sounds"); - //connect(menu, SIGNAL(moved(menuPosition)), - // this, SLOT(movedMenu(menuPosition))); ? + //connect(menu, TQT_SIGNAL(moved(menuPosition)), + // this, TQT_SLOT(movedMenu(menuPosition))); ? status = new KStatusBar(this); status->insertItem(i18n("Level: 99"), 1); @@ -97,16 +97,16 @@ GameWindow::GameWindow(QWidget *, const char *name) game = new GameWidget(this); setCentralWidget(game); - connect(game, SIGNAL(changedStats(int, int)), - this, SLOT(updateStats(int, int))); - connect(game, SIGNAL(gameOver()), this, SLOT(gameOver())); + connect(game, TQT_SIGNAL(changedStats(int, int)), + this, TQT_SLOT(updateStats(int, int))); + connect(game, TQT_SIGNAL(gameOver()), this, TQT_SLOT(gameOver())); //keys - (void)new KAction(i18n("Move Left"), Key_Left, game, SLOT(keyLeft()), actionCollection(), "left"); - (void)new KAction(i18n("Move Right"), Key_Right, game, SLOT(keyRight()), actionCollection(), "right"); - (void)new KAction(i18n("Rotate Left"), Key_Up, game, SLOT(keyUp()), actionCollection(), "up"); - (void)new KAction(i18n("Rotate Right"), Key_Down, game, SLOT(keyDown()), actionCollection(), "down"); - (void)new KAction(i18n("Drop Down"), Key_Space, game, SLOT(keySpace()), actionCollection(), "space"); + (void)new KAction(i18n("Move Left"), Key_Left, game, TQT_SLOT(keyLeft()), actionCollection(), "left"); + (void)new KAction(i18n("Move Right"), Key_Right, game, TQT_SLOT(keyRight()), actionCollection(), "right"); + (void)new KAction(i18n("Rotate Left"), Key_Up, game, TQT_SLOT(keyUp()), actionCollection(), "up"); + (void)new KAction(i18n("Rotate Right"), Key_Down, game, TQT_SLOT(keyDown()), actionCollection(), "down"); + (void)new KAction(i18n("Drop Down"), Key_Space, game, TQT_SLOT(keySpace()), actionCollection(), "space"); game->setFixedSize(default_width, default_height); adjustSize(); @@ -179,7 +179,7 @@ void GameWindow::menu_sounds() void GameWindow::updateStats(int level, int points) { - QString l, p; + TQString l, p; l.setNum(level); p.setNum(points); status->changeItem(i18n("Level: %1").arg(l), 1); diff --git a/ksmiletris/gamewindow.h b/ksmiletris/gamewindow.h index 54e637a0..cb06bae5 100644 --- a/ksmiletris/gamewindow.h +++ b/ksmiletris/gamewindow.h @@ -37,7 +37,7 @@ class GameWindow : public KMainWindow { Q_OBJECT public: - GameWindow(QWidget *parent=0, const char *name=0); + GameWindow(TQWidget *parent=0, const char *name=0); public slots: void menu_newGame(); @@ -57,7 +57,7 @@ private: KStatusBar *status; GameWidget *game; - QString m_player; + TQString m_player; }; #endif // !GAMEWINDOW_H diff --git a/ksmiletris/mirrorwidget.cpp b/ksmiletris/mirrorwidget.cpp index 43ae0175..8a7447eb 100644 --- a/ksmiletris/mirrorwidget.cpp +++ b/ksmiletris/mirrorwidget.cpp @@ -23,29 +23,29 @@ this software. #include "config.h" -#include <qframe.h> -#include <qpainter.h> -#include <qpixmap.h> +#include <tqframe.h> +#include <tqpainter.h> +#include <tqpixmap.h> #include "ksmiletris.h" #include "mirrorwidget.h" -MirrorWidget::MirrorWidget(QPixmap *s, bool *game, bool *pause, - QWidget *parent, const char *name) - : QFrame(parent, name) +MirrorWidget::MirrorWidget(TQPixmap *s, bool *game, bool *pause, + TQWidget *parent, const char *name) + : TQFrame(parent, name) { in_game = game; in_pause = pause; sprites = s; - setFrameStyle(QFrame::Box | QFrame::Raised); + setFrameStyle(TQFrame::Box | TQFrame::Raised); setLineWidth(2); setMidLineWidth(1); resize(scr_width * sprite_width + 10, sprite_height + 10); } -void MirrorWidget::drawContents(QPainter *p) +void MirrorWidget::drawContents(TQPainter *p) { - QRect r = contentsRect(); + TQRect r = contentsRect(); if (!*in_game) { p->fillRect(r, black); diff --git a/ksmiletris/mirrorwidget.h b/ksmiletris/mirrorwidget.h index 4b0c7fa0..80676a8a 100644 --- a/ksmiletris/mirrorwidget.h +++ b/ksmiletris/mirrorwidget.h @@ -24,26 +24,26 @@ this software. #ifndef MIRRORWIDGET_H #define MIRRORWIDGET_H -#include <qframe.h> +#include <tqframe.h> #include "ksmiletris.h" -class MirrorWidget : public QFrame { +class MirrorWidget : public TQFrame { public: - MirrorWidget(QPixmap *s, bool *game, bool *pause, - QWidget *parent=0, const char *name=0); + MirrorWidget(TQPixmap *s, bool *game, bool *pause, + TQWidget *parent=0, const char *name=0); void setBackgroundSprite(Sprite s) { bg_sprite = s; } void setMirrorSprites(Sprite *s) { mirror_sprites = s; } private: - QPixmap *sprites; + TQPixmap *sprites; bool *in_game, *in_pause; Sprite bg_sprite; Sprite *mirror_sprites; protected: - void drawContents(QPainter *p); + void drawContents(TQPainter *p); }; #endif // !MIRRORWIDGET_H diff --git a/ksmiletris/npiecewidget.cpp b/ksmiletris/npiecewidget.cpp index 5df68f8e..9e87a9a0 100644 --- a/ksmiletris/npiecewidget.cpp +++ b/ksmiletris/npiecewidget.cpp @@ -23,29 +23,29 @@ this software. #include "config.h" -#include <qframe.h> -#include <qpainter.h> -#include <qpixmap.h> +#include <tqframe.h> +#include <tqpainter.h> +#include <tqpixmap.h> #include "ksmiletris.h" #include "npiecewidget.h" -NextPieceWidget::NextPieceWidget(QPixmap *s, bool *game, bool *pause, - QWidget *parent, const char *name) - : QFrame(parent, name) +NextPieceWidget::NextPieceWidget(TQPixmap *s, bool *game, bool *pause, + TQWidget *parent, const char *name) + : TQFrame(parent, name) { in_game = game; in_pause = pause; sprites = s; - setFrameStyle(QFrame::Box | QFrame::Raised); + setFrameStyle(TQFrame::Box | TQFrame::Raised); setLineWidth(2); setMidLineWidth(1); resize(2 * sprite_width + 10, 2 * sprite_height + 10); } -void NextPieceWidget::drawContents(QPainter *p) +void NextPieceWidget::drawContents(TQPainter *p) { - QRect r = contentsRect(); + TQRect r = contentsRect(); if (!*in_game) { p->fillRect(r, black); diff --git a/ksmiletris/npiecewidget.h b/ksmiletris/npiecewidget.h index 66095e31..f2d7ac1f 100644 --- a/ksmiletris/npiecewidget.h +++ b/ksmiletris/npiecewidget.h @@ -24,26 +24,26 @@ this software. #ifndef NPIECEWIDGET_H #define NPIECEWIDGET_H -#include <qframe.h> +#include <tqframe.h> #include "ksmiletris.h" -class NextPieceWidget : public QFrame { +class NextPieceWidget : public TQFrame { public: - NextPieceWidget(QPixmap *s, bool *game, bool *pause, - QWidget *parent=0, const char *name=0); + NextPieceWidget(TQPixmap *s, bool *game, bool *pause, + TQWidget *parent=0, const char *name=0); void setBackgroundSprite(Sprite s) { bg_sprite = s; } void setNextPieceSprites(Sprite *s) { next_piece_sprites = s; } private: - QPixmap *sprites; + TQPixmap *sprites; bool *in_game, *in_pause; Sprite bg_sprite; Sprite *next_piece_sprites; protected: - void drawContents(QPainter *p); + void drawContents(TQPainter *p); }; #endif // !NPIECEWIDGET_H diff --git a/ksmiletris/screenwidget.cpp b/ksmiletris/screenwidget.cpp index 0080aadd..d8e87f4c 100644 --- a/ksmiletris/screenwidget.cpp +++ b/ksmiletris/screenwidget.cpp @@ -25,29 +25,29 @@ this software. #include <kapplication.h> #include <kstandarddirs.h> -#include <qframe.h> -#include <qpainter.h> -#include <qpixmap.h> +#include <tqframe.h> +#include <tqpainter.h> +#include <tqpixmap.h> #include "ksmiletris.h" #include "screenwidget.h" -ScreenWidget::ScreenWidget(QPixmap *s, bool *game, bool *pause, - QWidget *parent, const char *name) - : QFrame(parent, name) +ScreenWidget::ScreenWidget(TQPixmap *s, bool *game, bool *pause, + TQWidget *parent, const char *name) + : TQFrame(parent, name) { in_game = game; in_pause = pause; sprites = s; - setFrameStyle(QFrame::Box | QFrame::Raised); + setFrameStyle(TQFrame::Box | TQFrame::Raised); setLineWidth(2); setMidLineWidth(1); resize(scr_width * sprite_width + 10, scr_height * sprite_height + 10); } -void ScreenWidget::drawContents(QPainter *p) +void ScreenWidget::drawContents(TQPainter *p) { - QRect r = contentsRect(); + TQRect r = contentsRect(); if (!*in_game) { p->fillRect(r, black); @@ -61,7 +61,7 @@ void ScreenWidget::drawContents(QPainter *p) sprites[screen_sprites[y*scr_width + x]]); if (*in_pause) { - QPixmap pause(locate("appdata", "data/pause.bmp")); + TQPixmap pause(locate("appdata", "data/pause.bmp")); p->drawPixmap((width()-pause.width())/2, (height()-pause.height())/2, pause); } diff --git a/ksmiletris/screenwidget.h b/ksmiletris/screenwidget.h index 5643d7ed..a27b3b31 100644 --- a/ksmiletris/screenwidget.h +++ b/ksmiletris/screenwidget.h @@ -24,26 +24,26 @@ this software. #ifndef SCREENWIDGET_H #define SCREENWIDGET_H -#include <qframe.h> +#include <tqframe.h> #include "ksmiletris.h" -class ScreenWidget : public QFrame { +class ScreenWidget : public TQFrame { public: - ScreenWidget(QPixmap *s, bool *game, bool *pause, - QWidget *parent=0, const char *name=0); + ScreenWidget(TQPixmap *s, bool *game, bool *pause, + TQWidget *parent=0, const char *name=0); void setBackgroundSprite(Sprite s) { bg_sprite = s; } void setScreenSprites(Sprite *s) { screen_sprites = s; } private: - QPixmap *sprites; + TQPixmap *sprites; bool *in_game, *in_pause; Sprite bg_sprite; Sprite *screen_sprites; protected: - void drawContents(QPainter *p); + void drawContents(TQPainter *p); }; #endif // !SCREENWIDGET_H |