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 /kshisen/board.cpp | |
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 'kshisen/board.cpp')
-rw-r--r-- | kshisen/board.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/kshisen/board.cpp b/kshisen/board.cpp index ab61a912..ee0d70a7 100644 --- a/kshisen/board.cpp +++ b/kshisen/board.cpp @@ -42,9 +42,9 @@ #include <kglobalsettings.h> #include <kdebug.h> -#include <qpainter.h> -#include <qpaintdevicemetrics.h> -#include <qtimer.h> +#include <tqpainter.h> +#include <tqpaintdevicemetrics.h> +#include <tqtimer.h> #include "board.h" #include "prefs.h" @@ -57,8 +57,8 @@ static int size_x[5] = {14, 18, 24, 26, 30}; static int size_y[5] = { 6, 8, 12, 14, 16}; static int DELAY[5] = {1000, 750, 500, 250, 125}; -Board::Board(QWidget *parent, const char *name) : - QWidget(parent, name, WResizeNoErase), field(0), +Board::Board(TQWidget *parent, const char *name) : + TQWidget(parent, name, WResizeNoErase), field(0), _x_tiles(0), _y_tiles(0), _delay(125), paused(false), gravity_flag(true), _solvable_flag(true), @@ -74,7 +74,7 @@ Board::Board(QWidget *parent, const char *name) : _redo.setAutoDelete(true); _undo.setAutoDelete(true); - QPixmap bg(KGlobal::dirs()->findResource("appdata", "kshisen_bgnd.png")); + TQPixmap bg(KGlobal::dirs()->findResource("appdata", "kshisen_bgnd.png")); setBackgroundPixmap(bg); loadSettings(); @@ -165,7 +165,7 @@ void Board::gravity(int col, bool update) } } -void Board::mousePressEvent(QMouseEvent *e) +void Board::mousePressEvent(TQMouseEvent *e) { // Calculate field position int pos_x = (e->pos().x() - xOffset()) / tiles.tileWidth(); @@ -273,7 +273,7 @@ void Board::setSize(int x, int y) emit changed(); } -void Board::resizeEvent(QResizeEvent*) +void Board::resizeEvent(TQResizeEvent*) { resizeBoard(); emit resized(); @@ -292,11 +292,11 @@ void Board::resizeBoard() tiles.resizeTiles(w, h); } -QSize Board::unscaledSize() const +TQSize Board::unscaledSize() const { int w = tiles.unscaledTileWidth() * x_tiles() + tiles.unscaledTileWidth(); int h = tiles.unscaledTileHeight() * y_tiles() + tiles.unscaledTileWidth(); - return QSize(w, h); + return TQSize(w, h); } void Board::newGame() @@ -439,7 +439,7 @@ bool Board::isTileHighlighted(int x, int y) const void Board::updateField(int x, int y, bool erase) { - QRect r(xOffset() + x * tiles.tileWidth(), + TQRect r(xOffset() + x * tiles.tileWidth(), yOffset() + y * tiles.tileHeight(), tiles.tileWidth(), tiles.tileHeight()); @@ -447,13 +447,13 @@ void Board::updateField(int x, int y, bool erase) repaint(r, erase); } -void Board::paintEvent(QPaintEvent *e) +void Board::paintEvent(TQPaintEvent *e) { - QRect ur = e->rect(); // rectangle to update - QPixmap pm(ur.size()); // Pixmap for double-buffering + TQRect ur = e->rect(); // rectangle to update + TQPixmap pm(ur.size()); // Pixmap for double-buffering pm.fill(this, ur.topLeft()); // fill with widget background - QPainter p(&pm); + TQPainter p(&pm); p.translate(-ur.x(), -ur.y()); // use widget coordinate system if(paused) @@ -475,7 +475,7 @@ void Board::paintEvent(QPaintEvent *e) int xpos = xOffset() + i * w; int ypos = yOffset() + j * h; - QRect r(xpos, ypos, w, h); + TQRect r(xpos, ypos, w, h); if(e->rect().intersects(r)) { if(isTileHighlighted(i, j)) @@ -664,9 +664,9 @@ void Board::drawConnection(int timeout) updateField(connection.front().x, connection.front().y); updateField(connection.back().x, connection.back().y); - QPainter p; + TQPainter p; p.begin(this); - p.setPen(QPen(QColor("red"), tiles.lineWidth())); + p.setPen(TQPen(TQColor("red"), tiles.lineWidth())); // Path.size() will always be >= 2 Path::const_iterator pathEnd = connection.end(); @@ -683,7 +683,7 @@ void Board::drawConnection(int timeout) p.flush(); p.end(); - QTimer::singleShot(timeout, this, SLOT(undrawConnection())); + TQTimer::singleShot(timeout, this, TQT_SLOT(undrawConnection())); } void Board::undrawConnection() @@ -735,9 +735,9 @@ void Board::undrawConnection() } } -QPoint Board::midCoord(int x, int y) const +TQPoint Board::midCoord(int x, int y) const { - QPoint p; + TQPoint p; int w = tiles.tileWidth(); int h = tiles.tileHeight(); @@ -893,14 +893,14 @@ void Board::dumpBoard() const kdDebug() << "Board contents:" << endl; for(int y = 0; y < y_tiles(); ++y) { - QString row; + TQString row; for(int x = 0; x < x_tiles(); ++x) { int tile = getField(x, y); if(tile == EMPTY) row += " --"; else - row += QString("%1").arg(getField(x, y), 3); + row += TQString("%1").arg(getField(x, y), 3); } kdDebug() << row << endl; } @@ -1071,12 +1071,12 @@ bool Board::pause() return paused; } -QSize Board::sizeHint() const +TQSize Board::sizeHint() const { - int dpi = QPaintDeviceMetrics(this).logicalDpiX(); + int dpi = TQPaintDeviceMetrics(this).logicalDpiX(); if (dpi < 75) dpi = 75; - return QSize(9*dpi,7*dpi); + return TQSize(9*dpi,7*dpi); } #include "board.moc" |