diff options
Diffstat (limited to 'kbackgammon/engines')
-rw-r--r-- | kbackgammon/engines/fibs/kbgfibs.cpp | 196 | ||||
-rw-r--r-- | kbackgammon/engines/fibs/kbgfibschat.cpp | 54 | ||||
-rw-r--r-- | kbackgammon/engines/fibs/kplayerlist.cpp | 20 | ||||
-rw-r--r-- | kbackgammon/engines/gnubg/kbggnubg.cpp | 24 | ||||
-rw-r--r-- | kbackgammon/engines/offline/kbgoffline.cpp | 12 |
5 files changed, 153 insertions, 153 deletions
diff --git a/kbackgammon/engines/fibs/kbgfibs.cpp b/kbackgammon/engines/fibs/kbgfibs.cpp index 1492ad2c..c99b19f0 100644 --- a/kbackgammon/engines/fibs/kbgfibs.cpp +++ b/kbackgammon/engines/fibs/kbgfibs.cpp @@ -380,7 +380,7 @@ void KBgEngineFIBS::cancelJoin(const TQString &info) TQRegExp patt = TQRegExp("^" + info + " "); for (int i = 0; i <= numJoin; i++) { - if (actJoin[i]->text().tqcontains(patt)) { + if (actJoin[i]->text().contains(patt)) { // move all entries starting at i+1 up by one... for (int j = i; j < numJoin; j++) actJoin[j]->setText(actJoin[j+1]->text()); @@ -426,18 +426,18 @@ void KBgEngineFIBS::changeJoin(const TQString &info) for (TQStringList::Iterator it = invitations.begin(); it != invitations.end(); ++it) { - if ((*it).tqcontains(patt)) { + if ((*it).contains(patt)) { TQString text, menu; - if ((*it).tqcontains(TQRegExp(" r$"))) { + if ((*it).contains(TQRegExp(" r$"))) { menu = i18n("R means resume", "%1 (R)").tqarg(name); text = i18n("%1 (experience %2, rating %3) wants to resume a saved match with you. " "If you want to play, use the corresponding menu entry to join (or type " "'join %4').").tqarg(name).tqarg(expi_s).tqarg(rate_s).tqarg(name); KNotifyClient::event("invitation", i18n("%1 wants to resume a saved match with you"). arg(name)); - } else if ((*it).tqcontains(TQRegExp(" u$"))) { + } else if ((*it).contains(TQRegExp(" u$"))) { menu = i18n("U means unlimited", "%1 (U)").tqarg(name); text = i18n("%1 (experience %2, rating %3) wants to play an unlimited match with you. " "If you want to play, use the corresponding menu entry to join (or type " @@ -578,8 +578,8 @@ void KBgEngineFIBS::done() emit allowCommand(Roll, false); // Transform the string to FIBS cormat - lastMove.tqreplace(0, 2, "move "); - lastMove.tqreplace(pat[PlsChar], "-"); + lastMove.replace(0, 2, "move "); + lastMove.replace(pat[PlsChar], "-"); // sent it to the server emit serverString(lastMove); @@ -809,7 +809,7 @@ void KBgEngineFIBS::load() */ void KBgEngineFIBS::join(const TQString &msg) { - emit serverString("join " + msg.left(msg.tqfind('('))); + emit serverString("join " + msg.left(msg.find('('))); } void KBgEngineFIBS::join_0() { join(actJoin[0]->text()); } void KBgEngineFIBS::join_1() { join(actJoin[1]->text()); } @@ -1094,7 +1094,7 @@ bool KBgEngineFIBS::queryConnection(const bool newlogin) first = false; } - } while (ret && (msg.isEmpty() || msg.tqcontains(' ') || msg.tqcontains(':'))); + } while (ret && (msg.isEmpty() || msg.contains(' ') || msg.contains(':'))); if (ret) infoFIBS[FIBSUser] = msg; @@ -1130,7 +1130,7 @@ bool KBgEngineFIBS::queryConnection(const bool newlogin) first = false; } - } while (ret && (msg.isEmpty() || msg.tqcontains(' ') || msg.tqcontains(':'))); + } while (ret && (msg.isEmpty() || msg.contains(' ') || msg.contains(':'))); if (ret) infoFIBS[FIBSPswd] = msg; @@ -1281,13 +1281,13 @@ void KBgEngineFIBS::handleServerData(TQString &line) /* * Fix-up any HTML-like tags in the line */ - line.tqreplace(pat[HTML_lt], "<"); - line.tqreplace(pat[HTML_gt], ">"); + line.replace(pat[HTML_lt], "<"); + line.replace(pat[HTML_gt], ">"); /* * FIBS sometimes sends tabs, where it should send 8 spaces... */ - line.tqreplace(pat[TabChar], " "); + line.replace(pat[TabChar], " "); switch (rxtqStatus) { @@ -1344,7 +1344,7 @@ void KBgEngineFIBS::handleServerData(TQString &line) void KBgEngineFIBS::handleMessageWhois(const TQString &line) { rxCollect += "<br> " + line; - if (line.tqcontains(pat[WhoisE1]) || line.tqcontains(pat[WhoisE2])) { + if (line.contains(pat[WhoisE1]) || line.contains(pat[WhoisE2])) { rxtqStatus = RxNormal; emit infoText("<font color=\"darkgreen\">" + rxCollect + "<br></font>"); } @@ -1356,7 +1356,7 @@ void KBgEngineFIBS::handleMessageWhois(const TQString &line) void KBgEngineFIBS::handleMessageRating(const TQString &line) { rxCollect += "<br>" + line; - if (line.tqcontains(pat[EndRate]) && ++rxCount == 2) { + if (line.contains(pat[EndRate]) && ++rxCount == 2) { emit infoText("<font color=\"blue\">" + rxCollect + "<br></font>"); rxtqStatus = RxNormal; } @@ -1367,7 +1367,7 @@ void KBgEngineFIBS::handleMessageRating(const TQString &line) */ void KBgEngineFIBS::handleMessageMotd(const TQString &line) { - if (line.tqcontains(pat[MotdEnd])) { + if (line.contains(pat[MotdEnd])) { rxtqStatus = RxNormal; emit infoText("<font color=\"blue\"><pre>" + rxCollect + "</pre></font>"); /* @@ -1378,9 +1378,9 @@ void KBgEngineFIBS::handleMessageMotd(const TQString &line) emit serverString("set boardstyle 3"); } else { TQString tline = line; - tline.tqreplace(pat[BoxHori], "<br><hr>"); - tline.tqreplace(pat[BoxVer1], ""); - tline.tqreplace(pat[BoxVer2], ""); + tline.replace(pat[BoxHori], "<br><hr>"); + tline.replace(pat[BoxVer1], ""); + tline.replace(pat[BoxVer2], ""); rxCollect += "<br>" + tline; } } @@ -1393,7 +1393,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r /* * Two possibilities: either we are logged in or we sent bad password/login */ - if (line.tqcontains("login:")) { + if (line.contains("login:")) { /* * This can only happen if the password/login is wrong. */ @@ -1428,7 +1428,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r * Ok, we are logged in! Now receive personal information. These * are completely useless but what the heck. */ - if (line.tqcontains(pat[Welcome])) { + if (line.contains(pat[Welcome])) { char p[3][256]; time_t tmp; // Using latin1() is okay, since the string comes from FIBS. @@ -1471,7 +1471,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r * p[3] - timezone * */ - if (line.tqcontains(pat[OwnInfo])) { + if (line.contains(pat[OwnInfo])) { rxtqStatus = RxNormal; @@ -1537,7 +1537,7 @@ void KBgEngineFIBS::handleMessageConnect(const TQString &line, const TQString &r /* * The beginning of a new login procedure starts starts here */ - if (line.tqcontains(pat[OneName])) { + if (line.contains(pat[OneName])) { rxtqStatus = RxNewLogin; emit infoText(TQString("<font color=\"red\">") + rxCollect + "</font>"); rxCollect = ""; @@ -1560,14 +1560,14 @@ void KBgEngineFIBS::handleMessageNewLogin(const TQString &line) /* * Request the new login */ - if (line.tqcontains(pat[OneName])) { + if (line.contains(pat[OneName])) { emit serverString(TQString("name ") + infoFIBS[FIBSUser]); return; } /* * Ooops, user name already exists */ - if (line.tqcontains(pat[OthrNam])) { + if (line.contains(pat[OthrNam])) { TQString text = i18n("The selected login is alreay in use! Please select another one."); bool ret, first = true; TQString msg; @@ -1579,7 +1579,7 @@ void KBgEngineFIBS::handleMessageNewLogin(const TQString &line) text += i18n("\n\nThe login may not contain spaces or colons!"); first = false; } - } while (msg.tqcontains(' ') || msg.tqcontains(':')); + } while (msg.contains(' ') || msg.contains(':')); if (ret) { infoFIBS[FIBSUser] = msg; @@ -1592,21 +1592,21 @@ void KBgEngineFIBS::handleMessageNewLogin(const TQString &line) /* * first time we send the password */ - if (line.tqcontains(pat[YourNam])) { + if (line.contains(pat[YourNam])) { emit serverString(infoFIBS[FIBSPswd]); return; } /* * second time we send the password */ - if (line.tqcontains(pat[GivePwd])) { + if (line.contains(pat[GivePwd])) { emit serverString(infoFIBS[FIBSPswd]); return; } /* * at this point we are done creating the account */ - if (line.tqcontains(pat[RetypeP])) { + if (line.contains(pat[RetypeP])) { TQString text = i18n("Your account has been created. Your new login is <u>%1</u>. To fully activate " "this account, I will now close the connection. Once you reconnect, you can start " @@ -1632,7 +1632,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) * For now, the waves are ignored. They should probably go into * the chat window -- but only optional */ - if (line.tqcontains(pat[OneWave]) || line.tqcontains(pat[TwoWave]) || line.tqcontains(pat[YouWave])) { + if (line.contains(pat[OneWave]) || line.contains(pat[TwoWave]) || line.contains(pat[YouWave])) { return; } @@ -1642,8 +1642,8 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) * ever gets a games window, they should be in there. For now, they * are ignored. */ - else if (line.tqcontains(pat[GameBG1]) || line.tqcontains(pat[GameBG2]) || line.tqcontains(pat[GameRE1]) || - line.tqcontains(pat[GameRE2]) || line.tqcontains(pat[GameEnd])) { + else if (line.contains(pat[GameBG1]) || line.contains(pat[GameBG2]) || line.contains(pat[GameRE1]) || + line.contains(pat[GameRE2]) || line.contains(pat[GameEnd])) { return; } @@ -1651,7 +1651,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Artefact caused by the login test procedure utilized. */ - else if (line.tqcontains(pat[NoLogin])) { + else if (line.contains(pat[NoLogin])) { return; } @@ -1659,7 +1659,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Connection keep-alive response */ - else if (line.tqcontains(pat[KeepAlv])) { + else if (line.contains(pat[KeepAlv])) { return; } @@ -1670,10 +1670,10 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) * Chat and personal messages - note that the chat window sends these messages * back to us so we can display them if the user wants that. */ - else if (line.tqcontains(pat[ChatSay]) || line.tqcontains(pat[ChatSht]) || line.tqcontains(pat[ChatWis]) || - line.tqcontains(pat[ChatKib]) || line.tqcontains(pat[SelfSay]) || line.tqcontains(pat[SelfSht]) || - line.tqcontains(pat[SelfWis]) || line.tqcontains(pat[SelfKib]) || line.tqcontains(pat[SelfSlf]) || - line.tqcontains(pat[MsgPers]) || line.tqcontains(pat[MsgDeli]) || line.tqcontains(pat[MsgSave])) { + else if (line.contains(pat[ChatSay]) || line.contains(pat[ChatSht]) || line.contains(pat[ChatWis]) || + line.contains(pat[ChatKib]) || line.contains(pat[SelfSay]) || line.contains(pat[SelfSht]) || + line.contains(pat[SelfWis]) || line.contains(pat[SelfKib]) || line.contains(pat[SelfSlf]) || + line.contains(pat[MsgPers]) || line.contains(pat[MsgDeli]) || line.contains(pat[MsgSave])) { emit chatMessage(line); return; @@ -1684,12 +1684,12 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Beginning of games. In all these cases we are playing and not watching. */ - else if (line.tqcontains(pat[MatchB1]) || line.tqcontains(pat[MatchB2])) { + else if (line.contains(pat[MatchB1]) || line.contains(pat[MatchB2])) { if (useAutoMsg[MsgBeg] && !autoMsg[MsgBeg].stripWhiteSpace().isEmpty()) emit serverString("kibitz " + autoMsg[MsgBeg]); } - else if (line.tqcontains(pat[MatchB3]) || line.tqcontains(pat[MatchB4])) { + else if (line.contains(pat[MatchB3]) || line.contains(pat[MatchB4])) { if (useAutoMsg[MsgBeg] && !autoMsg[MsgBeg].stripWhiteSpace().isEmpty()) emit serverString("kibitz " + autoMsg[MsgBeg]); @@ -1702,7 +1702,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) * The help should be handled separately. A fairly complete implementation of a * help parsing can be found in KFibs. */ - else if (line.tqcontains(pat[HelpTxt])) { + else if (line.contains(pat[HelpTxt])) { // do nothing } @@ -1712,7 +1712,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Simple cases without the need for many comments... */ - else if (line.tqcontains(pat[RawBord])) { + else if (line.contains(pat[RawBord])) { /* * Save the board string and create a new game state @@ -1766,7 +1766,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) return; } - else if (line.tqcontains(pat[PlsMove]) || line.tqcontains(pat[YouMove])) { + else if (line.contains(pat[PlsMove]) || line.contains(pat[YouMove])) { KNotifyClient::event("move", i18n("Please make your move")); @@ -1777,13 +1777,13 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Being away and coming back */ - else if (line.tqcontains(pat[YouAway])) { + else if (line.contains(pat[YouAway])) { emit changePlayertqStatus(infoFIBS[FIBSUser], KFibsPlayerList::Away, true); actBack->setEnabled(true); line += "<br><pre> </pre>" + i18n("(or use the corresponding menu entry to join the match)"); } - else if (line.tqcontains(pat[YouBack])) { + else if (line.contains(pat[YouBack])) { emit changePlayertqStatus(infoFIBS[FIBSUser], KFibsPlayerList::Away, false); actBack->setEnabled(false); @@ -1795,7 +1795,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Catch the response of the user responding to double or resign */ - else if (line.tqcontains(pat[YouGive]) || line.tqcontains(pat[RejCont]) || line.tqcontains(pat[AcptWin])) { + else if (line.contains(pat[YouGive]) || line.contains(pat[RejCont]) || line.contains(pat[AcptWin])) { actAccept->setEnabled(false); actReject->setEnabled(false); @@ -1806,20 +1806,20 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Catch the responses to newly set toggles */ - else if (line.tqcontains(pat[GreedyY]) || line.tqcontains(pat[GreedyN])) { + else if (line.contains(pat[GreedyY]) || line.contains(pat[GreedyN])) { - fibsOpt[OptGreedy]->setChecked(line.tqcontains(pat[GreedyY])); + fibsOpt[OptGreedy]->setChecked(line.contains(pat[GreedyY])); line = "<font color=\"red\">" + line + "</font>"; } - else if (line.tqcontains(pat[DoubleY]) || line.tqcontains(pat[DoubleN])) { + else if (line.contains(pat[DoubleY]) || line.contains(pat[DoubleN])) { - fibsOpt[OptDouble]->setChecked(line.tqcontains(pat[DoubleY])); + fibsOpt[OptDouble]->setChecked(line.contains(pat[DoubleY])); line = "<font color=\"red\">" + line + "</font>"; } - else if (line.tqcontains(pat[RatingY]) || line.tqcontains(pat[RatingN])) { + else if (line.contains(pat[RatingY]) || line.contains(pat[RatingN])) { - fibsOpt[OptRatings]->setChecked(line.tqcontains(pat[RatingY])); + fibsOpt[OptRatings]->setChecked(line.contains(pat[RatingY])); line = "<font color=\"red\">" + line + "</font>"; } @@ -1828,7 +1828,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * It's our turn to roll or double */ - else if (line.tqcontains(pat[YouTurn]) || line.tqcontains(pat[YouRoll])) { + else if (line.contains(pat[YouTurn]) || line.contains(pat[YouRoll])) { emit allowCommand(Cube, playing); emit allowCommand(Roll, playing); @@ -1843,17 +1843,17 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Got an invitation for a match */ - else if (line.tqcontains(pat[Invite0]) || line.tqcontains(pat[Invite2]) || line.tqcontains(pat[Invite3])) { + else if (line.contains(pat[Invite0]) || line.contains(pat[Invite2]) || line.contains(pat[Invite3])) { - rxCollect = rawline.left(rawline.tqfind(' ')); + rxCollect = rawline.left(rawline.find(' ')); emit serverString("rawwho " + rxCollect); - if (line.tqcontains(pat[Invite0])) { - rawline.tqreplace(pat[Invite1], ""); - rawline = rxCollect + " "+ rawline.left(rawline.tqfind(' ')); - } else if (line.tqcontains(pat[Invite2])) { + if (line.contains(pat[Invite0])) { + rawline.replace(pat[Invite1], ""); + rawline = rxCollect + " "+ rawline.left(rawline.find(' ')); + } else if (line.contains(pat[Invite2])) { rawline = rxCollect + " r"; - } else if (line.tqcontains(pat[Invite3])) { + } else if (line.contains(pat[Invite3])) { invitations += rxCollect + " u"; } invitations += rawline; @@ -1862,23 +1862,23 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) // - rx status changes ------------------------------------------------------------ - else if (line.tqcontains(pat[WhoisBG])) { + else if (line.contains(pat[WhoisBG])) { rxtqStatus = RxWhois; rxCollect = TQString("<br><u>") + line + "</u>"; return; } - else if (line.tqcontains(pat[MotdBeg])) { + else if (line.contains(pat[MotdBeg])) { rxtqStatus = RxMotd; rxCollect = ""; return; } - else if (line.tqcontains(pat[BegRate])) { + else if (line.contains(pat[BegRate])) { rxtqStatus = RxRating; rxCount = 0; rxCollect = "<br>" + line; return; } - else if (line.tqcontains(pat[Goodbye])) { + else if (line.contains(pat[Goodbye])) { rxtqStatus = RxGoodbye; rxCollect = "<br><hr><br>"; handleServerData(rawline); // danger: recursion! @@ -1893,7 +1893,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Continue a mutli game match? We have to either leave or continue */ - else if (line.tqcontains(pat[ConLeav])) { + else if (line.contains(pat[ConLeav])) { actConti->setEnabled(true); actLeave->setEnabled(true); line.append("<br><pre> </pre>" + i18n("(or use the corresponding menu " @@ -1902,9 +1902,9 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Beginning and end of user updates */ - else if (line.tqcontains(pat[WhoInfo])) { - rawline.tqreplace(pat[WhoInfo], ""); - if (rawline.tqcontains(TQRegExp("^" + infoFIBS[FIBSUser] + " "))) { + else if (line.contains(pat[WhoInfo])) { + rawline.replace(pat[WhoInfo], ""); + if (rawline.contains(TQRegExp("^" + infoFIBS[FIBSUser] + " "))) { int ready; // Using latin1() is fine, since the string is coming from FIBS. sscanf(rawline.latin1(), "%*s %*s %*s %i %*s %*s %*s %*s %*s %*s %*s %*s", &ready); @@ -1913,7 +1913,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) emit fibsWhoInfo(rawline); return; } - else if (line.tqcontains(pat[WhoEnde])) { + else if (line.contains(pat[WhoEnde])) { emit fibsWhoEnd(); return; } @@ -1921,34 +1921,34 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) * This message is ignored. The instruction is given elsewhere (and slightly * delayed in the flow of time). */ - if (line.tqcontains(pat[TypJoin])) { + if (line.contains(pat[TypJoin])) { return; } /* * Watching other players */ - else if (line.tqcontains(pat[BegWtch])) { + else if (line.contains(pat[BegWtch])) { emit allowCommand(Load, true); - rawline.tqreplace(pat[BegWtch], ""); + rawline.replace(pat[BegWtch], ""); rawline.truncate(rawline.length()-1); emit fibsStartNewGame(rawline); load(); } - else if (line.tqcontains(pat[EndWtch])) { + else if (line.contains(pat[EndWtch])) { emit gameOver(); } /* * Blinding of players, the actual blind is handled by * the player list */ - else if (line.tqcontains(pat[BegBlnd])) { - rawline.tqreplace(pat[BegBlnd], ""); + else if (line.contains(pat[BegBlnd])) { + rawline.replace(pat[BegBlnd], ""); rawline.truncate(rawline.length()-1); emit changePlayertqStatus(rawline, KFibsPlayerList::Blind, true); line = "<font color=\"red\">" + line + "</font>"; } - else if (line.tqcontains(pat[EndBlnd])) { - rawline.tqreplace(pat[EndBlnd], ""); + else if (line.contains(pat[EndBlnd])) { + rawline.replace(pat[EndBlnd], ""); rawline.truncate(rawline.length()-1); emit changePlayertqStatus(rawline, KFibsPlayerList::Blind, false); line = "<font color=\"red\">" + line + "</font>"; @@ -1956,8 +1956,8 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Starting or reloading games or matches */ - else if (line.tqcontains(pat[BegGame])) { - rawline.tqreplace(pat[BegGame], ""); + else if (line.contains(pat[BegGame])) { + rawline.replace(pat[BegGame], ""); rawline.truncate(rawline.length()-1); emit fibsStartNewGame(rawline); fibsOpt[OptDouble]->setChecked(true); @@ -1965,9 +1965,9 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) actConti->setEnabled(false); actLeave->setEnabled(false); } - else if (line.tqcontains(pat[Reload1])) { - rawline.tqreplace(pat[Reload1], ""); - rawline = rawline.left(rawline.tqfind(' ')); + else if (line.contains(pat[Reload1])) { + rawline.replace(pat[Reload1], ""); + rawline = rawline.left(rawline.find(' ')); rawline.truncate(rawline.length()-1); emit fibsStartNewGame(rawline); fibsOpt[OptDouble]->setChecked(true); @@ -1976,8 +1976,8 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) actLeave->setEnabled(false); load(); } - else if (line.tqcontains(pat[Reload2])) { - rawline.tqreplace(pat[Reload2], ""); + else if (line.contains(pat[Reload2])) { + rawline.replace(pat[Reload2], ""); emit fibsStartNewGame(rawline); fibsOpt[OptDouble]->setChecked(true); fibsOpt[OptGreedy]->setChecked(false); @@ -1989,7 +1989,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) * Opponent offered resignation or the cube. We have to accept * or reject the offer. */ - else if (line.tqcontains(pat[RejAcpt])) { + else if (line.contains(pat[RejAcpt])) { actAccept->setEnabled(true); actReject->setEnabled(true); line += "<br><pre> </pre>" + i18n("(or use the corresponding menu " @@ -1999,10 +1999,10 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) * This is strange: FIBS seems to not send a newline at the * end of this pattern. So we work around that. */ - else if (line.tqcontains(pat[YouAcpt])) { + else if (line.contains(pat[YouAcpt])) { actAccept->setEnabled(false); actReject->setEnabled(false); - rawline.tqreplace(pat[YouAcpt], ""); + rawline.replace(pat[YouAcpt], ""); line.truncate(line.length()-rawline.length()); if (!rawline.stripWhiteSpace().isEmpty()) { handleServerData(rawline); @@ -2011,7 +2011,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) /* * Ending of games */ - else if (line.tqcontains(pat[EndLose])) { + else if (line.contains(pat[EndLose])) { if (playing) { KNotifyClient::event("game over l", i18n("Sorry, you lost the game.")); if (useAutoMsg[MsgLos] && !autoMsg[MsgLos].stripWhiteSpace().isEmpty()) @@ -2019,7 +2019,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) } emit gameOver(); } - else if (line.tqcontains(pat[EndVict])) { + else if (line.contains(pat[EndVict])) { if (playing) { KNotifyClient::event("game over w", i18n("Congratulations, you won the game!")); if (useAutoMsg[MsgWin] && !autoMsg[MsgWin].stripWhiteSpace().isEmpty()) @@ -2027,24 +2027,24 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) } emit gameOver(); } - else if (line.tqcontains(pat[GameSav])) { + else if (line.contains(pat[GameSav])) { emit gameOver(); } /* * User logs out. This has to be signalled to the player * list. Get the true user names by working on the rawline. */ - else if (line.tqcontains(pat[UserLot])) { - rawline.tqreplace(pat[UserLot], ""); - emit fibsLogout(rawline.left(rawline.tqfind(' '))); + else if (line.contains(pat[UserLot])) { + rawline.replace(pat[UserLot], ""); + emit fibsLogout(rawline.left(rawline.find(' '))); return; } /* * Emit the name of the newly logged in user. */ - else if (line.tqcontains(pat[UserLin])) { - rawline.tqreplace(pat[UserLin], ""); - emit fibsLogin(rawline.left(rawline.tqfind(' '))); + else if (line.contains(pat[UserLin])) { + rawline.replace(pat[UserLin], ""); + emit fibsLogin(rawline.left(rawline.find(' '))); return; } /* @@ -2052,11 +2052,11 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) * the 'boardstyle' variable, since we will not be able to display * the board properly without it. */ - else if (line.tqcontains(pat[BoardSY])) { + else if (line.contains(pat[BoardSY])) { // ignored return; } - else if (line.tqcontains(pat[BoardSN])) { + else if (line.contains(pat[BoardSN])) { emit serverString("set boardstyle 3"); emit infoText(TQString("<font color=\"red\"><br>") + i18n("You should never set the 'boardstyle' variable " @@ -2071,7 +2071,7 @@ void KBgEngineFIBS::handleMessageNormal(TQString &line, TQString &rawline) * hasn't been processed, make it red, since it is a server resp. * to something we just did. */ - else if (line.tqcontains(pat[TwoStar])) { + else if (line.contains(pat[TwoStar])) { line = "<font color=\"red\">" + line + "</font>"; } diff --git a/kbackgammon/engines/fibs/kbgfibschat.cpp b/kbackgammon/engines/fibs/kbgfibschat.cpp index 7e4c9d7f..f4dce656 100644 --- a/kbackgammon/engines/fibs/kbgfibschat.cpp +++ b/kbackgammon/engines/fibs/kbgfibschat.cpp @@ -446,7 +446,7 @@ void KBgChat::hideEvent(TQHideEvent *e) */ void KBgChat::startGame(const TQString &name) { - int *id = d->mName2ID->tqfind(d->mName[1] = name); + int *id = d->mName2ID->find(d->mName[1] = name); if (!id) { id = new int(nextId()); d->mName2ID->insert(name, id); @@ -460,7 +460,7 @@ void KBgChat::startGame(const TQString &name) */ void KBgChat::endGame() { - int *id = d->mName2ID->tqfind(d->mName[1]); + int *id = d->mName2ID->find(d->mName[1]); if (id) setSendingEntry(*id); else @@ -472,7 +472,7 @@ void KBgChat::endGame() */ void KBgChat::fibsTalk(const TQString &name) { - int *id = d->mName2ID->tqfind(name); + int *id = d->mName2ID->find(name); if (!id) { id = new int(nextId()); d->mName2ID->insert(name, id); @@ -486,7 +486,7 @@ void KBgChat::fibsTalk(const TQString &name) */ void KBgChat::deletePlayer(const TQString &name) { - int *id = d->mName2ID->tqfind(name); + int *id = d->mName2ID->find(name); if (id) { removeSendingEntry(*id); d->mName2ID->remove(name); @@ -535,21 +535,21 @@ void KBgChat::handleCommand(int id, const TQString& msg) */ void KBgChat::handleData(const TQString &msg) { - TQString clip = msg.left(msg.tqfind(' ')), user, cMsg = msg; + TQString clip = msg.left(msg.find(' ')), user, cMsg = msg; TQDateTime date; bool flag = false; int cmd = clip.toInt(&flag); if (flag) { - cMsg.tqreplace(0, cMsg.tqfind(' ')+1, ""); + cMsg.replace(0, cMsg.find(' ')+1, ""); - user = cMsg.left(cMsg.tqfind(' ')); + user = cMsg.left(cMsg.find(' ')); switch (cmd) { case CLIP_SAYS: - if (!d->mGag.tqcontains(user)) { - cMsg = i18n("<u>%1 tells you:</u> %2").tqarg(user).tqarg(cMsg.tqreplace(TQRegExp("^" + user), "")); + if (!d->mGag.contains(user)) { + cMsg = i18n("<u>%1 tells you:</u> %2").tqarg(user).tqarg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "<font color=\"red\">" + cMsg + "</font>"; emit personalMessage(cMsg); } else @@ -557,16 +557,16 @@ void KBgChat::handleData(const TQString &msg) break; case CLIP_SHOUTS: - if ((!((KToggleAction *)d->mAct[KBgChatPrivate::Silent])->isChecked()) && (!d->mGag.tqcontains(user))) { - cMsg = i18n("<u>%1 shouts:</u> %2").tqarg(user).tqarg(cMsg.tqreplace(TQRegExp("^" + user), "")); + if ((!((KToggleAction *)d->mAct[KBgChatPrivate::Silent])->isChecked()) && (!d->mGag.contains(user))) { + cMsg = i18n("<u>%1 shouts:</u> %2").tqarg(user).tqarg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "<font color=\"black\">" + cMsg + "</font>"; } else cMsg = ""; break; case CLIP_WHISPERS: - if (!d->mGag.tqcontains(user)) { - cMsg = i18n("<u>%1 whispers:</u> %2").tqarg(user).tqarg(cMsg.tqreplace(TQRegExp("^" + user), "")); + if (!d->mGag.contains(user)) { + cMsg = i18n("<u>%1 whispers:</u> %2").tqarg(user).tqarg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "<font color=\"red\">" + cMsg + "</font>"; emit personalMessage(cMsg); } else @@ -574,8 +574,8 @@ void KBgChat::handleData(const TQString &msg) break; case CLIP_KIBITZES: - if (!d->mGag.tqcontains(user)) { - cMsg = i18n("<u>%1 kibitzes:</u> %2").tqarg(user).tqarg(cMsg.tqreplace(TQRegExp("^" + user), "")); + if (!d->mGag.contains(user)) { + cMsg = i18n("<u>%1 kibitzes:</u> %2").tqarg(user).tqarg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "<font color=\"red\">" + cMsg + "</font>"; emit personalMessage(cMsg); } else @@ -583,7 +583,7 @@ void KBgChat::handleData(const TQString &msg) break; case CLIP_YOU_SAY: - cMsg = i18n("<u>You tell %1:</u> %2").tqarg(user).tqarg(cMsg.tqreplace(TQRegExp("^" + user), "")); + cMsg = i18n("<u>You tell %1:</u> %2").tqarg(user).tqarg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "<font color=\"darkgreen\">" + cMsg + "</font>"; emit personalMessage(cMsg); user = TQString(); @@ -611,10 +611,10 @@ void KBgChat::handleData(const TQString &msg) break; case CLIP_MESSAGE: - user = cMsg.left(cMsg.tqfind(' ')+1); - cMsg.remove(0, cMsg.tqfind(' ')+1); - date.setTime_t(cMsg.left(cMsg.tqfind(' ')+1).toUInt()); - cMsg.remove(0, cMsg.tqfind(' ')); + user = cMsg.left(cMsg.find(' ')+1); + cMsg.remove(0, cMsg.find(' ')+1); + date.setTime_t(cMsg.left(cMsg.find(' ')+1).toUInt()); + cMsg.remove(0, cMsg.find(' ')); cMsg = i18n("<u>User %1 left a message at %2</u>: %3").tqarg(user).tqarg(date.toString()).tqarg(cMsg); cMsg = "<font color=\"red\">" + cMsg + "</font>"; emit personalMessage(cMsg); @@ -644,8 +644,8 @@ void KBgChat::handleData(const TQString &msg) /* * Special treatment for non-CLIP messages */ - if (cMsg.tqcontains(TQRegExp("^You say to yourself: "))) { - cMsg.tqreplace(TQRegExp("^You say to yourself: "), + if (cMsg.contains(TQRegExp("^You say to yourself: "))) { + cMsg.replace(TQRegExp("^You say to yourself: "), i18n("<u>You say to yourself:</u> ")); } else { kdDebug(user.isNull(), 10500) << "KBgChat::handleData unhandled message: " @@ -694,7 +694,7 @@ void KBgChat::contextMenu(TQListBoxItem *i, const TQPoint &p) d->mChat->insertSeparator(); - if (d->mGag.tqcontains(d->mName[0]) <= 0) { + if (d->mGag.contains(d->mName[0]) <= 0) { d->mAct[KBgChatPrivate::Gag]->setText(i18n("Gag %1").tqarg(d->mName[0])); d->mAct[KBgChatPrivate::Gag]->plug(d->mChat); } else { @@ -797,10 +797,10 @@ void KBgChat::slotSilent() */ void KBgChat::slotCopy() { - d->mText.tqreplace(TQRegExp("<u>"), ""); - d->mText.tqreplace(TQRegExp("</u>"), ""); - d->mText.tqreplace(TQRegExp("</font>"), ""); - d->mText.tqreplace(TQRegExp("^.*\">"), ""); + d->mText.replace(TQRegExp("<u>"), ""); + d->mText.replace(TQRegExp("</u>"), ""); + d->mText.replace(TQRegExp("</font>"), ""); + d->mText.replace(TQRegExp("^.*\">"), ""); kapp->clipboard()->setText(d->mText); } diff --git a/kbackgammon/engines/fibs/kplayerlist.cpp b/kbackgammon/engines/fibs/kplayerlist.cpp index a928de7e..72714f4c 100644 --- a/kbackgammon/engines/fibs/kplayerlist.cpp +++ b/kbackgammon/engines/fibs/kplayerlist.cpp @@ -594,7 +594,7 @@ void KFibsPlayerList::showContextMenu(KListView *, TQListViewItem *i, const TQPo if (i && d->mCol[tqStatus]->show) d->mAct[KFibsPlayerListPrivate::BlindAct]->setText - ((i->text(d->mCol[tqStatus]->index).tqcontains(d->mAbrv[Blind])) ? + ((i->text(d->mCol[tqStatus]->index).contains(d->mAbrv[Blind])) ? i18n("Unblind %1").tqarg(d->mUser) : i18n("Blind %1").tqarg(d->mUser)); else d->mAct[KFibsPlayerListPrivate::BlindAct]->setText(i18n("Blind")); @@ -738,9 +738,9 @@ void KFibsPlayerList::changePlayer(const TQString &line) if ((str_entry[j] = entry[j]) == "-") str_entry[j] = ""; } - str_entry[tqStatus].tqreplace(Ready, 1, ready[0] == '0' ? "-" : d->mAbrv[Ready]); - str_entry[tqStatus].tqreplace(Away, 1, away [0] == '0' ? "-" : d->mAbrv[Away ]); - str_entry[tqStatus].tqreplace(Blind, 1, "-"); + str_entry[tqStatus].replace(Ready, 1, ready[0] == '0' ? "-" : d->mAbrv[Ready]); + str_entry[tqStatus].replace(Away, 1, away [0] == '0' ? "-" : d->mAbrv[Away ]); + str_entry[tqStatus].replace(Blind, 1, "-"); // disable drawing until the end of update setUpdatesEnabled(false); @@ -758,9 +758,9 @@ void KFibsPlayerList::changePlayer(const TQString &line) i = new KFibsPlayerListLVI(this); // count the KFibs and KBackgammon clients - if (str_entry[Client].tqcontains("KFibs")) + if (str_entry[Client].contains("KFibs")) d->mCount[0]++; - else if (str_entry[Client].tqcontains(PROG_NAME)) + else if (str_entry[Client].contains(PROG_NAME)) d->mCount[1]++; // new entry requires an update to the player count @@ -771,7 +771,7 @@ void KFibsPlayerList::changePlayer(const TQString &line) found: // getting here means the player is in the list - update private status - str_entry[tqStatus].tqreplace(Blind,1,i->text(tqStatus).tqcontains + str_entry[tqStatus].replace(Blind,1,i->text(tqStatus).contains (d->mAbrv[Blind]) ? d->mAbrv[Blind] : "-"); update: @@ -794,9 +794,9 @@ void KFibsPlayerList::deletePlayer(const TQString &player) TQListViewItemIterator it(this); for ( ; it.current(); ++it) { if (it.current()->text(0) == player) { - if (it.current()->text(Client).tqcontains(PROG_NAME)) + if (it.current()->text(Client).contains(PROG_NAME)) --d->mCount[1]; - else if (it.current()->text(Client).tqcontains("KFibs")) + else if (it.current()->text(Client).contains("KFibs")) --d->mCount[0]; delete it.current(); updateCaption(); @@ -827,7 +827,7 @@ void KFibsPlayerList::changePlayertqStatus(const TQString &player, int stat, boo /* * Update the status flag */ - i->setText(tqStatus, i->text(tqStatus).tqreplace(stat, 1, (flag) ? d->mAbrv[stat] : "-")); + i->setText(tqStatus, i->text(tqStatus).replace(stat, 1, (flag) ? d->mAbrv[stat] : "-")); } diff --git a/kbackgammon/engines/gnubg/kbggnubg.cpp b/kbackgammon/engines/gnubg/kbggnubg.cpp index e6f853a2..1ddc3664 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.tqcontains(TQRegExp("^gnubg rolls [1-6], .* rolls [1-6]\\."))) { + if (line.contains(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.tqcontains(TQRegExp("^.* cannot move\\..+$"))) { + if (line.contains(TQRegExp("^.* cannot move\\..+$"))) { KRegExp e("(^.* cannot move.)(.*$)"); e.match(line.latin1()); handleLine(e.group(1)); handleLine(e.group(2)); return; } - if (line.tqcontains(TQRegExp("^Are you sure you want to start a new game, and discard the one in progress\\?"))) { + if (line.contains(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,7 +113,7 @@ void KBgEngineGNU::handleLine(const TQString &l) /* * Cube handling */ - if (line.tqcontains(TQRegExp("^gnubg accepts and immediately redoubles to [0-9]+\\.$"))) { + if (line.contains(TQRegExp("^gnubg accepts and immediately redoubles to [0-9]+\\.$"))) { // redoubles mess up the game counter "turn" @@ -122,7 +122,7 @@ void KBgEngineGNU::handleLine(const TQString &l) //emit newState(st); } - if (line.tqcontains(TQRegExp("^gnubg doubles\\.$"))) { + if (line.contains(TQRegExp("^gnubg doubles\\.$"))) { // TODO: we need some generic class for this. the class // can be shared between all engines @@ -155,14 +155,14 @@ void KBgEngineGNU::handleLine(const TQString &l) /* * Ignore the following messages */ - if (line.tqcontains(TQRegExp("^TTY boards will be given in raw format"))) { + if (line.contains(TQRegExp("^TTY boards will be given in raw format"))) { line = " "; } /* * Board messages */ - if (line.tqcontains(TQRegExp("^board:"))) { + if (line.contains(TQRegExp("^board:"))) { KBgtqStatus st(line); @@ -248,7 +248,7 @@ void KBgEngineGNU::handleLine(const TQString &l) /* * Show the line... */ - line.tqreplace(TQRegExp(" "), " "); + line.replace(TQRegExp(" "), " "); if (!line.isEmpty()) emit infoText(line); } @@ -625,9 +625,9 @@ void KBgEngineGNU::done() emit allowCommand(Redo, false); // Transform the string to FIBS format - lastmove.tqreplace(0, 2, "move "); - lastmove.tqreplace(TQRegExp("\\+"), " "); - lastmove.tqreplace(TQRegExp("\\-"), " "); + lastmove.replace(0, 2, "move "); + lastmove.replace(TQRegExp("\\+"), " "); + lastmove.replace(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->tqfind(' ', index)); + TQString t = s->mid(index, s->find(' ', index)); index += 1 + t.length(); int moves = t.toInt(); diff --git a/kbackgammon/engines/offline/kbgoffline.cpp b/kbackgammon/engines/offline/kbgoffline.cpp index 14197f54..8dd93a7c 100644 --- a/kbackgammon/engines/offline/kbgoffline.cpp +++ b/kbackgammon/engines/offline/kbgoffline.cpp @@ -484,7 +484,7 @@ void KBgEngineOffline::redo() void KBgEngineOffline::handleMove(TQString *s) { int index = 0; - TQString t = s->mid(index, s->tqfind(' ', index)); + TQString t = s->mid(index, s->find(' ', index)); index += 1 + t.length(); int moves = t.toInt(); @@ -510,22 +510,22 @@ void KBgEngineOffline::handleMove(TQString *s) */ for (int i = 0; i < moves; i++) { bool kick = false; - t = s->mid(index, s->tqfind(' ', index) - index); + t = s->mid(index, s->find(' ', index) - index); index += 1 + t.length(); char c = '-'; - if (t.tqcontains('+')) { + if (t.contains('+')) { c = '+'; kick = true; } - TQString r = t.left(t.tqfind(c)); - if (r.tqcontains("bar")) { + TQString r = t.left(t.find(c)); + if (r.contains("bar")) { d->mGame[0].setBar(d->mRoll, abs(d->mGame[0].bar(d->mRoll)) - 1); } else { int from = r.toInt(); d->mGame[0].setBoard(from, d->mRoll, abs(d->mGame[0].board(from)) - 1); } t.remove(0, 1 + r.length()); - if (t.tqcontains("off")) { + if (t.contains("off")) { d->mGame[0].setHome(d->mRoll, abs(d->mGame[0].home(d->mRoll)) + 1); } else { int to = t.toInt(); |