summaryrefslogtreecommitdiffstats
path: root/ksmiletris
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /ksmiletris
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksmiletris')
-rw-r--r--ksmiletris/gamewidget.cpp30
-rw-r--r--ksmiletris/gamewidget.h5
-rw-r--r--ksmiletris/gamewindow.cpp34
-rw-r--r--ksmiletris/gamewindow.h3
-rw-r--r--ksmiletris/mirrorwidget.cpp4
-rw-r--r--ksmiletris/mirrorwidget.h2
-rw-r--r--ksmiletris/npiecewidget.cpp4
-rw-r--r--ksmiletris/npiecewidget.h2
-rw-r--r--ksmiletris/screenwidget.cpp4
-rw-r--r--ksmiletris/screenwidget.h2
10 files changed, 46 insertions, 44 deletions
diff --git a/ksmiletris/gamewidget.cpp b/ksmiletris/gamewidget.cpp
index f10f9b36..3ba3051a 100644
--- a/ksmiletris/gamewidget.cpp
+++ b/ksmiletris/gamewidget.cpp
@@ -43,8 +43,8 @@ this software.
#include <kmessagebox.h>
#include <klocale.h>
-GameWidget::GameWidget(TQWidget *parent, const char *name)
- : TQWidget(parent, name)
+GameWidget::GameWidget(TQWidget *tqparent, const char *name)
+ : TQWidget(tqparent, name)
{
in_game = false;
in_pause = false;
@@ -131,12 +131,12 @@ void GameWidget::setPieces(PiecesType type)
sprites[Sprite_Broken1 + i] = pm;
}
- if (in_game) repaintChilds();
+ if (in_game) tqrepaintChilds();
}
void GameWidget::loadSprites()
{
- sprites = new QPixmap[num_sprites];
+ sprites = new TQPixmap[num_sprites];
loadSprite(Sprite_Bg1, "bg1.bmp");
loadSprite(Sprite_Bg2, "bg2.bmp");
loadSprite(Sprite_Bg3, "bg3.bmp");
@@ -153,7 +153,7 @@ void GameWidget::loadSprites()
loadSprite(Sprite_Bg14, "bg14.bmp");
loadSprite(Sprite_Bg15, "bg15.bmp");
loadSprite(Sprite_Bg16, "bg16.bmp");
- loadMaskedSprite(Sprite_Broken, "broken.bmp", "broken-mask.bmp");
+ loadMaskedSprite(Sprite_Broken, "broken.bmp", "broken-tqmask.bmp");
}
void GameWidget::loadSprite(Sprite spr, const TQString & path)
@@ -198,17 +198,17 @@ void GameWidget::newGame()
updateMirror();
in_game = true;
- repaintChilds();
+ tqrepaintChilds();
emit changedStats(num_level, num_points);
timer_interval = 700;
timer->start(timer_interval);
}
-void GameWidget::repaintChilds()
+void GameWidget::tqrepaintChilds()
{
- screen->repaint(false);
- mirror->repaint(false);
- next->repaint(false);
+ screen->tqrepaint(false);
+ mirror->tqrepaint(false);
+ next->tqrepaint(false);
}
void GameWidget::putPiece()
@@ -218,7 +218,7 @@ void GameWidget::putPiece()
if (piece[2] != bg_sprite) ref(xpos + 0, ypos + 1) = piece[2];
if (piece[3] != bg_sprite) ref(xpos + 1, ypos + 1) = piece[3];
updateMirror();
- screen->repaint(false);
+ screen->tqrepaint(false);
}
void GameWidget::getPiece()
@@ -241,7 +241,7 @@ void GameWidget::newPiece()
next_piece[i] = (Sprite)(Sprite_Block1 + random.getLong(num_pieces_level));
else
next_piece[i] = bg_sprite;
- next->repaint(false);
+ next->tqrepaint(false);
}
void GameWidget::nextPiece()
@@ -258,7 +258,7 @@ void GameWidget::nextPiece()
|| (piece[2] != bg_sprite && ref(xpos + 0, ypos + 1) != bg_sprite)
|| (piece[3] != bg_sprite && ref(xpos + 1, ypos + 1) != bg_sprite)) {
in_game = false;
- repaintChilds();
+ tqrepaintChilds();
KMessageBox::sorry(this, i18n("Game Over"));
emit gameOver();
}
@@ -272,7 +272,7 @@ void GameWidget::updateMirror()
mirror_sprites[x] = bg_sprite;
mirror_sprites[xpos] = piece[2] == bg_sprite ? piece[0] : piece[2];
mirror_sprites[xpos+1] = piece[3] == bg_sprite ? piece[1] : piece[3];
- mirror->repaint(false);
+ mirror->tqrepaint(false);
}
void GameWidget::keyUp()
@@ -390,7 +390,7 @@ void GameWidget::broke(int x, int y, bool *xmap)
emit changedStats(num_level, num_points);
#ifdef HAVE_USLEEP
- screen->repaint(false);
+ screen->tqrepaint(false);
usleep(75 * 1000);
#endif
}
diff --git a/ksmiletris/gamewidget.h b/ksmiletris/gamewidget.h
index f1a84b6c..3eeaac96 100644
--- a/ksmiletris/gamewidget.h
+++ b/ksmiletris/gamewidget.h
@@ -36,6 +36,7 @@ class TQTimer;
class GameWidget : public TQWidget {
Q_OBJECT
+ TQ_OBJECT
signals:
void changedStats(int, int);
@@ -47,7 +48,7 @@ public:
int num_level;
int num_points;
- GameWidget(TQWidget *parent=0, const char *name=0);
+ GameWidget(TQWidget *tqparent=0, const char *name=0);
~GameWidget();
void setPieces(PiecesType type);
@@ -62,7 +63,7 @@ public:
return s;
}
- void repaintChilds();
+ void tqrepaintChilds();
private:
TQPixmap *sprites;
diff --git a/ksmiletris/gamewindow.cpp b/ksmiletris/gamewindow.cpp
index 991ff1c3..c28a81d2 100644
--- a/ksmiletris/gamewindow.cpp
+++ b/ksmiletris/gamewindow.cpp
@@ -46,40 +46,40 @@ GameWindow::GameWindow(TQWidget *, const char *name)
: KMainWindow(0, name)
{
//New Games
- (void)KStdGameAction::gameNew(this,
+ (void)KStdGameAction::gameNew(TQT_TQOBJECT(this),
TQT_SLOT(menu_newGame()),
actionCollection());
//Pause Game
- (void)KStdGameAction::pause(this,
+ (void)KStdGameAction::pause(TQT_TQOBJECT(this),
TQT_SLOT(menu_pause()),
actionCollection());
//End Game
- (void)KStdGameAction::end(this,
+ (void)KStdGameAction::end(TQT_TQOBJECT(this),
TQT_SLOT(menu_endGame()),
actionCollection());
//Highscores
- (void)KStdGameAction::highscores(this,
+ (void)KStdGameAction::highscores(TQT_TQOBJECT(this),
TQT_SLOT(menu_highScores()),
actionCollection());
//Quit
- (void)KStdGameAction::quit(this,
+ (void)KStdGameAction::quit(TQT_TQOBJECT(this),
TQT_SLOT(close()),
actionCollection());
TQStringList list;
KSelectAction* piecesAct =
- new KSelectAction(i18n("&Pieces"), 0, this, TQT_SLOT(menu_pieces()),
+ new KSelectAction(i18n("&Pieces"), 0, TQT_TQOBJECT(this), TQT_SLOT(menu_pieces()),
actionCollection(), "settings_pieces");
list.append(i18n("&Smiles"));
list.append(i18n("S&ymbols"));
list.append(i18n("&Icons"));
piecesAct->setItems(list);
- (void)new KToggleAction(i18n("&Sounds"), 0, this,
+ (void)new KToggleAction(i18n("&Sounds"), 0, TQT_TQOBJECT(this),
TQT_SLOT(menu_sounds()), actionCollection(), "settings_sounds");
@@ -99,14 +99,14 @@ GameWindow::GameWindow(TQWidget *, const char *name)
setCentralWidget(game);
connect(game, TQT_SIGNAL(changedStats(int, int)),
this, TQT_SLOT(updateStats(int, int)));
- connect(game, TQT_SIGNAL(gameOver()), this, TQT_SLOT(gameOver()));
+ connect(game, TQT_SIGNAL(gameOver()), TQT_TQOBJECT(this), TQT_SLOT(gameOver()));
//keys
- (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");
+ (void)new KAction(i18n("Move Left"), Key_Left, TQT_TQOBJECT(game), TQT_SLOT(keyLeft()), actionCollection(), "left");
+ (void)new KAction(i18n("Move Right"), Key_Right, TQT_TQOBJECT(game), TQT_SLOT(keyRight()), actionCollection(), "right");
+ (void)new KAction(i18n("Rotate Left"), Key_Up, TQT_TQOBJECT(game), TQT_SLOT(keyUp()), actionCollection(), "up");
+ (void)new KAction(i18n("Rotate Right"), Key_Down, TQT_TQOBJECT(game), TQT_SLOT(keyDown()), actionCollection(), "down");
+ (void)new KAction(i18n("Drop Down"), Key_Space, TQT_TQOBJECT(game), TQT_SLOT(keySpace()), actionCollection(), "space");
game->setFixedSize(default_width, default_height);
adjustSize();
@@ -137,7 +137,7 @@ void GameWindow::menu_pause()
if (game->in_game) {
game->in_pause = !game->in_pause;
((KToggleAction*)actionCollection()->action(KStdGameAction::stdName(KStdGameAction::Pause)))->setChecked(game->in_pause);
- game->repaintChilds();
+ game->tqrepaintChilds();
}
}
@@ -145,7 +145,7 @@ void GameWindow::menu_endGame()
{
if (game->in_game) {
game->in_game = false;
- game->repaintChilds();
+ game->tqrepaintChilds();
((KToggleAction*)actionCollection()->action(KStdGameAction::stdName(KStdGameAction::Pause)))->setChecked(false);
gameOver();
}
@@ -182,8 +182,8 @@ void GameWindow::updateStats(int level, int points)
TQString l, p;
l.setNum(level);
p.setNum(points);
- status->changeItem(i18n("Level: %1").arg(l), 1);
- status->changeItem(i18n("Score: %1").arg(p), 2);
+ status->changeItem(i18n("Level: %1").tqarg(l), 1);
+ status->changeItem(i18n("Score: %1").tqarg(p), 2);
}
void GameWindow::gameOver()
diff --git a/ksmiletris/gamewindow.h b/ksmiletris/gamewindow.h
index f8fff3f8..bdfaabf7 100644
--- a/ksmiletris/gamewindow.h
+++ b/ksmiletris/gamewindow.h
@@ -35,9 +35,10 @@ class KStatusBar;
class GameWindow : public KMainWindow {
Q_OBJECT
+ TQ_OBJECT
public:
- GameWindow(TQWidget *parent=0, const char *name=0);
+ GameWindow(TQWidget *tqparent=0, const char *name=0);
public slots:
void menu_newGame();
diff --git a/ksmiletris/mirrorwidget.cpp b/ksmiletris/mirrorwidget.cpp
index 8a7447eb..7a31a166 100644
--- a/ksmiletris/mirrorwidget.cpp
+++ b/ksmiletris/mirrorwidget.cpp
@@ -31,8 +31,8 @@ this software.
#include "mirrorwidget.h"
MirrorWidget::MirrorWidget(TQPixmap *s, bool *game, bool *pause,
- TQWidget *parent, const char *name)
- : TQFrame(parent, name)
+ TQWidget *tqparent, const char *name)
+ : TQFrame(tqparent, name)
{
in_game = game;
in_pause = pause;
diff --git a/ksmiletris/mirrorwidget.h b/ksmiletris/mirrorwidget.h
index 80676a8a..9d3f0a5d 100644
--- a/ksmiletris/mirrorwidget.h
+++ b/ksmiletris/mirrorwidget.h
@@ -31,7 +31,7 @@ this software.
class MirrorWidget : public TQFrame {
public:
MirrorWidget(TQPixmap *s, bool *game, bool *pause,
- TQWidget *parent=0, const char *name=0);
+ TQWidget *tqparent=0, const char *name=0);
void setBackgroundSprite(Sprite s) { bg_sprite = s; }
void setMirrorSprites(Sprite *s) { mirror_sprites = s; }
diff --git a/ksmiletris/npiecewidget.cpp b/ksmiletris/npiecewidget.cpp
index 9e87a9a0..4218df92 100644
--- a/ksmiletris/npiecewidget.cpp
+++ b/ksmiletris/npiecewidget.cpp
@@ -31,8 +31,8 @@ this software.
#include "npiecewidget.h"
NextPieceWidget::NextPieceWidget(TQPixmap *s, bool *game, bool *pause,
- TQWidget *parent, const char *name)
- : TQFrame(parent, name)
+ TQWidget *tqparent, const char *name)
+ : TQFrame(tqparent, name)
{
in_game = game;
in_pause = pause;
diff --git a/ksmiletris/npiecewidget.h b/ksmiletris/npiecewidget.h
index f2d7ac1f..961366f6 100644
--- a/ksmiletris/npiecewidget.h
+++ b/ksmiletris/npiecewidget.h
@@ -31,7 +31,7 @@ this software.
class NextPieceWidget : public TQFrame {
public:
NextPieceWidget(TQPixmap *s, bool *game, bool *pause,
- TQWidget *parent=0, const char *name=0);
+ TQWidget *tqparent=0, const char *name=0);
void setBackgroundSprite(Sprite s) { bg_sprite = s; }
void setNextPieceSprites(Sprite *s) { next_piece_sprites = s; }
diff --git a/ksmiletris/screenwidget.cpp b/ksmiletris/screenwidget.cpp
index d8e87f4c..a8f53c73 100644
--- a/ksmiletris/screenwidget.cpp
+++ b/ksmiletris/screenwidget.cpp
@@ -33,8 +33,8 @@ this software.
#include "screenwidget.h"
ScreenWidget::ScreenWidget(TQPixmap *s, bool *game, bool *pause,
- TQWidget *parent, const char *name)
- : TQFrame(parent, name)
+ TQWidget *tqparent, const char *name)
+ : TQFrame(tqparent, name)
{
in_game = game;
in_pause = pause;
diff --git a/ksmiletris/screenwidget.h b/ksmiletris/screenwidget.h
index a27b3b31..f15a1e23 100644
--- a/ksmiletris/screenwidget.h
+++ b/ksmiletris/screenwidget.h
@@ -31,7 +31,7 @@ this software.
class ScreenWidget : public TQFrame {
public:
ScreenWidget(TQPixmap *s, bool *game, bool *pause,
- TQWidget *parent=0, const char *name=0);
+ TQWidget *tqparent=0, const char *name=0);
void setBackgroundSprite(Sprite s) { bg_sprite = s; }
void setScreenSprites(Sprite *s) { screen_sprites = s; }