From 838baf3f99ec5ab81b063eb5449a3381d860f377 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 11 Jun 2011 04:58:26 +0000 Subject: 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 --- kreversi/DESIGN | 4 +-- kreversi/Engine.cpp | 2 +- kreversi/Move.cpp | 4 +-- kreversi/board.cpp | 71 +++++++++++++++++++-------------------- kreversi/board.h | 11 +++--- kreversi/highscores.cpp | 6 ++-- kreversi/kreversi.cpp | 58 ++++++++++++++++---------------- kreversi/kreversi.h | 5 +-- kreversi/kzoommainwindow.cpp | 10 +++--- kreversi/kzoommainwindow.h | 3 +- kreversi/qreversigame.cpp | 14 ++++---- kreversi/qreversigame.h | 13 ++++---- kreversi/qreversigameview.cpp | 78 +++++++++++++++++++++---------------------- kreversi/qreversigameview.h | 30 +++++++++-------- kreversi/settings.ui | 54 +++++++++++++++--------------- 15 files changed, 184 insertions(+), 179 deletions(-) (limited to 'kreversi') diff --git a/kreversi/DESIGN b/kreversi/DESIGN index d2a13202..08c329fd 100644 --- a/kreversi/DESIGN +++ b/kreversi/DESIGN @@ -71,9 +71,9 @@ Engine QReversiGame The "document" for KReversi. - Handles a game being played and sends signals to all its views + Handles a game being played and sends Q_SIGNALS to all its views when something changes. Basically, the only difference between - this class and the more basic ReversiGame is that it sends signals + this class and the more basic ReversiGame is that it sends Q_SIGNALS to the views. Inherits: ReversiGame The actual game being played diff --git a/kreversi/Engine.cpp b/kreversi/Engine.cpp index c675b5b2..ce86b6bd 100644 --- a/kreversi/Engine.cpp +++ b/kreversi/Engine.cpp @@ -290,7 +290,7 @@ Engine::Engine() : SuperEngine(1) // keep GUI alive void Engine::yield() { - qApp->processEvents(); + tqApp->processEvents(); } diff --git a/kreversi/Move.cpp b/kreversi/Move.cpp index 3916925e..14a03577 100644 --- a/kreversi/Move.cpp +++ b/kreversi/Move.cpp @@ -66,7 +66,7 @@ TQString SimpleMove::asString() const if (m_x == -1) return TQString("pass"); else - return TQString("%1%2").arg(" ABCDEFGH"[m_x]).arg(" 12345678"[m_y]); + return TQString("%1%2").tqarg(" ABCDEFGH"[m_x]).tqarg(" 12345678"[m_y]); } @@ -114,5 +114,5 @@ bool Move::wasTurned(uint x, uint y) const { // findIndex returns the first index where the item is found, or -1 // if not found. - return (m_turnedPieces.findIndex(10 * x + y) != -1); + return (m_turnedPieces.tqfindIndex(10 * x + y) != -1); } 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 #include @@ -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() ) { diff --git a/kreversi/board.h b/kreversi/board.h index f5efc739..59c9463c 100644 --- a/kreversi/board.h +++ b/kreversi/board.h @@ -49,18 +49,19 @@ class KConfig; -class QReversiGame; +class TQReversiGame; // The class Board is the visible Reversi Board widget. // -class QReversiBoardView : public TQWidget { +class TQReversiBoardView : public TQWidget { Q_OBJECT + TQ_OBJECT public: - QReversiBoardView(TQWidget *parent, QReversiGame *game); - ~QReversiBoardView(); + TQReversiBoardView(TQWidget *tqparent, TQReversiGame *game); + ~TQReversiBoardView(); // starts all: emits some signal, so it can't be called from // constructor @@ -124,7 +125,7 @@ private: private: - QReversiGame *m_krgame; // Pointer to the game object (not owner). + TQReversiGame *m_krgame; // Pointer to the game object (not owner). // The background of the board - a color and a pixmap. TQColor bgColor; diff --git a/kreversi/highscores.cpp b/kreversi/highscores.cpp index 1da40d26..2c089975 100644 --- a/kreversi/highscores.cpp +++ b/kreversi/highscores.cpp @@ -61,7 +61,7 @@ TQString ExtManager::gameTypeLabel(uint gameType, LabelType type) const case WW: break; } - return TQString::null; + return TQString(); } @@ -79,7 +79,7 @@ void ExtManager::convertLegacy(uint gameType) for (uint i = 1; i <= 10; i++) { TQString key = "Pos" + TQString::number(i); - TQString name = cg.config()->readEntry(key + "Name", TQString::null); + TQString name = cg.config()->readEntry(key + "Name", TQString()); if ( name.isEmpty() ) name = i18n("anonymous"); @@ -88,7 +88,7 @@ void ExtManager::convertLegacy(uint gameType) if ( score==0 ) continue; - TQString sdate = cg.config()->readEntry(key + "Date", TQString::null); + TQString sdate = cg.config()->readEntry(key + "Date", TQString()); TQDateTime date = TQDateTime::fromString(sdate); Score s(Won); diff --git a/kreversi/kreversi.cpp b/kreversi/kreversi.cpp index d01c2f6e..0305dda9 100644 --- a/kreversi/kreversi.cpp +++ b/kreversi/kreversi.cpp @@ -88,7 +88,7 @@ KReversi::KReversi() KNotifyClient::startDaemon(); // The game. - m_game = new QReversiGame(); + m_game = new TQReversiGame(); m_cheating = false; m_gameOver = false; m_humanColor = Black; @@ -104,7 +104,7 @@ KReversi::KReversi() top = new TQGridLayout(w, 2, 2); // The reversi game view. - m_gameView = new QReversiGameView(w, m_game); + m_gameView = new TQReversiGameView(w, m_game); top->addMultiCellWidget(m_gameView, 0, 1, 0, 0); // Populate the GUI. @@ -116,15 +116,15 @@ KReversi::KReversi() // The only part of the view that is left in this class is the // indicator of whose turn it is in the status bar. The rest is // in the game view. - connect(m_game, TQT_SIGNAL(sig_newGame()), this, TQT_SLOT(showTurn())); + connect(m_game, TQT_SIGNAL(sig_newGame()), TQT_TQOBJECT(this), TQT_SLOT(showTurn())); connect(m_game, TQT_SIGNAL(sig_move(uint, Move&)), - this, TQT_SLOT(handleMove(uint, Move&))); // Calls showTurn(). - connect(m_game, TQT_SIGNAL(sig_update()), this, TQT_SLOT(showTurn())); - connect(m_game, TQT_SIGNAL(sig_gameOver()), this, TQT_SLOT(slotGameOver())); + TQT_TQOBJECT(this), TQT_SLOT(handleMove(uint, Move&))); // Calls showTurn(). + connect(m_game, TQT_SIGNAL(sig_update()), TQT_TQOBJECT(this), TQT_SLOT(showTurn())); + connect(m_game, TQT_SIGNAL(sig_gameOver()), TQT_TQOBJECT(this), TQT_SLOT(slotGameOver())); // Signal that is sent when the user clicks on the board. connect(m_gameView, TQT_SIGNAL(signalSquareClicked(int, int)), - this, TQT_SLOT(slotSquareClicked(int, int))); + TQT_TQOBJECT(this), TQT_SLOT(slotSquareClicked(int, int))); loadSettings(); @@ -150,38 +150,38 @@ KReversi::~KReversi() void KReversi::createKActions() { // Standard Game Actions. - KStdGameAction::gameNew(this, TQT_SLOT(slotNewGame()), actionCollection(), + KStdGameAction::gameNew(TQT_TQOBJECT(this), TQT_SLOT(slotNewGame()), actionCollection(), "game_new"); - KStdGameAction::load(this, TQT_SLOT(slotOpenGame()), actionCollection()); - KStdGameAction::save(this, TQT_SLOT(slotSave()), actionCollection()); - KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection()); - KStdGameAction::hint(this, TQT_SLOT(slotHint()), actionCollection(), + KStdGameAction::load(TQT_TQOBJECT(this), TQT_SLOT(slotOpenGame()), actionCollection()); + KStdGameAction::save(TQT_TQOBJECT(this), TQT_SLOT(slotSave()), actionCollection()); + KStdGameAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection()); + KStdGameAction::hint(TQT_TQOBJECT(this), TQT_SLOT(slotHint()), actionCollection(), "game_hint"); - KStdGameAction::undo(this, TQT_SLOT(slotUndo()), actionCollection(), + KStdGameAction::undo(TQT_TQOBJECT(this), TQT_SLOT(slotUndo()), actionCollection(), "game_undo"); // Non-standard Game Actions: Stop, Continue, Switch sides - stopAction = new KAction(i18n("&Stop Thinking"), "game_stop", Qt::Key_Escape, - this, TQT_SLOT(slotInterrupt()), actionCollection(), + stopAction = new KAction(i18n("&Stop Thinking"), "game_stop", TQt::Key_Escape, + TQT_TQOBJECT(this), TQT_SLOT(slotInterrupt()), actionCollection(), "game_stop"); continueAction = new KAction(i18n("&Continue Thinking"), "reload", 0, - this, TQT_SLOT(slotContinue()), actionCollection(), + TQT_TQOBJECT(this), TQT_SLOT(slotContinue()), actionCollection(), "game_continue"); new KAction(i18n("S&witch Sides"), 0, 0, - this, TQT_SLOT(slotSwitchSides()), actionCollection(), + TQT_TQOBJECT(this), TQT_SLOT(slotSwitchSides()), actionCollection(), "game_switch_sides"); // Some more standard game actions: Highscores, Settings. - KStdGameAction::highscores(this, TQT_SLOT(showHighScoreDialog()), actionCollection()); - KStdAction::preferences(this, TQT_SLOT(slotEditSettings()), actionCollection()); + KStdGameAction::highscores(TQT_TQOBJECT(this), TQT_SLOT(showHighScoreDialog()), actionCollection()); + KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(slotEditSettings()), actionCollection()); // Actions for the view(s). showLastMoveAction = new KToggleAction(i18n("Show Last Move"), "lastmoves", 0, - this, TQT_SLOT(slotShowLastMove()), + TQT_TQOBJECT(this), TQT_SLOT(slotShowLastMove()), actionCollection(), "show_last_move"); showLegalMovesAction = new KToggleAction(i18n("Show Legal Moves"), "legalmoves", 0, - this, TQT_SLOT(slotShowLegalMoves()), + TQT_TQOBJECT(this), TQT_SLOT(slotShowLegalMoves()), actionCollection(), "show_legal_moves"); } @@ -200,7 +200,7 @@ void KReversi::setStrength(uint strength) // FIXME: 7 should be MAXSTRENGTH or something similar. Q_ASSERT( 1 <= strength && strength <= 7 ); - strength = QMAX(QMIN(strength, 7), 1); + strength = TQMAX(TQMIN(strength, 7), 1); m_engine->setStrength(strength); if (m_lowestStrength < strength) m_lowestStrength = strength; @@ -329,9 +329,9 @@ void KReversi::slotUndo() } if (m_game->toMove() == computerColor()) { - // Must repaint so that the new move is not shown before the old + // Must tqrepaint so that the new move is not shown before the old // one is removed on the screen. - m_gameView->repaint(); + m_gameView->tqrepaint(); computerMakeMove(); } else @@ -392,7 +392,7 @@ void KReversi::slotSwitchSides() if (m_game->moveNumber() != 0) { int res = KMessageBox::warningContinueCancel(this, i18n("If you switch side, your score will not be added to the highscores."), - TQString::null, TQString::null, "switch_side_warning"); + TQString(), TQString(), "switch_side_warning"); if ( res==KMessageBox::Cancel ) return; @@ -609,21 +609,21 @@ void KReversi::showGameOver(Color color) if ( color == Nobody ) { KNotifyClient::event(winId(), "draw", i18n("Draw!")); TQString s = i18n("Game is drawn!\n\nYou : %1\nComputer: %2") - .arg(human).arg(computer); + .tqarg(human).tqarg(computer); KMessageBox::information(this, s, i18n("Game Ended")); score.setType(KExtHighscore::Draw); } else if ( humanColor() == color ) { KNotifyClient::event(winId(), "won", i18n("Game won!")); TQString s = i18n("Congratulations, you have won!\n\nYou : %1\nComputer: %2") - .arg(human).arg(computer); + .tqarg(human).tqarg(computer); KMessageBox::information(this, s, i18n("Game Ended")); score.setType(KExtHighscore::Won); } else { KNotifyClient::event(winId(), "lost", i18n("Game lost!")); TQString s = i18n("You have lost the game!\n\nYou : %1\nComputer: %2") - .arg(human).arg(computer); + .tqarg(human).tqarg(computer); KMessageBox::information(this, s, i18n("Game Ended")); score.setType(KExtHighscore::Lost); } @@ -755,7 +755,7 @@ void KReversi::slotEditSettings() Settings *general = new Settings(0, "General"); dialog->addPage(general, i18n("General"), "package_settings"); - connect(dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(loadSettings())); + connect(dialog, TQT_SIGNAL(settingsChanged()), TQT_TQOBJECT(this), TQT_SLOT(loadSettings())); dialog->show(); } diff --git a/kreversi/kreversi.h b/kreversi/kreversi.h index f8ea3bb6..1be7069d 100644 --- a/kreversi/kreversi.h +++ b/kreversi/kreversi.h @@ -59,6 +59,7 @@ class KAction; class KReversi : public KZoomMainWindow { Q_OBJECT + TQ_OBJECT public: @@ -157,7 +158,7 @@ private: KToggleAction *showLegalMovesAction; // The game itself and game properties - QReversiGame *m_game; // The main document - the game + TQReversiGame *m_game; // The main document - the game Color m_humanColor; // The Color of the human player. bool m_gameOver; // True if the game is over @@ -170,7 +171,7 @@ private: Engine *m_engine; // The AI that creates the computers moves. // Widgets - QReversiGameView *m_gameView; // The board widget. + TQReversiGameView *m_gameView; // The board widget. }; diff --git a/kreversi/kzoommainwindow.cpp b/kreversi/kzoommainwindow.cpp index 56f46742..dc2820fe 100644 --- a/kreversi/kzoommainwindow.cpp +++ b/kreversi/kzoommainwindow.cpp @@ -34,11 +34,11 @@ KZoomMainWindow::KZoomMainWindow(uint min, uint max, uint step, installEventFilter(this); m_zoomInAction = - KStdAction::zoomIn(this, TQT_SLOT(zoomIn()), actionCollection()); + KStdAction::zoomIn(TQT_TQOBJECT(this), TQT_SLOT(zoomIn()), actionCollection()); m_zoomOutAction = - KStdAction::zoomOut(this, TQT_SLOT(zoomOut()), actionCollection()); + KStdAction::zoomOut(TQT_TQOBJECT(this), TQT_SLOT(zoomOut()), actionCollection()); m_menu = - KStdAction::showMenubar(this, TQT_SLOT(toggleMenubar()), actionCollection()); + KStdAction::showMenubar(TQT_TQOBJECT(this), TQT_SLOT(toggleMenubar()), actionCollection()); } @@ -65,7 +65,7 @@ void KZoomMainWindow::addWidget(TQWidget *widget) { widget->adjustSize(); - TQWidget *tlw = widget->topLevelWidget(); + TQWidget *tlw = widget->tqtopLevelWidget(); KZoomMainWindow *zm = static_cast(tlw->qt_cast("KZoomMainWindow")); @@ -84,7 +84,7 @@ void KZoomMainWindow::widgetDestroyed() bool KZoomMainWindow::eventFilter(TQObject *o, TQEvent *e) { if ( e->type()==TQEvent::LayoutHint ) - setFixedSize(minimumSize()); // because K/QMainWindow + setFixedSize(tqminimumSize()); // because K/TQMainWindow // does not manage fixed central widget // with hidden menubar... return KMainWindow::eventFilter(o, e); diff --git a/kreversi/kzoommainwindow.h b/kreversi/kzoommainwindow.h index 73acd539..a27b61a4 100644 --- a/kreversi/kzoommainwindow.h +++ b/kreversi/kzoommainwindow.h @@ -47,6 +47,7 @@ class KToggleAction; class KZoomMainWindow : public KMainWindow { Q_OBJECT + TQ_OBJECT public: /** Constructor. */ KZoomMainWindow(uint minZoom, uint maxZoom, uint zoomStep, @@ -54,7 +55,7 @@ public: /** Add a widget to be managed i.e. the adjustSize() method of the * widget is called whenever the zoom is changed. - * This function assumes that the topLevelWidget() is the KZoomMainWindow. + * This function assumes that the tqtopLevelWidget() is the KZoomMainWindow. */ static void addWidget(TQWidget *widget); diff --git a/kreversi/qreversigame.cpp b/kreversi/qreversigame.cpp index 3e940ca2..d126789a 100644 --- a/kreversi/qreversigame.cpp +++ b/kreversi/qreversigame.cpp @@ -41,21 +41,21 @@ // ================================================================ -// class QReversiGame +// class TQReversiGame -QReversiGame::QReversiGame(TQObject *parent) - : TQObject(parent), Game() +TQReversiGame::TQReversiGame(TQObject *tqparent) + : TQObject(tqparent), Game() { } -QReversiGame::~QReversiGame() +TQReversiGame::~TQReversiGame() { } -void QReversiGame::newGame() +void TQReversiGame::newGame() { Game::newGame(); @@ -63,7 +63,7 @@ void QReversiGame::newGame() } -bool QReversiGame::doMove(Move move) +bool TQReversiGame::doMove(Move move) { bool retval = Game::doMove(move); if (!retval) @@ -78,7 +78,7 @@ bool QReversiGame::doMove(Move move) } -bool QReversiGame::undoMove() +bool TQReversiGame::undoMove() { bool retval = Game::undoMove(); diff --git a/kreversi/qreversigame.h b/kreversi/qreversigame.h index b4dcb19b..875d2c07 100644 --- a/kreversi/qreversigame.h +++ b/kreversi/qreversigame.h @@ -36,8 +36,8 @@ ******************************************************************* */ -#ifndef __QREVERSIGAME__H__ -#define __QREVERSIGAME__H__ +#ifndef __TQREVERSIGAME__H__ +#define __TQREVERSIGAME__H__ #include #include @@ -52,7 +52,7 @@ class KConfig; // The main document class in the reversi program. The thing that -// makes this a QReversiGame instead of just a ReversiGame is that it +// makes this a TQReversiGame instead of just a ReversiGame is that it // emits signals that can be used to update a view. // // Signals: @@ -62,12 +62,13 @@ class KConfig; // gameOver() // -class QReversiGame : public TQObject, public Game { +class TQReversiGame : public TQObject, public Game { Q_OBJECT + TQ_OBJECT public: - QReversiGame(TQObject *parent = 0); - ~QReversiGame(); + TQReversiGame(TQObject *tqparent = 0); + ~TQReversiGame(); // Methods dealing with the game void newGame(); diff --git a/kreversi/qreversigameview.cpp b/kreversi/qreversigameview.cpp index e9104398..e6a17cbf 100644 --- a/kreversi/qreversigameview.cpp +++ b/kreversi/qreversigameview.cpp @@ -71,8 +71,8 @@ // class StatusWidget -StatusWidget::StatusWidget(const TQString &text, TQWidget *parent) - : TQWidget(parent, "status_widget") +StatusWidget::StatusWidget(const TQString &text, TQWidget *tqparent) + : TQWidget(tqparent, "status_widget") { TQHBoxLayout *hbox = new TQHBoxLayout(this, 0, KDialog::spacingHint()); TQLabel *label; @@ -119,11 +119,11 @@ void StatusWidget::setScore(uint s) // ================================================================ -// class QReversiGameView +// class TQReversiGameView -QReversiGameView::QReversiGameView(TQWidget *parent, QReversiGame *game) - : TQWidget(parent, "gameview") +TQReversiGameView::TQReversiGameView(TQWidget *tqparent, TQReversiGame *game) + : TQWidget(tqparent, "gameview") { // Store a pointer to the game. m_game = game; @@ -147,39 +147,39 @@ QReversiGameView::QReversiGameView(TQWidget *parent, QReversiGame *game) } -QReversiGameView::~QReversiGameView() +TQReversiGameView::~TQReversiGameView() { } // Create the entire view. Only called once from the constructor. -void QReversiGameView::createView() +void TQReversiGameView::createView() { - TQGridLayout *layout = new TQGridLayout(this, 4, 2); + TQGridLayout *tqlayout = new TQGridLayout(this, 4, 2); // The board - m_boardView = new QReversiBoardView(this, m_game); + m_boardView = new TQReversiBoardView(this, m_game); m_boardView->loadSettings(); // Load the pixmaps used in the status widgets. - layout->addMultiCellWidget(m_boardView, 0, 3, 0, 0); + tqlayout->addMultiCellWidget(m_boardView, 0, 3, 0, 0); // The status widgets - m_blackStatus = new StatusWidget(TQString::null, this); - m_blackStatus->setPixmap(m_boardView->chipPixmap(Black, 20)); - layout->addWidget(m_blackStatus, 0, 1); - m_whiteStatus = new StatusWidget(TQString::null, this); - m_whiteStatus->setPixmap(m_boardView->chipPixmap(White, 20)); - layout->addWidget(m_whiteStatus, 1, 1); + m_blacktqStatus = new StatusWidget(TQString(), this); + m_blacktqStatus->setPixmap(m_boardView->chipPixmap(Black, 20)); + tqlayout->addWidget(m_blacktqStatus, 0, 1); + m_whitetqStatus = new StatusWidget(TQString(), this); + m_whitetqStatus->setPixmap(m_boardView->chipPixmap(White, 20)); + tqlayout->addWidget(m_whitetqStatus, 1, 1); // The "Moves" label TQLabel *movesLabel = new TQLabel( i18n("Moves"), this); - movesLabel->setAlignment(AlignCenter); - layout->addWidget(movesLabel, 2, 1); + movesLabel->tqsetAlignment(AlignCenter); + tqlayout->addWidget(movesLabel, 2, 1); // The list of moves. m_movesView = new TQListBox(this, "moves"); m_movesView->setMinimumWidth(150); - layout->addWidget(m_movesView, 3, 1); + tqlayout->addWidget(m_movesView, 3, 1); } @@ -189,17 +189,17 @@ void QReversiGameView::createView() // Recieves the sig_newGame signal from the game. -void QReversiGameView::newGame() +void TQReversiGameView::newGame() { m_boardView->updateBoard(true); m_movesView->clear(); - updateStatus(); + updatetqStatus(); } // Recieves the sig_move signal from the game. -void QReversiGameView::moveMade(uint moveNum, Move &move) +void TQReversiGameView::moveMade(uint moveNum, Move &move) { //FIXME: Error checks. TQString colorsWB[] = { @@ -213,10 +213,10 @@ void QReversiGameView::moveMade(uint moveNum, Move &move) // Insert the new move in the listbox and mark it as the current one. m_movesView->insertItem(TQString("%1. %2 %3") - .arg(moveNum) - .arg(Prefs::grayscale() ? colorsWB[move.color()] + .tqarg(moveNum) + .tqarg(Prefs::grayscale() ? colorsWB[move.color()] : colorsRB[move.color()]) - .arg(move.asString())); + .tqarg(move.asString())); m_movesView->setCurrentItem(moveNum - 1); m_movesView->ensureCurrentVisible(); @@ -225,33 +225,33 @@ void QReversiGameView::moveMade(uint moveNum, Move &move) m_boardView->updateBoard(); // Update the score. - updateStatus(); + updatetqStatus(); } // Recieves the sig_update signal from the game, and can be called // whenever a total update of the view is required. -void QReversiGameView::updateView() +void TQReversiGameView::updateView() { m_boardView->updateBoard(true); updateMovelist(); - updateStatus(); + updatetqStatus(); } // Only updates the status widgets (score). -void QReversiGameView::updateStatus() +void TQReversiGameView::updatetqStatus() { - m_blackStatus->setScore(m_game->score(Black)); - m_whiteStatus->setScore(m_game->score(White)); + m_blacktqStatus->setScore(m_game->score(Black)); + m_whitetqStatus->setScore(m_game->score(White)); } // Only updates the status board. -void QReversiGameView::updateBoard(bool force) +void TQReversiGameView::updateBoard(bool force) { m_boardView->updateBoard(force); } @@ -260,7 +260,7 @@ void QReversiGameView::updateBoard(bool force) // Only updates the movelist. This method regenerates the list from // scratch. -void QReversiGameView::updateMovelist() +void TQReversiGameView::updateMovelist() { // FIXME: NYI } @@ -270,7 +270,7 @@ void QReversiGameView::updateMovelist() // access to the internal board view. // -void QReversiGameView::squareClicked(int row, int col) +void TQReversiGameView::squareClicked(int row, int col) { emit signalSquareClicked(row, col); } @@ -280,17 +280,17 @@ void QReversiGameView::squareClicked(int row, int col) // Other public methods. -void QReversiGameView::setHumanColor(Color color) +void TQReversiGameView::setHumanColor(Color color) { m_humanColor = color; if (color == Black) { - m_blackStatus->setText(i18n("You")); - m_whiteStatus->setText(""); + m_blacktqStatus->setText(i18n("You")); + m_whitetqStatus->setText(""); } else { - m_blackStatus->setText(""); - m_whiteStatus->setText(i18n("You")); + m_blacktqStatus->setText(""); + m_whitetqStatus->setText(i18n("You")); } } diff --git a/kreversi/qreversigameview.h b/kreversi/qreversigameview.h index 97cc1738..628c4637 100644 --- a/kreversi/qreversigameview.h +++ b/kreversi/qreversigameview.h @@ -36,8 +36,8 @@ ******************************************************************* */ -#ifndef __QREVERSIGAMEVIEW__H__ -#define __QREVERSIGAMEVIEW__H__ +#ifndef __TQREVERSIGAMEVIEW__H__ +#define __TQREVERSIGAMEVIEW__H__ #include @@ -52,15 +52,16 @@ class KConfig; class TQLabel; -class QReversiGame; +class TQReversiGame; -class StatusWidget : public QWidget +class StatusWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - StatusWidget(const TQString &text, TQWidget *parent); + StatusWidget(const TQString &text, TQWidget *tqparent); void setText(const TQString &string); void setPixmap(const TQPixmap &pixmap); @@ -75,13 +76,14 @@ private: // The main game view -class QReversiGameView : public TQWidget { +class TQReversiGameView : public TQWidget { Q_OBJECT + TQ_OBJECT public: - QReversiGameView(TQWidget *parent, QReversiGame *game); - ~QReversiGameView(); + TQReversiGameView(TQWidget *tqparent, TQReversiGame *game); + ~TQReversiGameView(); // Proxy methods for the board view void showHint(Move move) { m_boardView->showHint(move); } @@ -102,7 +104,7 @@ public: void insertMove(TQString moveString) { m_movesView->insertItem(moveString); } void removeMove(int moveNum) { m_movesView->removeItem(moveNum); - updateStatus(); + updatetqStatus(); } void setCurrentMove(int moveNum) { m_movesView->setCurrentItem(moveNum); @@ -127,7 +129,7 @@ public slots: void moveMade(uint moveNum, Move &move); void updateView(); // Update the entire view. - void updateStatus(); // Update the status widgets (score) + void updatetqStatus(); // Update the status widgets (score) void updateBoard(bool force = FALSE); // Update the board. void updateMovelist(); // Update the move list. @@ -144,15 +146,15 @@ private: private: // Pointer to the game we are displaying - QReversiGame *m_game; // Pointer to the game object (not owner). + TQReversiGame *m_game; // Pointer to the game object (not owner). Color m_humanColor; // Widgets in the view. - QReversiBoardView *m_boardView; + TQReversiBoardView *m_boardView; TQListBox *m_movesView; - StatusWidget *m_blackStatus; - StatusWidget *m_whiteStatus; + StatusWidget *m_blacktqStatus; + StatusWidget *m_whitetqStatus; }; diff --git a/kreversi/settings.ui b/kreversi/settings.ui index b7c59ff5..f9dc2031 100644 --- a/kreversi/settings.ui +++ b/kreversi/settings.ui @@ -1,10 +1,10 @@ Settings - + Settings - + 0 0 @@ -25,7 +25,7 @@ 0 - + frame3 @@ -52,14 +52,14 @@ Expanding - + 20 20 - + kcfg_Grayscale @@ -67,7 +67,7 @@ &Grayscale chips - + kcfg_CompetitiveGameChoice @@ -78,7 +78,7 @@ unnamed - + CasualGameChoice @@ -92,7 +92,7 @@ true - + CompetitiveGameChoice @@ -105,7 +105,7 @@ - + skillGroup @@ -116,7 +116,7 @@ unnamed - + kcfg_skill @@ -136,42 +136,42 @@ NoMarks - + Beginner Beginner - + AlignVCenter|AlignLeft - + Expert Expert - + AlignVCenter|AlignRight - + Average Average - + AlignCenter - + groupBox2 @@ -182,29 +182,29 @@ unnamed - + textLabel1 Slow - + AlignVCenter|AlignLeft - + textLabel3 Fast - + AlignVCenter|AlignRight - + kcfg_AnimationSpeed @@ -229,7 +229,7 @@ - + kcfg_Animation @@ -240,7 +240,7 @@ true - + kcfg_BackgroundImageChoice @@ -251,7 +251,7 @@ unnamed - + BackgroundColorChoice @@ -264,7 +264,7 @@ kcfg_BackgroundImage - + BackgroundImageChoice @@ -319,7 +319,7 @@ setEnabled(bool) - + kurlrequester.h klineedit.h -- cgit v1.2.3