diff options
Diffstat (limited to 'kreversi/board.cpp')
-rw-r--r-- | kreversi/board.cpp | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/kreversi/board.cpp b/kreversi/board.cpp index e0324ebd..b3f75663 100644 --- a/kreversi/board.cpp +++ b/kreversi/board.cpp @@ -36,7 +36,6 @@ ******************************************************************* */ - #include <unistd.h> #include <tqpainter.h> @@ -72,8 +71,8 @@ const uint CHIP_SIZE = 36; // class KReversiBoardView -QReversiBoardView::QReversiBoardView(TQWidget *parent, QReversiGame *krgame) - : TQWidget(parent, "board"), +TQReversiBoardView::TQReversiBoardView(TQWidget *tqparent, TQReversiGame *krgame) + : TQWidget(tqparent, "board"), chiptype(Unloaded) { m_krgame = krgame; @@ -87,7 +86,7 @@ QReversiBoardView::QReversiBoardView(TQWidget *parent, QReversiGame *krgame) } -QReversiBoardView::~QReversiBoardView() +TQReversiBoardView::~TQReversiBoardView() { } @@ -98,14 +97,14 @@ QReversiBoardView::~QReversiBoardView() // Start it all up. // -void QReversiBoardView::start() +void TQReversiBoardView::start() { updateBoard(true); adjustSize(); } -void QReversiBoardView::loadChips(ChipType type) +void TQReversiBoardView::loadChips(ChipType type) { TQString name("pics/"); name += (type==Colored ? "chips.png" : "chips_mono.png"); @@ -124,7 +123,7 @@ void QReversiBoardView::loadChips(ChipType type) // no animations are displayed. // -void QReversiBoardView::setAnimationSpeed(uint speed) +void TQReversiBoardView::setAnimationSpeed(uint speed) { if (speed <= 10) anim_speed = speed; @@ -134,10 +133,10 @@ void QReversiBoardView::setAnimationSpeed(uint speed) // Handle mouse clicks. // -void QReversiBoardView::mousePressEvent(TQMouseEvent *e) +void TQReversiBoardView::mousePressEvent(TQMouseEvent *e) { // Only handle left button. No context menu. - if ( e->button() != LeftButton ) { + if ( e->button() != Qt::LeftButton ) { e->ignore(); return; } @@ -156,7 +155,7 @@ void QReversiBoardView::mousePressEvent(TQMouseEvent *e) } -void QReversiBoardView::showHint(Move move) +void TQReversiBoardView::showHint(Move move) { // Only show a hint if there is a move to show. if (move.x() == -1) @@ -186,7 +185,7 @@ void QReversiBoardView::showHint(Move move) // keep GUI alive while waiting for (int dummy = 0; dummy < 5; dummy++) { usleep(HINT_BLINKRATE / 5); - qApp->processEvents(); + tqApp->processEvents(); } } m_hintShowing = false; @@ -202,26 +201,26 @@ void QReversiBoardView::showHint(Move move) // end, if it is running. // -void QReversiBoardView::quitHint() +void TQReversiBoardView::quitHint() { m_hintShowing = false; } -void QReversiBoardView::setShowLegalMoves(bool show) +void TQReversiBoardView::setShowLegalMoves(bool show) { m_legalMovesShowing = show; updateBoard(true); } -void QReversiBoardView::setShowMarks(bool show) +void TQReversiBoardView::setShowMarks(bool show) { m_marksShowing = show; updateBoard(true); } -void QReversiBoardView::setShowLastMove(bool show) +void TQReversiBoardView::setShowLastMove(bool show) { m_showLastMove = show; updateBoard(true); @@ -237,7 +236,7 @@ void QReversiBoardView::setShowLastMove(bool show) // NOTE: This code is quite a hack. Should make it better. // -void QReversiBoardView::animateChanged(Move move) +void TQReversiBoardView::animateChanged(Move move) { if (anim_speed == 0) return; @@ -253,13 +252,13 @@ void QReversiBoardView::animateChanged(Move move) } -bool QReversiBoardView::isField(int row, int col) const +bool TQReversiBoardView::isField(int row, int col) const { return ((0 <= row) && (row < 8) && (0 <= col) && (col < 8)); } -void QReversiBoardView::animateChangedRow(int row, int col, int dy, int dx) +void TQReversiBoardView::animateChangedRow(int row, int col, int dy, int dx) { row = row + dy; col = col + dx; @@ -276,7 +275,7 @@ void QReversiBoardView::animateChangedRow(int row, int col, int dy, int dx) } -void QReversiBoardView::rotateChip(uint row, uint col) +void TQReversiBoardView::rotateChip(uint row, uint col) { // Check which direction the chip has to be rotated. If the new // chip is white, the chip was black first, so lets begin at index @@ -302,16 +301,16 @@ void QReversiBoardView::rotateChip(uint row, uint col) // m_krgame->squareModified(col, row)). // -void QReversiBoardView::updateBoard (bool force) +void TQReversiBoardView::updateBoard (bool force) { TQPainter p(this); p.setPen(black); // If we are showing legal moves, we have to erase the old ones // before we can show the new ones. The easiest way to do that is - // to repaint everything. + // to tqrepaint everything. // - // FIXME: A better way, perhaps, is to do the repainting in + // FIXME: A better way, perhaps, is to do the tqrepainting in // drawPiece (which should be renamed drawSquare). if (m_legalMovesShowing) force = true; @@ -403,7 +402,7 @@ void QReversiBoardView::updateBoard (bool force) // Show legal moves on the board. -void QReversiBoardView::showLegalMoves() +void TQReversiBoardView::showLegalMoves() { TQPainter p(this); p.setPen(black); @@ -419,7 +418,7 @@ void QReversiBoardView::showLegalMoves() } -void QReversiBoardView::drawSmallCircle(int x, int y, TQPainter &p) +void TQReversiBoardView::drawSmallCircle(int x, int y, TQPainter &p) { int offset = m_marksShowing ? OFFSET() : 0; int ellipseSize = zoomedSize() / 3; @@ -433,7 +432,7 @@ void QReversiBoardView::drawSmallCircle(int x, int y, TQPainter &p) -TQPixmap QReversiBoardView::chipPixmap(Color color, uint size) const +TQPixmap TQReversiBoardView::chipPixmap(Color color, uint size) const { return chipPixmap(CHIP_OFFSET[color], size); } @@ -442,7 +441,7 @@ TQPixmap QReversiBoardView::chipPixmap(Color color, uint size) const // Get a pixmap for the chip 'i' at size 'size'. // -TQPixmap QReversiBoardView::chipPixmap(uint i, uint size) const +TQPixmap TQReversiBoardView::chipPixmap(uint i, uint size) const { // Get the part of the 'allchips' pixmap that contains exactly that // chip that we want to use. @@ -458,20 +457,20 @@ TQPixmap QReversiBoardView::chipPixmap(uint i, uint size) const } -uint QReversiBoardView::zoomedSize() const +uint TQReversiBoardView::zoomedSize() const { - return qRound(float(CHIP_SIZE) * Prefs::zoom() / 100); + return tqRound(float(CHIP_SIZE) * Prefs::zoom() / 100); } -void QReversiBoardView::drawPiece(uint row, uint col, Color color) +void TQReversiBoardView::drawPiece(uint row, uint col, Color color) { int i = (color == Nobody ? -1 : int(CHIP_OFFSET[color])); drawOnePiece(row, col, i); } -void QReversiBoardView::drawOnePiece(uint row, uint col, int i) +void TQReversiBoardView::drawOnePiece(uint row, uint col, int i) { int px = col * zoomedSize() + 1; int py = row * zoomedSize() + 1; @@ -499,17 +498,17 @@ void QReversiBoardView::drawOnePiece(uint row, uint col, int i) } -// We got a repaint event. We make it easy for us and redraw the +// We got a tqrepaint event. We make it easy for us and redraw the // entire board. // -void QReversiBoardView::paintEvent(TQPaintEvent *) +void TQReversiBoardView::paintEvent(TQPaintEvent *) { updateBoard(true); } -void QReversiBoardView::adjustSize() +void TQReversiBoardView::adjustSize() { int w = 8 * zoomedSize(); @@ -520,7 +519,7 @@ void QReversiBoardView::adjustSize() } -void QReversiBoardView::setPixmap(TQPixmap &pm) +void TQReversiBoardView::setPixmap(TQPixmap &pm) { if ( pm.width() == 0 ) return; @@ -531,7 +530,7 @@ void QReversiBoardView::setPixmap(TQPixmap &pm) } -void QReversiBoardView::setColor(const TQColor &c) +void TQReversiBoardView::setColor(const TQColor &c) { bgColor = c; bg = TQPixmap(); @@ -543,7 +542,7 @@ void QReversiBoardView::setColor(const TQColor &c) // Load all settings that have to do with the board view, such as // piece colors, background, animation speed, an so on. -void QReversiBoardView::loadSettings() +void TQReversiBoardView::loadSettings() { // Colors of the pieces (red/blue or black/white) if ( Prefs::grayscale() ) { |