summaryrefslogtreecommitdiffstats
path: root/ksokoban/PlayField.cpp
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 /ksokoban/PlayField.cpp
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 'ksokoban/PlayField.cpp')
-rw-r--r--ksokoban/PlayField.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/ksokoban/PlayField.cpp b/ksokoban/PlayField.cpp
index f277192e..68b97f76 100644
--- a/ksokoban/PlayField.cpp
+++ b/ksokoban/PlayField.cpp
@@ -45,8 +45,8 @@
#include "PlayField.moc"
-PlayField::PlayField(TQWidget *parent, const char *name, WFlags f)
- : TQWidget(parent, name, f|WResizeNoErase), imageData_(0), lastLevel_(-1),
+PlayField::PlayField(TQWidget *tqparent, const char *name, WFlags f)
+ : TQWidget(tqparent, name, f|WResizeNoErase), imageData_(0), lastLevel_(-1),
moveSequence_(0), moveInProgress_(false), dragInProgress_(false),
xOffs_(0), yOffs_(0),
wheelDelta_(0),
@@ -54,9 +54,9 @@ PlayField::PlayField(TQWidget *parent, const char *name, WFlags f)
pushesText_(i18n("Pushes:")),
statusFont_(KGlobalSettings::generalFont().family(), 18, TQFont::Bold), statusMetrics_(statusFont_) {
- setFocusPolicy(TQWidget::StrongFocus);
+ setFocusPolicy(TQ_StrongFocus);
setFocus();
- setBackgroundMode(Qt::NoBackground);
+ setBackgroundMode(TQt::NoBackground);
setMouseTracking(true);
highlightX_ = highlightY_ = 0;
@@ -72,7 +72,7 @@ PlayField::PlayField(TQWidget *parent, const char *name, WFlags f)
history_ = new History;
background_.setPixmap(imageData_->background());
- floor_ = TQColor(0x66,0x66,0x66);
+ floor_ = TQBrush(TQColor(0x66,0x66,0x66));
levelMap_ = new LevelMap;
mapDelta_ = new MapDelta(levelMap_);
@@ -187,7 +187,7 @@ void
PlayField::paintDelta() {
TQPainter paint(this);
- // the following line is a workaround for a bug in Qt 2.0.1
+ // the following line is a workaround for a bug in TQt 2.0.1
// (and possibly earlier versions)
paint.setBrushOrigin(0, 0);
@@ -204,7 +204,7 @@ void
PlayField::paintEvent(TQPaintEvent *e) {
TQPainter paint(this);
- // the following line is a workaround for a bug in Qt 2.0.1
+ // the following line is a workaround for a bug in TQt 2.0.1
// (and possibly earlier versions)
paint.setBrushOrigin(0, 0);
@@ -324,26 +324,26 @@ PlayField::mouseMoveEvent(TQMouseEvent *e) {
dragImage_ = dragXpm_;
for (int yy=0; yy<size_; yy++) {
for (int xx=0; xx<size_; xx++) {
- QRgb rgb1 = imageData_->objectImg().pixel(xx, yy);
- int r1 = qRed(rgb1);
- int g1 = qGreen(rgb1);
- int b1 = qBlue(rgb1);
+ TQRgb rgb1 = imageData_->objectImg().pixel(xx, yy);
+ int r1 = tqRed(rgb1);
+ int g1 = tqGreen(rgb1);
+ int b1 = tqBlue(rgb1);
if (r1 != g1 || r1 != b1 || r1 == 255) {
- QRgb rgb2 = dragImage_.pixel(xx, yy);
- int r2 = qRed(rgb2);
- int g2 = qGreen(rgb2);
- int b2 = qBlue(rgb2);
+ TQRgb rgb2 = dragImage_.pixel(xx, yy);
+ int r2 = tqRed(rgb2);
+ int g2 = tqGreen(rgb2);
+ int b2 = tqBlue(rgb2);
r2 = (int) (0.75 * r1 + 0.25 * r2 + 0.5);
g2 = (int) (0.75 * g1 + 0.25 * g2 + 0.5);
b2 = (int) (0.75 * b1 + 0.25 * b2 + 0.5);
- dragImage_.setPixel(xx, yy, qRgb(r2, g2, b2));
+ dragImage_.setPixel(xx, yy, tqRgb(r2, g2, b2));
}
}
}
paint.begin(this);
- // the following line is a workaround for a bug in Qt 2.0.1
+ // the following line is a workaround for a bug in TQt 2.0.1
// (and possibly earlier versions)
paint.setBrushOrigin(0, 0);
@@ -421,7 +421,7 @@ PlayField::highlight() {
void
PlayField::stopMoving() {
- killTimers();
+ TQT_TQOBJECT(this)->killTimers();
delete moveSequence_;
moveSequence_ = 0;
moveInProgress_ = false;
@@ -456,7 +456,7 @@ void
PlayField::timerEvent(TQTimerEvent *) {
assert(moveInProgress_);
if (moveSequence_ == 0) {
- killTimers();
+ TQT_TQOBJECT(this)->killTimers();
moveInProgress_ = false;
return;
}
@@ -599,7 +599,7 @@ PlayField::keyPressEvent(TQKeyEvent * e) {
case Key_X:
levelMap_->random();
levelChange();
- repaint(false);
+ tqrepaint(false);
break;
case Key_R:
@@ -620,7 +620,7 @@ PlayField::keyPressEvent(TQKeyEvent * e) {
break;
case Key_I:
history_->redo(levelMap_);
- repaint(false);
+ tqrepaint(false);
return;
break;
@@ -644,7 +644,7 @@ PlayField::keyPressEvent(TQKeyEvent * e) {
}
updateStepsXpm();
updatePushesXpm();
- repaint(false);
+ tqrepaint(false);
return;
break;
#endif
@@ -669,7 +669,7 @@ PlayField::stopDrag() {
TQPainter paint(this);
- // the following line is a workaround for a bug in Qt 2.0.1
+ // the following line is a workaround for a bug in TQt 2.0.1
// (and possibly earlier versions)
paint.setBrushOrigin(0, 0);
@@ -700,7 +700,7 @@ PlayField::mousePressEvent(TQMouseEvent *e) {
if (!canMoveNow()) return;
if (dragInProgress_) {
- if (e->button() == LeftButton) dragObject(e->x(), e->y());
+ if (e->button() == Qt::LeftButton) dragObject(e->x(), e->y());
else stopDrag();
return;
}
@@ -711,7 +711,7 @@ PlayField::mousePressEvent(TQMouseEvent *e) {
if (x < 0 || y < 0 || x >= levelMap_->width() || y >= levelMap_->height())
return;
- if (e->button() == LeftButton && pathFinder_.canDrag(x, y)) {
+ if (e->button() == Qt::LeftButton && pathFinder_.canDrag(x, y)) {
TQPainter paint(this);
changeCursor(&sizeAllCursor);
@@ -732,7 +732,7 @@ PlayField::mousePressEvent(TQMouseEvent *e) {
Move *m;
switch (e->button()) {
- case LeftButton:
+ case Qt::LeftButton:
m = pathFinder_.search(levelMap_, x, y);
if (m != 0) {
history_->add(m);
@@ -740,11 +740,11 @@ PlayField::mousePressEvent(TQMouseEvent *e) {
startMoving(m);
}
break;
- case MidButton:
+ case Qt::MidButton:
undo();
return;
break;
- case RightButton:
+ case Qt::RightButton:
push(x, y);
break;
@@ -855,7 +855,7 @@ this level yet."), this);
level(levelMap_->level()+1);
levelChange();
- repaint(false);
+ tqrepaint(false);
}
void
@@ -868,7 +868,7 @@ the current collection."), this);
}
level(levelMap_->level()-1);
levelChange();
- repaint(false);
+ tqrepaint(false);
}
void
@@ -892,7 +892,7 @@ PlayField::restartLevel() {
level(levelMap_->level());
updateStepsXpm();
updatePushesXpm();
- repaint(false);
+ tqrepaint(false);
}
void
@@ -901,7 +901,7 @@ PlayField::changeCollection(LevelCollection *collection) {
levelMap_->changeCollection(collection);
levelChange();
//erase(collRect_);
- repaint(false);
+ tqrepaint(false);
}
void
@@ -1030,7 +1030,7 @@ PlayField::goToBookmark(Bookmark *bm) {
//updateLevelXpm();
updateStepsXpm();
updatePushesXpm();
- repaint(false);
+ tqrepaint(false);
}
bool