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 /ksokoban | |
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 'ksokoban')
-rw-r--r-- | ksokoban/Bookmark.cpp | 12 | ||||
-rw-r--r-- | ksokoban/Bookmark.h | 6 | ||||
-rw-r--r-- | ksokoban/History.cpp | 4 | ||||
-rw-r--r-- | ksokoban/History.h | 10 | ||||
-rw-r--r-- | ksokoban/ImageData.cpp | 56 | ||||
-rw-r--r-- | ksokoban/ImageData.h | 60 | ||||
-rw-r--r-- | ksokoban/InternalCollections.cpp | 2 | ||||
-rw-r--r-- | ksokoban/InternalCollections.h | 8 | ||||
-rw-r--r-- | ksokoban/LevelCollection.cpp | 14 | ||||
-rw-r--r-- | ksokoban/LevelCollection.h | 20 | ||||
-rw-r--r-- | ksokoban/LevelMap.cpp | 2 | ||||
-rw-r--r-- | ksokoban/LevelMap.h | 4 | ||||
-rw-r--r-- | ksokoban/MainWindow.cpp | 116 | ||||
-rw-r--r-- | ksokoban/MainWindow.h | 20 | ||||
-rw-r--r-- | ksokoban/ModalLabel.cpp | 56 | ||||
-rw-r--r-- | ksokoban/ModalLabel.h | 12 | ||||
-rw-r--r-- | ksokoban/Move.cpp | 2 | ||||
-rw-r--r-- | ksokoban/Move.h | 4 | ||||
-rw-r--r-- | ksokoban/PlayField.cpp | 114 | ||||
-rw-r--r-- | ksokoban/PlayField.h | 76 | ||||
-rw-r--r-- | ksokoban/main.cpp | 4 |
21 files changed, 301 insertions, 301 deletions
diff --git a/ksokoban/Bookmark.cpp b/ksokoban/Bookmark.cpp index 796d54b6..5571b7aa 100644 --- a/ksokoban/Bookmark.cpp +++ b/ksokoban/Bookmark.cpp @@ -21,7 +21,7 @@ #include "History.h" #include "LevelMap.h" -#include <qfile.h> +#include <tqfile.h> #include <kapplication.h> @@ -37,10 +37,10 @@ #include <assert.h> void -Bookmark::fileName(QString &p) { +Bookmark::fileName(TQString &p) { p = KGlobal::dirs()->saveLocation("appdata"); - QString n; + TQString n; n.setNum(number_); p += "/bookmark" + n; } @@ -48,7 +48,7 @@ Bookmark::fileName(QString &p) { Bookmark::Bookmark(int _num) : number_(_num), collection_(-1), level_(-1), moves_(0), data_("") { - QString p; + TQString p; fileName(p); FILE *file = fopen(p.latin1(), "r"); @@ -91,9 +91,9 @@ Bookmark::set(int _collection, int _level, int _moves, History *_h) { data_ = ""; _h->save(data_); - QString p; + TQString p; fileName(p); - FILE *file = fopen(QFile::encodeName(p), "w"); + FILE *file = fopen(TQFile::encodeName(p), "w"); if (file == NULL) return; fprintf(file, "%d %d %d\n", collection_, level_, moves_); fprintf(file, "%s\n", data_.latin1()); diff --git a/ksokoban/Bookmark.h b/ksokoban/Bookmark.h index 30c5faff..f4642ae1 100644 --- a/ksokoban/Bookmark.h +++ b/ksokoban/Bookmark.h @@ -23,7 +23,7 @@ class History; class LevelMap; -#include <qstring.h> +#include <tqstring.h> class Bookmark { public: @@ -38,14 +38,14 @@ public: bool goTo(LevelMap *_map, History *_h); private: - void fileName(QString &p); + void fileName(TQString &p); int number_; int collection_; int level_; int moves_; //int pushes_; - QString data_; + TQString data_; }; #endif /* BOOKMARK_H */ diff --git a/ksokoban/History.cpp b/ksokoban/History.cpp index 4c73827d..4525516f 100644 --- a/ksokoban/History.cpp +++ b/ksokoban/History.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <qptrlist.h> +#include <tqptrlist.h> #include "History.h" #include "Move.h" @@ -43,7 +43,7 @@ History::clear() { } void -History::save(QString &_str) { +History::save(TQString &_str) { Move *m = past_.first(); while (m != 0) { diff --git a/ksokoban/History.h b/ksokoban/History.h index c3db5194..27825f95 100644 --- a/ksokoban/History.h +++ b/ksokoban/History.h @@ -20,8 +20,8 @@ #ifndef HISTORY_H #define HISTORY_H -#include <qptrlist.h> -#include <qstring.h> +#include <tqptrlist.h> +#include <tqstring.h> #include "Move.h" class MoveSequence; @@ -37,8 +37,8 @@ class MoveSequence; class History { private: - QPtrList<Move> past_; - QPtrList<Move> future_; + TQPtrList<Move> past_; + TQPtrList<Move> future_; protected: @@ -53,7 +53,7 @@ public: */ void clear(); - void save(QString &_str); + void save(TQString &_str); const char *load(LevelMap *map, const char *_str); bool redo(LevelMap *map); MoveSequence *deferRedo(LevelMap *map); diff --git a/ksokoban/ImageData.cpp b/ksokoban/ImageData.cpp index 13040c47..c34ece36 100644 --- a/ksokoban/ImageData.cpp +++ b/ksokoban/ImageData.cpp @@ -20,10 +20,10 @@ #include "ImageData.h" #include <assert.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qimage.h> -#include <qcolor.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqimage.h> +#include <tqcolor.h> ImageData::ImageData() : indexSize_(0), size_(0), halfSize_(0) { random.setSeed(0); @@ -52,28 +52,28 @@ ImageData::expandIndex(int size) { indexSize_ = size; } -const QPixmap & +const TQPixmap & ImageData::upperLarge(int index) { assert(index >= 0); if (indexSize_ <= index) expandIndex(index); return largeStone_xpm_[(unsigned char)upperLargeIndex_[index]]; } -const QPixmap & +const TQPixmap & ImageData::lowerLarge(int index) { assert(index >= 0); if (indexSize_ <= index) expandIndex(index); return largeStone_xpm_[(unsigned char)lowerLargeIndex_[index]]; } -const QPixmap & +const TQPixmap & ImageData::leftSmall(int index) { assert(index >= 0); if (indexSize_ <= index) expandIndex(index); return smallStone_xpm_[(unsigned char)leftSmallIndex_[index]]; } -const QPixmap & +const TQPixmap & ImageData::rightSmall(int index) { assert(index >= 0); if (indexSize_ <= index) expandIndex(index); @@ -91,12 +91,12 @@ ImageData::resize(int size) { for (int i=0; i<SMALL_STONES; i++) { image2pixmap(images_[i].smoothScale(halfSize_, halfSize_), smallStone_xpm_[i]); -// smallStone_xpm_[i].convertFromImage(images_[i].smoothScale(halfSize_, halfSize_), QPixmap::ColorOnly|QPixmap::DiffuseDither|QPixmap::DiffuseAlphaDither|QPixmap::AvoidDither); +// smallStone_xpm_[i].convertFromImage(images_[i].smoothScale(halfSize_, halfSize_), TQPixmap::ColorOnly|TQPixmap::DiffuseDither|TQPixmap::DiffuseAlphaDither|TQPixmap::AvoidDither); } for (int i=0; i<LARGE_STONES; i++) { image2pixmap(images_[SMALL_STONES+i].smoothScale(size_, halfSize_), largeStone_xpm_[i]); -// largeStone_xpm_[i].convertFromImage(images_[SMALL_STONES+i].smoothScale(size_, halfSize_) , QPixmap::ColorOnly|QPixmap::DiffuseDither|QPixmap::DiffuseAlphaDither|QPixmap::AvoidDither); +// largeStone_xpm_[i].convertFromImage(images_[SMALL_STONES+i].smoothScale(size_, halfSize_) , TQPixmap::ColorOnly|TQPixmap::DiffuseDither|TQPixmap::DiffuseAlphaDither|TQPixmap::AvoidDither); } objectImg_ = images_[SMALL_STONES+LARGE_STONES].smoothScale(size_, size_); @@ -111,7 +111,7 @@ ImageData::resize(int size) { brighten(objectImg_); image2pixmap(objectImg_, brightObject_, false); - QImage img = images_[SMALL_STONES+LARGE_STONES+1].smoothScale(size_, size_); + TQImage img = images_[SMALL_STONES+LARGE_STONES+1].smoothScale(size_, size_); if (img.width() == size_) img = img.copy(); image2pixmap(img, otherPixmaps_[1], false); @@ -120,7 +120,7 @@ ImageData::resize(int size) { for (int i=2; i<OTHER_IMAGES; i++) { image2pixmap(images_[SMALL_STONES+LARGE_STONES+i].smoothScale(size_, size_), otherPixmaps_[i]); -// otherPixmaps_[i].convertFromImage(images_[SMALL_STONES+LARGE_STONES+i].smoothScale(size_, size_), QPixmap::ColorOnly|QPixmap::OrderedDither|QPixmap::OrderedAlphaDither|QPixmap::AvoidDither); +// otherPixmaps_[i].convertFromImage(images_[SMALL_STONES+LARGE_STONES+i].smoothScale(size_, size_), TQPixmap::ColorOnly|TQPixmap::OrderedDither|TQPixmap::OrderedAlphaDither|TQPixmap::AvoidDither); } return size_; @@ -130,16 +130,16 @@ ImageData::resize(int size) { // it gives spurious dots on the floor around them void -ImageData::image2pixmap(QImage img, QPixmap& xpm, bool diffuse) { +ImageData::image2pixmap(TQImage img, TQPixmap& xpm, bool diffuse) { xpm.convertFromImage(img, (diffuse ? - (QPixmap::DiffuseDither|QPixmap::DiffuseAlphaDither) : - (QPixmap::OrderedDither|QPixmap::OrderedAlphaDither))| - QPixmap::ColorOnly|QPixmap::AvoidDither); + (TQPixmap::DiffuseDither|TQPixmap::DiffuseAlphaDither) : + (TQPixmap::OrderedDither|TQPixmap::OrderedAlphaDither))| + TQPixmap::ColorOnly|TQPixmap::AvoidDither); } void -ImageData::brighten(QImage& img) { +ImageData::brighten(TQImage& img) { assert(img.depth() == 32); for (int y=0; y<img.height(); y++) { @@ -152,8 +152,8 @@ ImageData::brighten(QImage& img) { if (r > g && r > b) { // only modify redish pixels - QColor col(r, g, b); - QColor lcol = col.light(130); + TQColor col(r, g, b); + TQColor lcol = col.light(130); img.setPixel(x, y, lcol.rgb()); } @@ -162,7 +162,7 @@ ImageData::brighten(QImage& img) { } void -ImageData::wall(QPainter &p, int x, int y, int index, bool left, bool right) { +ImageData::wall(TQPainter &p, int x, int y, int index, bool left, bool right) { if (left) p.drawPixmap(x, y, upperLarge(index-1), halfSize_); else p.drawPixmap(x, y, leftSmall(index)); @@ -173,41 +173,41 @@ ImageData::wall(QPainter &p, int x, int y, int index, bool left, bool right) { } void -ImageData::floor(QPainter &p, int x, int y) { +ImageData::floor(TQPainter &p, int x, int y) { p.eraseRect(x, y, size_, size_); } void -ImageData::goal(QPainter &p, int x, int y) { +ImageData::goal(TQPainter &p, int x, int y) { p.drawPixmap(x, y, otherPixmaps_[2]); } void -ImageData::man(QPainter &p, int x, int y) { +ImageData::man(TQPainter &p, int x, int y) { p.drawPixmap(x, y, otherPixmaps_[3]); } void -ImageData::object(QPainter &p, int x, int y) { +ImageData::object(TQPainter &p, int x, int y) { p.drawPixmap(x, y, otherPixmaps_[0]); } void -ImageData::saveman(QPainter &p, int x, int y) { +ImageData::saveman(TQPainter &p, int x, int y) { p.drawPixmap(x, y, otherPixmaps_[4]); } void -ImageData::treasure(QPainter &p, int x, int y) { +ImageData::treasure(TQPainter &p, int x, int y) { p.drawPixmap(x, y, otherPixmaps_[1]); } void -ImageData::brightObject(QPainter &p, int x, int y) { +ImageData::brightObject(TQPainter &p, int x, int y) { p.drawPixmap(x, y, brightObject_); } void -ImageData::brightTreasure(QPainter &p, int x, int y) { +ImageData::brightTreasure(TQPainter &p, int x, int y) { p.drawPixmap(x, y, brightTreasure_); } diff --git a/ksokoban/ImageData.h b/ksokoban/ImageData.h index 4e57bc7d..ae2f2a42 100644 --- a/ksokoban/ImageData.h +++ b/ksokoban/ImageData.h @@ -20,9 +20,9 @@ #ifndef IMAGEDATA_H #define IMAGEDATA_H -#include <qimage.h> -#include <qpixmap.h> -#include <qcstring.h> +#include <tqimage.h> +#include <tqpixmap.h> +#include <tqcstring.h> #include <krandomsequence.h> @@ -41,44 +41,44 @@ public: int resize(int size); int size() { return size_; } - void wall(QPainter &p, int x, int y, int index, bool left, bool right); - void floor(QPainter &p, int x, int y); - void goal(QPainter &p, int x, int y); - void man(QPainter &p, int x, int y); - void object(QPainter &p, int x, int y); - void saveman(QPainter &p, int x, int y); - void treasure(QPainter &p, int x, int y); - void brightObject(QPainter &p, int x, int y); - void brightTreasure(QPainter &p, int x, int y); + void wall(TQPainter &p, int x, int y, int index, bool left, bool right); + void floor(TQPainter &p, int x, int y); + void goal(TQPainter &p, int x, int y); + void man(TQPainter &p, int x, int y); + void object(TQPainter &p, int x, int y); + void saveman(TQPainter &p, int x, int y); + void treasure(TQPainter &p, int x, int y); + void brightObject(TQPainter &p, int x, int y); + void brightTreasure(TQPainter &p, int x, int y); - const QPixmap &background() { return background_; } - const QImage& objectImg() const { return objectImg_; } + const TQPixmap &background() { return background_; } + const TQImage& objectImg() const { return objectImg_; } protected: ImageData(); void expandIndex(int size); - void image2pixmap(QImage img, QPixmap& xpm, bool diffuse=true); - void brighten(QImage& img); + void image2pixmap(TQImage img, TQPixmap& xpm, bool diffuse=true); + void brighten(TQImage& img); - const QPixmap &upperLarge(int index); - const QPixmap &lowerLarge(int index); - const QPixmap &leftSmall(int index); - const QPixmap &rightSmall(int index); + const TQPixmap &upperLarge(int index); + const TQPixmap &lowerLarge(int index); + const TQPixmap &leftSmall(int index); + const TQPixmap &rightSmall(int index); - QImage images_[NO_OF_IMAGES]; + TQImage images_[NO_OF_IMAGES]; - QPixmap smallStone_xpm_[SMALL_STONES]; - QPixmap largeStone_xpm_[LARGE_STONES]; - QPixmap otherPixmaps_[OTHER_IMAGES]; - QPixmap background_, brightObject_, brightTreasure_; - QImage objectImg_; + TQPixmap smallStone_xpm_[SMALL_STONES]; + TQPixmap largeStone_xpm_[LARGE_STONES]; + TQPixmap otherPixmaps_[OTHER_IMAGES]; + TQPixmap background_, brightObject_, brightTreasure_; + TQImage objectImg_; int indexSize_; - QByteArray upperLargeIndex_; - QByteArray lowerLargeIndex_; - QByteArray leftSmallIndex_; - QByteArray rightSmallIndex_; + TQByteArray upperLargeIndex_; + TQByteArray lowerLargeIndex_; + TQByteArray leftSmallIndex_; + TQByteArray rightSmallIndex_; int size_, halfSize_; KRandomSequence random; diff --git a/ksokoban/InternalCollections.cpp b/ksokoban/InternalCollections.cpp index cdc3dbb3..242a724d 100644 --- a/ksokoban/InternalCollections.cpp +++ b/ksokoban/InternalCollections.cpp @@ -63,7 +63,7 @@ InternalCollections::collectionName(int _level) { } assert(false); - return QString(); + return TQString(); } diff --git a/ksokoban/InternalCollections.h b/ksokoban/InternalCollections.h index 13759da8..03e4e807 100644 --- a/ksokoban/InternalCollections.h +++ b/ksokoban/InternalCollections.h @@ -21,8 +21,8 @@ #define INTERNALCOLLECTIONS_H #include <assert.h> -#include <qstring.h> -#include <qptrvector.h> +#include <tqstring.h> +#include <tqptrvector.h> #include "LevelCollection.h" @@ -44,9 +44,9 @@ private: static int configCollection2Real(int collection); static int realCollection2Config(int collection); - static QString collectionName(int _level); + static TQString collectionName(int _level); - QPtrVector<LevelCollection> collections_; + TQPtrVector<LevelCollection> collections_; char *data_; }; diff --git a/ksokoban/LevelCollection.cpp b/ksokoban/LevelCollection.cpp index 7f5db852..a562fb35 100644 --- a/ksokoban/LevelCollection.cpp +++ b/ksokoban/LevelCollection.cpp @@ -2,7 +2,7 @@ #include "Map.h" -#include <qfile.h> +#include <tqfile.h> #include <stdio.h> #include <assert.h> @@ -146,7 +146,7 @@ LevelCollection::loadPrefs() { KConfig *cfg=(KApplication::kApplication())->config(); cfg->setGroup("settings"); - QString key; + TQString key; key.sprintf("level%d", id_); level_ = cfg->readNumEntry(key, 0); @@ -199,7 +199,7 @@ LevelCollection::addSeparator() { } LevelCollection::LevelCollection(const char *_def, int _len, - const QString &_name, int _id) : + const TQString &_name, int _id) : level_(0), completedLevels_(0), noOfLevels_(0), name_(_name), id_(_id) { @@ -213,7 +213,7 @@ LevelCollection::LevelCollection(const char *_def, int _len, loadPrefs(); } -LevelCollection::LevelCollection(const QString &_path, const QString &_name, +LevelCollection::LevelCollection(const TQString &_path, const TQString &_name, int _id) : level_(0), completedLevels_(0), noOfLevels_(0), name_(_name), path_(_path), id_(_id) { @@ -221,7 +221,7 @@ LevelCollection::LevelCollection(const QString &_path, const QString &_name, char buf[1024]; int len; - QFile file(path_); + TQFile file(path_); if (file.open(IO_Raw | IO_ReadOnly)) { while ((len = file.readBlock(buf, 1024)) > 0) { addData((const char *) buf, len); @@ -243,7 +243,7 @@ LevelCollection::~LevelCollection() { KConfig *cfg=(KApplication::kApplication())->config(); cfg->setGroup ("settings"); - QString key; + TQString key; key.sprintf("level%d", id_); cfg->writeEntry(key, level_, true, false, false); } @@ -268,7 +268,7 @@ LevelCollection::levelCompleted() { x = forward(x, 0xd4d657b4ul, 0x1ful, 0x7e129575ul); x = forward(x, 0x80ff0b94ul, 0x0eul, 0x92fc153dul); - QString key; + TQString key; key.sprintf("status%d", id_); KConfig *cfg=(KApplication::kApplication())->config(); diff --git a/ksokoban/LevelCollection.h b/ksokoban/LevelCollection.h index f01d1316..0f0b3b11 100644 --- a/ksokoban/LevelCollection.h +++ b/ksokoban/LevelCollection.h @@ -20,19 +20,19 @@ #ifndef LEVELCOLLECTION_H #define LEVELCOLLECTION_H -#include <qstring.h> -#include <qcstring.h> -#include <qptrvector.h> +#include <tqstring.h> +#include <tqcstring.h> +#include <tqptrvector.h> class Map; class LevelCollection { public: - LevelCollection(const char *_def, int _len, const QString &_name, int _id=-1); - LevelCollection(const QString &_path, const QString &_name, int _id=-1); + LevelCollection(const char *_def, int _len, const TQString &_name, int _id=-1); + LevelCollection(const TQString &_path, const TQString &_name, int _id=-1); ~LevelCollection(); - const QString &name() const { return name_; } + const TQString &name() const { return name_; } int id() const { return id_; } int level() const { return level_; } void level(int _level); @@ -51,15 +51,15 @@ private: void addData(const char* _data, unsigned _len); void addSeparator(); - QPtrVector<const char> index_; - QByteArray data_; + TQPtrVector<const char> index_; + TQByteArray data_; //int dataLen_; int level_; int completedLevels_; int noOfLevels_; - QString name_; - QString path_; + TQString name_; + TQString path_; int id_; }; diff --git a/ksokoban/LevelMap.cpp b/ksokoban/LevelMap.cpp index 954dc588..34c2a15f 100644 --- a/ksokoban/LevelMap.cpp +++ b/ksokoban/LevelMap.cpp @@ -38,7 +38,7 @@ #define BUFSIZE (128*1024) -const QString & +const TQString & LevelMap::collectionName() { return collection_->name(); } diff --git a/ksokoban/LevelMap.h b/ksokoban/LevelMap.h index ed45f1c0..7d4541c5 100644 --- a/ksokoban/LevelMap.h +++ b/ksokoban/LevelMap.h @@ -21,7 +21,7 @@ #define LEVELMAP_H #include <assert.h> -#include <qstring.h> +#include <tqstring.h> #include "Map.h" class LevelCollection; @@ -34,7 +34,7 @@ public: ~LevelMap(); LevelCollection *collection() const { return collection_; } - const QString &collectionName(); + const TQString &collectionName(); void changeCollection(LevelCollection *_collection); int totalMoves() const { return totalMoves_; } int totalPushes() const { return totalPushes_; } diff --git a/ksokoban/MainWindow.cpp b/ksokoban/MainWindow.cpp index 63654f1c..1f9ba526 100644 --- a/ksokoban/MainWindow.cpp +++ b/ksokoban/MainWindow.cpp @@ -22,19 +22,19 @@ #include <kapplication.h> #include <kconfig.h> #include <kmenubar.h> -#include <qpopupmenu.h> -#include <qkeycode.h> +#include <tqpopupmenu.h> +#include <tqkeycode.h> #include <assert.h> #include <klocale.h> -#include <qstring.h> +#include <tqstring.h> #include <kfiledialog.h> -#include <qframe.h> +#include <tqframe.h> #include <kmessagebox.h> #include <kstandarddirs.h> #include <kio/netaccess.h> #include <kiconloader.h> -#include <qiconset.h> -#include <qdragobject.h> +#include <tqiconset.h> +#include <tqdragobject.h> #include <kpopupmenu.h> #include <kurldrag.h> #include <kstdaccel.h> @@ -47,10 +47,10 @@ void MainWindow::createCollectionMenu() { - collection_ = new QPopupMenu(0,"collection menu"); + collection_ = new TQPopupMenu(0,"collection menu"); collection_->setCheckable(true); - //connect(collection_, SIGNAL(activated(int)), playField_, SLOT(changeCollection(int))); - connect(collection_, SIGNAL(activated(int)), this, SLOT(changeCollection(int))); + //connect(collection_, TQT_SIGNAL(activated(int)), playField_, TQT_SLOT(changeCollection(int))); + connect(collection_, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changeCollection(int))); for (int i=0; i<internalCollections_.collections(); i++) { collection_->insertItem(internalCollections_[i]->name(), i); @@ -72,9 +72,9 @@ MainWindow::createCollectionMenu() { MainWindow::MainWindow() : KMainWindow(0), externalCollection_(0) { int i; - QPixmap pixmap; + TQPixmap pixmap; - setEraseColor(QColor(0,0,0)); + setEraseColor(TQColor(0,0,0)); KConfig *cfg=(KApplication::kApplication())->config(); cfg->setGroup("Geometry"); @@ -88,32 +88,32 @@ MainWindow::MainWindow() : KMainWindow(0), externalCollection_(0) { menu_ = new KMenuBar(this, "menubar" ); - game_ = new QPopupMenu(0,"game menu"); + game_ = new TQPopupMenu(0,"game menu"); pixmap = SmallIcon("fileopen"); - game_->insertItem(QIconSet(pixmap), i18n("&Load Levels..."), this, SLOT(loadLevels())); + game_->insertItem(TQIconSet(pixmap), i18n("&Load Levels..."), this, TQT_SLOT(loadLevels())); pixmap = SmallIcon("forward"); - game_->insertItem(QIconSet(pixmap), i18n("&Next Level"), playField_, SLOT(nextLevel()), Key_N); + game_->insertItem(TQIconSet(pixmap), i18n("&Next Level"), playField_, TQT_SLOT(nextLevel()), Key_N); pixmap = SmallIcon("back"); - game_->insertItem(QIconSet(pixmap), i18n("&Previous Level"), playField_, SLOT(previousLevel()), Key_P); + game_->insertItem(TQIconSet(pixmap), i18n("&Previous Level"), playField_, TQT_SLOT(previousLevel()), Key_P); pixmap = SmallIcon("reload"); - game_->insertItem(QIconSet(pixmap), i18n("Re&start Level"), playField_, SLOT(restartLevel()), Key_Escape); + game_->insertItem(TQIconSet(pixmap), i18n("Re&start Level"), playField_, TQT_SLOT(restartLevel()), Key_Escape); createCollectionMenu(); game_->insertItem(i18n("&Level Collection"), collection_); pixmap = SmallIcon("undo"); - game_->insertItem(QIconSet(pixmap), i18n("&Undo"), playField_, SLOT(undo()),QKeySequence( (KStdAccel::undo()).toString())); + game_->insertItem(TQIconSet(pixmap), i18n("&Undo"), playField_, TQT_SLOT(undo()),TQKeySequence( (KStdAccel::undo()).toString())); pixmap = SmallIcon("redo"); - game_->insertItem(QIconSet(pixmap), i18n("&Redo"), playField_, SLOT(redo()), QKeySequence( (KStdAccel::redo()).toString())); + game_->insertItem(TQIconSet(pixmap), i18n("&Redo"), playField_, TQT_SLOT(redo()), TQKeySequence( (KStdAccel::redo()).toString())); game_->insertSeparator(); pixmap = SmallIcon("exit"); - game_->insertItem(QIconSet(pixmap), i18n("&Quit"), KApplication::kApplication(), SLOT(closeAllWindows()), QKeySequence( (KStdAccel::quit()).toString())); + game_->insertItem(TQIconSet(pixmap), i18n("&Quit"), KApplication::kApplication(), TQT_SLOT(closeAllWindows()), TQKeySequence( (KStdAccel::quit()).toString())); menu_->insertItem(i18n("&Game"), game_); - animation_ = new QPopupMenu(0,"animation menu"); + animation_ = new TQPopupMenu(0,"animation menu"); animation_->setCheckable(true); - connect(animation_, SIGNAL(activated(int)), this, SLOT(updateAnimMenu(int))); - connect(animation_, SIGNAL(activated(int)), playField_, SLOT(changeAnim(int))); + connect(animation_, TQT_SIGNAL(activated(int)), this, TQT_SLOT(updateAnimMenu(int))); + connect(animation_, TQT_SIGNAL(activated(int)), playField_, TQT_SLOT(changeAnim(int))); animation_->insertItem(i18n("&Slow"), 3); animation_->insertItem(i18n("&Medium"), 2); animation_->insertItem(i18n("&Fast"), 1); @@ -123,54 +123,54 @@ MainWindow::MainWindow() : KMainWindow(0), externalCollection_(0) { menu_->insertItem(i18n("&Animation"), animation_); pixmap = SmallIcon("bookmark_add"); - bookmarkMenu_ = new QPopupMenu(0,"bookmarks menu"); - setBM_ = new QPopupMenu(0, "set bookmark menu"); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 1); + bookmarkMenu_ = new TQPopupMenu(0,"bookmarks menu"); + setBM_ = new TQPopupMenu(0, "set bookmark menu"); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 1); setBM_->setAccel(CTRL+Key_1, 1); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 2); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 2); setBM_->setAccel(CTRL+Key_2, 2); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 3); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 3); setBM_->setAccel(CTRL+Key_3, 3); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 4); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 4); setBM_->setAccel(CTRL+Key_4, 4); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 5); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 5); setBM_->setAccel(CTRL+Key_5, 5); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 6); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 6); setBM_->setAccel(CTRL+Key_6, 6); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 7); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 7); setBM_->setAccel(CTRL+Key_7, 7); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 8); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 8); setBM_->setAccel(CTRL+Key_8, 8); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 9); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 9); setBM_->setAccel(CTRL+Key_9, 9); - setBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 10); + setBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 10); setBM_->setAccel(CTRL+Key_0, 10); - connect(setBM_, SIGNAL(activated(int)), this, SLOT(setBookmark(int))); + connect(setBM_, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setBookmark(int))); bookmarkMenu_->insertItem(i18n("&Set Bookmark"), setBM_); pixmap = SmallIcon("bookmark"); - goToBM_ = new QPopupMenu(0, "go to bookmark menu"); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 1); + goToBM_ = new TQPopupMenu(0, "go to bookmark menu"); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 1); goToBM_->setAccel(Key_1, 1); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 2); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 2); goToBM_->setAccel(Key_2, 2); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 3); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 3); goToBM_->setAccel(Key_3, 3); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 4); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 4); goToBM_->setAccel(Key_4, 4); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 5); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 5); goToBM_->setAccel(Key_5, 5); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 6); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 6); goToBM_->setAccel(Key_6, 6); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 7); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 7); goToBM_->setAccel(Key_7, 7); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 8); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 8); goToBM_->setAccel(Key_8, 8); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 9); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 9); goToBM_->setAccel(Key_9, 9); - goToBM_->insertItem(QIconSet(pixmap), i18n("(unused)"), 10); + goToBM_->insertItem(TQIconSet(pixmap), i18n("(unused)"), 10); goToBM_->setAccel(Key_0, 10); - connect(goToBM_, SIGNAL(activated(int)), this, SLOT(goToBookmark(int))); + connect(goToBM_, TQT_SIGNAL(activated(int)), this, TQT_SLOT(goToBookmark(int))); bookmarkMenu_->insertItem(i18n("&Go to Bookmark"), goToBM_); menu_->insertItem(i18n("&Bookmarks"), bookmarkMenu_); @@ -179,7 +179,7 @@ MainWindow::MainWindow() : KMainWindow(0), externalCollection_(0) { updateBookmark(i); } - help_ = helpMenu(QString::null, false); + help_ = helpMenu(TQString::null, false); menu_->insertSeparator(); menu_->insertItem(i18n("&Help"), help_); @@ -222,7 +222,7 @@ MainWindow::~MainWindow() void -MainWindow::focusInEvent(QFocusEvent *) { +MainWindow::focusInEvent(TQFocusEvent *) { playField_->setFocus(); } @@ -241,12 +241,12 @@ MainWindow::updateBookmark(int num) { if (col < 0 || lev < 0) return; - QString name; + TQString name; if (col >= 0 && col < internalCollections_.collections()) name = internalCollections_[col]->name(); else name = i18n("(invalid)"); - QString l; + TQString l; l.setNum(lev+1); name += " #" + l; l.setNum(mov); @@ -299,7 +299,7 @@ void MainWindow::loadLevels() { KConfig *cfg=(KApplication::kApplication())->config(); cfg->setGroup("settings"); - QString lastFile = cfg->readPathEntry("lastLevelFile"); + TQString lastFile = cfg->readPathEntry("lastLevelFile"); KURL result = KFileDialog::getOpenURL(lastFile, "*", this, i18n("Load Levels From File")); if (result.isEmpty()) return; @@ -312,10 +312,10 @@ MainWindow::openURL(KURL _url) { KConfig *cfg=(KApplication::kApplication())->config(); // int namepos = _url.path().findRev('/') + 1; // NOTE: findRev can return -1 -// QString levelName = _url.path().mid(namepos); - QString levelName = _url.fileName(); +// TQString levelName = _url.path().mid(namepos); + TQString levelName = _url.fileName(); - QString levelFile; + TQString levelFile; if (_url.isLocalFile()) { levelFile = _url.path(); } else { @@ -347,15 +347,15 @@ MainWindow::openURL(KURL _url) { } void -MainWindow::dragEnterEvent(QDragEnterEvent* event) { +MainWindow::dragEnterEvent(TQDragEnterEvent* event) { event->accept(KURLDrag::canDecode(event)); } void -MainWindow::dropEvent(QDropEvent* event) { +MainWindow::dropEvent(TQDropEvent* event) { KURL::List urls; if (KURLDrag::decode(event, urls)) { -// kdDebug() << "MainWindow:Handling QUriDrag..." << endl; +// kdDebug() << "MainWindow:Handling TQUriDrag..." << endl; if (urls.count() > 0) { const KURL &url = urls.first(); openURL(url); diff --git a/ksokoban/MainWindow.h b/ksokoban/MainWindow.h index 202afd13..19ff4060 100644 --- a/ksokoban/MainWindow.h +++ b/ksokoban/MainWindow.h @@ -50,10 +50,10 @@ public slots: void loadLevels(); protected: - void focusInEvent(QFocusEvent*); + void focusInEvent(TQFocusEvent*); void createCollectionMenu(); - virtual void dragEnterEvent(QDragEnterEvent*); - virtual void dropEvent(QDropEvent*); + virtual void dragEnterEvent(TQDragEnterEvent*); + virtual void dropEvent(TQDropEvent*); private: InternalCollections internalCollections_; @@ -63,13 +63,13 @@ private: Bookmark *bookmarks_[10]; int currentCollection_; - QPopupMenu *game_; - QPopupMenu *collection_; - QPopupMenu *animation_; - QPopupMenu *bookmarkMenu_; - QPopupMenu *setBM_; - QPopupMenu *goToBM_; - QPopupMenu *help_; + TQPopupMenu *game_; + TQPopupMenu *collection_; + TQPopupMenu *animation_; + TQPopupMenu *bookmarkMenu_; + TQPopupMenu *setBM_; + TQPopupMenu *goToBM_; + TQPopupMenu *help_; int checkedCollection_; int checkedAnim_; diff --git a/ksokoban/ModalLabel.cpp b/ksokoban/ModalLabel.cpp index 1ed55dcf..c0ccbbad 100644 --- a/ksokoban/ModalLabel.cpp +++ b/ksokoban/ModalLabel.cpp @@ -19,23 +19,23 @@ #include "ModalLabel.h" -#include <qlabel.h> -#include <qfont.h> +#include <tqlabel.h> +#include <tqfont.h> #include <kapplication.h> #include <kglobalsettings.h> -#include <qwidgetlist.h> -#include <qstring.h> +#include <tqwidgetlist.h> +#include <tqstring.h> #include "ModalLabel.moc" -ModalLabel::ModalLabel(const QString &text, QWidget *parent, +ModalLabel::ModalLabel(const TQString &text, TQWidget *parent, const char *name, WFlags f) - : QLabel(text, parent, name, f) { - QFont font(KGlobalSettings::generalFont().family(), 24, QFont::Bold); - QFontMetrics fontMet(font); + : TQLabel(text, parent, name, f) { + TQFont font(KGlobalSettings::generalFont().family(), 24, TQFont::Bold); + TQFontMetrics fontMet(font); - QString currentLine; - QRect bounds; + TQString currentLine; + TQRect bounds; int lineLen, width=0, height=0; for (int linePos=0; linePos < (int) text.length(); linePos += lineLen+1) { @@ -58,15 +58,15 @@ ModalLabel::ModalLabel(const QString &text, QWidget *parent, if (height < 75) height = 75; setAlignment (AlignCenter); - setFrameStyle (QFrame::Panel | QFrame::Raised); + setFrameStyle (TQFrame::Panel | TQFrame::Raised); setLineWidth (4); setFont (font); move (parent->width ()/2 - width/2, parent->height ()/2 - height/2); resize (width, height); show (); - QWidgetList *list = QApplication::allWidgets(); - QWidgetListIt it( *list ); + TQWidgetList *list = TQApplication::allWidgets(); + TQWidgetListIt it( *list ); while (it.current()) { it.current()->installEventFilter (this); ++it; @@ -78,25 +78,25 @@ ModalLabel::ModalLabel(const QString &text, QWidget *parent, } void -ModalLabel::timerEvent (QTimerEvent *) { +ModalLabel::timerEvent (TQTimerEvent *) { completed_ = true; } bool -ModalLabel::eventFilter (QObject *, QEvent *e) { +ModalLabel::eventFilter (TQObject *, TQEvent *e) { switch (e->type()) { - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonDblClick: - case QEvent::MouseMove: - case QEvent::KeyPress: - case QEvent::KeyRelease: - case QEvent::Accel: - //case QEvent::DragEnter: - case QEvent::DragMove: - case QEvent::DragLeave: - case QEvent::Drop: - //case QEvent::DragResponse: + case TQEvent::MouseButtonPress: + case TQEvent::MouseButtonRelease: + case TQEvent::MouseButtonDblClick: + case TQEvent::MouseMove: + case TQEvent::KeyPress: + case TQEvent::KeyRelease: + case TQEvent::Accel: + //case TQEvent::DragEnter: + case TQEvent::DragMove: + case TQEvent::DragLeave: + case TQEvent::Drop: + //case TQEvent::DragResponse: //kdDebug << "Ate event" << endl; return true; @@ -107,7 +107,7 @@ ModalLabel::eventFilter (QObject *, QEvent *e) { } void -ModalLabel::message (const QString &text, QWidget *parent) { +ModalLabel::message (const TQString &text, TQWidget *parent) { KApplication *app = KApplication::kApplication (); ModalLabel cl (text, parent); diff --git a/ksokoban/ModalLabel.h b/ksokoban/ModalLabel.h index 4b35a82a..2fd010e9 100644 --- a/ksokoban/ModalLabel.h +++ b/ksokoban/ModalLabel.h @@ -20,19 +20,19 @@ #ifndef MODALLABEL_H #define MODALLABEL_H -#include <qlabel.h> +#include <tqlabel.h> -class ModalLabel : public QLabel { +class ModalLabel : public TQLabel { Q_OBJECT public: - static void message (const QString &text, QWidget *parent); + static void message (const TQString &text, TQWidget *parent); - void timerEvent (QTimerEvent *); - bool eventFilter (QObject *, QEvent *); + void timerEvent (TQTimerEvent *); + bool eventFilter (TQObject *, TQEvent *); bool completed_; protected: - ModalLabel (const QString &text, QWidget *parent, const char *name=0, WFlags f=0); + ModalLabel (const TQString &text, TQWidget *parent, const char *name=0, WFlags f=0); }; diff --git a/ksokoban/Move.cpp b/ksokoban/Move.cpp index 22773774..449e9b0e 100644 --- a/ksokoban/Move.cpp +++ b/ksokoban/Move.cpp @@ -56,7 +56,7 @@ Move::finish () { } void -Move::save (QString &s) { +Move::save (TQString &s) { static const char move1[] = "lrud"; static const char push1[] = "LRUD"; static const char move2[] = "wens"; diff --git a/ksokoban/Move.h b/ksokoban/Move.h index ad6b3eed..129e8607 100644 --- a/ksokoban/Move.h +++ b/ksokoban/Move.h @@ -21,7 +21,7 @@ #define MOVE_H #include <assert.h> -#include <qstring.h> +#include <tqstring.h> #include "Map.h" class LevelMap; @@ -106,7 +106,7 @@ public: int finalY () const { return (moves_[moveIndex_-1]>>8)&0x7f; } - void save (QString &_str); + void save (TQString &_str); const char *load (const char *_str); bool redo (LevelMap *map); bool undo (LevelMap *map); diff --git a/ksokoban/PlayField.cpp b/ksokoban/PlayField.cpp index 4d98d309..f277192e 100644 --- a/ksokoban/PlayField.cpp +++ b/ksokoban/PlayField.cpp @@ -20,13 +20,13 @@ #include <stdio.h> #include <assert.h> -#include <qwidget.h> -#include <qpixmap.h> -#include <qkeycode.h> +#include <tqwidget.h> +#include <tqpixmap.h> +#include <tqkeycode.h> #include <kconfig.h> #include <kapplication.h> #include <klocale.h> -#include <qpainter.h> +#include <tqpainter.h> #include <kmessagebox.h> #include <kglobalsettings.h> @@ -45,16 +45,16 @@ #include "PlayField.moc" -PlayField::PlayField(QWidget *parent, const char *name, WFlags f) - : QWidget(parent, name, f|WResizeNoErase), imageData_(0), lastLevel_(-1), +PlayField::PlayField(TQWidget *parent, const char *name, WFlags f) + : TQWidget(parent, name, f|WResizeNoErase), imageData_(0), lastLevel_(-1), moveSequence_(0), moveInProgress_(false), dragInProgress_(false), xOffs_(0), yOffs_(0), wheelDelta_(0), levelText_(i18n("Level:")), stepsText_(i18n("Steps:")), pushesText_(i18n("Pushes:")), - statusFont_(KGlobalSettings::generalFont().family(), 18, QFont::Bold), statusMetrics_(statusFont_) { + statusFont_(KGlobalSettings::generalFont().family(), 18, TQFont::Bold), statusMetrics_(statusFont_) { - setFocusPolicy(QWidget::StrongFocus); + setFocusPolicy(TQWidget::StrongFocus); setFocus(); setBackgroundMode(Qt::NoBackground); setMouseTracking(true); @@ -72,7 +72,7 @@ PlayField::PlayField(QWidget *parent, const char *name, WFlags f) history_ = new History; background_.setPixmap(imageData_->background()); - floor_ = QColor(0x66,0x66,0x66); + floor_ = TQColor(0x66,0x66,0x66); levelMap_ = new LevelMap; mapDelta_ = new MapDelta(levelMap_); @@ -93,7 +93,7 @@ PlayField::~PlayField() { } void -PlayField::changeCursor(const QCursor* c) { +PlayField::changeCursor(const TQCursor* c) { if (cursor_ == c) return; cursor_ = c; @@ -107,9 +107,9 @@ PlayField::level() const { return levelMap_->level(); } -const QString & +const TQString & PlayField::collectionName() { - static QString error = "????"; + static TQString error = "????"; if (levelMap_ == 0) return error; return levelMap_->collectionName(); } @@ -140,7 +140,7 @@ PlayField::levelChange() { } void -PlayField::paintSquare(int x, int y, QPainter &paint) { +PlayField::paintSquare(int x, int y, TQPainter &paint) { if (levelMap_->xpos() == x && levelMap_->ypos() == y) { if (levelMap_->goal(x, y)) imageData_->saveman(paint, x2pixel(x), y2pixel(y)); @@ -185,7 +185,7 @@ PlayField::paintSquare(int x, int y, QPainter &paint) { void PlayField::paintDelta() { - QPainter paint(this); + TQPainter paint(this); // the following line is a workaround for a bug in Qt 2.0.1 // (and possibly earlier versions) @@ -201,8 +201,8 @@ PlayField::paintDelta() { void -PlayField::paintEvent(QPaintEvent *e) { - QPainter paint(this); +PlayField::paintEvent(TQPaintEvent *e) { + TQPainter paint(this); // the following line is a workaround for a bug in Qt 2.0.1 // (and possibly earlier versions) @@ -215,8 +215,8 @@ PlayField::paintEvent(QPaintEvent *e) { } void -PlayField::paintPainterClip(QPainter &paint, int x, int y, int w, int h) { - QRect rect(x, y, w, h); +PlayField::paintPainterClip(TQPainter &paint, int x, int y, int w, int h) { + TQRect rect(x, y, w, h); paint.setClipRect(rect); paint.setClipping(true); @@ -224,7 +224,7 @@ PlayField::paintPainterClip(QPainter &paint, int x, int y, int w, int h) { } void -PlayField::paintPainter(QPainter &paint, const QRect &rect) { +PlayField::paintPainter(TQPainter &paint, const TQRect &rect) { if (size_ <= 0) return; int minx = pixel2x(rect.x()); int miny = pixel2y(rect.y()); @@ -272,12 +272,12 @@ PlayField::paintPainter(QPainter &paint, const QRect &rect) { } void -PlayField::resizeEvent(QResizeEvent *e) { +PlayField::resizeEvent(TQResizeEvent *e) { setSize(e->size().width(), e->size().height()); } void -PlayField::mouseMoveEvent(QMouseEvent *e) { +PlayField::mouseMoveEvent(TQMouseEvent *e) { lastMouseXPos_ = e->x(); lastMouseYPos_ = e->y(); @@ -309,11 +309,11 @@ PlayField::mouseMoveEvent(QMouseEvent *e) { if (dragX_ == old_x && dragY_ == old_y) return; - QRect rect(dragX_, dragY_, size_, size_); + TQRect rect(dragX_, dragY_, size_, size_); dragXpm_.resize(size_, size_); - QPainter paint; + TQPainter paint; paint.begin(&dragXpm_); paint.setBackgroundColor(backgroundColor()); paint.setBrushOrigin(- dragX_, - dragY_); @@ -358,19 +358,19 @@ PlayField::mouseMoveEvent(QMouseEvent *e) { int y2 = old_y; if (dy > 0) { paintPainterClip(paint, old_x, old_y, size_, dy); - // NOTE: clipping is now activated in the QPainter paint + // NOTE: clipping is now activated in the TQPainter paint y2 += dy; } else if (dy < 0) { paintPainterClip(paint, old_x, old_y+size_+dy, size_, -dy); - // NOTE: clipping is now activated in the QPainter paint + // NOTE: clipping is now activated in the TQPainter paint dy = -dy; } if (dx > 0) { paintPainterClip(paint, old_x, y2, dx, size_-dy); - // NOTE: clipping is now activated in the QPainter paint + // NOTE: clipping is now activated in the TQPainter paint } else if (dx < 0) { paintPainterClip(paint, old_x+size_+dx, y2, -dx, size_-dy); - // NOTE: clipping is now activated in the QPainter paint + // NOTE: clipping is now activated in the TQPainter paint } } paint.end(); @@ -390,7 +390,7 @@ PlayField::highlight() { if (x == highlightX_ && y == highlightY_) return; if (pathFinder_.canDrag(x, y)) { - QPainter paint(this); + TQPainter paint(this); if (highlightX_ >= 0) { int x = highlightX_, y = highlightY_; @@ -409,7 +409,7 @@ PlayField::highlight() { if (pathFinder_.canWalkTo(x, y)) changeCursor(&crossCursor); else changeCursor(0); if (highlightX_ >= 0) { - QPainter paint(this); + TQPainter paint(this); int x = highlightX_, y = highlightY_; highlightX_ = -1; @@ -428,7 +428,7 @@ PlayField::stopMoving() { updateStepsXpm(); updatePushesXpm(); - QPainter paint(this); + TQPainter paint(this); paint.drawPixmap(snumRect_.x(), snumRect_.y(), snumXpm_); paint.drawPixmap(pnumRect_.x(), pnumRect_.y(), pnumXpm_); @@ -453,7 +453,7 @@ PlayField::startMoving(MoveSequence *ms) { } void -PlayField::timerEvent(QTimerEvent *) { +PlayField::timerEvent(TQTimerEvent *) { assert(moveInProgress_); if (moveSequence_ == 0) { killTimers(); @@ -559,7 +559,7 @@ PlayField::push(int _x, int _y) { } void -PlayField::keyPressEvent(QKeyEvent * e) { +PlayField::keyPressEvent(TQKeyEvent * e) { int x=levelMap_->xpos(); int y=levelMap_->ypos(); @@ -626,7 +626,7 @@ PlayField::keyPressEvent(QKeyEvent * e) { case Key_S: { - QString buf; + TQString buf; history_->save(buf); printf("%s\n", (char *) buf); } @@ -667,7 +667,7 @@ PlayField::stopDrag() { changeCursor(0); - QPainter paint(this); + TQPainter paint(this); // the following line is a workaround for a bug in Qt 2.0.1 // (and possibly earlier versions) @@ -677,7 +677,7 @@ PlayField::stopDrag() { paintSquare(x, y, paint); paintPainterClip(paint, dragX_, dragY_, size_, size_); - // NOTE: clipping is now activated in the QPainter paint + // NOTE: clipping is now activated in the TQPainter paint dragInProgress_ = false; } @@ -696,7 +696,7 @@ PlayField::dragObject(int xpixel, int ypixel) { void -PlayField::mousePressEvent(QMouseEvent *e) { +PlayField::mousePressEvent(TQMouseEvent *e) { if (!canMoveNow()) return; if (dragInProgress_) { @@ -712,7 +712,7 @@ PlayField::mousePressEvent(QMouseEvent *e) { return; if (e->button() == LeftButton && pathFinder_.canDrag(x, y)) { - QPainter paint(this); + TQPainter paint(this); changeCursor(&sizeAllCursor); if (levelMap_->goal(x, y)) @@ -754,7 +754,7 @@ PlayField::mousePressEvent(QMouseEvent *e) { } void -PlayField::wheelEvent(QWheelEvent *e) { +PlayField::wheelEvent(TQWheelEvent *e) { wheelDelta_ += e->delta(); if (wheelDelta_ >= 120) { @@ -767,23 +767,23 @@ PlayField::wheelEvent(QWheelEvent *e) { } void -PlayField::mouseReleaseEvent(QMouseEvent *e) { +PlayField::mouseReleaseEvent(TQMouseEvent *e) { if (dragInProgress_) dragObject(e->x(), e->y()); } void -PlayField::focusInEvent(QFocusEvent *) { +PlayField::focusInEvent(TQFocusEvent *) { //printf("PlayField::focusInEvent\n"); } void -PlayField::focusOutEvent(QFocusEvent *) { +PlayField::focusOutEvent(TQFocusEvent *) { //printf("PlayField::focusOutEvent\n"); } void -PlayField::leaveEvent(QEvent *) { +PlayField::leaveEvent(TQEvent *) { stopDrag(); } @@ -908,12 +908,12 @@ void PlayField::updateCollectionXpm() { if (collXpm_.isNull()) return; - QPainter paint(&collXpm_); + TQPainter paint(&collXpm_); paint.setBrushOrigin(- collRect_.x(), - collRect_.y()); paint.fillRect(0, 0, collRect_.width(), collRect_.height(), background_); paint.setFont(statusFont_); - paint.setPen(QColor(0,255,0)); + paint.setPen(TQColor(0,255,0)); paint.drawText(0, 0, collRect_.width(), collRect_.height(), AlignLeft, collectionName()); } @@ -922,13 +922,13 @@ void PlayField::updateTextXpm() { if (ltxtXpm_.isNull()) return; - QPainter paint; + TQPainter paint; paint.begin(<xtXpm_); paint.setBrushOrigin(- ltxtRect_.x(), - ltxtRect_.y()); paint.fillRect(0, 0, ltxtRect_.width(), ltxtRect_.height(), background_); paint.setFont(statusFont_); - paint.setPen(QColor(128,128,128)); + paint.setPen(TQColor(128,128,128)); paint.drawText(0, 0, ltxtRect_.width(), ltxtRect_.height(), AlignLeft, levelText_); paint.end(); @@ -936,7 +936,7 @@ PlayField::updateTextXpm() { paint.setBrushOrigin(- stxtRect_.x(), - stxtRect_.y()); paint.fillRect(0, 0, stxtRect_.width(), stxtRect_.height(), background_); paint.setFont(statusFont_); - paint.setPen(QColor(128,128,128)); + paint.setPen(TQColor(128,128,128)); paint.drawText(0, 0, stxtRect_.width(), stxtRect_.height(), AlignLeft, stepsText_); paint.end(); @@ -944,7 +944,7 @@ PlayField::updateTextXpm() { paint.setBrushOrigin(- ptxtRect_.x(), - ptxtRect_.y()); paint.fillRect(0, 0, ptxtRect_.width(), ptxtRect_.height(), background_); paint.setFont(statusFont_); - paint.setPen(QColor(128,128,128)); + paint.setPen(TQColor(128,128,128)); paint.drawText(0, 0, ptxtRect_.width(), ptxtRect_.height(), AlignLeft, pushesText_); paint.end(); } @@ -953,13 +953,13 @@ void PlayField::updateLevelXpm() { if (lnumXpm_.isNull()) return; - QPainter paint(&lnumXpm_); + TQPainter paint(&lnumXpm_); paint.setBrushOrigin(- lnumRect_.x(), - lnumRect_.y()); paint.fillRect(0, 0, lnumRect_.width(), lnumRect_.height(), background_); - QString str; + TQString str; paint.setFont(statusFont_); - paint.setPen(QColor(255,0,0)); + paint.setPen(TQColor(255,0,0)); paint.drawText(0, 0, lnumRect_.width(), lnumRect_.height(), AlignLeft, str.sprintf("%05d", level()+1)); } @@ -968,13 +968,13 @@ void PlayField::updateStepsXpm() { if (snumXpm_.isNull()) return; - QPainter paint(&snumXpm_); + TQPainter paint(&snumXpm_); paint.setBrushOrigin(- snumRect_.x(), - snumRect_.y()); paint.fillRect(0, 0, snumRect_.width(), snumRect_.height(), background_); - QString str; + TQString str; paint.setFont(statusFont_); - paint.setPen(QColor(255,0,0)); + paint.setPen(TQColor(255,0,0)); paint.drawText(0, 0, snumRect_.width(), snumRect_.height(), AlignLeft, str.sprintf("%05d", totalMoves())); } @@ -983,13 +983,13 @@ void PlayField::updatePushesXpm() { if (pnumXpm_.isNull()) return; - QPainter paint(&pnumXpm_); + TQPainter paint(&pnumXpm_); paint.setBrushOrigin(- pnumRect_.x(), - pnumRect_.y()); paint.fillRect(0, 0, pnumRect_.width(), pnumRect_.height(), background_); - QString str; + TQString str; paint.setFont(statusFont_); - paint.setPen(QColor(255,0,0)); + paint.setPen(TQColor(255,0,0)); paint.drawText(0, 0, pnumRect_.width(), pnumRect_.height(), AlignLeft, str.sprintf("%05d", totalPushes())); } diff --git a/ksokoban/PlayField.h b/ksokoban/PlayField.h index 57524ea8..0066442a 100644 --- a/ksokoban/PlayField.h +++ b/ksokoban/PlayField.h @@ -20,13 +20,13 @@ #ifndef PLAYFIELD_H #define PLAYFIELD_H -#include <qwidget.h> -#include <qstring.h> -#include <qfont.h> -#include <qfontmetrics.h> -#include <qpixmap.h> -#include <qimage.h> -#include <qbrush.h> +#include <tqwidget.h> +#include <tqstring.h> +#include <tqfont.h> +#include <tqfontmetrics.h> +#include <tqpixmap.h> +#include <tqimage.h> +#include <tqbrush.h> #include "ImageData.h" #include "LevelMap.h" @@ -41,10 +41,10 @@ class LevelCollection; class QPainter; class QCursor; -class PlayField : public QWidget { +class PlayField : public TQWidget { Q_OBJECT public: - PlayField(QWidget *parent, const char *name=0, WFlags f=0); + PlayField(TQWidget *parent, const char *name=0, WFlags f=0); ~PlayField (); bool canMoveNow(); @@ -57,7 +57,7 @@ public: void goToBookmark(Bookmark *bm); int level() const; - const QString &collectionName(); + const TQString &collectionName(); int totalMoves() const; int totalPushes() const; @@ -87,30 +87,30 @@ protected: bool dragInProgress_; PathFinder pathFinder_; int animDelay_; - const QCursor* cursor_; + const TQCursor* cursor_; void levelChange (); - void paintSquare (int x, int y, QPainter &paint); + void paintSquare (int x, int y, TQPainter &paint); void paintDelta (); - void paintEvent (QPaintEvent *e); - void paintPainterClip(QPainter& paint, int x, int y, int w, int h); - void paintPainter(QPainter& paint, const QRect& rect); - void resizeEvent (QResizeEvent *e); - void mouseMoveEvent(QMouseEvent* e); - void keyPressEvent (QKeyEvent *); - void focusInEvent (QFocusEvent *); - void focusOutEvent (QFocusEvent *); - void mousePressEvent (QMouseEvent *); - void mouseReleaseEvent(QMouseEvent*); - void leaveEvent(QEvent*); - void wheelEvent (QWheelEvent *); + void paintEvent (TQPaintEvent *e); + void paintPainterClip(TQPainter& paint, int x, int y, int w, int h); + void paintPainter(TQPainter& paint, const TQRect& rect); + void resizeEvent (TQResizeEvent *e); + void mouseMoveEvent(TQMouseEvent* e); + void keyPressEvent (TQKeyEvent *); + void focusInEvent (TQFocusEvent *); + void focusOutEvent (TQFocusEvent *); + void mousePressEvent (TQMouseEvent *); + void mouseReleaseEvent(TQMouseEvent*); + void leaveEvent(TQEvent*); + void wheelEvent (TQWheelEvent *); void step (int _x, int _y); void push (int _x, int _y); - virtual void timerEvent (QTimerEvent *); + virtual void timerEvent (TQTimerEvent *); void stopDrag(); void dragObject(int xpixel, int ypixel); void highlight(); - void changeCursor(const QCursor* c); + void changeCursor(const TQCursor* c); void eatKeyPressEvents(); private: @@ -131,18 +131,18 @@ private: void startMoving (MoveSequence *ms); void stopMoving (); - QRect pnumRect_, ptxtRect_, snumRect_, stxtRect_, lnumRect_, ltxtRect_; - QRect collRect_; - - const QString levelText_, stepsText_, pushesText_; - QPixmap pnumXpm_, ptxtXpm_, snumXpm_, stxtXpm_, lnumXpm_, ltxtXpm_; - QPixmap collXpm_; - QPixmap dragXpm_; - QImage dragImage_; - QFont statusFont_; - QFontMetrics statusMetrics_; - QBrush background_; - QBrush floor_; + TQRect pnumRect_, ptxtRect_, snumRect_, stxtRect_, lnumRect_, ltxtRect_; + TQRect collRect_; + + const TQString levelText_, stepsText_, pushesText_; + TQPixmap pnumXpm_, ptxtXpm_, snumXpm_, stxtXpm_, lnumXpm_, ltxtXpm_; + TQPixmap collXpm_; + TQPixmap dragXpm_; + TQImage dragImage_; + TQFont statusFont_; + TQFontMetrics statusMetrics_; + TQBrush background_; + TQBrush floor_; }; diff --git a/ksokoban/main.cpp b/ksokoban/main.cpp index 9c997613..d55c6ce9 100644 --- a/ksokoban/main.cpp +++ b/ksokoban/main.cpp @@ -60,7 +60,7 @@ main (int argc, char **argv) // if (!KUniqueApplication::start()) // return 0; - QApplication::setColorSpec(QApplication::ManyColor); + TQApplication::setColorSpec(TQApplication::ManyColor); // KUniqueApplication app; KApplication app; @@ -76,7 +76,7 @@ main (int argc, char **argv) } args->clear(); - QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); + TQObject::connect(&app, TQT_SIGNAL(lastWindowClosed()), &app, TQT_SLOT(quit())); int rc = app.exec(); |