diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:58:26 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:58:26 +0000 |
commit | 838baf3f99ec5ab81b063eb5449a3381d860f377 (patch) | |
tree | dd31abcfde08ca92e4623b8f50b3d762a87c997a /kbackgammon/engines/fibs/kbgfibschat.cpp | |
parent | 2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff) | |
download | tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip |
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
Diffstat (limited to 'kbackgammon/engines/fibs/kbgfibschat.cpp')
-rw-r--r-- | kbackgammon/engines/fibs/kbgfibschat.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/kbackgammon/engines/fibs/kbgfibschat.cpp b/kbackgammon/engines/fibs/kbgfibschat.cpp index 7b34bae0..c1eca59d 100644 --- a/kbackgammon/engines/fibs/kbgfibschat.cpp +++ b/kbackgammon/engines/fibs/kbgfibschat.cpp @@ -63,7 +63,7 @@ * Private utility class that might become more generally useful in * the future. Basically, it implements rich text TQListBox items. */ -class KLBT : public QListBoxText +class KLBT : public TQListBoxText { public: @@ -71,10 +71,10 @@ public: /* * Constructor */ - KLBT(TQWidget *parent, const TQString &text = TQString::null, const TQString &player = TQString::null) + KLBT(TQWidget *tqparent, const TQString &text = TQString(), const TQString &player = TQString()) : TQListBoxText(text) { - w = parent; + w = tqparent; n = new TQString(player); t = new TQSimpleRichText(text, w->font()); @@ -123,7 +123,7 @@ protected: */ virtual void paint(TQPainter *p) { - t->draw(p, 1, 1, TQRegion(p->viewport()), w->colorGroup()); + t->draw(p, 1, 1, TQRegion(p->viewport()), w->tqcolorGroup()); } private: @@ -189,18 +189,18 @@ public: /* * Constructor of the chat window. */ -KBgChat::KBgChat(TQWidget *parent, const char *name) - : KChat(parent, false) +KBgChat::KBgChat(TQWidget *tqparent, const char *name) + : KChat(tqparent, false) { d = new KBgChatPrivate(); KActionCollection* actions = new KActionCollection(this); - d->mName[0] = TQString::null; + d->mName[0] = TQString(); d->mChat = 0; d->mInvt = new TQPopupMenu(); setAutoAddMessages(false); // we get an echo from FIBS - setFromNickname(i18n("%1 user").arg(PROG_NAME)); + setFromNickname(i18n("%1 user").tqarg(PROG_NAME)); if (!addSendingEntry(i18n("Kibitz to watchers and players"), CLIP_YOU_KIBITZ)) kdDebug(10500) << "adding kibitz" << endl; @@ -233,31 +233,31 @@ KBgChat::KBgChat(TQWidget *parent, const char *name) d->mAct[KBgChatPrivate::Inquire] = new KAction(i18n("Info On"), TQIconSet(kapp->iconLoader()->loadIcon( "help.xpm", KIcon::Small)), - 0, this, TQT_SLOT(slotInquire()), actions); + 0, TQT_TQOBJECT(this), TQT_SLOT(slotInquire()), actions); d->mAct[KBgChatPrivate::Talk] = new KAction(i18n("Talk To"), TQIconSet(kapp->iconLoader()->loadIcon( PROG_NAME "-chat.png", KIcon::Small)), - 0, this, TQT_SLOT(slotTalk()), actions); + 0, TQT_TQOBJECT(this), TQT_SLOT(slotTalk()), actions); - d->mAct[KBgChatPrivate::InviteD] = new KAction(i18n("Use Dialog"), 0, this, + d->mAct[KBgChatPrivate::InviteD] = new KAction(i18n("Use Dialog"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInviteD()), actions); - d->mAct[KBgChatPrivate::Invite1] = new KAction(i18n("1 Point Match"), 0, this, + d->mAct[KBgChatPrivate::Invite1] = new KAction(i18n("1 Point Match"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInvite1()), actions); - d->mAct[KBgChatPrivate::Invite2] = new KAction(i18n("2 Point Match"), 0, this, + d->mAct[KBgChatPrivate::Invite2] = new KAction(i18n("2 Point Match"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInvite2()), actions); - d->mAct[KBgChatPrivate::Invite3] = new KAction(i18n("3 Point Match"), 0, this, + d->mAct[KBgChatPrivate::Invite3] = new KAction(i18n("3 Point Match"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInvite3()), actions); - d->mAct[KBgChatPrivate::Invite4] = new KAction(i18n("4 Point Match"), 0, this, + d->mAct[KBgChatPrivate::Invite4] = new KAction(i18n("4 Point Match"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInvite4()), actions); - d->mAct[KBgChatPrivate::Invite5] = new KAction(i18n("5 Point Match"), 0, this, + d->mAct[KBgChatPrivate::Invite5] = new KAction(i18n("5 Point Match"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInvite5()), actions); - d->mAct[KBgChatPrivate::Invite6] = new KAction(i18n("6 Point Match"), 0, this, + d->mAct[KBgChatPrivate::Invite6] = new KAction(i18n("6 Point Match"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInvite6()), actions); - d->mAct[KBgChatPrivate::Invite7] = new KAction(i18n("7 Point Match"), 0, this, + d->mAct[KBgChatPrivate::Invite7] = new KAction(i18n("7 Point Match"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInvite7()), actions); - d->mAct[KBgChatPrivate::InviteU] = new KAction(i18n("Unlimited"), 0, this, + d->mAct[KBgChatPrivate::InviteU] = new KAction(i18n("Unlimited"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInviteU()), actions); - d->mAct[KBgChatPrivate::InviteR] = new KAction(i18n("Resume"), 0, this, + d->mAct[KBgChatPrivate::InviteR] = new KAction(i18n("Resume"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotInviteR()), actions); d->mAct[KBgChatPrivate::InviteD]->plug(d->mInvt); @@ -277,13 +277,13 @@ KBgChat::KBgChat(TQWidget *parent, const char *name) d->mAct[KBgChatPrivate::InviteU]->plug(d->mInvt); d->mAct[KBgChatPrivate::InviteR]->plug(d->mInvt); - d->mAct[KBgChatPrivate::Gag] = new KAction(i18n("Gag"), 0, this, TQT_SLOT(slotGag()), actions); - d->mAct[KBgChatPrivate::Ungag] = new KAction(i18n("Ungag"), 0, this, TQT_SLOT(slotUngag()), actions); - d->mAct[KBgChatPrivate::Cleargag] = new KAction(i18n("Clear Gag List"), 0, this, TQT_SLOT(slotCleargag()), actions); - d->mAct[KBgChatPrivate::Copy] = KStdAction::copy(this, TQT_SLOT(slotCopy()), actions); - d->mAct[KBgChatPrivate::Clear] = new KAction(i18n("Clear"), 0, this, TQT_SLOT(slotClear()), actions); - d->mAct[KBgChatPrivate::Close] = KStdAction::close(this, TQT_SLOT(hide()), actions); - d->mAct[KBgChatPrivate::Silent] = new KToggleAction(i18n("Silent"), 0, this, TQT_SLOT(slotSilent()), actions); + d->mAct[KBgChatPrivate::Gag] = new KAction(i18n("Gag"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotGag()), actions); + d->mAct[KBgChatPrivate::Ungag] = new KAction(i18n("Ungag"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotUngag()), actions); + d->mAct[KBgChatPrivate::Cleargag] = new KAction(i18n("Clear Gag List"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotCleargag()), actions); + d->mAct[KBgChatPrivate::Copy] = KStdAction::copy(TQT_TQOBJECT(this), TQT_SLOT(slotCopy()), actions); + d->mAct[KBgChatPrivate::Clear] = new KAction(i18n("Clear"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotClear()), actions); + d->mAct[KBgChatPrivate::Close] = KStdAction::close(TQT_TQOBJECT(this), TQT_SLOT(hide()), actions); + d->mAct[KBgChatPrivate::Silent] = new KToggleAction(i18n("Silent"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotSilent()), actions); } @@ -416,7 +416,7 @@ void KBgChat::setupDefault() /* * Overloaded member to create a TQListBoxItem for the chat window. */ -TQListBoxItem* KBgChat::layoutMessage(const TQString& fromName, const TQString& text) +TQListBoxItem* KBgChat::tqlayoutMessage(const TQString& fromName, const TQString& text) { TQListBoxText* message = new KLBT(this, text, fromName); return message; @@ -446,11 +446,11 @@ void KBgChat::hideEvent(TQHideEvent *e) */ void KBgChat::startGame(const TQString &name) { - int *id = d->mName2ID->find(d->mName[1] = name); + int *id = d->mName2ID->tqfind(d->mName[1] = name); if (!id) { id = new int(nextId()); d->mName2ID->insert(name, id); - addSendingEntry(i18n("Talk to %1").arg(name), *id); + addSendingEntry(i18n("Talk to %1").tqarg(name), *id); } setSendingEntry(CLIP_YOU_KIBITZ); } @@ -460,7 +460,7 @@ void KBgChat::startGame(const TQString &name) */ void KBgChat::endGame() { - int *id = d->mName2ID->find(d->mName[1]); + int *id = d->mName2ID->tqfind(d->mName[1]); if (id) setSendingEntry(*id); else @@ -472,11 +472,11 @@ void KBgChat::endGame() */ void KBgChat::fibsTalk(const TQString &name) { - int *id = d->mName2ID->find(name); + int *id = d->mName2ID->tqfind(name); if (!id) { id = new int(nextId()); d->mName2ID->insert(name, id); - addSendingEntry(i18n("Talk to %1").arg(name), *id); + addSendingEntry(i18n("Talk to %1").tqarg(name), *id); } setSendingEntry(*id); } @@ -486,7 +486,7 @@ void KBgChat::fibsTalk(const TQString &name) */ void KBgChat::deletePlayer(const TQString &name) { - int *id = d->mName2ID->find(name); + int *id = d->mName2ID->tqfind(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.find(' ')), user, cMsg = msg; + TQString clip = msg.left(msg.tqfind(' ')), user, cMsg = msg; TQDateTime date; bool flag = false; int cmd = clip.toInt(&flag); if (flag) { - cMsg.replace(0, cMsg.find(' ')+1, ""); + cMsg.tqreplace(0, cMsg.tqfind(' ')+1, ""); - user = cMsg.left(cMsg.find(' ')); + user = cMsg.left(cMsg.tqfind(' ')); switch (cmd) { case CLIP_SAYS: - if (!d->mGag.contains(user)) { - cMsg = i18n("<u>%1 tells you:</u> %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); + if (!d->mGag.tqcontains(user)) { + cMsg = i18n("<u>%1 tells you:</u> %2").tqarg(user).tqarg(cMsg.tqreplace(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.contains(user))) { - cMsg = i18n("<u>%1 shouts:</u> %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); + 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), "")); cMsg = "<font color=\"black\">" + cMsg + "</font>"; } else cMsg = ""; break; case CLIP_WHISPERS: - if (!d->mGag.contains(user)) { - cMsg = i18n("<u>%1 whispers:</u> %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); + if (!d->mGag.tqcontains(user)) { + cMsg = i18n("<u>%1 whispers:</u> %2").tqarg(user).tqarg(cMsg.tqreplace(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.contains(user)) { - cMsg = i18n("<u>%1 kibitzes:</u> %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); + if (!d->mGag.tqcontains(user)) { + cMsg = i18n("<u>%1 kibitzes:</u> %2").tqarg(user).tqarg(cMsg.tqreplace(TQRegExp("^" + user), "")); cMsg = "<font color=\"red\">" + cMsg + "</font>"; emit personalMessage(cMsg); } else @@ -583,56 +583,56 @@ void KBgChat::handleData(const TQString &msg) break; case CLIP_YOU_SAY: - cMsg = i18n("<u>You tell %1:</u> %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); + cMsg = i18n("<u>You tell %1:</u> %2").tqarg(user).tqarg(cMsg.tqreplace(TQRegExp("^" + user), "")); cMsg = "<font color=\"darkgreen\">" + cMsg + "</font>"; emit personalMessage(cMsg); - user = TQString::null; + user = TQString(); break; case CLIP_YOU_SHOUT: - cMsg = i18n("<u>You shout:</u> %1").arg(cMsg); + cMsg = i18n("<u>You shout:</u> %1").tqarg(cMsg); cMsg = "<font color=\"darkgreen\">" + cMsg + "</font>"; emit personalMessage(cMsg); - user = TQString::null; + user = TQString(); break; case CLIP_YOU_WHISPER: - cMsg = i18n("<u>You whisper:</u> %1").arg(cMsg); + cMsg = i18n("<u>You whisper:</u> %1").tqarg(cMsg); cMsg = "<font color=\"darkgreen\">" + cMsg + "</font>"; emit personalMessage(cMsg); - user = TQString::null; + user = TQString(); break; case CLIP_YOU_KIBITZ: - cMsg = i18n("<u>You kibitz:</u> %1").arg(cMsg); + cMsg = i18n("<u>You kibitz:</u> %1").tqarg(cMsg); cMsg = "<font color=\"darkgreen\">" + cMsg + "</font>"; emit personalMessage(cMsg); - user = TQString::null; + user = TQString(); break; case CLIP_MESSAGE: - 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").arg(user).arg(date.toString()).arg(cMsg); + 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(' ')); + 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); - user = TQString::null; + user = TQString(); break; case CLIP_MESSAGE_DELIVERED: - cMsg = i18n("Your message for %1 has been delivered.").arg(user); + cMsg = i18n("Your message for %1 has been delivered.").tqarg(user); cMsg = TQString("<font color=\"darkgreen\">") + cMsg + "</font>"; emit personalMessage(cMsg); - user = TQString::null; + user = TQString(); break; case CLIP_MESSAGE_SAVED: - cMsg = i18n("Your message for %1 has been saved.").arg(user); + cMsg = i18n("Your message for %1 has been saved.").tqarg(user); cMsg = TQString("<font color=\"darkgreen\">") + cMsg + "</font>"; emit personalMessage(cMsg); - user = TQString::null; + user = TQString(); break; default: // ignore the message @@ -644,8 +644,8 @@ void KBgChat::handleData(const TQString &msg) /* * Special treatment for non-CLIP messages */ - if (cMsg.contains(TQRegExp("^You say to yourself: "))) { - cMsg.replace(TQRegExp("^You say to yourself: "), + if (cMsg.tqcontains(TQRegExp("^You say to yourself: "))) { + cMsg.tqreplace(TQRegExp("^You say to yourself: "), i18n("<u>You say to yourself:</u> ")); } else { kdDebug(user.isNull(), 10500) << "KBgChat::handleData unhandled message: " @@ -667,10 +667,10 @@ void KBgChat::handleData(const TQString &msg) void KBgChat::contextMenu(TQListBoxItem *i, const TQPoint &p) { /* - * Even if i is non-null, user might still be TQString::null + * Even if i is non-null, user might still be TQString() */ - d->mName[0] = (i == 0) ? TQString::null : ((KLBT *)i)->player(); - d->mText = (i == 0) ? TQString::null : ((KLBT *)i)->text(); + d->mName[0] = (i == 0) ? TQString() : ((KLBT *)i)->player(); + d->mText = (i == 0) ? TQString() : ((KLBT *)i)->text(); /* * Get a new context menu every time. Safe to delete the 0 @@ -683,22 +683,22 @@ void KBgChat::contextMenu(TQListBoxItem *i, const TQPoint &p) */ if (!d->mName[0].isNull()) { - d->mAct[KBgChatPrivate::Talk]->setText(i18n("Talk to %1").arg(d->mName[0])); + d->mAct[KBgChatPrivate::Talk]->setText(i18n("Talk to %1").tqarg(d->mName[0])); d->mAct[KBgChatPrivate::Talk]->plug(d->mChat); - d->mAct[KBgChatPrivate::Inquire]->setText(i18n("Info on %1").arg(d->mName[0])); + d->mAct[KBgChatPrivate::Inquire]->setText(i18n("Info on %1").tqarg(d->mName[0])); d->mAct[KBgChatPrivate::Inquire]->plug(d->mChat); // invite menu is always the same - d->mChat->insertItem(i18n("Invite %1").arg(d->mName[0]), d->mInvt); + d->mChat->insertItem(i18n("Invite %1").tqarg(d->mName[0]), d->mInvt); d->mChat->insertSeparator(); - if (d->mGag.contains(d->mName[0]) <= 0) { - d->mAct[KBgChatPrivate::Gag]->setText(i18n("Gag %1").arg(d->mName[0])); + if (d->mGag.tqcontains(d->mName[0]) <= 0) { + d->mAct[KBgChatPrivate::Gag]->setText(i18n("Gag %1").tqarg(d->mName[0])); d->mAct[KBgChatPrivate::Gag]->plug(d->mChat); } else { - d->mAct[KBgChatPrivate::Ungag]->setText(i18n("Ungag %1").arg(d->mName[0])); + d->mAct[KBgChatPrivate::Ungag]->setText(i18n("Ungag %1").tqarg(d->mName[0])); d->mAct[KBgChatPrivate::Ungag]->plug(d->mChat); } } @@ -730,7 +730,7 @@ void KBgChat::slotCleargag() msg += i18n("The gag list is now empty."); msg += "</font>"; - addMessage(TQString::null, msg); + addMessage(TQString(), msg); } /* @@ -741,10 +741,10 @@ void KBgChat::slotGag() d->mGag.append(d->mName[0]); TQString msg("<font color=\"blue\">"); - msg += i18n("You won't hear what %1 says and shouts.").arg(d->mName[0]); + msg += i18n("You won't hear what %1 says and shouts.").tqarg(d->mName[0]); msg += "</font>"; - addMessage(TQString::null, msg); + addMessage(TQString(), msg); } /* @@ -763,10 +763,10 @@ void KBgChat::slotUngag() d->mGag.remove(d->mName[0]); TQString msg("<font color=\"blue\">"); - msg += i18n("You will again hear what %1 says and shouts.").arg(d->mName[0]); + msg += i18n("You will again hear what %1 says and shouts.").tqarg(d->mName[0]); msg += "</font>"; - addMessage(TQString::null, msg); + addMessage(TQString(), msg); } /* @@ -788,7 +788,7 @@ void KBgChat::slotSilent() msg = "<font color=\"blue\">" + i18n("You will not hear what people shout.") + "</font>"; else msg = "<font color=\"blue\">" + i18n("You will hear what people shout.") + "</font>"; - addMessage(TQString::null, msg); + addMessage(TQString(), msg); } /* @@ -797,10 +797,10 @@ void KBgChat::slotSilent() */ void KBgChat::slotCopy() { - d->mText.replace(TQRegExp("<u>"), ""); - d->mText.replace(TQRegExp("</u>"), ""); - d->mText.replace(TQRegExp("</font>"), ""); - d->mText.replace(TQRegExp("^.*\">"), ""); + d->mText.tqreplace(TQRegExp("<u>"), ""); + d->mText.tqreplace(TQRegExp("</u>"), ""); + d->mText.tqreplace(TQRegExp("</font>"), ""); + d->mText.tqreplace(TQRegExp("^.*\">"), ""); kapp->clipboard()->setText(d->mText); } |