From 576eb4299a00bc053db35414406f46372a0f70f2 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:42:31 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kbackgammon/engines/fibs/kbgfibschat.cpp | 246 +++++++++++++++---------------- 1 file changed, 123 insertions(+), 123 deletions(-) (limited to 'kbackgammon/engines/fibs/kbgfibschat.cpp') diff --git a/kbackgammon/engines/fibs/kbgfibschat.cpp b/kbackgammon/engines/fibs/kbgfibschat.cpp index 45ba2bb7..7b34bae0 100644 --- a/kbackgammon/engines/fibs/kbgfibschat.cpp +++ b/kbackgammon/engines/fibs/kbgfibschat.cpp @@ -26,25 +26,25 @@ #include "kbgfibschat.h" #include "kbgfibschat.moc" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -61,7 +61,7 @@ /* * Private utility class that might become more generally useful in - * the future. Basically, it implements rich text QListBox items. + * the future. Basically, it implements rich text TQListBox items. */ class KLBT : public QListBoxText { @@ -71,12 +71,12 @@ public: /* * Constructor */ - KLBT(QWidget *parent, const QString &text = QString::null, const QString &player = QString::null) - : QListBoxText(text) + KLBT(TQWidget *parent, const TQString &text = TQString::null, const TQString &player = TQString::null) + : TQListBoxText(text) { w = parent; - n = new QString(player); - t = new QSimpleRichText(text, w->font()); + n = new TQString(player); + t = new TQSimpleRichText(text, w->font()); // FIXME: this is not yet perfect t->setWidth(w->width()-20); @@ -94,7 +94,7 @@ public: /* * Overloaded required members returning height */ - virtual int height(const QListBox *) const + virtual int height(const TQListBox *) const { return (1+t->height()); } @@ -102,7 +102,7 @@ public: /* * Overloaded required members returning width */ - virtual int width(const QListBox *) const + virtual int width(const TQListBox *) const { return t->width(); } @@ -111,7 +111,7 @@ public: * The context menu needs the name of the player. It's easier * than extracting it from the text. */ - QString player() const + TQString player() const { return *n; } @@ -121,16 +121,16 @@ protected: /* * Required overloaded member to paint the text on the painter p. */ - virtual void paint(QPainter *p) + virtual void paint(TQPainter *p) { - t->draw(p, 1, 1, QRegion(p->viewport()), w->colorGroup()); + t->draw(p, 1, 1, TQRegion(p->viewport()), w->colorGroup()); } private: - QSimpleRichText *t; - QWidget *w; - QString *n; + TQSimpleRichText *t; + TQWidget *w; + TQString *n; }; @@ -142,12 +142,12 @@ public: /* * Name of the users */ - QString mName[2]; + TQString mName[2]; /* * Hold and assemble info text */ - QString mText; + TQString mText; /* * Numbers of the private action list. @@ -164,22 +164,22 @@ public: /* * Context menu and invitation menu */ - QPopupMenu *mChat, *mInvt; + TQPopupMenu *mChat, *mInvt; /* * list of users we do not want to hear shouting */ - QStringList mGag; + TQStringList mGag; /* * Listbox needed by the setup dialog */ - QListBox *mLb; + TQListBox *mLb; /* * Internal ID to name mapping */ - QDict *mName2ID; + TQDict *mName2ID; }; @@ -189,15 +189,15 @@ public: /* * Constructor of the chat window. */ -KBgChat::KBgChat(QWidget *parent, const char *name) +KBgChat::KBgChat(TQWidget *parent, const char *name) : KChat(parent, false) { d = new KBgChatPrivate(); KActionCollection* actions = new KActionCollection(this); - d->mName[0] = QString::null; + d->mName[0] = TQString::null; d->mChat = 0; - d->mInvt = new QPopupMenu(); + d->mInvt = new TQPopupMenu(); setAutoAddMessages(false); // we get an echo from FIBS setFromNickname(i18n("%1 user").arg(PROG_NAME)); @@ -207,12 +207,12 @@ KBgChat::KBgChat(QWidget *parent, const char *name) if (!addSendingEntry(i18n("Whisper to watchers only"), CLIP_YOU_WHISPER)) kdDebug(10500) << "adding whisper" << endl; - connect(this, SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), - this, SLOT(contextMenu(QListBoxItem *, const QPoint &))); - connect(this, SIGNAL(signalSendMessage(int, const QString &)), - this, SLOT(handleCommand(int, const QString &))); + connect(this, TQT_SIGNAL(rightButtonClicked(TQListBoxItem *, const TQPoint &)), + this, TQT_SLOT(contextMenu(TQListBoxItem *, const TQPoint &))); + connect(this, TQT_SIGNAL(signalSendMessage(int, const TQString &)), + this, TQT_SLOT(handleCommand(int, const TQString &))); - d->mName2ID = new QDict(17, true); + d->mName2ID = new TQDict(17, true); d->mName2ID->setAutoDelete(true); /* @@ -221,7 +221,7 @@ KBgChat::KBgChat(QWidget *parent, const char *name) setIcon(kapp->miniIcon()); setCaption(i18n("Chat Window")); - QWhatsThis::add(this, i18n("This is the chat window.\n\n" + TQWhatsThis::add(this, i18n("This is the chat window.\n\n" "The text in this window is colored depending on whether " "it is directed at you personally, shouted to the general " "FIBS population, has been said by you, or is of general " @@ -231,34 +231,34 @@ KBgChat::KBgChat(QWidget *parent, const char *name) * Define set of available actions */ d->mAct[KBgChatPrivate::Inquire] = new KAction(i18n("Info On"), - QIconSet(kapp->iconLoader()->loadIcon( + TQIconSet(kapp->iconLoader()->loadIcon( "help.xpm", KIcon::Small)), - 0, this, SLOT(slotInquire()), actions); + 0, this, TQT_SLOT(slotInquire()), actions); d->mAct[KBgChatPrivate::Talk] = new KAction(i18n("Talk To"), - QIconSet(kapp->iconLoader()->loadIcon( + TQIconSet(kapp->iconLoader()->loadIcon( PROG_NAME "-chat.png", KIcon::Small)), - 0, this, SLOT(slotTalk()), actions); + 0, this, TQT_SLOT(slotTalk()), actions); d->mAct[KBgChatPrivate::InviteD] = new KAction(i18n("Use Dialog"), 0, this, - SLOT(slotInviteD()), actions); + TQT_SLOT(slotInviteD()), actions); d->mAct[KBgChatPrivate::Invite1] = new KAction(i18n("1 Point Match"), 0, this, - SLOT(slotInvite1()), actions); + TQT_SLOT(slotInvite1()), actions); d->mAct[KBgChatPrivate::Invite2] = new KAction(i18n("2 Point Match"), 0, this, - SLOT(slotInvite2()), actions); + TQT_SLOT(slotInvite2()), actions); d->mAct[KBgChatPrivate::Invite3] = new KAction(i18n("3 Point Match"), 0, this, - SLOT(slotInvite3()), actions); + TQT_SLOT(slotInvite3()), actions); d->mAct[KBgChatPrivate::Invite4] = new KAction(i18n("4 Point Match"), 0, this, - SLOT(slotInvite4()), actions); + TQT_SLOT(slotInvite4()), actions); d->mAct[KBgChatPrivate::Invite5] = new KAction(i18n("5 Point Match"), 0, this, - SLOT(slotInvite5()), actions); + TQT_SLOT(slotInvite5()), actions); d->mAct[KBgChatPrivate::Invite6] = new KAction(i18n("6 Point Match"), 0, this, - SLOT(slotInvite6()), actions); + TQT_SLOT(slotInvite6()), actions); d->mAct[KBgChatPrivate::Invite7] = new KAction(i18n("7 Point Match"), 0, this, - SLOT(slotInvite7()), actions); + TQT_SLOT(slotInvite7()), actions); d->mAct[KBgChatPrivate::InviteU] = new KAction(i18n("Unlimited"), 0, this, - SLOT(slotInviteU()), actions); + TQT_SLOT(slotInviteU()), actions); d->mAct[KBgChatPrivate::InviteR] = new KAction(i18n("Resume"), 0, this, - SLOT(slotInviteR()), actions); + TQT_SLOT(slotInviteR()), actions); d->mAct[KBgChatPrivate::InviteD]->plug(d->mInvt); @@ -277,13 +277,13 @@ KBgChat::KBgChat(QWidget *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, SLOT(slotGag()), actions); - d->mAct[KBgChatPrivate::Ungag] = new KAction(i18n("Ungag"), 0, this, SLOT(slotUngag()), actions); - d->mAct[KBgChatPrivate::Cleargag] = new KAction(i18n("Clear Gag List"), 0, this, SLOT(slotCleargag()), actions); - d->mAct[KBgChatPrivate::Copy] = KStdAction::copy(this, SLOT(slotCopy()), actions); - d->mAct[KBgChatPrivate::Clear] = new KAction(i18n("Clear"), 0, this, SLOT(slotClear()), actions); - d->mAct[KBgChatPrivate::Close] = KStdAction::close(this, SLOT(hide()), actions); - d->mAct[KBgChatPrivate::Silent] = new KToggleAction(i18n("Silent"), 0, this, SLOT(slotSilent()), actions); + 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); } @@ -309,7 +309,7 @@ void KBgChat::readConfig() KConfig* config = kapp->config(); config->setGroup("chat window"); - QPoint pos(10, 10); + TQPoint pos(10, 10); pos = config->readPointEntry("ori", &pos); setGeometry(pos.x(), pos.y(), config->readNumEntry("wdt",460), config->readNumEntry("hgt",200)); @@ -344,7 +344,7 @@ void KBgChat::saveConfig() * Setup dialog page of the player list - allow the user to select the * columns to show * - * FIXME: need to be able to set font here KChatBase::setBothFont(const QFont& font) + * FIXME: need to be able to set font here KChatBase::setBothFont(const TQFont& font) */ void KBgChat::getSetupPages(KTabCtl *nb, int space) { @@ -352,18 +352,18 @@ void KBgChat::getSetupPages(KTabCtl *nb, int space) * Main Widget * =========== */ - QWidget *w = new QWidget(nb); - QGridLayout *gl = new QGridLayout(w, 2, 1, space); + TQWidget *w = new TQWidget(nb); + TQGridLayout *gl = new TQGridLayout(w, 2, 1, space); - d->mLb = new QListBox(w); + d->mLb = new TQListBox(w); d->mLb->setMultiSelection(true); d->mLb->insertStringList(d->mGag); - QLabel *info = new QLabel(w); + TQLabel *info = new TQLabel(w); info->setText(i18n("Select users to be removed from the gag list.")); - QWhatsThis::add(w, i18n("Select all the users you want " + TQWhatsThis::add(w, i18n("Select all the users you want " "to remove from the gag list " "and then click OK. Afterwards " "you will again hear what they shout.")); @@ -414,37 +414,37 @@ void KBgChat::setupDefault() // == various slots and functions ============================================== /* - * Overloaded member to create a QListBoxItem for the chat window. + * Overloaded member to create a TQListBoxItem for the chat window. */ -QListBoxItem* KBgChat::layoutMessage(const QString& fromName, const QString& text) +TQListBoxItem* KBgChat::layoutMessage(const TQString& fromName, const TQString& text) { - QListBoxText* message = new KLBT(this, text, fromName); + TQListBoxText* message = new KLBT(this, text, fromName); return message; } /* * Catch hide events, so the engine's menu can be update. */ -void KBgChat::showEvent(QShowEvent *e) +void KBgChat::showEvent(TQShowEvent *e) { - QFrame::showEvent(e); + TQFrame::showEvent(e); emit windowVisible(true); } /* * Catch hide events, so the engine's menu can be update. */ -void KBgChat::hideEvent(QHideEvent *e) +void KBgChat::hideEvent(TQHideEvent *e) { emit windowVisible(false); - QFrame::hideEvent(e); + TQFrame::hideEvent(e); } /* * At the beginning of a game, add the name to the list and switch to * kibitz mode. */ -void KBgChat::startGame(const QString &name) +void KBgChat::startGame(const TQString &name) { int *id = d->mName2ID->find(d->mName[1] = name); if (!id) { @@ -470,7 +470,7 @@ void KBgChat::endGame() /* * Set the chat window ready to talk to name */ -void KBgChat::fibsTalk(const QString &name) +void KBgChat::fibsTalk(const TQString &name) { int *id = d->mName2ID->find(name); if (!id) { @@ -484,7 +484,7 @@ void KBgChat::fibsTalk(const QString &name) /* * Remove the player from the combo box when he/she logs out. */ -void KBgChat::deletePlayer(const QString &name) +void KBgChat::deletePlayer(const TQString &name) { int *id = d->mName2ID->find(name); if (id) { @@ -496,7 +496,7 @@ void KBgChat::deletePlayer(const QString &name) /* * Take action when the user presses return in the line edit control. */ -void KBgChat::handleCommand(int id, const QString& msg) +void KBgChat::handleCommand(int id, const TQString& msg) { int realID = sendingEntry(); @@ -511,7 +511,7 @@ void KBgChat::handleCommand(int id, const QString& msg) emit fibsCommand("whisper " + msg); break; default: - QDictIterator it(*d->mName2ID); + TQDictIterator it(*d->mName2ID); while (it.current()) { if (*it.current() == realID) { emit fibsCommand("tell " + it.currentKey() + " " + msg); @@ -533,10 +533,10 @@ void KBgChat::handleCommand(int id, const QString& msg) * This function emits the string in rich text format with the signal * personalMessage - again: the string contains rich text! */ -void KBgChat::handleData(const QString &msg) +void KBgChat::handleData(const TQString &msg) { - QString clip = msg.left(msg.find(' ')), user, cMsg = msg; - QDateTime date; + TQString clip = msg.left(msg.find(' ')), user, cMsg = msg; + TQDateTime date; bool flag = false; int cmd = clip.toInt(&flag); @@ -549,7 +549,7 @@ void KBgChat::handleData(const QString &msg) switch (cmd) { case CLIP_SAYS: if (!d->mGag.contains(user)) { - cMsg = i18n("%1 tells you: %2").arg(user).arg(cMsg.replace(QRegExp("^" + user), "")); + cMsg = i18n("%1 tells you: %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "" + cMsg + ""; emit personalMessage(cMsg); } else @@ -558,7 +558,7 @@ void KBgChat::handleData(const QString &msg) case CLIP_SHOUTS: if ((!((KToggleAction *)d->mAct[KBgChatPrivate::Silent])->isChecked()) && (!d->mGag.contains(user))) { - cMsg = i18n("%1 shouts: %2").arg(user).arg(cMsg.replace(QRegExp("^" + user), "")); + cMsg = i18n("%1 shouts: %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "" + cMsg + ""; } else cMsg = ""; @@ -566,7 +566,7 @@ void KBgChat::handleData(const QString &msg) case CLIP_WHISPERS: if (!d->mGag.contains(user)) { - cMsg = i18n("%1 whispers: %2").arg(user).arg(cMsg.replace(QRegExp("^" + user), "")); + cMsg = i18n("%1 whispers: %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "" + cMsg + ""; emit personalMessage(cMsg); } else @@ -575,7 +575,7 @@ void KBgChat::handleData(const QString &msg) case CLIP_KIBITZES: if (!d->mGag.contains(user)) { - cMsg = i18n("%1 kibitzes: %2").arg(user).arg(cMsg.replace(QRegExp("^" + user), "")); + cMsg = i18n("%1 kibitzes: %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "" + cMsg + ""; emit personalMessage(cMsg); } else @@ -583,31 +583,31 @@ void KBgChat::handleData(const QString &msg) break; case CLIP_YOU_SAY: - cMsg = i18n("You tell %1: %2").arg(user).arg(cMsg.replace(QRegExp("^" + user), "")); + cMsg = i18n("You tell %1: %2").arg(user).arg(cMsg.replace(TQRegExp("^" + user), "")); cMsg = "" + cMsg + ""; emit personalMessage(cMsg); - user = QString::null; + user = TQString::null; break; case CLIP_YOU_SHOUT: cMsg = i18n("You shout: %1").arg(cMsg); cMsg = "" + cMsg + ""; emit personalMessage(cMsg); - user = QString::null; + user = TQString::null; break; case CLIP_YOU_WHISPER: cMsg = i18n("You whisper: %1").arg(cMsg); cMsg = "" + cMsg + ""; emit personalMessage(cMsg); - user = QString::null; + user = TQString::null; break; case CLIP_YOU_KIBITZ: cMsg = i18n("You kibitz: %1").arg(cMsg); cMsg = "" + cMsg + ""; emit personalMessage(cMsg); - user = QString::null; + user = TQString::null; break; case CLIP_MESSAGE: @@ -618,21 +618,21 @@ void KBgChat::handleData(const QString &msg) cMsg = i18n("User %1 left a message at %2: %3").arg(user).arg(date.toString()).arg(cMsg); cMsg = "" + cMsg + ""; emit personalMessage(cMsg); - user = QString::null; + user = TQString::null; break; case CLIP_MESSAGE_DELIVERED: cMsg = i18n("Your message for %1 has been delivered.").arg(user); - cMsg = QString("") + cMsg + ""; + cMsg = TQString("") + cMsg + ""; emit personalMessage(cMsg); - user = QString::null; + user = TQString::null; break; case CLIP_MESSAGE_SAVED: cMsg = i18n("Your message for %1 has been saved.").arg(user); - cMsg = QString("") + cMsg + ""; + cMsg = TQString("") + cMsg + ""; emit personalMessage(cMsg); - user = QString::null; + user = TQString::null; break; default: // ignore the message @@ -644,8 +644,8 @@ void KBgChat::handleData(const QString &msg) /* * Special treatment for non-CLIP messages */ - if (cMsg.contains(QRegExp("^You say to yourself: "))) { - cMsg.replace(QRegExp("^You say to yourself: "), + if (cMsg.contains(TQRegExp("^You say to yourself: "))) { + cMsg.replace(TQRegExp("^You say to yourself: "), i18n("You say to yourself: ")); } else { kdDebug(user.isNull(), 10500) << "KBgChat::handleData unhandled message: " @@ -664,19 +664,19 @@ void KBgChat::handleData(const QString &msg) /* * RMB opens a context menu. */ -void KBgChat::contextMenu(QListBoxItem *i, const QPoint &p) +void KBgChat::contextMenu(TQListBoxItem *i, const TQPoint &p) { /* - * Even if i is non-null, user might still be QString::null + * Even if i is non-null, user might still be TQString::null */ - d->mName[0] = (i == 0) ? QString::null : ((KLBT *)i)->player(); - d->mText = (i == 0) ? QString::null : ((KLBT *)i)->text(); + d->mName[0] = (i == 0) ? TQString::null : ((KLBT *)i)->player(); + d->mText = (i == 0) ? TQString::null : ((KLBT *)i)->text(); /* * Get a new context menu every time. Safe to delete the 0 * pointer. */ - delete d->mChat; d->mChat = new QPopupMenu(); + delete d->mChat; d->mChat = new TQPopupMenu(); /* * Fill the context menu with actions @@ -726,11 +726,11 @@ void KBgChat::slotCleargag() { d->mGag.clear(); - QString msg(""); + TQString msg(""); msg += i18n("The gag list is now empty."); msg += ""; - addMessage(QString::null, msg); + addMessage(TQString::null, msg); } /* @@ -740,11 +740,11 @@ void KBgChat::slotGag() { d->mGag.append(d->mName[0]); - QString msg(""); + TQString msg(""); msg += i18n("You won't hear what %1 says and shouts.").arg(d->mName[0]); msg += ""; - addMessage(QString::null, msg); + addMessage(TQString::null, msg); } /* @@ -762,11 +762,11 @@ void KBgChat::slotUngag() { d->mGag.remove(d->mName[0]); - QString msg(""); + TQString msg(""); msg += i18n("You will again hear what %1 says and shouts.").arg(d->mName[0]); msg += ""; - addMessage(QString::null, msg); + addMessage(TQString::null, msg); } /* @@ -783,12 +783,12 @@ void KBgChat::slotInquire() */ void KBgChat::slotSilent() { - QString msg; + TQString msg; if (((KToggleAction *)d->mAct[KBgChatPrivate::Silent])->isChecked()) msg = "" + i18n("You will not hear what people shout.") + ""; else msg = "" + i18n("You will hear what people shout.") + ""; - addMessage(QString::null, msg); + addMessage(TQString::null, msg); } /* @@ -797,10 +797,10 @@ void KBgChat::slotSilent() */ void KBgChat::slotCopy() { - d->mText.replace(QRegExp(""), ""); - d->mText.replace(QRegExp(""), ""); - d->mText.replace(QRegExp(""), ""); - d->mText.replace(QRegExp("^.*\">"), ""); + d->mText.replace(TQRegExp(""), ""); + d->mText.replace(TQRegExp(""), ""); + d->mText.replace(TQRegExp(""), ""); + d->mText.replace(TQRegExp("^.*\">"), ""); kapp->clipboard()->setText(d->mText); } -- cgit v1.2.1