diff options
Diffstat (limited to 'kbackgammon/engines/gnubg')
-rw-r--r-- | kbackgammon/engines/gnubg/kbggnubg.cpp | 58 | ||||
-rw-r--r-- | kbackgammon/engines/gnubg/kbggnubg.h | 3 |
2 files changed, 31 insertions, 30 deletions
diff --git a/kbackgammon/engines/gnubg/kbggnubg.cpp b/kbackgammon/engines/gnubg/kbggnubg.cpp index d17a6f88..e6f853a2 100644 --- a/kbackgammon/engines/gnubg/kbggnubg.cpp +++ b/kbackgammon/engines/gnubg/kbggnubg.cpp @@ -85,7 +85,7 @@ void KBgEngineGNU::handleLine(const TQString &l) /* * Start of a new game/match */ - if (line.contains(TQRegExp("^gnubg rolls [1-6], .* rolls [1-6]\\."))) { + if (line.tqcontains(TQRegExp("^gnubg rolls [1-6], .* rolls [1-6]\\."))) { KRegExp e("^gnubg rolls ([1-6]), .* rolls ([1-6])\\."); e.match(line.latin1()); if (int r = strcmp(e.group(1), e.group(2))) @@ -95,14 +95,14 @@ void KBgEngineGNU::handleLine(const TQString &l) /* * Bug fixes for older versions of GNUBG - to be removed */ - if (line.contains(TQRegExp("^.* cannot move\\..+$"))) { + if (line.tqcontains(TQRegExp("^.* cannot move\\..+$"))) { KRegExp e("(^.* cannot move.)(.*$)"); e.match(line.latin1()); handleLine(e.group(1)); handleLine(e.group(2)); return; } - if (line.contains(TQRegExp("^Are you sure you want to start a new game, and discard the one in progress\\?"))) { + if (line.tqcontains(TQRegExp("^Are you sure you want to start a new game, and discard the one in progress\\?"))) { KRegExp e("(^Are you sure you want to start a new game, and discard the one in progress\\? )(.+$)"); e.match(line.latin1()); handleLine(e.group(1)); @@ -113,25 +113,25 @@ void KBgEngineGNU::handleLine(const TQString &l) /* * Cube handling */ - if (line.contains(TQRegExp("^gnubg accepts and immediately redoubles to [0-9]+\\.$"))) { + if (line.tqcontains(TQRegExp("^gnubg accepts and immediately redoubles to [0-9]+\\.$"))) { // redoubles mess up the game counter "turn" - //KBgStatus st(board); + //KBgtqStatus st(board); //st.setCube(32, BOTH); //emit newState(st); } - if (line.contains(TQRegExp("^gnubg doubles\\.$"))) { + if (line.tqcontains(TQRegExp("^gnubg doubles\\.$"))) { // TODO: we need some generic class for this. the class // can be shared between all engines #if 0 - KBgStatus st(board); + KBgtqStatus st(board); int ret = KMessageBox::warningYesNoCancel - (0, i18n("gnubg doubles the cube to %1.").arg(2*st.cube(THEM)), + (0, i18n("gnubg doubles the cube to %1.").tqarg(2*st.cube(THEM)), i18n("gnubg doubles"), i18n("&Accept"), i18n("Re&double"), i18n("&Reject"), true); @@ -155,16 +155,16 @@ void KBgEngineGNU::handleLine(const TQString &l) /* * Ignore the following messages */ - if (line.contains(TQRegExp("^TTY boards will be given in raw format"))) { + if (line.tqcontains(TQRegExp("^TTY boards will be given in raw format"))) { line = " "; } /* * Board messages */ - if (line.contains(TQRegExp("^board:"))) { + if (line.tqcontains(TQRegExp("^board:"))) { - KBgStatus st(line); + KBgtqStatus st(line); /* * Do preliminary analysis of board @@ -199,7 +199,7 @@ void KBgEngineGNU::handleLine(const TQString &l) case uMove: st.setDice(THEM, 0, 0); st.setDice(THEM, 1, 0); - emit infoText(i18n("You roll %1 and %2.").arg(st.dice(US, 0)).arg(st.dice(US, 1))); + emit infoText(i18n("You roll %1 and %2.").tqarg(st.dice(US, 0)).tqarg(st.dice(US, 1))); switch (st.moves()) { case 0: // get a message @@ -208,7 +208,7 @@ void KBgEngineGNU::handleLine(const TQString &l) emit infoText(i18n("Please move 1 piece.")); break; default: - emit infoText(i18n("Please move %1 pieces.").arg(st.moves())); + emit infoText(i18n("Please move %1 pieces.").tqarg(st.moves())); break; } emit allowCommand(Roll, false); @@ -220,7 +220,7 @@ void KBgEngineGNU::handleLine(const TQString &l) case tMove: st.setDice(US, 0, 0); st.setDice(US, 1, 0); - emit infoText(i18n("gnubg rolls %1 and %2.").arg(st.dice(THEM, 0)).arg(st.dice(THEM, 1))); + emit infoText(i18n("gnubg rolls %1 and %2.").tqarg(st.dice(THEM, 0)).tqarg(st.dice(THEM, 1))); if (st.moves() == 0) emit infoText(i18n("gnubg cannot move.")); @@ -236,7 +236,7 @@ void KBgEngineGNU::handleLine(const TQString &l) emit allowMoving(st.turn() == US); emit newState(st); - emit statText(i18n("%1 vs. %2").arg(st.player(US)).arg(st.player(THEM))); + emit statText(i18n("%1 vs. %2").tqarg(st.player(US)).tqarg(st.player(THEM))); emit allowCommand(Load, true ); emit allowCommand(Undo, false); @@ -248,7 +248,7 @@ void KBgEngineGNU::handleLine(const TQString &l) /* * Show the line... */ - line.replace(TQRegExp(" "), " "); + line.tqreplace(TQRegExp(" "), " "); if (!line.isEmpty()) emit infoText(line); } @@ -275,10 +275,10 @@ void KBgEngineGNU::newGame() /* * If there is a game running we warn the user first */ - if (gameRunning && (KMessageBox::warningYesNo((TQWidget *)parent(), + if (gameRunning && (KMessageBox::warningYesNo((TQWidget *)tqparent(), i18n("A game is currently in progress. " "Starting a new one will terminate it."), - TQString::null, i18n("Start New Game"), i18n("Continue Old Game")) + TQString(), i18n("Start New Game"), i18n("Continue Old Game")) == KMessageBox::No)) return; @@ -422,8 +422,8 @@ void KBgEngineGNU::saveConfig() /* * Constructor */ -KBgEngineGNU::KBgEngineGNU(TQWidget *parent, TQString *name, TQPopupMenu *pmenu) - : KBgEngine(parent, name, pmenu) +KBgEngineGNU::KBgEngineGNU(TQWidget *tqparent, TQString *name, TQPopupMenu *pmenu) + : KBgEngine(tqparent, name, pmenu) { // obsolete nameUS = "US"; @@ -503,7 +503,7 @@ void KBgEngineGNU::startGNU() resAction->setEnabled(false); if (!gnubg.start(KProcess::NotifyOnExit, KProcess::All)) - KMessageBox::information((TQWidget *)parent(), + KMessageBox::information((TQWidget *)tqparent(), i18n("Could not start the GNU Backgammon process.\n" "Make sure the program is in your PATH and is " "called \"gnubg\".\n" @@ -533,7 +533,7 @@ void KBgEngineGNU::gnubgExit(KProcess *proc) emit allowMoving(false); emit infoText(TQString("<br/><font color=\"red\">") + i18n("The GNU Backgammon process (%1) has exited. ") - .arg(proc->pid()) + "</font><br/>"); + .tqarg(proc->pid()) + "</font><br/>"); resAction->setEnabled(true); } @@ -564,12 +564,12 @@ void KBgEngineGNU::nextCommand() TQString s = (*it) + "\n"; if (!gnubg.writeStdin(s.latin1(), strlen(s.latin1()))) { cmdTimer->start(250, true); - cmdList.remove(TQString::null); + cmdList.remove(TQString()); return; } - (*it) = TQString::null; + (*it) = TQString(); } - cmdList.remove(TQString::null); + cmdList.remove(TQString()); cmdTimer->stop(); } @@ -625,9 +625,9 @@ void KBgEngineGNU::done() emit allowCommand(Redo, false); // Transform the string to FIBS format - lastmove.replace(0, 2, "move "); - lastmove.replace(TQRegExp("\\+"), " "); - lastmove.replace(TQRegExp("\\-"), " "); + lastmove.tqreplace(0, 2, "move "); + lastmove.tqreplace(TQRegExp("\\+"), " "); + lastmove.tqreplace(TQRegExp("\\-"), " "); // sent it to the server handleCommand(lastmove); @@ -669,7 +669,7 @@ void KBgEngineGNU::handleMove(TQString *s) lastmove = *s; int index = 0; - TQString t = s->mid(index, s->find(' ', index)); + TQString t = s->mid(index, s->tqfind(' ', index)); index += 1 + t.length(); int moves = t.toInt(); diff --git a/kbackgammon/engines/gnubg/kbggnubg.h b/kbackgammon/engines/gnubg/kbggnubg.h index acb007f1..78b4566e 100644 --- a/kbackgammon/engines/gnubg/kbggnubg.h +++ b/kbackgammon/engines/gnubg/kbggnubg.h @@ -44,13 +44,14 @@ class KBgEngineGNU : public KBgEngine { Q_OBJECT + TQ_OBJECT public: /* * Constructor and destructor */ - KBgEngineGNU(TQWidget *parent = 0, TQString *name = 0, TQPopupMenu *pmenu = 0); + KBgEngineGNU(TQWidget *tqparent = 0, TQString *name = 0, TQPopupMenu *pmenu = 0); virtual ~KBgEngineGNU(); /** |