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 /kreversi/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 'kreversi/board.cpp')
-rw-r--r-- | kreversi/board.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/kreversi/board.cpp b/kreversi/board.cpp index 9d367a38..e0324ebd 100644 --- a/kreversi/board.cpp +++ b/kreversi/board.cpp @@ -39,8 +39,8 @@ #include <unistd.h> -#include <qpainter.h> -#include <qfont.h> +#include <tqpainter.h> +#include <tqfont.h> #include <kapplication.h> #include <kstandarddirs.h> @@ -57,7 +57,7 @@ #ifndef PICDATA -#define PICDATA(x) KGlobal::dirs()->findResource("appdata", QString("pics/")+ x) +#define PICDATA(x) KGlobal::dirs()->findResource("appdata", TQString("pics/")+ x) #endif const uint HINT_BLINKRATE = 250000; @@ -72,8 +72,8 @@ const uint CHIP_SIZE = 36; // class KReversiBoardView -QReversiBoardView::QReversiBoardView(QWidget *parent, QReversiGame *krgame) - : QWidget(parent, "board"), +QReversiBoardView::QReversiBoardView(TQWidget *parent, QReversiGame *krgame) + : TQWidget(parent, "board"), chiptype(Unloaded) { m_krgame = krgame; @@ -107,10 +107,10 @@ void QReversiBoardView::start() void QReversiBoardView::loadChips(ChipType type) { - QString name("pics/"); + TQString name("pics/"); name += (type==Colored ? "chips.png" : "chips_mono.png"); - QString s = KGlobal::dirs()->findResource("appdata", name); + TQString s = KGlobal::dirs()->findResource("appdata", name); bool ok = allchips.load(s); Q_ASSERT( ok && allchips.width()==CHIP_SIZE*5 @@ -134,7 +134,7 @@ void QReversiBoardView::setAnimationSpeed(uint speed) // Handle mouse clicks. // -void QReversiBoardView::mousePressEvent(QMouseEvent *e) +void QReversiBoardView::mousePressEvent(TQMouseEvent *e) { // Only handle left button. No context menu. if ( e->button() != LeftButton ) { @@ -167,7 +167,7 @@ void QReversiBoardView::showHint(Move move) // The isVisible condition has been added so that when the player // was viewing a hint and quits the game window, the game doesn't // still have to do all this looping and directly ends. - QPainter p(this); + TQPainter p(this); p.setPen(black); m_hintShowing = true; for (int flash = 0; @@ -291,7 +291,7 @@ void QReversiBoardView::rotateChip(uint row, uint col) for (uint i = from; i != end; i += delta) { drawOnePiece(row, col, i); - kapp->flushX(); // FIXME: use QCanvas to avoid flicker... + kapp->flushX(); // FIXME: use TQCanvas to avoid flicker... usleep(ANIMATION_DELAY * anim_speed); } } @@ -304,7 +304,7 @@ void QReversiBoardView::rotateChip(uint row, uint col) void QReversiBoardView::updateBoard (bool force) { - QPainter p(this); + TQPainter p(this); p.setPen(black); // If we are showing legal moves, we have to erase the old ones @@ -331,32 +331,32 @@ void QReversiBoardView::updateBoard (bool force) // Draw letters and numbers if appropriate. if (m_marksShowing) { - QFont font("Sans Serif", zoomedSize() / 2 - 6); - font.setWeight(QFont::DemiBold); - QFontMetrics metrics(font); + TQFont font("Sans Serif", zoomedSize() / 2 - 6); + font.setWeight(TQFont::DemiBold); + TQFontMetrics metrics(font); p.setFont(font); uint charHeight = metrics.ascent(); for (uint i = 0; i < 8; i++) { - QChar letter = "ABCDEFGH"[i]; - QChar number = "12345678"[i]; + TQChar letter = "ABCDEFGH"[i]; + TQChar number = "12345678"[i]; uint charWidth = metrics.charWidth("ABCDEFGH", i); // The horizontal letters p.drawText(offset + i * zoomedSize() + (zoomedSize() - charWidth) / 2, offset - charHeight / 2 + 2, - QString(letter)); + TQString(letter)); p.drawText(offset + i * zoomedSize() + (zoomedSize() - charWidth) / 2, offset + 8 * zoomedSize() + offset - charHeight / 2 + 2, - QString(letter)); + TQString(letter)); // The vertical numbers p.drawText((offset - charWidth) / 2 + 2, offset + (i + 1) * zoomedSize() - charHeight / 2 + 2, - QString(number)); + TQString(number)); p.drawText(offset + 8 * zoomedSize() + (offset - charWidth) / 2 + 2, offset + (i + 1) * zoomedSize() - charHeight / 2 + 2, - QString(number)); + TQString(number)); } } @@ -405,7 +405,7 @@ void QReversiBoardView::updateBoard (bool force) void QReversiBoardView::showLegalMoves() { - QPainter p(this); + TQPainter p(this); p.setPen(black); // Get the legal moves in the current position. @@ -419,7 +419,7 @@ void QReversiBoardView::showLegalMoves() } -void QReversiBoardView::drawSmallCircle(int x, int y, QPainter &p) +void QReversiBoardView::drawSmallCircle(int x, int y, TQPainter &p) { int offset = m_marksShowing ? OFFSET() : 0; int ellipseSize = zoomedSize() / 3; @@ -433,7 +433,7 @@ void QReversiBoardView::drawSmallCircle(int x, int y, QPainter &p) -QPixmap QReversiBoardView::chipPixmap(Color color, uint size) const +TQPixmap QReversiBoardView::chipPixmap(Color color, uint size) const { return chipPixmap(CHIP_OFFSET[color], size); } @@ -442,16 +442,16 @@ QPixmap QReversiBoardView::chipPixmap(Color color, uint size) const // Get a pixmap for the chip 'i' at size 'size'. // -QPixmap QReversiBoardView::chipPixmap(uint i, uint size) const +TQPixmap QReversiBoardView::chipPixmap(uint i, uint size) const { // Get the part of the 'allchips' pixmap that contains exactly that // chip that we want to use. - QPixmap pix(CHIP_SIZE, CHIP_SIZE); + TQPixmap pix(CHIP_SIZE, CHIP_SIZE); copyBlt(&pix, 0, 0, &allchips, (i%5) * CHIP_SIZE, (i/5) * CHIP_SIZE, CHIP_SIZE, CHIP_SIZE); // Resize (scale) the pixmap to the desired size. - QWMatrix wm3; + TQWMatrix wm3; wm3.scale(float(size)/CHIP_SIZE, float(size)/CHIP_SIZE); return pix.xForm(wm3); @@ -475,7 +475,7 @@ void QReversiBoardView::drawOnePiece(uint row, uint col, int i) { int px = col * zoomedSize() + 1; int py = row * zoomedSize() + 1; - QPainter p(this); + TQPainter p(this); // Draw either a background pixmap or a background color to the square. int offset = m_marksShowing ? OFFSET() : 0; @@ -503,7 +503,7 @@ void QReversiBoardView::drawOnePiece(uint row, uint col, int i) // entire board. // -void QReversiBoardView::paintEvent(QPaintEvent *) +void QReversiBoardView::paintEvent(TQPaintEvent *) { updateBoard(true); } @@ -520,7 +520,7 @@ void QReversiBoardView::adjustSize() } -void QReversiBoardView::setPixmap(QPixmap &pm) +void QReversiBoardView::setPixmap(TQPixmap &pm) { if ( pm.width() == 0 ) return; @@ -531,10 +531,10 @@ void QReversiBoardView::setPixmap(QPixmap &pm) } -void QReversiBoardView::setColor(const QColor &c) +void QReversiBoardView::setColor(const TQColor &c) { bgColor = c; - bg = QPixmap(); + bg = TQPixmap(); update(); setEraseColor(c); } @@ -563,7 +563,7 @@ void QReversiBoardView::loadSettings() // Background if ( Prefs::backgroundImageChoice() ) { - QPixmap pm( Prefs::backgroundImage() ); + TQPixmap pm( Prefs::backgroundImage() ); if (!pm.isNull()) setPixmap(pm); } else { |