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 | |
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')
-rw-r--r-- | kreversi/Engine.cpp | 6 | ||||
-rw-r--r-- | kreversi/Engine.h | 8 | ||||
-rw-r--r-- | kreversi/Move.cpp | 6 | ||||
-rw-r--r-- | kreversi/Move.h | 10 | ||||
-rw-r--r-- | kreversi/Position.cpp | 8 | ||||
-rw-r--r-- | kreversi/Position.h | 4 | ||||
-rw-r--r-- | kreversi/Score.h | 2 | ||||
-rw-r--r-- | kreversi/board.cpp | 64 | ||||
-rw-r--r-- | kreversi/board.h | 30 | ||||
-rw-r--r-- | kreversi/highscores.cpp | 16 | ||||
-rw-r--r-- | kreversi/highscores.h | 2 | ||||
-rw-r--r-- | kreversi/kreversi.cpp | 76 | ||||
-rw-r--r-- | kreversi/kreversi.h | 2 | ||||
-rw-r--r-- | kreversi/kzoommainwindow.cpp | 24 | ||||
-rw-r--r-- | kreversi/kzoommainwindow.h | 6 | ||||
-rw-r--r-- | kreversi/qreversigame.cpp | 4 | ||||
-rw-r--r-- | kreversi/qreversigame.h | 8 | ||||
-rw-r--r-- | kreversi/qreversigameview.cpp | 64 | ||||
-rw-r--r-- | kreversi/qreversigameview.h | 24 |
19 files changed, 182 insertions, 182 deletions
diff --git a/kreversi/Engine.cpp b/kreversi/Engine.cpp index da7750ce..c675b5b2 100644 --- a/kreversi/Engine.cpp +++ b/kreversi/Engine.cpp @@ -117,7 +117,7 @@ // or nearly equal value after the search is completed. -#include <qapplication.h> +#include <tqapplication.h> #include "Engine.h" @@ -129,7 +129,7 @@ #if !defined(__GNUC__) -ULONG64::ULONG64() : QBitArray(64) +ULONG64::ULONG64() : TQBitArray(64) { fill(0); } @@ -138,7 +138,7 @@ ULONG64::ULONG64() : QBitArray(64) // Initialize an ULONG64 from a 32 bit value. // -ULONG64::ULONG64( unsigned int value ) : QBitArray(64) +ULONG64::ULONG64( unsigned int value ) : TQBitArray(64) { fill(0); for(int i = 0; i < 32; i++) { diff --git a/kreversi/Engine.h b/kreversi/Engine.h index a84be895..4b895080 100644 --- a/kreversi/Engine.h +++ b/kreversi/Engine.h @@ -124,9 +124,9 @@ #include "Game.h" #include "Move.h" #include "Score.h" -#include <qmemarray.h> +#include <tqmemarray.h> #include <sys/times.h> -#include <qbitarray.h> +#include <tqbitarray.h> // Class ULONG64 is used as a bitmap for the squares. @@ -134,7 +134,7 @@ #if defined(__GNUC__) #define ULONG64 unsigned long long int #else -class ULONG64 : public QBitArray { +class ULONG64 : public TQBitArray { public: ULONG64(); ULONG64( unsigned int ); @@ -171,7 +171,7 @@ public: void Push(int x, int y); private: - QMemArray<SquareStackEntry> m_squarestack; + TQMemArray<SquareStackEntry> m_squarestack; int m_top; }; diff --git a/kreversi/Move.cpp b/kreversi/Move.cpp index 3a616647..3916925e 100644 --- a/kreversi/Move.cpp +++ b/kreversi/Move.cpp @@ -61,12 +61,12 @@ SimpleMove::SimpleMove(const SimpleMove &move) } -QString SimpleMove::asString() const +TQString SimpleMove::asString() const { if (m_x == -1) - return QString("pass"); + return TQString("pass"); else - return QString("%1%2").arg(" ABCDEFGH"[m_x]).arg(" 12345678"[m_y]); + return TQString("%1%2").arg(" ABCDEFGH"[m_x]).arg(" 12345678"[m_y]); } diff --git a/kreversi/Move.h b/kreversi/Move.h index e205f279..e6ddcf52 100644 --- a/kreversi/Move.h +++ b/kreversi/Move.h @@ -66,8 +66,8 @@ #define __MOVE__H__ -#include "qvaluelist.h" -#include "qstring.h" +#include "tqvaluelist.h" +#include "tqstring.h" #include "Score.h" @@ -88,7 +88,7 @@ public: int x() const { return m_x; } int y() const { return m_y; } - QString asString() const; + TQString asString() const; protected: Color m_color; @@ -114,11 +114,11 @@ public: bool wasTurned(uint x, uint y) const; private: - QValueList<char> m_turnedPieces; + TQValueList<char> m_turnedPieces; }; -typedef QValueList<Move> MoveList; +typedef TQValueList<Move> MoveList; #endif diff --git a/kreversi/Position.cpp b/kreversi/Position.cpp index 22ffb3cf..80daa7ac 100644 --- a/kreversi/Position.cpp +++ b/kreversi/Position.cpp @@ -207,7 +207,7 @@ bool Position::moveIsAtAllPossible() const // // Return true if the move was legal, otherwise return false. // -bool Position::doMove(SimpleMove &move, QValueList<char> *turned) +bool Position::doMove(SimpleMove &move, TQValueList<char> *turned) { if (move.color() == Nobody) return false; @@ -293,7 +293,7 @@ bool Position::undoMove(Move &move) } // 2. All turned pieces must be on the board anb be of the right color. - QValueList<char>::iterator it; + TQValueList<char>::iterator it; for (it = move.m_turnedPieces.begin(); it != move.m_turnedPieces.end(); ++it) { @@ -345,9 +345,9 @@ MoveList Position::generateMoves(Color color) const } -QString Position::asString() const +TQString Position::asString() const { - QString result; + TQString result; for (uint y = 1; y < 9; ++y) { for (uint x = 1; x < 9; ++x) { diff --git a/kreversi/Position.h b/kreversi/Position.h index 7269c2e6..916279e2 100644 --- a/kreversi/Position.h +++ b/kreversi/Position.h @@ -77,13 +77,13 @@ public: bool moveIsPossible(Color color) const; bool moveIsAtAllPossible() const; bool moveIsLegal(SimpleMove &move) const; - bool doMove(SimpleMove &move, QValueList<char> *turned = 0); + bool doMove(SimpleMove &move, TQValueList<char> *turned = 0); bool doMove(Move &move); bool undoMove(Move &move); MoveList generateMoves(Color color) const; - QString asString() const; + TQString asString() const; private: // The actual position itself. Use the simplest representation possible. diff --git a/kreversi/Score.h b/kreversi/Score.h index 947272dc..e1681be9 100644 --- a/kreversi/Score.h +++ b/kreversi/Score.h @@ -47,7 +47,7 @@ #ifndef __SCORE__H__ #define __SCORE__H__ -#include <qglobal.h> +#include <tqglobal.h> enum Color { White = 0, Black = 1, NbColors = 2, Nobody = NbColors }; 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 { diff --git a/kreversi/board.h b/kreversi/board.h index 4f9d1603..f5efc739 100644 --- a/kreversi/board.h +++ b/kreversi/board.h @@ -39,8 +39,8 @@ #ifndef __BOARD__H__ #define __BOARD__H__ -#include <qwidget.h> -#include <qpixmap.h> +#include <tqwidget.h> +#include <tqpixmap.h> #include "Position.h" //#include "Game.h" @@ -54,12 +54,12 @@ class QReversiGame; // The class Board is the visible Reversi Board widget. // -class QReversiBoardView : public QWidget { +class QReversiBoardView : public TQWidget { Q_OBJECT public: - QReversiBoardView(QWidget *parent, QReversiGame *game); + QReversiBoardView(TQWidget *parent, QReversiGame *game); ~QReversiBoardView(); // starts all: emits some signal, so it can't be called from @@ -86,7 +86,7 @@ public: void loadSettings(); // To get the pixmap for the status view - QPixmap chipPixmap(Color color, uint size) const; + TQPixmap chipPixmap(Color color, uint size) const; signals: @@ -96,8 +96,8 @@ signals: protected: // event stuff - void paintEvent(QPaintEvent *); - void mousePressEvent(QMouseEvent *); + void paintEvent(TQPaintEvent *); + void mousePressEvent(TQMouseEvent *); private: @@ -108,31 +108,31 @@ private: void rotateChip(uint row, uint col); bool isField(int row, int col) const; - void setColor(const QColor &); - QColor color() const { return bgColor; } - void setPixmap(QPixmap &); + void setColor(const TQColor &); + TQColor color() const { return bgColor; } + void setPixmap(TQPixmap &); // Methods for handling images of pieces. enum ChipType { Unloaded, Colored, Grayscale }; void loadChips(ChipType); ChipType chipType() const { return chiptype; } - QPixmap chipPixmap(uint i, uint size) const; + TQPixmap chipPixmap(uint i, uint size) const; // Private drawing methods. void showLegalMoves(); - void drawSmallCircle(int x, int y, QPainter &p); + void drawSmallCircle(int x, int y, TQPainter &p); private: QReversiGame *m_krgame; // Pointer to the game object (not owner). // The background of the board - a color and a pixmap. - QColor bgColor; - QPixmap bg; + TQColor bgColor; + TQPixmap bg; // the pieces ChipType chiptype; - QPixmap allchips; + TQPixmap allchips; uint anim_speed; // Special stuff used only in smaller areas. diff --git a/kreversi/highscores.cpp b/kreversi/highscores.cpp index 88317a87..1da40d26 100644 --- a/kreversi/highscores.cpp +++ b/kreversi/highscores.cpp @@ -45,23 +45,23 @@ ExtManager::ExtManager() setShowDrawGamesStatistic(true); const uint RANGE[6] = { 0, 32, 40, 48, 56, 64 }; - QMemArray<uint> s; + TQMemArray<uint> s; s.duplicate(RANGE, 6); setScoreHistogram(s, ScoreBound); } -QString ExtManager::gameTypeLabel(uint gameType, LabelType type) const +TQString ExtManager::gameTypeLabel(uint gameType, LabelType type) const { const Data &data = DATA[gameType]; switch (type) { case Icon: return data.icon; - case Standard: return QString::number(gameType); + case Standard: return TQString::number(gameType); case I18N: return i18n(data.label); case WW: break; } - return QString::null; + return TQString::null; } @@ -78,8 +78,8 @@ void ExtManager::convertLegacy(uint gameType) KConfigGroupSaver cg(kapp->config(), "High Score"); for (uint i = 1; i <= 10; i++) { - QString key = "Pos" + QString::number(i); - QString name = cg.config()->readEntry(key + "Name", QString::null); + TQString key = "Pos" + TQString::number(i); + TQString name = cg.config()->readEntry(key + "Name", TQString::null); if ( name.isEmpty() ) name = i18n("anonymous"); @@ -88,8 +88,8 @@ void ExtManager::convertLegacy(uint gameType) if ( score==0 ) continue; - QString sdate = cg.config()->readEntry(key + "Date", QString::null); - QDateTime date = QDateTime::fromString(sdate); + TQString sdate = cg.config()->readEntry(key + "Date", TQString::null); + TQDateTime date = TQDateTime::fromString(sdate); Score s(Won); s.setScore(score); diff --git a/kreversi/highscores.h b/kreversi/highscores.h index a599d12d..3eda6482 100644 --- a/kreversi/highscores.h +++ b/kreversi/highscores.h @@ -35,7 +35,7 @@ class KDE_EXPORT ExtManager : public Manager ExtManager(); private: - QString gameTypeLabel(uint gameTye, LabelType) const; + TQString gameTypeLabel(uint gameTye, LabelType) const; void convertLegacy(uint gameType); struct Data { diff --git a/kreversi/kreversi.cpp b/kreversi/kreversi.cpp index b0a5ddc8..d01c2f6e 100644 --- a/kreversi/kreversi.cpp +++ b/kreversi/kreversi.cpp @@ -39,9 +39,9 @@ #include <unistd.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qlistbox.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqlistbox.h> #include <kapplication.h> #include <kdebug.h> @@ -74,7 +74,7 @@ #ifndef PICDATA #define PICDATA(x) \ - KGlobal::dirs()->findResource("appdata", QString("pics/") + x) + KGlobal::dirs()->findResource("appdata", TQString("pics/") + x) #endif @@ -82,8 +82,8 @@ KReversi::KReversi() : KZoomMainWindow(10, 300, 5, "kreversi"), m_gameOver(false) { - QWidget *w; - QGridLayout *top; + TQWidget *w; + TQGridLayout *top; KNotifyClient::startDaemon(); @@ -98,10 +98,10 @@ KReversi::KReversi() setStrength(1); // The visual stuff - w = new QWidget(this); + w = new TQWidget(this); setCentralWidget(w); - top = new QGridLayout(w, 2, 2); + top = new TQGridLayout(w, 2, 2); // The reversi game view. m_gameView = new QReversiGameView(w, m_game); @@ -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, SIGNAL(sig_newGame()), this, SLOT(showTurn())); - connect(m_game, SIGNAL(sig_move(uint, Move&)), - this, SLOT(handleMove(uint, Move&))); // Calls showTurn(). - connect(m_game, SIGNAL(sig_update()), this, SLOT(showTurn())); - connect(m_game, SIGNAL(sig_gameOver()), this, SLOT(slotGameOver())); + connect(m_game, TQT_SIGNAL(sig_newGame()), 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())); // Signal that is sent when the user clicks on the board. - connect(m_gameView, SIGNAL(signalSquareClicked(int, int)), - this, SLOT(slotSquareClicked(int, int))); + connect(m_gameView, TQT_SIGNAL(signalSquareClicked(int, int)), + this, TQT_SLOT(slotSquareClicked(int, int))); loadSettings(); @@ -150,38 +150,38 @@ KReversi::~KReversi() void KReversi::createKActions() { // Standard Game Actions. - KStdGameAction::gameNew(this, SLOT(slotNewGame()), actionCollection(), + KStdGameAction::gameNew(this, TQT_SLOT(slotNewGame()), actionCollection(), "game_new"); - KStdGameAction::load(this, SLOT(slotOpenGame()), actionCollection()); - KStdGameAction::save(this, SLOT(slotSave()), actionCollection()); - KStdGameAction::quit(this, SLOT(close()), actionCollection()); - KStdGameAction::hint(this, SLOT(slotHint()), actionCollection(), + 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(), "game_hint"); - KStdGameAction::undo(this, SLOT(slotUndo()), actionCollection(), + KStdGameAction::undo(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, SLOT(slotInterrupt()), actionCollection(), + this, TQT_SLOT(slotInterrupt()), actionCollection(), "game_stop"); continueAction = new KAction(i18n("&Continue Thinking"), "reload", 0, - this, SLOT(slotContinue()), actionCollection(), + this, TQT_SLOT(slotContinue()), actionCollection(), "game_continue"); new KAction(i18n("S&witch Sides"), 0, 0, - this, SLOT(slotSwitchSides()), actionCollection(), + this, TQT_SLOT(slotSwitchSides()), actionCollection(), "game_switch_sides"); // Some more standard game actions: Highscores, Settings. - KStdGameAction::highscores(this, SLOT(showHighScoreDialog()), actionCollection()); - KStdAction::preferences(this, SLOT(slotEditSettings()), actionCollection()); + KStdGameAction::highscores(this, TQT_SLOT(showHighScoreDialog()), actionCollection()); + KStdAction::preferences(this, TQT_SLOT(slotEditSettings()), actionCollection()); // Actions for the view(s). showLastMoveAction = new KToggleAction(i18n("Show Last Move"), "lastmoves", 0, - this, SLOT(slotShowLastMove()), + this, TQT_SLOT(slotShowLastMove()), actionCollection(), "show_last_move"); showLegalMovesAction = new KToggleAction(i18n("Show Legal Moves"), "legalmoves", 0, - this, SLOT(slotShowLegalMoves()), + this, TQT_SLOT(slotShowLegalMoves()), actionCollection(), "show_legal_moves"); } @@ -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."), - QString::null, QString::null, "switch_side_warning"); + TQString::null, TQString::null, "switch_side_warning"); if ( res==KMessageBox::Cancel ) return; @@ -465,7 +465,7 @@ void KReversi::showTurn(Color color) if (color == humanColor()) statusBar()->message(i18n("Your turn")); else if (color == computerColor()) { - QString message = i18n("Computer's turn"); + TQString message = i18n("Computer's turn"); // We can't use the interrupted() test here since we might be in a // middle state when called from slotInterrupt(). @@ -608,21 +608,21 @@ void KReversi::showGameOver(Color color) // Show the winner in a messagebox. if ( color == Nobody ) { KNotifyClient::event(winId(), "draw", i18n("Draw!")); - QString s = i18n("Game is drawn!\n\nYou : %1\nComputer: %2") + TQString s = i18n("Game is drawn!\n\nYou : %1\nComputer: %2") .arg(human).arg(computer); KMessageBox::information(this, s, i18n("Game Ended")); score.setType(KExtHighscore::Draw); } else if ( humanColor() == color ) { KNotifyClient::event(winId(), "won", i18n("Game won!")); - QString s = i18n("Congratulations, you have won!\n\nYou : %1\nComputer: %2") + TQString s = i18n("Congratulations, you have won!\n\nYou : %1\nComputer: %2") .arg(human).arg(computer); KMessageBox::information(this, s, i18n("Game Ended")); score.setType(KExtHighscore::Won); } else { KNotifyClient::event(winId(), "lost", i18n("Game lost!")); - QString s = i18n("You have lost the game!\n\nYou : %1\nComputer: %2") + TQString s = i18n("You have lost the game!\n\nYou : %1\nComputer: %2") .arg(human).arg(computer); KMessageBox::information(this, s, i18n("Game Ended")); score.setType(KExtHighscore::Lost); @@ -661,8 +661,8 @@ void KReversi::saveGame(KConfig *config) for (uint i = 0; i < m_game->moveNumber(); i++) { Move move = m_game->move(i); - QString moveString; - QString idx; + TQString moveString; + TQString idx; moveString.sprintf("%d %d %d", move.x(), move.y(), (int) move.color()); idx.sprintf("Move_%d", i + 1); @@ -691,10 +691,10 @@ bool KReversi::loadGame(KConfig *config) uint movenumber = 1; while (nmoves--) { // Read one move. - QString idx; + TQString idx; idx.sprintf("Move_%d", movenumber++); - QStringList s = config->readListEntry(idx, ' '); + TQStringList s = config->readListEntry(idx, ' '); uint x = (*s.at(0)).toUInt(); uint y = (*s.at(1)).toUInt(); Color color = (Color)(*s.at(2)).toInt(); @@ -755,7 +755,7 @@ void KReversi::slotEditSettings() Settings *general = new Settings(0, "General"); dialog->addPage(general, i18n("General"), "package_settings"); - connect(dialog, SIGNAL(settingsChanged()), this, SLOT(loadSettings())); + connect(dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(loadSettings())); dialog->show(); } diff --git a/kreversi/kreversi.h b/kreversi/kreversi.h index 17599fa2..a106623c 100644 --- a/kreversi/kreversi.h +++ b/kreversi/kreversi.h @@ -90,7 +90,7 @@ private: void createKActions(); // View functions. - QString getPlayerName(); + TQString getPlayerName(); virtual void writeZoomSetting(uint zoom); virtual uint readZoomSetting() const; diff --git a/kreversi/kzoommainwindow.cpp b/kreversi/kzoommainwindow.cpp index 4da50935..56f46742 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, SLOT(zoomIn()), actionCollection()); + KStdAction::zoomIn(this, TQT_SLOT(zoomIn()), actionCollection()); m_zoomOutAction = - KStdAction::zoomOut(this, SLOT(zoomOut()), actionCollection()); + KStdAction::zoomOut(this, TQT_SLOT(zoomOut()), actionCollection()); m_menu = - KStdAction::showMenubar(this, SLOT(toggleMenubar()), actionCollection()); + KStdAction::showMenubar(this, TQT_SLOT(toggleMenubar()), actionCollection()); } @@ -53,37 +53,37 @@ void KZoomMainWindow::init(const char *popupName) // context popup if (popupName) { - QPopupMenu *popup = - static_cast<QPopupMenu *>(factory()->container(popupName, this)); + TQPopupMenu *popup = + static_cast<TQPopupMenu *>(factory()->container(popupName, this)); Q_ASSERT(popup); if (popup) KContextMenuManager::insert(this, popup); } } -void KZoomMainWindow::addWidget(QWidget *widget) +void KZoomMainWindow::addWidget(TQWidget *widget) { widget->adjustSize(); - QWidget *tlw = widget->topLevelWidget(); + TQWidget *tlw = widget->topLevelWidget(); KZoomMainWindow *zm = static_cast<KZoomMainWindow *>(tlw->qt_cast("KZoomMainWindow")); Q_ASSERT(zm); zm->m_widgets.append(widget); - connect(widget, SIGNAL(destroyed()), zm, SLOT(widgetDestroyed())); + connect(widget, TQT_SIGNAL(destroyed()), zm, TQT_SLOT(widgetDestroyed())); } void KZoomMainWindow::widgetDestroyed() { - m_widgets.remove(static_cast<const QWidget *>(sender())); + m_widgets.remove(static_cast<const TQWidget *>(sender())); } -bool KZoomMainWindow::eventFilter(QObject *o, QEvent *e) +bool KZoomMainWindow::eventFilter(TQObject *o, TQEvent *e) { - if ( e->type()==QEvent::LayoutHint ) + if ( e->type()==TQEvent::LayoutHint ) setFixedSize(minimumSize()); // because K/QMainWindow // does not manage fixed central widget // with hidden menubar... @@ -96,7 +96,7 @@ void KZoomMainWindow::setZoom(uint zoom) m_zoom = zoom; writeZoomSetting(m_zoom); - QPtrListIterator<QWidget> it(m_widgets); + TQPtrListIterator<TQWidget> it(m_widgets); for (; it.current(); ++it) (*it)->adjustSize(); diff --git a/kreversi/kzoommainwindow.h b/kreversi/kzoommainwindow.h index dee04139..73acd539 100644 --- a/kreversi/kzoommainwindow.h +++ b/kreversi/kzoommainwindow.h @@ -56,7 +56,7 @@ public: * widget is called whenever the zoom is changed. * This function assumes that the topLevelWidget() is the KZoomMainWindow. */ - static void addWidget(QWidget *widget); + static void addWidget(TQWidget *widget); uint zoom() const { return m_zoom; } @@ -74,7 +74,7 @@ protected: void init(const char *popupName = 0); virtual void setZoom(uint zoom); - virtual bool eventFilter(QObject *o, QEvent *e); + virtual bool eventFilter(TQObject *o, TQEvent *e); virtual bool queryExit(); /** You need to implement this method since different application @@ -124,7 +124,7 @@ private: uint m_minZoom; uint m_maxZoom; - QPtrList<QWidget> m_widgets; + TQPtrList<TQWidget> m_widgets; KAction *m_zoomInAction; KAction *m_zoomOutAction; diff --git a/kreversi/qreversigame.cpp b/kreversi/qreversigame.cpp index d31bac4a..3e940ca2 100644 --- a/kreversi/qreversigame.cpp +++ b/kreversi/qreversigame.cpp @@ -44,8 +44,8 @@ // class QReversiGame -QReversiGame::QReversiGame(QObject *parent) - : QObject(parent), Game() +QReversiGame::QReversiGame(TQObject *parent) + : TQObject(parent), Game() { } diff --git a/kreversi/qreversigame.h b/kreversi/qreversigame.h index d1712832..b4dcb19b 100644 --- a/kreversi/qreversigame.h +++ b/kreversi/qreversigame.h @@ -39,8 +39,8 @@ #ifndef __QREVERSIGAME__H__ #define __QREVERSIGAME__H__ -#include <qwidget.h> -#include <qpixmap.h> +#include <tqwidget.h> +#include <tqpixmap.h> #include "Position.h" #include "Game.h" @@ -62,11 +62,11 @@ class KConfig; // gameOver() // -class QReversiGame : public QObject, public Game { +class QReversiGame : public TQObject, public Game { Q_OBJECT public: - QReversiGame(QObject *parent = 0); + QReversiGame(TQObject *parent = 0); ~QReversiGame(); // Methods dealing with the game diff --git a/kreversi/qreversigameview.cpp b/kreversi/qreversigameview.cpp index 92812657..e9104398 100644 --- a/kreversi/qreversigameview.cpp +++ b/kreversi/qreversigameview.cpp @@ -37,9 +37,9 @@ */ -#include <qlayout.h> -#include <qwidget.h> -#include <qlabel.h> +#include <tqlayout.h> +#include <tqwidget.h> +#include <tqlabel.h> #include <klocale.h> #include <kdialog.h> @@ -47,8 +47,8 @@ #if 0 #include <unistd.h> -#include <qpainter.h> -#include <qfont.h> +#include <tqpainter.h> +#include <tqfont.h> #include <kapplication.h> #include <kstandarddirs.h> @@ -71,22 +71,22 @@ // class StatusWidget -StatusWidget::StatusWidget(const QString &text, QWidget *parent) - : QWidget(parent, "status_widget") +StatusWidget::StatusWidget(const TQString &text, TQWidget *parent) + : TQWidget(parent, "status_widget") { - QHBoxLayout *hbox = new QHBoxLayout(this, 0, KDialog::spacingHint()); - QLabel *label; + TQHBoxLayout *hbox = new TQHBoxLayout(this, 0, KDialog::spacingHint()); + TQLabel *label; - m_textLabel = new QLabel(text, this); + m_textLabel = new TQLabel(text, this); hbox->addWidget(m_textLabel); - m_pixLabel = new QLabel(this); + m_pixLabel = new TQLabel(this); hbox->addWidget(m_pixLabel); - label = new QLabel(":", this); + label = new TQLabel(":", this); hbox->addWidget(label); - m_scoreLabel = new QLabel(this); + m_scoreLabel = new TQLabel(this); hbox->addWidget(m_scoreLabel); } @@ -94,7 +94,7 @@ StatusWidget::StatusWidget(const QString &text, QWidget *parent) // Set the text label // -void StatusWidget::setText(const QString &string) +void StatusWidget::setText(const TQString &string) { m_textLabel->setText(string); } @@ -103,7 +103,7 @@ void StatusWidget::setText(const QString &string) // Set the pixel label - used to show the color. // -void StatusWidget::setPixmap(const QPixmap &pixmap) +void StatusWidget::setPixmap(const TQPixmap &pixmap) { m_pixLabel->setPixmap(pixmap); } @@ -114,7 +114,7 @@ void StatusWidget::setPixmap(const QPixmap &pixmap) void StatusWidget::setScore(uint s) { - m_scoreLabel->setText(QString::number(s)); + m_scoreLabel->setText(TQString::number(s)); } @@ -122,8 +122,8 @@ void StatusWidget::setScore(uint s) // class QReversiGameView -QReversiGameView::QReversiGameView(QWidget *parent, QReversiGame *game) - : QWidget(parent, "gameview") +QReversiGameView::QReversiGameView(TQWidget *parent, QReversiGame *game) + : TQWidget(parent, "gameview") { // Store a pointer to the game. m_game = game; @@ -135,15 +135,15 @@ QReversiGameView::QReversiGameView(QWidget *parent, QReversiGame *game) m_humanColor = Nobody; // Connect the game to the view. - connect(m_game, SIGNAL(sig_newGame()), this, SLOT(newGame())); - connect(m_game, SIGNAL(sig_move(uint, Move&)), - this, SLOT(moveMade(uint, Move&))); - connect(m_game, SIGNAL(sig_update()), this, SLOT(updateView())); + connect(m_game, TQT_SIGNAL(sig_newGame()), this, TQT_SLOT(newGame())); + connect(m_game, TQT_SIGNAL(sig_move(uint, Move&)), + this, TQT_SLOT(moveMade(uint, Move&))); + connect(m_game, TQT_SIGNAL(sig_update()), this, TQT_SLOT(updateView())); // The sig_gameOver signal is not used by the view. // Reemit the signal from the board. - connect(m_boardView, SIGNAL(signalSquareClicked(int, int)), - this, SLOT(squareClicked(int, int))); + connect(m_boardView, TQT_SIGNAL(signalSquareClicked(int, int)), + this, TQT_SLOT(squareClicked(int, int))); } @@ -156,7 +156,7 @@ QReversiGameView::~QReversiGameView() void QReversiGameView::createView() { - QGridLayout *layout = new QGridLayout(this, 4, 2); + TQGridLayout *layout = new TQGridLayout(this, 4, 2); // The board m_boardView = new QReversiBoardView(this, m_game); @@ -164,20 +164,20 @@ void QReversiGameView::createView() layout->addMultiCellWidget(m_boardView, 0, 3, 0, 0); // The status widgets - m_blackStatus = new StatusWidget(QString::null, this); + 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(QString::null, this); + m_whiteStatus = new StatusWidget(TQString::null, this); m_whiteStatus->setPixmap(m_boardView->chipPixmap(White, 20)); layout->addWidget(m_whiteStatus, 1, 1); // The "Moves" label - QLabel *movesLabel = new QLabel( i18n("Moves"), this); + TQLabel *movesLabel = new TQLabel( i18n("Moves"), this); movesLabel->setAlignment(AlignCenter); layout->addWidget(movesLabel, 2, 1); // The list of moves. - m_movesView = new QListBox(this, "moves"); + m_movesView = new TQListBox(this, "moves"); m_movesView->setMinimumWidth(150); layout->addWidget(m_movesView, 3, 1); } @@ -202,17 +202,17 @@ void QReversiGameView::newGame() void QReversiGameView::moveMade(uint moveNum, Move &move) { //FIXME: Error checks. - QString colorsWB[] = { + TQString colorsWB[] = { i18n("White"), i18n("Black") }; - QString colorsRB[] = { + TQString colorsRB[] = { i18n("Red"), i18n("Blue") }; // Insert the new move in the listbox and mark it as the current one. - m_movesView->insertItem(QString("%1. %2 %3") + m_movesView->insertItem(TQString("%1. %2 %3") .arg(moveNum) .arg(Prefs::grayscale() ? colorsWB[move.color()] : colorsRB[move.color()]) diff --git a/kreversi/qreversigameview.h b/kreversi/qreversigameview.h index a3059a25..59855fa9 100644 --- a/kreversi/qreversigameview.h +++ b/kreversi/qreversigameview.h @@ -40,7 +40,7 @@ #define __QREVERSIGAMEVIEW__H__ -#include <qlistbox.h> +#include <tqlistbox.h> #include "Score.h" #include "Move.h" @@ -60,27 +60,27 @@ class StatusWidget : public QWidget Q_OBJECT public: - StatusWidget(const QString &text, QWidget *parent); + StatusWidget(const TQString &text, TQWidget *parent); - void setText(const QString &string); - void setPixmap(const QPixmap &pixmap); + void setText(const TQString &string); + void setPixmap(const TQPixmap &pixmap); void setScore(uint score); private: - QLabel *m_textLabel; - QLabel *m_pixLabel; - QLabel *m_scoreLabel; + TQLabel *m_textLabel; + TQLabel *m_pixLabel; + TQLabel *m_scoreLabel; }; // The main game view -class QReversiGameView : public QWidget { +class QReversiGameView : public TQWidget { Q_OBJECT public: - QReversiGameView(QWidget *parent, QReversiGame *game); + QReversiGameView(TQWidget *parent, QReversiGame *game); ~QReversiGameView(); // Proxy methods for the board view @@ -94,12 +94,12 @@ public: void setAnimationSpeed(uint speed){m_boardView->setAnimationSpeed(speed);} // To get the pixmap for the status view - QPixmap chipPixmap(Color color, uint size) const + TQPixmap chipPixmap(Color color, uint size) const { return m_boardView->chipPixmap(color, size); } // Proxy methods for the movelist // FIXME: Not all of these need to be externally reachable - void insertMove(QString moveString) { m_movesView->insertItem(moveString); } + void insertMove(TQString moveString) { m_movesView->insertItem(moveString); } void removeMove(int moveNum) { m_movesView->removeItem(moveNum); updateStatus(); @@ -150,7 +150,7 @@ private: // Widgets in the view. QReversiBoardView *m_boardView; - QListBox *m_movesView; + TQListBox *m_movesView; StatusWidget *m_blackStatus; StatusWidget *m_whiteStatus; }; |