summaryrefslogtreecommitdiffstats
path: root/ksokoban
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
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')
-rw-r--r--ksokoban/ImageData.cpp12
-rw-r--r--ksokoban/InternalCollections.cpp2
-rw-r--r--ksokoban/MainWindow.cpp4
-rw-r--r--ksokoban/MainWindow.h1
-rw-r--r--ksokoban/ModalLabel.cpp16
-rw-r--r--ksokoban/ModalLabel.h5
-rw-r--r--ksokoban/NEWS2
-rw-r--r--ksokoban/PlayField.cpp66
-rw-r--r--ksokoban/PlayField.h3
-rw-r--r--ksokoban/Queue.h6
-rw-r--r--ksokoban/StaticImage.cpp2
11 files changed, 61 insertions, 58 deletions
diff --git a/ksokoban/ImageData.cpp b/ksokoban/ImageData.cpp
index c34ece36..76fd0f2b 100644
--- a/ksokoban/ImageData.cpp
+++ b/ksokoban/ImageData.cpp
@@ -144,10 +144,10 @@ ImageData::brighten(TQImage& img) {
for (int y=0; y<img.height(); y++) {
for (int x=0; x<img.width(); x++) {
- QRgb rgb = img.pixel(x, y);
- int r = qRed(rgb);
- int g = qGreen(rgb);
- int b = qBlue(rgb);
+ TQRgb rgb = img.pixel(x, y);
+ int r = tqRed(rgb);
+ int g = tqGreen(rgb);
+ int b = tqBlue(rgb);
if (r > g && r > b) {
// only modify redish pixels
@@ -163,10 +163,10 @@ ImageData::brighten(TQImage& img) {
void
ImageData::wall(TQPainter &p, int x, int y, int index, bool left, bool right) {
- if (left) p.drawPixmap(x, y, upperLarge(index-1), halfSize_);
+ if (left) p.tqdrawPixmap(x, y, upperLarge(index-1), halfSize_);
else p.drawPixmap(x, y, leftSmall(index));
- if (right) p.drawPixmap(x+halfSize_, y, upperLarge(index), 0, 0, halfSize_);
+ if (right) p.tqdrawPixmap(x+halfSize_, y, upperLarge(index), 0, 0, halfSize_);
else p.drawPixmap(x+halfSize_, y, rightSmall(index));
p.drawPixmap(x, y+halfSize_, lowerLarge(index));
diff --git a/ksokoban/InternalCollections.cpp b/ksokoban/InternalCollections.cpp
index 242a724d..5b019f52 100644
--- a/ksokoban/InternalCollections.cpp
+++ b/ksokoban/InternalCollections.cpp
@@ -38,7 +38,7 @@ InternalCollections::realCollection2Config(int collection) {
return collection_save_id[collection];
}
-QString
+TQString
InternalCollections::collectionName(int _level) {
switch (_level) {
case 0:
diff --git a/ksokoban/MainWindow.cpp b/ksokoban/MainWindow.cpp
index 1f9ba526..0c28579c 100644
--- a/ksokoban/MainWindow.cpp
+++ b/ksokoban/MainWindow.cpp
@@ -179,7 +179,7 @@ MainWindow::MainWindow() : KMainWindow(0), externalCollection_(0) {
updateBookmark(i);
}
- help_ = helpMenu(TQString::null, false);
+ help_ = helpMenu(TQString(), false);
menu_->insertSeparator();
menu_->insertItem(i18n("&Help"), help_);
@@ -311,7 +311,7 @@ void
MainWindow::openURL(KURL _url) {
KConfig *cfg=(KApplication::kApplication())->config();
-// int namepos = _url.path().findRev('/') + 1; // NOTE: findRev can return -1
+// int namepos = _url.path().tqfindRev('/') + 1; // NOTE: tqfindRev can return -1
// TQString levelName = _url.path().mid(namepos);
TQString levelName = _url.fileName();
diff --git a/ksokoban/MainWindow.h b/ksokoban/MainWindow.h
index 30c1fbb3..7551c935 100644
--- a/ksokoban/MainWindow.h
+++ b/ksokoban/MainWindow.h
@@ -35,6 +35,7 @@ class LevelCollection;
class MainWindow : public KMainWindow {
Q_OBJECT
+ TQ_OBJECT
public:
MainWindow();
~MainWindow();
diff --git a/ksokoban/ModalLabel.cpp b/ksokoban/ModalLabel.cpp
index c0ccbbad..cf813779 100644
--- a/ksokoban/ModalLabel.cpp
+++ b/ksokoban/ModalLabel.cpp
@@ -28,9 +28,9 @@
#include "ModalLabel.moc"
-ModalLabel::ModalLabel(const TQString &text, TQWidget *parent,
+ModalLabel::ModalLabel(const TQString &text, TQWidget *tqparent,
const char *name, WFlags f)
- : TQLabel(text, parent, name, f) {
+ : TQLabel(text, tqparent, name, f) {
TQFont font(KGlobalSettings::generalFont().family(), 24, TQFont::Bold);
TQFontMetrics fontMet(font);
@@ -40,7 +40,7 @@ ModalLabel::ModalLabel(const TQString &text, TQWidget *parent,
for (int linePos=0; linePos < (int) text.length(); linePos += lineLen+1) {
- lineLen = text.find('\n', linePos);
+ lineLen = text.tqfind('\n', linePos);
if (lineLen < 0) lineLen = text.length() - linePos;
else lineLen -= linePos;
@@ -57,15 +57,15 @@ ModalLabel::ModalLabel(const TQString &text, TQWidget *parent,
if (width < 300) width = 300;
if (height < 75) height = 75;
- setAlignment (AlignCenter);
+ tqsetAlignment (AlignCenter);
setFrameStyle (TQFrame::Panel | TQFrame::Raised);
setLineWidth (4);
setFont (font);
- move (parent->width ()/2 - width/2, parent->height ()/2 - height/2);
+ move (tqparent->width ()/2 - width/2, tqparent->height ()/2 - height/2);
resize (width, height);
show ();
- TQWidgetList *list = TQApplication::allWidgets();
+ TQWidgetList *list = TQApplication::tqallWidgets();
TQWidgetListIt it( *list );
while (it.current()) {
it.current()->installEventFilter (this);
@@ -107,9 +107,9 @@ ModalLabel::eventFilter (TQObject *, TQEvent *e) {
}
void
-ModalLabel::message (const TQString &text, TQWidget *parent) {
+ModalLabel::message (const TQString &text, TQWidget *tqparent) {
KApplication *app = KApplication::kApplication ();
- ModalLabel cl (text, parent);
+ ModalLabel cl (text, tqparent);
while (!cl.completed_) app->processOneEvent ();
}
diff --git a/ksokoban/ModalLabel.h b/ksokoban/ModalLabel.h
index 2fd010e9..cb4420cc 100644
--- a/ksokoban/ModalLabel.h
+++ b/ksokoban/ModalLabel.h
@@ -24,15 +24,16 @@
class ModalLabel : public TQLabel {
Q_OBJECT
+ TQ_OBJECT
public:
- static void message (const TQString &text, TQWidget *parent);
+ static void message (const TQString &text, TQWidget *tqparent);
void timerEvent (TQTimerEvent *);
bool eventFilter (TQObject *, TQEvent *);
bool completed_;
protected:
- ModalLabel (const TQString &text, TQWidget *parent, const char *name=0, WFlags f=0);
+ ModalLabel (const TQString &text, TQWidget *tqparent, const char *name=0, WFlags f=0);
};
diff --git a/ksokoban/NEWS b/ksokoban/NEWS
index bf717f78..5377962f 100644
--- a/ksokoban/NEWS
+++ b/ksokoban/NEWS
@@ -48,7 +48,7 @@ New features:
* Bookmarks
* Animation speed menu
-* Status bar
+* tqStatus bar
* Internationalisation
-------------------------------------------------------------------------------
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
diff --git a/ksokoban/PlayField.h b/ksokoban/PlayField.h
index 2a70b4b9..161c49d0 100644
--- a/ksokoban/PlayField.h
+++ b/ksokoban/PlayField.h
@@ -43,8 +43,9 @@ class TQCursor;
class PlayField : public TQWidget {
Q_OBJECT
+ TQ_OBJECT
public:
- PlayField(TQWidget *parent, const char *name=0, WFlags f=0);
+ PlayField(TQWidget *tqparent, const char *name=0, WFlags f=0);
~PlayField ();
bool canMoveNow();
diff --git a/ksokoban/Queue.h b/ksokoban/Queue.h
index cab9db90..4e193f54 100644
--- a/ksokoban/Queue.h
+++ b/ksokoban/Queue.h
@@ -17,8 +17,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef QUEUE_H
-#define QUEUE_H
+#ifndef TQUEUE_H
+#define TQUEUE_H
#include <assert.h>
@@ -53,4 +53,4 @@ public:
}
};
-#endif /* QUEUE_H */
+#endif /* TQUEUE_H */
diff --git a/ksokoban/StaticImage.cpp b/ksokoban/StaticImage.cpp
index 49a2aafa..d0a9f76a 100644
--- a/ksokoban/StaticImage.cpp
+++ b/ksokoban/StaticImage.cpp
@@ -72,7 +72,7 @@ StaticImage::StaticImage () {
if (!valid) {
background_.resize(128, 128);
- background_.fill(Qt::black);
+ background_.fill(TQt::black);
}
for (int i=0; i<NO_OF_IMAGES; i++) {