diff options
Diffstat (limited to 'libkdegames/kgame')
40 files changed, 1143 insertions, 1143 deletions
diff --git a/libkdegames/kgame/dialogs/kgameconnectdialog.cpp b/libkdegames/kgame/dialogs/kgameconnectdialog.cpp index 4d2d90e0..575b3090 100644 --- a/libkdegames/kgame/dialogs/kgameconnectdialog.cpp +++ b/libkdegames/kgame/dialogs/kgameconnectdialog.cpp @@ -24,15 +24,15 @@ #include <knuminput.h> #include <klocale.h> -#include <qlineedit.h> -#include <qcombobox.h> -#include <qvbuttongroup.h> -#include <qlayout.h> -#include <qradiobutton.h> -#include <qlabel.h> +#include <tqlineedit.h> +#include <tqcombobox.h> +#include <tqvbuttongroup.h> +#include <tqlayout.h> +#include <tqradiobutton.h> +#include <tqlabel.h> #include <dnssd/servicebrowser.h> -#include <qpushbutton.h> -#include <qgrid.h> +#include <tqpushbutton.h> +#include <tqgrid.h> class KGameConnectWidgetPrivate { @@ -46,42 +46,42 @@ class KGameConnectWidgetPrivate } KIntNumInput* mPort; - QLineEdit* mHost; //KLineEdit? - QVButtonGroup* mButtonGroup; - QComboBox *mClientName; - QLabel *mClientNameLabel; + TQLineEdit* mHost; //KLineEdit? + TQVButtonGroup* mButtonGroup; + TQComboBox *mClientName; + TQLabel *mClientNameLabel; DNSSD::ServiceBrowser *mBrowser; - QLabel *mServerNameLabel; - QLineEdit *mServerName; - QString mType; + TQLabel *mServerNameLabel; + TQLineEdit *mServerName; + TQString mType; }; -KGameConnectWidget::KGameConnectWidget(QWidget* parent) : QWidget(parent) +KGameConnectWidget::KGameConnectWidget(TQWidget* parent) : TQWidget(parent) { d = new KGameConnectWidgetPrivate; - QVBoxLayout* vb = new QVBoxLayout(this, KDialog::spacingHint()); - d->mButtonGroup = new QVButtonGroup(this); + TQVBoxLayout* vb = new TQVBoxLayout(this, KDialog::spacingHint()); + d->mButtonGroup = new TQVButtonGroup(this); vb->addWidget(d->mButtonGroup); - connect(d->mButtonGroup, SIGNAL(clicked(int)), this, SLOT(slotTypeChanged(int))); - (void)new QRadioButton(i18n("Create a network game"), d->mButtonGroup); - (void)new QRadioButton(i18n("Join a network game"), d->mButtonGroup); + connect(d->mButtonGroup, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(slotTypeChanged(int))); + (void)new TQRadioButton(i18n("Create a network game"), d->mButtonGroup); + (void)new TQRadioButton(i18n("Join a network game"), d->mButtonGroup); - QGrid* g = new QGrid(2, this); + TQGrid* g = new TQGrid(2, this); vb->addWidget(g); g->setSpacing(KDialog::spacingHint()); - d->mServerNameLabel = new QLabel(i18n("Game name:"), g); - d->mServerName = new QLineEdit(g); - d->mClientNameLabel = new QLabel(i18n("Network games:"), g); - d->mClientName = new QComboBox(g); - connect(d->mClientName,SIGNAL(activated(int)),SLOT(slotGameSelected(int))); - (void)new QLabel(i18n("Port to connect to:"), g); + d->mServerNameLabel = new TQLabel(i18n("Game name:"), g); + d->mServerName = new TQLineEdit(g); + d->mClientNameLabel = new TQLabel(i18n("Network games:"), g); + d->mClientName = new TQComboBox(g); + connect(d->mClientName,TQT_SIGNAL(activated(int)),TQT_SLOT(slotGameSelected(int))); + (void)new TQLabel(i18n("Port to connect to:"), g); d->mPort = new KIntNumInput(g); - (void)new QLabel(i18n("Host to connect to:"), g); - d->mHost = new QLineEdit(g); + (void)new TQLabel(i18n("Host to connect to:"), g); + d->mHost = new TQLineEdit(g); - QPushButton *button=new QPushButton(i18n("&Start Network"), this); - connect(button, SIGNAL(clicked()), this, SIGNAL(signalNetworkSetup())); + TQPushButton *button=new TQPushButton(i18n("&Start Network"), this); + connect(button, TQT_SIGNAL(clicked()), this, TQT_SIGNAL(signalNetworkSetup())); vb->addWidget(button); // Hide until type is set d->mClientName->hide(); @@ -107,12 +107,12 @@ void KGameConnectWidget::showDnssdControls() } } -void KGameConnectWidget::setType(const QString& type) +void KGameConnectWidget::setType(const TQString& type) { d->mType = type; delete d->mBrowser; d->mBrowser = new DNSSD::ServiceBrowser(type); - connect(d->mBrowser,SIGNAL(finished()),SLOT(slotGamesFound())); + connect(d->mBrowser,TQT_SIGNAL(finished()),TQT_SLOT(slotGamesFound())); d->mBrowser->startBrowse(); showDnssdControls(); } @@ -122,25 +122,25 @@ void KGameConnectWidget::slotGamesFound() bool autoselect=false; if (!d->mClientName->count()) autoselect=true; d->mClientName->clear(); - QStringList names; - QValueList<DNSSD::RemoteService::Ptr>::ConstIterator itEnd = d->mBrowser->services().end(); - for (QValueList<DNSSD::RemoteService::Ptr>::ConstIterator it = d->mBrowser->services().begin(); + TQStringList names; + TQValueList<DNSSD::RemoteService::Ptr>::ConstIterator itEnd = d->mBrowser->services().end(); + for (TQValueList<DNSSD::RemoteService::Ptr>::ConstIterator it = d->mBrowser->services().begin(); it!=itEnd; ++it) names << (*it)->serviceName(); d->mClientName->insertStringList(names); if (autoselect && d->mClientName->count()) slotGameSelected(0); } -void KGameConnectWidget::setName(const QString& name) +void KGameConnectWidget::setName(const TQString& name) { d->mServerName->setText(name); } -QString KGameConnectWidget::gameName() const +TQString KGameConnectWidget::gameName() const { return d->mServerName->text(); } -QString KGameConnectWidget::type() const +TQString KGameConnectWidget::type() const { return d->mType; } @@ -160,12 +160,12 @@ KGameConnectWidget::~KGameConnectWidget() delete d; } -QString KGameConnectWidget::host() const +TQString KGameConnectWidget::host() const { if (d->mHost->isEnabled()) { return d->mHost->text(); } else { - return QString::null; + return TQString::null; } } @@ -174,7 +174,7 @@ unsigned short int KGameConnectWidget::port() const return d->mPort->value(); } -void KGameConnectWidget::setHost(const QString& host) +void KGameConnectWidget::setHost(const TQString& host) { d->mHost->setText(host); } @@ -213,11 +213,11 @@ class KGameConnectDialogPrivate }; // buttonmask =Ok|Cancel -KGameConnectDialog::KGameConnectDialog(QWidget* parent,int buttonmask) : KDialogBase(Plain, +KGameConnectDialog::KGameConnectDialog(TQWidget* parent,int buttonmask) : KDialogBase(Plain, i18n("Network Game"),buttonmask , Ok, parent, 0, true, buttonmask!=0) { d = new KGameConnectDialogPrivate; - QVBoxLayout* vb = new QVBoxLayout(plainPage(), spacingHint()); + TQVBoxLayout* vb = new TQVBoxLayout(plainPage(), spacingHint()); d->mConnect = new KGameConnectWidget(plainPage()); vb->addWidget(d->mConnect); } @@ -228,7 +228,7 @@ KGameConnectDialog::~KGameConnectDialog() } int KGameConnectDialog::initConnection( unsigned short int& port, - QString& host, QWidget* parent, bool server) + TQString& host, TQWidget* parent, bool server) { KGameConnectDialog d(parent); d.setHost(host); @@ -240,14 +240,14 @@ int KGameConnectDialog::initConnection( unsigned short int& port, } int result = d.exec(); - if (result == QDialog::Accepted) { + if (result == TQDialog::Accepted) { host = d.host(); port = d.port(); } return result; } -QString KGameConnectDialog::host() const +TQString KGameConnectDialog::host() const { return d->mConnect->host(); } @@ -257,7 +257,7 @@ unsigned short int KGameConnectDialog::port() const return d->mConnect->port(); } -void KGameConnectDialog::setHost(const QString& host) +void KGameConnectDialog::setHost(const TQString& host) { d->mConnect->setHost(host); } diff --git a/libkdegames/kgame/dialogs/kgameconnectdialog.h b/libkdegames/kgame/dialogs/kgameconnectdialog.h index acbf21d2..fdb0be4f 100644 --- a/libkdegames/kgame/dialogs/kgameconnectdialog.h +++ b/libkdegames/kgame/dialogs/kgameconnectdialog.h @@ -30,19 +30,19 @@ class KGameConnectWidget : public QWidget { Q_OBJECT public: - KGameConnectWidget(QWidget* parent); + KGameConnectWidget(TQWidget* parent); virtual ~KGameConnectWidget(); /** * @param host The host to connect to by default **/ - void setHost(const QString& host); + void setHost(const TQString& host); /** - * @return The host to connect to or QString::null if the user wants to + * @return The host to connect to or TQString::null if the user wants to * be the MASTER **/ - QString host() const; + TQString host() const; /** * @param port The port that will be shown by default @@ -66,24 +66,24 @@ public: * It should be unique for application. * @since 3.4 **/ - void setType(const QString& type); + void setType(const TQString& type); /** * @return service type */ - QString type() const; + TQString type() const; /** * Set game name for publishing. * @param name Game name. Important only for server mode. If not * set hostname will be used. In case of name conflict -2, -3 and so on will be added to name. */ - void setName(const QString& name); + void setName(const TQString& name); /** * @return game name. */ - QString gameName() const; + TQString gameName() const; protected slots: /** @@ -108,7 +108,7 @@ private: * @short Dialog to ask for host and port * * This Dialog is used to create a game. You call initConnection(port, - * QString::null, parent, true) to create a network game (as a server) + * TQString::null, parent, true) to create a network game (as a server) * or initConnection(port, host, parent) to join a network game. * * @author Andreas Beckermann <b_mann@gmx.de> @@ -117,7 +117,7 @@ class KGameConnectDialog : public KDialogBase { Q_OBJECT public: - KGameConnectDialog(QWidget* parent = 0,int buttonmask=Ok|Cancel); + KGameConnectDialog(TQWidget* parent = 0,int buttonmask=Ok|Cancel); virtual ~KGameConnectDialog(); /** @@ -125,23 +125,23 @@ public: * server game, depending on user's choice. * @param port The port the user wants to connect to. * @param host The host the user wants to connect to. Will be - * QString::null if server game is chosen + * TQString::null if server game is chosen * @param parent The parent of the dialog * @param server True to create a network game per default, false to * join a game by default **/ - static int initConnection(unsigned short int& port, QString& host, QWidget* parent, bool server = false); + static int initConnection(unsigned short int& port, TQString& host, TQWidget* parent, bool server = false); /** * @param host The host to connect to by default **/ - void setHost(const QString& host); + void setHost(const TQString& host); /** - * @return The host to connect to or QString::null if the user wants to + * @return The host to connect to or TQString::null if the user wants to * be the MASTER **/ - QString host() const; + TQString host() const; /** * @param port The port that will be shown by default diff --git a/libkdegames/kgame/dialogs/kgamedebugdialog.cpp b/libkdegames/kgame/dialogs/kgamedebugdialog.cpp index b112b04c..09a35e56 100644 --- a/libkdegames/kgame/dialogs/kgamedebugdialog.cpp +++ b/libkdegames/kgame/dialogs/kgamedebugdialog.cpp @@ -32,11 +32,11 @@ #include <kpushbutton.h> #include <kstdguiitem.h> -#include <qlayout.h> -#include <qstring.h> -#include <qintdict.h> -#include <qlabel.h> -#include <qdatetime.h> +#include <tqlayout.h> +#include <tqstring.h> +#include <tqintdict.h> +#include <tqlabel.h> +#include <tqdatetime.h> #include <typeinfo> @@ -85,42 +85,42 @@ public: const KGame* mGame; - QFrame* mGamePage; + TQFrame* mGamePage; KListView* mGameProperties; - QListViewItem* mGameAddress; - QListViewItem* mGameId; - QListViewItem* mGameCookie; - QListViewItem* mGameMaster; - QListViewItem* mGameAdmin; - QListViewItem* mGameOffering; - QListViewItem* mGameStatus; - QListViewItem* mGameRunning; - QListViewItem* mGameMaxPlayers; - QListViewItem* mGameMinPlayers; - QListViewItem* mGamePlayerCount; + TQListViewItem* mGameAddress; + TQListViewItem* mGameId; + TQListViewItem* mGameCookie; + TQListViewItem* mGameMaster; + TQListViewItem* mGameAdmin; + TQListViewItem* mGameOffering; + TQListViewItem* mGameStatus; + TQListViewItem* mGameRunning; + TQListViewItem* mGameMaxPlayers; + TQListViewItem* mGameMinPlayers; + TQListViewItem* mGamePlayerCount; - QFrame* mPlayerPage; + TQFrame* mPlayerPage; KListBox* mPlayerList; KListView* mPlayerProperties; - QListViewItem* mPlayerAddress; - QListViewItem* mPlayerId; - QListViewItem* mPlayerName; - QListViewItem* mPlayerGroup; - QListViewItem* mPlayerUserId; - QListViewItem* mPlayerMyTurn; - QListViewItem* mPlayerAsyncInput; - QListViewItem* mPlayerKGameAddress; - QListViewItem* mPlayerVirtual; - QListViewItem* mPlayerActive; - QListViewItem* mPlayerRtti; - QListViewItem* mPlayerNetworkPriority; - - QFrame* mMessagePage; + TQListViewItem* mPlayerAddress; + TQListViewItem* mPlayerId; + TQListViewItem* mPlayerName; + TQListViewItem* mPlayerGroup; + TQListViewItem* mPlayerUserId; + TQListViewItem* mPlayerMyTurn; + TQListViewItem* mPlayerAsyncInput; + TQListViewItem* mPlayerKGameAddress; + TQListViewItem* mPlayerVirtual; + TQListViewItem* mPlayerActive; + TQListViewItem* mPlayerRtti; + TQListViewItem* mPlayerNetworkPriority; + + TQFrame* mMessagePage; KListView* mMessageList; KListBox* mHideIdList; }; -KGameDebugDialog::KGameDebugDialog(KGame* g, QWidget* parent, bool modal) : +KGameDebugDialog::KGameDebugDialog(KGame* g, TQWidget* parent, bool modal) : KDialogBase(Tabbed, i18n("KGame Debug Dialog"), Close, Close, parent, 0, modal, true) { @@ -141,8 +141,8 @@ KGameDebugDialog::~KGameDebugDialog() void KGameDebugDialog::initGamePage() { d->mGamePage = addPage(i18n("Debug &KGame")); - QVBoxLayout* topLayout = new QVBoxLayout(d->mGamePage, marginHint(), spacingHint()); - QHBoxLayout* layout = new QHBoxLayout(topLayout); + TQVBoxLayout* topLayout = new TQVBoxLayout(d->mGamePage, marginHint(), spacingHint()); + TQHBoxLayout* layout = new TQHBoxLayout(topLayout); KListView* v = new KListView(d->mGamePage); v->addColumn(i18n("Data")); @@ -155,38 +155,38 @@ void KGameDebugDialog::initGamePage() d->mGameProperties->addColumn(i18n("Policy")); layout->addWidget(d->mGameProperties); - QPushButton* b = new QPushButton(i18n("Update"), d->mGamePage); - connect(b, SIGNAL(pressed()), this, SLOT(slotUpdateGameData())); + TQPushButton* b = new TQPushButton(i18n("Update"), d->mGamePage); + connect(b, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotUpdateGameData())); topLayout->addWidget(b); // game data - d->mGameAddress = new QListViewItem(v, i18n("KGame Pointer")); - d->mGameId = new QListViewItem(v, i18n("Game ID")); - d->mGameCookie = new QListViewItem(v, i18n("Game Cookie")); - d->mGameMaster = new QListViewItem(v, i18n("Is Master")); - d->mGameAdmin = new QListViewItem(v, i18n("Is Admin")); - d->mGameOffering = new QListViewItem(v, i18n("Is Offering Connections")); - d->mGameStatus = new QListViewItem(v, i18n("Game Status")); - d->mGameRunning = new QListViewItem(v, i18n("Game is Running")); - d->mGameMaxPlayers = new QListViewItem(v, i18n("Maximal Players")); - d->mGameMinPlayers = new QListViewItem(v, i18n("Minimal Players")); - d->mGamePlayerCount = new QListViewItem(v, i18n("Players")); + d->mGameAddress = new TQListViewItem(v, i18n("KGame Pointer")); + d->mGameId = new TQListViewItem(v, i18n("Game ID")); + d->mGameCookie = new TQListViewItem(v, i18n("Game Cookie")); + d->mGameMaster = new TQListViewItem(v, i18n("Is Master")); + d->mGameAdmin = new TQListViewItem(v, i18n("Is Admin")); + d->mGameOffering = new TQListViewItem(v, i18n("Is Offering Connections")); + d->mGameStatus = new TQListViewItem(v, i18n("Game Status")); + d->mGameRunning = new TQListViewItem(v, i18n("Game is Running")); + d->mGameMaxPlayers = new TQListViewItem(v, i18n("Maximal Players")); + d->mGameMinPlayers = new TQListViewItem(v, i18n("Minimal Players")); + d->mGamePlayerCount = new TQListViewItem(v, i18n("Players")); } void KGameDebugDialog::initPlayerPage() { d->mPlayerPage = addPage(i18n("Debug &Players")); - QVBoxLayout* topLayout = new QVBoxLayout(d->mPlayerPage, marginHint(), spacingHint()); - QHBoxLayout* layout = new QHBoxLayout(topLayout); + TQVBoxLayout* topLayout = new TQVBoxLayout(d->mPlayerPage, marginHint(), spacingHint()); + TQHBoxLayout* layout = new TQHBoxLayout(topLayout); //TODO: connect to the KGame signals for joined/removed players!!! - QVBoxLayout* listLayout = new QVBoxLayout(layout); - QLabel* listLabel = new QLabel(i18n("Available Players"), d->mPlayerPage); + TQVBoxLayout* listLayout = new TQVBoxLayout(layout); + TQLabel* listLabel = new TQLabel(i18n("Available Players"), d->mPlayerPage); listLayout->addWidget(listLabel); d->mPlayerList = new KListBox(d->mPlayerPage); - connect(d->mPlayerList, SIGNAL(executed(QListBoxItem*)), this, SLOT(slotUpdatePlayerData(QListBoxItem*))); + connect(d->mPlayerList, TQT_SIGNAL(executed(TQListBoxItem*)), this, TQT_SLOT(slotUpdatePlayerData(TQListBoxItem*))); listLayout->addWidget(d->mPlayerList); - d->mPlayerList->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding)); + d->mPlayerList->setSizePolicy(TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding)); KListView* v = new KListView(d->mPlayerPage); layout->addWidget(v); @@ -199,28 +199,28 @@ void KGameDebugDialog::initPlayerPage() d->mPlayerProperties->addColumn(i18n("Policy")); layout->addWidget(d->mPlayerProperties); - QPushButton* b = new QPushButton(i18n("Update"), d->mPlayerPage); - connect(b, SIGNAL(pressed()), this, SLOT(slotUpdatePlayerList())); + TQPushButton* b = new TQPushButton(i18n("Update"), d->mPlayerPage); + connect(b, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotUpdatePlayerList())); topLayout->addWidget(b); - d->mPlayerAddress = new QListViewItem(v, i18n("Player Pointer")); - d->mPlayerId = new QListViewItem(v, i18n("Player ID")); - d->mPlayerName = new QListViewItem(v, i18n("Player Name")); - d->mPlayerGroup = new QListViewItem(v, i18n("Player Group")); - d->mPlayerUserId = new QListViewItem(v, i18n("Player User ID")); - d->mPlayerMyTurn = new QListViewItem(v, i18n("My Turn")); - d->mPlayerAsyncInput = new QListViewItem(v, i18n("Async Input")); - d->mPlayerKGameAddress = new QListViewItem(v, i18n("KGame Address")); - d->mPlayerVirtual = new QListViewItem(v, i18n("Player is Virtual")); - d->mPlayerActive = new QListViewItem(v, i18n("Player is Active")); - d->mPlayerRtti = new QListViewItem(v, i18n("RTTI")); - d->mPlayerNetworkPriority = new QListViewItem(v, i18n("Network Priority")); + d->mPlayerAddress = new TQListViewItem(v, i18n("Player Pointer")); + d->mPlayerId = new TQListViewItem(v, i18n("Player ID")); + d->mPlayerName = new TQListViewItem(v, i18n("Player Name")); + d->mPlayerGroup = new TQListViewItem(v, i18n("Player Group")); + d->mPlayerUserId = new TQListViewItem(v, i18n("Player User ID")); + d->mPlayerMyTurn = new TQListViewItem(v, i18n("My Turn")); + d->mPlayerAsyncInput = new TQListViewItem(v, i18n("Async Input")); + d->mPlayerKGameAddress = new TQListViewItem(v, i18n("KGame Address")); + d->mPlayerVirtual = new TQListViewItem(v, i18n("Player is Virtual")); + d->mPlayerActive = new TQListViewItem(v, i18n("Player is Active")); + d->mPlayerRtti = new TQListViewItem(v, i18n("RTTI")); + d->mPlayerNetworkPriority = new TQListViewItem(v, i18n("Network Priority")); } void KGameDebugDialog::initMessagePage() { d->mMessagePage = addPage(i18n("Debug &Messages")); - QGridLayout* layout = new QGridLayout(d->mMessagePage, 11, 7, marginHint(), spacingHint()); + TQGridLayout* layout = new TQGridLayout(d->mMessagePage, 11, 7, marginHint(), spacingHint()); d->mMessageList = new KListView(d->mMessagePage); layout->addMultiCellWidget(d->mMessageList, 0, 9, 0, 3); d->mMessageList->addColumn(i18n("Time")); @@ -229,21 +229,21 @@ void KGameDebugDialog::initMessagePage() d->mMessageList->addColumn(i18n("Sender")); d->mMessageList->addColumn(i18n("ID - Text")); - QPushButton* hide = new QPushButton(i18n("&>>"), d->mMessagePage); - connect(hide, SIGNAL(pressed()), this, SLOT(slotHideId())); + TQPushButton* hide = new TQPushButton(i18n("&>>"), d->mMessagePage); + connect(hide, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotHideId())); layout->addWidget(hide, 4, 4); - QPushButton* show = new QPushButton(i18n("&<<"), d->mMessagePage); - connect(show, SIGNAL(pressed()), this, SLOT(slotShowId())); + TQPushButton* show = new TQPushButton(i18n("&<<"), d->mMessagePage); + connect(show, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotShowId())); layout->addWidget(show, 6, 4); - QLabel* l = new QLabel(i18n("Do not show IDs:"), d->mMessagePage); + TQLabel* l = new TQLabel(i18n("Do not show IDs:"), d->mMessagePage); layout->addMultiCellWidget(l, 0, 0, 5, 6); d->mHideIdList = new KListBox(d->mMessagePage); layout->addMultiCellWidget(d->mHideIdList, 1, 8, 5, 6); - QPushButton* clear = new KPushButton(KStdGuiItem::clear(), d->mMessagePage); - connect(clear, SIGNAL(pressed()), this, SLOT(slotClearMessages())); + TQPushButton* clear = new KPushButton(KStdGuiItem::clear(), d->mMessagePage); + connect(clear, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotClearMessages())); layout->addMultiCellWidget(clear, 10, 10, 0, 6); //TODO: "show all but..." and "show nothing but..." } @@ -292,12 +292,12 @@ void KGameDebugDialog::slotUpdatePlayerData() void KGameDebugDialog::slotUpdatePlayerList() { - QListBoxItem* i = d->mPlayerList->firstItem(); + TQListBoxItem* i = d->mPlayerList->firstItem(); for (; i; i = d->mPlayerList->firstItem()) { removePlayer(i); } - QPtrList<KPlayer> list = *d->mGame->playerList(); + TQPtrList<KPlayer> list = *d->mGame->playerList(); for (KPlayer* p = list.first(); p; p = list.next()) { addPlayer(p); } @@ -312,26 +312,26 @@ void KGameDebugDialog::slotUpdateGameData() clearGameData(); - QString buf; + TQString buf; buf.sprintf("%p", d->mGame); d->mGameAddress->setText(1, buf); - d->mGameId->setText(1, QString::number(d->mGame->gameId())); - d->mGameCookie->setText(1, QString::number(d->mGame->cookie())); + d->mGameId->setText(1, TQString::number(d->mGame->gameId())); + d->mGameCookie->setText(1, TQString::number(d->mGame->cookie())); d->mGameMaster->setText(1, d->mGame->isMaster() ? i18n("True") : i18n("False")); d->mGameAdmin->setText(1, d->mGame->isAdmin() ? i18n("True") : i18n("False")); d->mGameOffering->setText(1, d->mGame->isOfferingConnections() ? i18n("True") : i18n("False")); - d->mGameStatus->setText(1, QString::number(d->mGame->gameStatus())); + d->mGameStatus->setText(1, TQString::number(d->mGame->gameStatus())); d->mGameRunning->setText(1, d->mGame->isRunning() ? i18n("True") : i18n("False")); - d->mGameMaxPlayers->setText(1, QString::number(d->mGame->maxPlayers())); - d->mGameMinPlayers->setText(1, QString::number(d->mGame->minPlayers())); - d->mGamePlayerCount->setText(1, QString::number(d->mGame->playerCount())); + d->mGameMaxPlayers->setText(1, TQString::number(d->mGame->maxPlayers())); + d->mGameMinPlayers->setText(1, TQString::number(d->mGame->minPlayers())); + d->mGamePlayerCount->setText(1, TQString::number(d->mGame->playerCount())); //TODO ios KGamePropertyHandler* handler = d->mGame->dataHandler(); - QIntDictIterator<KGamePropertyBase> it(handler->dict()); + TQIntDictIterator<KGamePropertyBase> it(handler->dict()); while (it.current()) { - QString policy; + TQString policy; switch (it.current()->policy()) { case KGamePropertyBase::PolicyClean: policy = i18n("Clean"); @@ -347,7 +347,7 @@ void KGameDebugDialog::slotUpdateGameData() policy = i18n("Undefined"); break; } - (void) new QListViewItem(d->mGameProperties, + (void) new TQListViewItem(d->mGameProperties, handler->propertyName(it.current()->id()), handler->propertyValue(it.current()), policy); @@ -356,7 +356,7 @@ void KGameDebugDialog::slotUpdateGameData() } } -void KGameDebugDialog::slotUpdatePlayerData(QListBoxItem* item) +void KGameDebugDialog::slotUpdatePlayerData(TQListBoxItem* item) { if (!item || !d->mGame) { return; @@ -371,29 +371,29 @@ void KGameDebugDialog::slotUpdatePlayerData(QListBoxItem* item) clearPlayerData(); - QString buf; + TQString buf; buf.sprintf("%p", p); d->mPlayerAddress->setText(1, buf); - d->mPlayerId->setText(1, QString::number(p->id())); + d->mPlayerId->setText(1, TQString::number(p->id())); d->mPlayerName->setText(1, p->name()); d->mPlayerGroup->setText(1, p->group()); - d->mPlayerUserId->setText(1, QString::number(p->userId())); + d->mPlayerUserId->setText(1, TQString::number(p->userId())); d->mPlayerMyTurn->setText(1, p->myTurn() ? i18n("True") : i18n("False")); d->mPlayerAsyncInput->setText(1, p->asyncInput() ? i18n("True") : i18n("False")); buf.sprintf("%p", p->game()); d->mPlayerKGameAddress->setText(1, buf); d->mPlayerVirtual->setText(1, p->isVirtual() ? i18n("True") : i18n("False")); d->mPlayerActive->setText(1, p->isActive() ? i18n("True") : i18n("False")); - d->mPlayerRtti->setText(1, QString::number(p->rtti())); - d->mPlayerNetworkPriority->setText(1, QString::number(p->networkPriority())); + d->mPlayerRtti->setText(1, TQString::number(p->rtti())); + d->mPlayerNetworkPriority->setText(1, TQString::number(p->networkPriority())); //TODO ios // Properties KGamePropertyHandler * handler = p->dataHandler(); - QIntDictIterator<KGamePropertyBase> it((handler->dict())); + TQIntDictIterator<KGamePropertyBase> it((handler->dict())); while (it.current()) { - QString policy; + TQString policy; switch (it.current()->policy()) { case KGamePropertyBase::PolicyClean: policy = i18n("Clean"); @@ -409,7 +409,7 @@ void KGameDebugDialog::slotUpdatePlayerData(QListBoxItem* item) policy = i18n("Undefined"); break; } - (void)new QListViewItem(d->mPlayerProperties, + (void)new TQListViewItem(d->mPlayerProperties, handler->propertyName(it.current()->id()), handler->propertyValue(it.current()), policy); @@ -431,17 +431,17 @@ void KGameDebugDialog::setKGame(const KGame* g) d->mGame = g; if (g) { //TODO: connect to the KGame signals for joined/removed players!!! - connect(d->mGame, SIGNAL(destroyed()), this, SLOT(slotUnsetKGame())); + connect(d->mGame, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotUnsetKGame())); // connect(); - QPtrList<KPlayer> list = *d->mGame->playerList(); + TQPtrList<KPlayer> list = *d->mGame->playerList(); for (KPlayer* p = list.first(); p; p = list.next()) { addPlayer(p); } slotUpdateGameData(); - connect(d->mGame, SIGNAL(signalMessageUpdate(int, Q_UINT32, Q_UINT32)), this, SLOT(slotMessageUpdate(int, Q_UINT32, Q_UINT32))); + connect(d->mGame, TQT_SIGNAL(signalMessageUpdate(int, Q_UINT32, Q_UINT32)), this, TQT_SLOT(slotMessageUpdate(int, Q_UINT32, Q_UINT32))); } } @@ -461,11 +461,11 @@ void KGameDebugDialog::addPlayer(KPlayer* p) return; } - (void) new QListBoxText(d->mPlayerList, QString::number(p->id())); + (void) new TQListBoxText(d->mPlayerList, TQString::number(p->id())); //TODO connect to signals, like deleted/removed, ... } -void KGameDebugDialog::removePlayer(QListBoxItem* i) +void KGameDebugDialog::removePlayer(TQListBoxItem* i) { if (!i || !d->mGame) { return; @@ -486,7 +486,7 @@ void KGameDebugDialog::slotMessageUpdate(int msgid, Q_UINT32 receiver, Q_UINT32 if (!showId(msgid)) { return; } - QString msgidText = KGameMessage::messageId2Text(msgid); + TQString msgidText = KGameMessage::messageId2Text(msgid); if (msgidText.isNull()) { if (msgid > KGameMessage::IdUser) { emit signalRequestIdName(msgid-KGameMessage::IdUser, true, msgidText); @@ -497,9 +497,9 @@ void KGameDebugDialog::slotMessageUpdate(int msgid, Q_UINT32 receiver, Q_UINT32 msgidText = i18n("Unknown"); } } - (void) new QListViewItem( d->mMessageList, QTime::currentTime().toString(), - QString::number(msgid), QString::number(receiver), - QString::number(sender), msgidText); + (void) new TQListViewItem( d->mMessageList, TQTime::currentTime().toString(), + TQString::number(msgid), TQString::number(receiver), + TQString::number(sender), msgidText); } void KGameDebugDialog::slotClearMessages() @@ -509,7 +509,7 @@ void KGameDebugDialog::slotClearMessages() void KGameDebugDialog::slotShowId() { -/* QListBoxItem* i = d->mHideIdList->firstItem(); +/* TQListBoxItem* i = d->mHideIdList->firstItem(); for (; i; i = i->next()) { if (i->selected()) { d->mHideIdList->removeItem(i->); @@ -530,12 +530,12 @@ void KGameDebugDialog::slotHideId() if (!showId(msgid)) { return; } - (void)new QListBoxText(d->mHideIdList, QString::number(msgid)); + (void)new TQListBoxText(d->mHideIdList, TQString::number(msgid)); } bool KGameDebugDialog::showId(int msgid) { - QListBoxItem* i = d->mHideIdList->firstItem(); + TQListBoxItem* i = d->mHideIdList->firstItem(); for (; i; i = i->next()) { if (i->text().toInt() == msgid) { return false; diff --git a/libkdegames/kgame/dialogs/kgamedebugdialog.h b/libkdegames/kgame/dialogs/kgamedebugdialog.h index 65afc92a..57f20c34 100644 --- a/libkdegames/kgame/dialogs/kgamedebugdialog.h +++ b/libkdegames/kgame/dialogs/kgamedebugdialog.h @@ -35,7 +35,7 @@ class KDE_EXPORT KGameDebugDialog : public KDialogBase { Q_OBJECT public: - KGameDebugDialog(KGame* g, QWidget* parent, bool modal = false); + KGameDebugDialog(KGame* g, TQWidget* parent, bool modal = false); ~KGameDebugDialog(); /** @@ -89,7 +89,7 @@ signals: * KGameMessage::GameMessageIds couldn't be found. * @param name The name of the msgid. You have to fill this! **/ - void signalRequestIdName(int messageid, bool userid, QString& name); + void signalRequestIdName(int messageid, bool userid, TQString& name); protected: void clearPages(); @@ -113,7 +113,7 @@ protected: /** * Remove a player from the list **/ - void removePlayer(QListBoxItem* item); + void removePlayer(TQListBoxItem* item); /** * @return Whether messages with this msgid shall be displayed or not @@ -123,10 +123,10 @@ protected: protected slots: /** * Update the data of the player specified in item - * @param item The @ref QListBoxItem of the player to be updated. Note + * @param item The @ref TQListBoxItem of the player to be updated. Note * that the text of this item MUST be the ID of the player **/ - void slotUpdatePlayerData(QListBoxItem* item); + void slotUpdatePlayerData(TQListBoxItem* item); void slotShowId(); void slotHideId(); diff --git a/libkdegames/kgame/dialogs/kgamedialog.cpp b/libkdegames/kgame/dialogs/kgamedialog.cpp index dc564b8e..c03df4ff 100644 --- a/libkdegames/kgame/dialogs/kgamedialog.cpp +++ b/libkdegames/kgame/dialogs/kgamedialog.cpp @@ -18,8 +18,8 @@ Boston, MA 02110-1301, USA. */ -#include <qlayout.h> -#include <qvbox.h> +#include <tqlayout.h> +#include <tqvbox.h> #include <klocale.h> @@ -48,31 +48,31 @@ public: mGame = 0; } - QVBox* mGamePage; - QVBox* mNetworkPage; - QVBox* mMsgServerPage;// unused here? - QVBoxLayout* mTopLayout; + TQVBox* mGamePage; + TQVBox* mNetworkPage; + TQVBox* mMsgServerPage;// unused here? + TQVBoxLayout* mTopLayout; KGameDialogNetworkConfig* mNetworkConfig; KGameDialogGeneralConfig* mGameConfig; // a list of all config widgets added to this dialog - QPtrList<KGameDialogConfig> mConfigWidgets; + TQPtrList<KGameDialogConfig> mConfigWidgets; // just pointers: KPlayer* mOwner; KGame* mGame; }; -KGameDialog::KGameDialog(KGame* g, KPlayer* owner, const QString& title, - QWidget* parent, bool modal) +KGameDialog::KGameDialog(KGame* g, KPlayer* owner, const TQString& title, + TQWidget* parent, bool modal) : KDialogBase(Tabbed, title, Ok|Default|Apply, Ok, parent, 0, modal, true) { init(g, owner); } -KGameDialog::KGameDialog(KGame* g, KPlayer* owner, const QString& title, - QWidget* parent, long initConfigs, int chatMsgId, bool modal) +KGameDialog::KGameDialog(KGame* g, KPlayer* owner, const TQString& title, + TQWidget* parent, long initConfigs, int chatMsgId, bool modal) : KDialogBase(Tabbed, title, Ok|Default|Apply, Ok, parent, 0, modal, true) { @@ -165,7 +165,7 @@ void KGameDialog::addMsgServerConfig(KGameDialogMsgServerConfig* msgConf) d->mMsgServerPage = addConfigPage(msgConf, i18n("&Message Server")); } -void KGameDialog::addChatWidget(KGameDialogChatConfig* chat, QVBox* parent) +void KGameDialog::addChatWidget(KGameDialogChatConfig* chat, TQVBox* parent) { if (!chat) { return; @@ -180,7 +180,7 @@ void KGameDialog::addChatWidget(KGameDialogChatConfig* chat, QVBox* parent) addConfigWidget(chat, parent); } -void KGameDialog::addConnectionList(KGameDialogConnectionConfig* c, QVBox* parent) +void KGameDialog::addConnectionList(KGameDialogConnectionConfig* c, TQVBox* parent) { if (!c) { return; @@ -195,9 +195,9 @@ void KGameDialog::addConnectionList(KGameDialogConnectionConfig* c, QVBox* paren addConfigWidget(c, parent); } -QVBox *KGameDialog::configPage(ConfigOptions which) +TQVBox *KGameDialog::configPage(ConfigOptions which) { - QVBox *box = 0; + TQVBox *box = 0; switch(which) { case NetworkConfig: @@ -215,18 +215,18 @@ QVBox *KGameDialog::configPage(ConfigOptions which) return box; } -QVBox* KGameDialog::addConfigPage(KGameDialogConfig* widget, const QString& title) +TQVBox* KGameDialog::addConfigPage(KGameDialogConfig* widget, const TQString& title) { if (!widget) { kdError(11001) << "Cannot add NULL config widget" << endl; return 0; } - QVBox* page = addVBoxPage(title); + TQVBox* page = addVBoxPage(title); addConfigWidget(widget, page); return page; } -void KGameDialog::addConfigWidget(KGameDialogConfig* widget, QWidget* parent) +void KGameDialog::addConfigWidget(KGameDialogConfig* widget, TQWidget* parent) { if (!widget) { kdError(11001) << "Cannot add NULL config widget" << endl; @@ -237,9 +237,9 @@ void KGameDialog::addConfigWidget(KGameDialogConfig* widget, QWidget* parent) return; } // kdDebug(11001) << "reparenting widget" << endl; - widget->reparent(parent, QPoint(0,0)); + widget->reparent(parent, TQPoint(0,0)); d->mConfigWidgets.append(widget); - connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(slotRemoveConfigWidget(QObject*))); + connect(widget, TQT_SIGNAL(destroyed(TQObject*)), this, TQT_SLOT(slotRemoveConfigWidget(TQObject*))); if (!d->mGame) { kdWarning(11001) << "No game has been set!" << endl; } else { @@ -278,7 +278,7 @@ void KGameDialog::slotDefault() void KGameDialog::slotOk() { slotApply(); - QDialog::accept(); + TQDialog::accept(); } void KGameDialog::setOwner(KPlayer* owner) @@ -306,9 +306,9 @@ void KGameDialog::setKGame(KGame* g) } if (d->mGame) { setAdmin(d->mGame->isAdmin()); - connect(d->mGame, SIGNAL(destroyed()), this, SLOT(slotUnsetKGame())); - connect(d->mGame, SIGNAL(signalAdminStatusChanged(bool)), - this, SLOT(setAdmin(bool))); + connect(d->mGame, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotUnsetKGame())); + connect(d->mGame, TQT_SIGNAL(signalAdminStatusChanged(bool)), + this, TQT_SLOT(setAdmin(bool))); } } @@ -340,7 +340,7 @@ void KGameDialog::submitToKGame() } } -void KGameDialog::slotRemoveConfigWidget(QObject* configWidget) +void KGameDialog::slotRemoveConfigWidget(TQObject* configWidget) { d->mConfigWidgets.removeRef((KGameDialogConfig*)configWidget); } diff --git a/libkdegames/kgame/dialogs/kgamedialog.h b/libkdegames/kgame/dialogs/kgamedialog.h index f7a0c6e5..f3256d8a 100644 --- a/libkdegames/kgame/dialogs/kgamedialog.h +++ b/libkdegames/kgame/dialogs/kgamedialog.h @@ -97,8 +97,8 @@ public: * @param parent The parent of the dialog * @param modal Whether the dialog is modal or not **/ - KGameDialog(KGame* g, KPlayer* owner, const QString& title, - QWidget* parent, bool modal = false); + KGameDialog(KGame* g, KPlayer* owner, const TQString& title, + TQWidget* parent, bool modal = false); /** * Create a KGameDialog with the standard configuration widgets. This @@ -129,8 +129,8 @@ public: * @param chatMsgId The ID of Chat messages. See KGameChat. Unused * if initConfigs = false **/ - KGameDialog(KGame* g, KPlayer* owner, const QString& title, - QWidget* parent, long initConfigs = AllConfig, + KGameDialog(KGame* g, KPlayer* owner, const TQString& title, + TQWidget* parent, long initConfigs = AllConfig, int chatMsgId = 15432, bool modal = false); virtual ~KGameDialog(); @@ -175,7 +175,7 @@ public: * already added config widget. Note that the game page will be used * if parent is 0. **/ - void addChatWidget(KGameDialogChatConfig* chat, QVBox* parent = 0); + void addChatWidget(KGameDialogChatConfig* chat, TQVBox* parent = 0); /** * Add a connection list to the dialog. The list consists of a @@ -189,7 +189,7 @@ public: * @param parent The parent of the widget. If 0 the networkConfig * page is used. **/ - void addConnectionList(KGameDialogConnectionConfig* c, QVBox* parent = 0); + void addConnectionList(KGameDialogConnectionConfig* c, TQVBox* parent = 0); /** * Add a new page to the dialog. The page will contain you new config @@ -201,13 +201,13 @@ public: * @param title The title of the newly added page. * @return The newly added page which contains your config widget. **/ - QVBox* addConfigPage(KGameDialogConfig* widget, const QString& title); + TQVBox* addConfigPage(KGameDialogConfig* widget, const TQString& title); /** - * @return The QVBox of the given key, The key is from ConfigOptions + * @return The TQVBox of the given key, The key is from ConfigOptions * Note that not all are supported yet **/ - QVBox *configPage(ConfigOptions which); + TQVBox *configPage(ConfigOptions which); /** * @return The default netowrk config. Note that this always returns 0 if @@ -227,7 +227,7 @@ public: * it to the same page. Just use the returned page of * addConfigPage. **/ - void addConfigWidget(KGameDialogConfig* widget, QWidget* parent); + void addConfigWidget(KGameDialogConfig* widget, TQWidget* parent); /** * Used to add the main network config widget in a new page. Use this to @@ -275,7 +275,7 @@ protected: protected slots: /** * Called when the user clicks on Ok. Calls slotApply and - * QDialog::accept() + * TQDialog::accept() **/ virtual void slotOk(); @@ -306,9 +306,9 @@ protected slots: /** * Remove a config widget from the widget list. - * @see QObject::destroyed + * @see TQObject::destroyed **/ - void slotRemoveConfigWidget(QObject* configWidget); + void slotRemoveConfigWidget(TQObject* configWidget); private: void init(KGame*, KPlayer*); diff --git a/libkdegames/kgame/dialogs/kgamedialogconfig.cpp b/libkdegames/kgame/dialogs/kgamedialogconfig.cpp index 27f91cd1..44eaa3c7 100644 --- a/libkdegames/kgame/dialogs/kgamedialogconfig.cpp +++ b/libkdegames/kgame/dialogs/kgamedialogconfig.cpp @@ -31,13 +31,13 @@ #include <klistbox.h> #include <kmessagebox.h> -#include <qlayout.h> -#include <qhgroupbox.h> -#include <qlabel.h> -#include <qpushbutton.h> -#include <qlineedit.h> -#include <qvbox.h> -#include <qptrdict.h> +#include <tqlayout.h> +#include <tqhgroupbox.h> +#include <tqlabel.h> +#include <tqpushbutton.h> +#include <tqlineedit.h> +#include <tqvbox.h> +#include <tqptrdict.h> #include "kgamedialogconfig.moc" @@ -57,7 +57,7 @@ public: KPlayer* mOwner; }; -KGameDialogConfig::KGameDialogConfig(QWidget* parent) : QWidget(parent) +KGameDialogConfig::KGameDialogConfig(TQWidget* parent) : TQWidget(parent) { d = new KGameDialogConfigPrivate; } @@ -104,42 +104,42 @@ public: } - // QPushButton* mInitConnection; - QHGroupBox* mInitConnection; - QLabel* mNetworkLabel; - QPushButton *mDisconnectButton; + // TQPushButton* mInitConnection; + TQHGroupBox* mInitConnection; + TQLabel* mNetworkLabel; + TQPushButton *mDisconnectButton; bool mDefaultServer; - QString mDefaultHost; + TQString mDefaultHost; unsigned short int mDefaultPort; KGameConnectWidget *mConnect; }; -KGameDialogNetworkConfig::KGameDialogNetworkConfig(QWidget* parent) +KGameDialogNetworkConfig::KGameDialogNetworkConfig(TQWidget* parent) : KGameDialogConfig(parent) { // kdDebug(11001) << k_funcinfo << ": this=" << this << endl; d = new KGameDialogNetworkConfigPrivate(); - QVBoxLayout* topLayout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint(), "toplayout"); + TQVBoxLayout* topLayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint(), "toplayout"); - QHBoxLayout *hb = new QHBoxLayout(topLayout, KDialog::spacingHint()); + TQHBoxLayout *hb = new TQHBoxLayout(topLayout, KDialog::spacingHint()); - d->mNetworkLabel = new QLabel(this); + d->mNetworkLabel = new TQLabel(this); hb->addWidget(d->mNetworkLabel); - d->mDisconnectButton=new QPushButton(i18n("Disconnect"),this); - connect(d->mDisconnectButton, SIGNAL(clicked()), this, SLOT(slotExitConnection())); + d->mDisconnectButton=new TQPushButton(i18n("Disconnect"),this); + connect(d->mDisconnectButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotExitConnection())); hb->addWidget(d->mDisconnectButton); - d->mInitConnection = new QHGroupBox(i18n("Network Configuration"), this); + d->mInitConnection = new TQHGroupBox(i18n("Network Configuration"), this); topLayout->addWidget(d->mInitConnection); d->mConnect = new KGameConnectWidget(d->mInitConnection); - connect(d->mConnect, SIGNAL(signalNetworkSetup()), this, SLOT(slotInitConnection())); - connect(d->mConnect, SIGNAL(signalServerTypeChanged(int)), - this, SIGNAL(signalServerTypeChanged(int))); + connect(d->mConnect, TQT_SIGNAL(signalNetworkSetup()), this, TQT_SLOT(slotInitConnection())); + connect(d->mConnect, TQT_SIGNAL(signalServerTypeChanged(int)), + this, TQT_SIGNAL(signalServerTypeChanged(int))); // Needs to be AFTER the creation of the dialogs setConnected(false); @@ -165,7 +165,7 @@ void KGameDialogNetworkConfig::slotInitConnection() bool connected = false; bool master = true; unsigned short int port = d->mConnect->port(); - QString host = d->mConnect->host(); + TQString host = d->mConnect->host(); if (host.isNull()) { master = true; @@ -180,8 +180,8 @@ void KGameDialogNetworkConfig::slotInitConnection() } // We need to learn about failed connections if (game()) { - connect(game(), SIGNAL(signalConnectionBroken()), - this, SLOT(slotConnectionBroken())); + connect(game(), TQT_SIGNAL(signalConnectionBroken()), + this, TQT_SLOT(slotConnectionBroken())); } } setConnected(connected, master); @@ -225,7 +225,7 @@ void KGameDialogNetworkConfig::setKGame(KGame* g) setConnected(game()->isNetwork(), game()->isMaster()); } -void KGameDialogNetworkConfig::setDefaultNetworkInfo(const QString& host, unsigned short int port,bool server) +void KGameDialogNetworkConfig::setDefaultNetworkInfo(const TQString& host, unsigned short int port,bool server) { d->mDefaultPort = port; d->mDefaultHost = host; @@ -240,7 +240,7 @@ void KGameDialogNetworkConfig::setDefaultNetworkInfo(const QString& host, unsign } } -void KGameDialogNetworkConfig::setDiscoveryInfo(const QString& type, const QString& name) +void KGameDialogNetworkConfig::setDiscoveryInfo(const TQString& type, const TQString& name) { d->mConnect->setType(type); d->mConnect->setName(name); @@ -256,26 +256,26 @@ public: mName = 0; } - QLineEdit* mName; + TQLineEdit* mName; - QVBoxLayout* mTopLayout; + TQVBoxLayout* mTopLayout; }; -KGameDialogGeneralConfig::KGameDialogGeneralConfig(QWidget* parent, bool initializeGUI) +KGameDialogGeneralConfig::KGameDialogGeneralConfig(TQWidget* parent, bool initializeGUI) : KGameDialogConfig(parent) { // kdDebug(11001) << k_funcinfo << ": this=" << this << endl; d = new KGameDialogGeneralConfigPrivate; if (initializeGUI) { - d->mTopLayout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + d->mTopLayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); d->mTopLayout->setAutoAdd(true); - QWidget* nameWidget = new QWidget(this); - QHBoxLayout* l = new QHBoxLayout(nameWidget); - QLabel* nameLabel = new QLabel(i18n("Your name:"), nameWidget); + TQWidget* nameWidget = new TQWidget(this); + TQHBoxLayout* l = new TQHBoxLayout(nameWidget); + TQLabel* nameLabel = new TQLabel(i18n("Your name:"), nameWidget); l->addWidget(nameLabel); - d->mName = new QLineEdit(nameWidget); + d->mName = new TQLineEdit(nameWidget); l->addWidget(d->mName); } } @@ -286,16 +286,16 @@ KGameDialogGeneralConfig::~KGameDialogGeneralConfig() delete d; } -void KGameDialogGeneralConfig::setPlayerName(const QString& name) +void KGameDialogGeneralConfig::setPlayerName(const TQString& name) { if (d->mName) { d->mName->setText(name); } } -QString KGameDialogGeneralConfig::playerName() const +TQString KGameDialogGeneralConfig::playerName() const { - return d->mName ? d->mName->text() : QString::null; + return d->mName ? d->mName->text() : TQString::null; } void KGameDialogGeneralConfig::setOwner(KPlayer* p) @@ -309,8 +309,8 @@ void KGameDialogGeneralConfig::setOwner(KPlayer* p) // maybe call hide() return; } - connect(owner(), SIGNAL(signalPropertyChanged(KGamePropertyBase*, KPlayer*)), - this, SLOT(slotPropertyChanged(KGamePropertyBase*, KPlayer*))); + connect(owner(), TQT_SIGNAL(signalPropertyChanged(KGamePropertyBase*, KPlayer*)), + this, TQT_SLOT(slotPropertyChanged(KGamePropertyBase*, KPlayer*))); setPlayerName(p->name()); //TODO: connect signalPropertyChanged and check for playername changes! } @@ -373,29 +373,29 @@ public: noMaster = 0; } - QVBoxLayout* senderLayout; - QHBoxLayout* localLayout; + TQVBoxLayout* senderLayout; + TQHBoxLayout* localLayout; - QPushButton* changeMaxClients; - QPushButton* changeAdmin; - QPushButton* removeClient; - QLabel* noAdmin; + TQPushButton* changeMaxClients; + TQPushButton* changeAdmin; + TQPushButton* removeClient; + TQLabel* noAdmin; - QLabel* noMaster; + TQLabel* noMaster; }; // TODO: change ADMIN ID, remove CLIENTS, change MAXCLIENTS // we do everything here with QPushButtons as we want to wait a moment before // continuing - the message must be sent over network first -KGameDialogMsgServerConfig::KGameDialogMsgServerConfig(QWidget* parent) +KGameDialogMsgServerConfig::KGameDialogMsgServerConfig(TQWidget* parent) : KGameDialogConfig(parent) { d = new KGameDialogMsgServerConfigPrivate; - QVBoxLayout* topLayout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); - d->senderLayout = new QVBoxLayout(topLayout); - d->localLayout = new QHBoxLayout(topLayout); + TQVBoxLayout* topLayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + d->senderLayout = new TQVBoxLayout(topLayout); + d->localLayout = new TQHBoxLayout(topLayout); } KGameDialogMsgServerConfig::~KGameDialogMsgServerConfig() @@ -408,7 +408,7 @@ void KGameDialogMsgServerConfig::setKGame(KGame* g) { KGameDialogConfig::setKGame(g); //TODO display the ID of the admin if we aren't - // connect(g, SIGNAL(signalAdminChanged(int)), this, SLOT(slotChangeIsAdmin(int)));//TODO + // connect(g, TQT_SIGNAL(signalAdminChanged(int)), this, TQT_SLOT(slotChangeIsAdmin(int)));//TODO if (!game()) { // we cannot do anything without a KGame object! setAdmin(false); @@ -430,17 +430,17 @@ void KGameDialogMsgServerConfig::slotChangeMaxClients() return; } int max; -// edit->setText(QString::number()); // current max clients! //TODO +// edit->setText(TQString::number()); // current max clients! //TODO - QDialog* dialog = new QDialog(); + TQDialog* dialog = new TQDialog(); dialog->setCaption(i18n("Maximal Number of Clients")); - QHBoxLayout* l = new QHBoxLayout(dialog, KDialog::marginHint(), KDialog::spacingHint()); + TQHBoxLayout* l = new TQHBoxLayout(dialog, KDialog::marginHint(), KDialog::spacingHint()); l->setAutoAdd(true); - (void) new QLabel(i18n("Maximal number of clients (-1 = infinite):"), dialog); - QLineEdit* edit = new QLineEdit(dialog);//TODO: use KIntNumInput -// edit->setText(QString::number(max)); // current max clients! //TODO - if (dialog->exec() == QDialog::Accepted) { + (void) new TQLabel(i18n("Maximal number of clients (-1 = infinite):"), dialog); + TQLineEdit* edit = new TQLineEdit(dialog);//TODO: use KIntNumInput +// edit->setText(TQString::number(max)); // current max clients! //TODO + if (dialog->exec() == TQDialog::Accepted) { bool ok; max = edit->text().toInt(&ok); if (ok) { @@ -487,12 +487,12 @@ void KGameDialogMsgServerConfig::setAdmin(bool a) delete d->noAdmin; d->noAdmin = 0; } - d->changeMaxClients = new QPushButton(i18n("Change Maximal Number of Clients"), this); - connect(d->changeMaxClients, SIGNAL(pressed()), this, SLOT(slotChangeMaxClients())); - d->changeAdmin = new QPushButton(i18n("Change Admin"), this); - connect(d->changeAdmin, SIGNAL(pressed()), this, SLOT(slotChangeAdmin())); - d->removeClient = new QPushButton(i18n("Remove Client with All Players"), this); - connect(d->removeClient, SIGNAL(pressed()), this, SLOT(slotRemoveClient())); + d->changeMaxClients = new TQPushButton(i18n("Change Maximal Number of Clients"), this); + connect(d->changeMaxClients, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotChangeMaxClients())); + d->changeAdmin = new TQPushButton(i18n("Change Admin"), this); + connect(d->changeAdmin, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotChangeAdmin())); + d->removeClient = new TQPushButton(i18n("Remove Client with All Players"), this); + connect(d->removeClient, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotRemoveClient())); d->senderLayout->addWidget(d->changeMaxClients); d->senderLayout->addWidget(d->changeAdmin); d->senderLayout->addWidget(d->removeClient); @@ -509,7 +509,7 @@ void KGameDialogMsgServerConfig::setAdmin(bool a) delete d->removeClient; d->removeClient = 0; } - d->noAdmin = new QLabel(i18n("Only the admin can configure the message server!"), this); + d->noAdmin = new TQLabel(i18n("Only the admin can configure the message server!"), this); d->senderLayout->addWidget(d->noAdmin); } } @@ -520,7 +520,7 @@ void KGameDialogMsgServerConfig::setHasMsgServer(bool has) if (!has) { // delete all inputs if (!d->noMaster) { - d->noMaster = new QLabel(i18n("You don't own the message server"), this); + d->noMaster = new TQLabel(i18n("You don't own the message server"), this); d->localLayout->addWidget(d->noMaster); } return; @@ -547,13 +547,13 @@ public: KGameChat* mChat; }; -KGameDialogChatConfig::KGameDialogChatConfig(int chatMsgId, QWidget* parent) +KGameDialogChatConfig::KGameDialogChatConfig(int chatMsgId, TQWidget* parent) : KGameDialogConfig(parent) { d = new KGameDialogChatConfigPrivate; - QVBoxLayout* topLayout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + TQVBoxLayout* topLayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); topLayout->setAutoAdd(true); - QHGroupBox* b = new QHGroupBox(i18n("Chat"), this); + TQHGroupBox* b = new TQHGroupBox(i18n("Chat"), this); d->mChat = new KGameChat(0, chatMsgId, b); } @@ -595,18 +595,18 @@ public: mPlayerBox = 0; } - QPtrDict<KPlayer> mItem2Player; + TQPtrDict<KPlayer> mItem2Player; KListBox* mPlayerBox; }; -KGameDialogConnectionConfig::KGameDialogConnectionConfig(QWidget* parent) +KGameDialogConnectionConfig::KGameDialogConnectionConfig(TQWidget* parent) : KGameDialogConfig(parent) { //TODO: prevent player to ban himself d = new KGameDialogConnectionConfigPrivate; - QVBoxLayout* topLayout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + TQVBoxLayout* topLayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); topLayout->setAutoAdd(true); - QHGroupBox* b = new QHGroupBox(i18n("Connected Players"), this); + TQHGroupBox* b = new TQHGroupBox(i18n("Connected Players"), this); d->mPlayerBox = new KListBox(b); setMinimumHeight(100); } @@ -627,10 +627,10 @@ void KGameDialogConnectionConfig::setKGame(KGame* g) slotClearPlayers(); if (game()) { // react to changes in KGame::playerList() - connect(game(), SIGNAL(signalPlayerJoinedGame(KPlayer*)), - this, SLOT(slotPlayerJoinedGame(KPlayer*))); - connect(game(), SIGNAL(signalPlayerLeftGame(KPlayer*)), - this, SLOT(slotPlayerLeftGame(KPlayer*))); + connect(game(), TQT_SIGNAL(signalPlayerJoinedGame(KPlayer*)), + this, TQT_SLOT(slotPlayerJoinedGame(KPlayer*))); + connect(game(), TQT_SIGNAL(signalPlayerLeftGame(KPlayer*)), + this, TQT_SLOT(slotPlayerLeftGame(KPlayer*))); KGame::KGamePlayerList l = *game()->playerList(); for (KPlayer* p = l.first(); p; p = l.next()) { @@ -650,21 +650,21 @@ void KGameDialogConnectionConfig::setAdmin(bool a) return; } if (admin()) { - disconnect(game(), SIGNAL(executed(QListBoxItem*)), this, 0); + disconnect(game(), TQT_SIGNAL(executed(TQListBoxItem*)), this, 0); } KGameDialogConfig::setAdmin(a); if (admin()) { - connect(d->mPlayerBox, SIGNAL(executed(QListBoxItem*)), this, - SLOT(slotKickPlayerOut(QListBoxItem*))); + connect(d->mPlayerBox, TQT_SIGNAL(executed(TQListBoxItem*)), this, + TQT_SLOT(slotKickPlayerOut(TQListBoxItem*))); } } -QListBoxItem* KGameDialogConnectionConfig::item(KPlayer* p) const +TQListBoxItem* KGameDialogConnectionConfig::item(KPlayer* p) const { - QPtrDictIterator<KPlayer> it(d->mItem2Player); + TQPtrDictIterator<KPlayer> it(d->mItem2Player); while (it.current()) { if (it.current() == p) { - return (QListBoxItem*)it.currentKey(); + return (TQListBoxItem*)it.currentKey(); } ++it; } @@ -673,7 +673,7 @@ QListBoxItem* KGameDialogConnectionConfig::item(KPlayer* p) const void KGameDialogConnectionConfig::slotClearPlayers() { - QPtrDictIterator<KPlayer> it(d->mItem2Player); + TQPtrDictIterator<KPlayer> it(d->mItem2Player); while (it.current()) { slotPlayerLeftGame(it.current()); ++it; @@ -700,12 +700,12 @@ void KGameDialogConnectionConfig::slotPlayerJoinedGame(KPlayer* p) return; } kdDebug(11001) << k_funcinfo << ": add player " << p->id() << endl; - QListBoxText* t = new QListBoxText(p->name()); + TQListBoxText* t = new TQListBoxText(p->name()); d->mItem2Player.insert(t, p); d->mPlayerBox->insertItem(t); - connect(p, SIGNAL(signalPropertyChanged(KGamePropertyBase*, KPlayer*)), - this, SLOT(slotPropertyChanged(KGamePropertyBase*, KPlayer*))); + connect(p, TQT_SIGNAL(signalPropertyChanged(KGamePropertyBase*, KPlayer*)), + this, TQT_SLOT(slotPropertyChanged(KGamePropertyBase*, KPlayer*))); } @@ -722,7 +722,7 @@ void KGameDialogConnectionConfig::slotPlayerLeftGame(KPlayer* p) } -void KGameDialogConnectionConfig::slotKickPlayerOut(QListBoxItem* item) +void KGameDialogConnectionConfig::slotKickPlayerOut(TQListBoxItem* item) { kdDebug(11001) << "kick player out" << endl; KPlayer* p = d->mItem2Player[item]; @@ -744,7 +744,7 @@ void KGameDialogConnectionConfig::slotKickPlayerOut(QListBoxItem* item) } if (KMessageBox::questionYesNo(this, i18n("Do you want to ban player \"%1\" from the game?").arg( - p->name()), QString::null, i18n("Ban Player"), i18n("Do Not Ban")) == KMessageBox::Yes) { + p->name()), TQString::null, i18n("Ban Player"), i18n("Do Not Ban")) == KMessageBox::Yes) { kdDebug(11001) << "will remove player " << p << endl; game()->removePlayer(p); // d->mPlayerBox->removeItem(d->mPlayerBox->index(item)); // should be done by signalPlayerLeftGame @@ -756,15 +756,15 @@ void KGameDialogConnectionConfig::slotKickPlayerOut(QListBoxItem* item) void KGameDialogConnectionConfig::slotPropertyChanged(KGamePropertyBase* prop, KPlayer* player) { if(prop->id() == KGamePropertyBase::IdName) { - QListBoxText* old = 0; - QPtrDictIterator<KPlayer> it(d->mItem2Player); + TQListBoxText* old = 0; + TQPtrDictIterator<KPlayer> it(d->mItem2Player); while (it.current() && !old) { if (it.current() == player) { - old = (QListBoxText*)it.currentKey(); + old = (TQListBoxText*)it.currentKey(); } ++it; } - QListBoxText* t = new QListBoxText(player->name()); + TQListBoxText* t = new TQListBoxText(player->name()); d->mPlayerBox->changeItem(t, d->mPlayerBox->index(old)); d->mItem2Player.remove(old); d->mItem2Player.insert(t, player); diff --git a/libkdegames/kgame/dialogs/kgamedialogconfig.h b/libkdegames/kgame/dialogs/kgamedialogconfig.h index b7d30b23..e1b592af 100644 --- a/libkdegames/kgame/dialogs/kgamedialogconfig.h +++ b/libkdegames/kgame/dialogs/kgamedialogconfig.h @@ -28,7 +28,7 @@ #ifndef __KGAMEDIALOGCONFIG_H__ #define __KGAMEDIALOGCONFIG_H__ -#include <qwidget.h> +#include <tqwidget.h> #include <kdemacros.h> class QGridLayout; @@ -52,7 +52,7 @@ class KDE_EXPORT KGameDialogConfig : public QWidget { Q_OBJECT public: - KGameDialogConfig(QWidget* parent = 0); + KGameDialogConfig(TQWidget* parent = 0); virtual ~KGameDialogConfig(); /** @@ -137,7 +137,7 @@ private: * * It currently contains a line edit for the name of the player only. You can * add widgets by using the KGameDialogGeneralConfig as parent parameter as it - * uses QLayout::autoAdd == true. + * uses TQLayout::autoAdd == true. * @author Andreas Beckermann <b_mann@gmx.de> **/ class KGameDialogGeneralConfigPrivate; @@ -151,7 +151,7 @@ public: * * If you just want to add more widgets you can just create your widgets * with the KGameDialogGeneralConfig as parent as it uses - * QLayout::setAutoAdd(true). + * TQLayout::setAutoAdd(true). * * @param parent Parent widget for this dialog. * @param initializeGUI If you really don't want to use the @@ -160,7 +160,7 @@ public: * will exist anymore. * **/ - KGameDialogGeneralConfig(QWidget* parent = 0, bool initializeGUI = true); + KGameDialogGeneralConfig(TQWidget* parent = 0, bool initializeGUI = true); virtual ~KGameDialogGeneralConfig(); /** @@ -199,9 +199,9 @@ protected slots: void slotPropertyChanged(KGamePropertyBase*, KPlayer*); protected: - void setPlayerName(const QString& name); + void setPlayerName(const TQString& name); - QString playerName() const; + TQString playerName() const; private: KGameDialogGeneralConfigPrivate* d; @@ -212,7 +212,7 @@ class KDE_EXPORT KGameDialogNetworkConfig : public KGameDialogConfig { Q_OBJECT public: - KGameDialogNetworkConfig(QWidget* parent = 0); + KGameDialogNetworkConfig(TQWidget* parent = 0); virtual ~KGameDialogNetworkConfig(); @@ -238,7 +238,7 @@ public: * @param port The default port to connect to / listen on * @param host The default host to connect to **/ - void setDefaultNetworkInfo(const QString& host, unsigned short int port,bool server=true); + void setDefaultNetworkInfo(const TQString& host, unsigned short int port,bool server=true); /** * Set service type that will be published or browsed for and game name that will be displayed in @@ -248,7 +248,7 @@ public: * @param type Service type (something like _kwin4._tcp). It should be unique for application. * @since 3.4 **/ - void setDiscoveryInfo(const QString& type, const QString& name=QString::null); + void setDiscoveryInfo(const TQString& type, const TQString& name=TQString::null); signals: /** @@ -278,7 +278,7 @@ class KGameDialogMsgServerConfig : public KGameDialogConfig { Q_OBJECT public: - KGameDialogMsgServerConfig(QWidget* parent = 0); + KGameDialogMsgServerConfig(TQWidget* parent = 0); virtual ~KGameDialogMsgServerConfig(); virtual void submitToKGame(KGame*, KPlayer*) {} @@ -311,7 +311,7 @@ class KGameDialogChatConfig : public KGameDialogConfig { Q_OBJECT public: - KGameDialogChatConfig(int chatMsgId, QWidget* parent = 0); + KGameDialogChatConfig(int chatMsgId, TQWidget* parent = 0); virtual ~KGameDialogChatConfig(); virtual void setKGame(KGame* g); @@ -332,7 +332,7 @@ class KGameDialogConnectionConfig : public KGameDialogConfig { Q_OBJECT public: - KGameDialogConnectionConfig(QWidget* parent = 0); + KGameDialogConnectionConfig(TQWidget* parent = 0); virtual ~KGameDialogConnectionConfig(); virtual void setKGame(KGame* g); @@ -344,12 +344,12 @@ public: protected: /** * @param p A player - * @return The QListBoxItem that belongs to the player @p p + * @return The TQListBoxItem that belongs to the player @p p **/ - QListBoxItem* item(KPlayer* p) const; + TQListBoxItem* item(KPlayer* p) const; protected slots: - void slotKickPlayerOut(QListBoxItem* item); + void slotKickPlayerOut(TQListBoxItem* item); void slotPropertyChanged(KGamePropertyBase* prop, KPlayer* p); void slotPlayerLeftGame(KPlayer* p); void slotPlayerJoinedGame(KPlayer* p); diff --git a/libkdegames/kgame/dialogs/kgameerrordialog.cpp b/libkdegames/kgame/dialogs/kgameerrordialog.cpp index 1750892c..7c3b0509 100644 --- a/libkdegames/kgame/dialogs/kgameerrordialog.cpp +++ b/libkdegames/kgame/dialogs/kgameerrordialog.cpp @@ -37,7 +37,7 @@ public: const KGame* mGame; }; -KGameErrorDialog::KGameErrorDialog(QWidget* parent) : QObject(parent) +KGameErrorDialog::KGameErrorDialog(TQWidget* parent) : TQObject(parent) { d = new KGameErrorDialogPrivate; } @@ -52,15 +52,15 @@ void KGameErrorDialog::setKGame(const KGame* g) slotUnsetKGame(); d->mGame = g; - connect(d->mGame, SIGNAL(destroyed()), this, SLOT(slotUnsetKGame())); + connect(d->mGame, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotUnsetKGame())); // the error signals: - connect(d->mGame, SIGNAL(signalNetworkErrorMessage(int, QString)), - this, SLOT(slotError(int, QString))); - connect(d->mGame, SIGNAL(signalConnectionBroken()), - this, SLOT(slotServerConnectionLost())); - connect(d->mGame, SIGNAL(signalClientDisconnected(Q_UINT32,bool)), - this, SLOT(slotClientConnectionLost(Q_UINT32,bool))); + connect(d->mGame, TQT_SIGNAL(signalNetworkErrorMessage(int, TQString)), + this, TQT_SLOT(slotError(int, TQString))); + connect(d->mGame, TQT_SIGNAL(signalConnectionBroken()), + this, TQT_SLOT(slotServerConnectionLost())); + connect(d->mGame, TQT_SIGNAL(signalClientDisconnected(Q_UINT32,bool)), + this, TQT_SLOT(slotClientConnectionLost(Q_UINT32,bool))); } void KGameErrorDialog::slotUnsetKGame() @@ -71,51 +71,51 @@ void KGameErrorDialog::slotUnsetKGame() d->mGame = 0; } -void KGameErrorDialog::error(const QString& errorText, QWidget* parent) +void KGameErrorDialog::error(const TQString& errorText, TQWidget* parent) { KMessageBox::error(parent, errorText); } void KGameErrorDialog::slotServerConnectionLost() { // TODO: add IP/port of the server - QString message = i18n("Connection to the server has been lost!"); - error(message, (QWidget*)parent()); + TQString message = i18n("Connection to the server has been lost!"); + error(message, (TQWidget*)parent()); } void KGameErrorDialog::slotClientConnectionLost(Q_UINT32 /*id*/,bool) { //TODO: add IP/port of the client - QString message; + TQString message; // if (c) { // message = i18n("Connection to client has been lost!\nID: %1\nIP: %2").arg(c->id()).arg(c->IP()); // } else { // message = i18n("Connection to client has been lost!"); // } message = i18n("Connection to client has been lost!"); - error(message, (QWidget*)parent()); + error(message, (TQWidget*)parent()); } -void KGameErrorDialog::slotError(int errorNo, QString text) +void KGameErrorDialog::slotError(int errorNo, TQString text) { - QString message = i18n("Received a network error!\nError number: %1\nError message: %2").arg(errorNo).arg(text); - error(message, (QWidget*)parent()); + TQString message = i18n("Received a network error!\nError number: %1\nError message: %2").arg(errorNo).arg(text); + error(message, (TQWidget*)parent()); } -void KGameErrorDialog::connectionError(QString s) +void KGameErrorDialog::connectionError(TQString s) { - QString message; + TQString message; if (s.isNull()) { message = i18n("No connection could be created."); } else { message = i18n("No connection could be created.\nThe error message was:\n%1").arg(s); } - error(message, (QWidget*)parent()); + error(message, (TQWidget*)parent()); } // should become the real dialog - currently we just use messageboxes // -> maybe unused forever -KGameErrorMessageDialog::KGameErrorMessageDialog(QWidget* parent) +KGameErrorMessageDialog::KGameErrorMessageDialog(TQWidget* parent) : KDialogBase(Plain, i18n("Error"), Ok, Ok, parent, 0, true, true) { } diff --git a/libkdegames/kgame/dialogs/kgameerrordialog.h b/libkdegames/kgame/dialogs/kgameerrordialog.h index c1dbd1ca..3883399b 100644 --- a/libkdegames/kgame/dialogs/kgameerrordialog.h +++ b/libkdegames/kgame/dialogs/kgameerrordialog.h @@ -40,7 +40,7 @@ class KGameErrorDialog : public QObject { Q_OBJECT public: - KGameErrorDialog(QWidget* parent); + KGameErrorDialog(TQWidget* parent); ~KGameErrorDialog(); /** @@ -55,12 +55,12 @@ public: * KGame couldn't establish a connection. Use this if * KGame::initConnection returns false * @param s A string that describes the error further (like port is - * already in use). Will be ignored if QString::null + * already in use). Will be ignored if TQString::null **/ - void connectionError(QString s = QString::null); + void connectionError(TQString s = TQString::null); public slots: - void slotError(int error, QString text); + void slotError(int error, TQString text); /** * The connection to the @ref KMessageServer has been lost @@ -87,7 +87,7 @@ public slots: void slotUnsetKGame(); protected: - void error(const QString& errorText, QWidget* parent = 0); + void error(const TQString& errorText, TQWidget* parent = 0); private: KGameErrorDialogPrivate* d; @@ -104,7 +104,7 @@ class KGameErrorMessageDialog : public KDialogBase { Q_OBJECT public: - KGameErrorMessageDialog(QWidget* parent); + KGameErrorMessageDialog(TQWidget* parent); ~KGameErrorMessageDialog(); private: diff --git a/libkdegames/kgame/kgame.cpp b/libkdegames/kgame/kgame.cpp index 101dbfcc..ff215837 100644 --- a/libkdegames/kgame/kgame.cpp +++ b/libkdegames/kgame/kgame.cpp @@ -36,10 +36,10 @@ #include <stdio.h> #include <assert.h> -#include <qbuffer.h> -#include <qtimer.h> -#include <qptrqueue.h> -#include <qfile.h> +#include <tqbuffer.h> +#include <tqtimer.h> +#include <tqptrqueue.h> +#include <tqfile.h> #include <klocale.h> #include <krandomsequence.h> @@ -60,7 +60,7 @@ public: } int mUniquePlayerNumber; - QPtrQueue<KPlayer> mAddPlayerList;// this is a list of to-be-added players. See addPlayer() docu + TQPtrQueue<KPlayer> mAddPlayerList;// this is a list of to-be-added players. See addPlayer() docu KRandomSequence* mRandom; KGame::GamePolicy mPolicy; KGameSequence* mGameSequence; @@ -76,12 +76,12 @@ public: KGamePropertyInt mMaxPlayer; KGamePropertyUInt mMinPlayer; KGamePropertyInt mGameStatus; // Game running? - QValueList<int> mInactiveIdList; + TQValueList<int> mInactiveIdList; }; // ------------------- GAME CLASS -------------------------- -KGame::KGame(int cookie,QObject* parent) : KGameNetwork(cookie,parent) +KGame::KGame(int cookie,TQObject* parent) : KGameNetwork(cookie,parent) { kdDebug(11001) << k_funcinfo << " - " << this << ", sizeof(KGame)=" << sizeof(KGame) << endl; d = new KGamePrivate; @@ -89,8 +89,8 @@ KGame::KGame(int cookie,QObject* parent) : KGameNetwork(cookie,parent) d->mProperties = new KGamePropertyHandler(this); d->mProperties->registerHandler(KGameMessage::IdGameProperty, - this,SLOT(sendProperty(int, QDataStream&, bool* )), - SLOT(emitSignal(KGamePropertyBase *))); + this,TQT_SLOT(sendProperty(int, TQDataStream&, bool* )), + TQT_SLOT(emitSignal(KGamePropertyBase *))); d->mMaxPlayer.registerData(KGamePropertyBase::IdMaxPlayer, this, i18n("MaxPlayers")); d->mMaxPlayer.setLocal(-1); // Infinite d->mMinPlayer.registerData(KGamePropertyBase::IdMinPlayer, this, i18n("MinPlayers")); @@ -101,20 +101,20 @@ KGame::KGame(int cookie,QObject* parent) : KGameNetwork(cookie,parent) d->mRandom = new KRandomSequence; d->mRandom->setSeed(0); - connect(this, SIGNAL(signalClientConnected(Q_UINT32)), - this, SLOT(slotClientConnected(Q_UINT32))); - connect(this, SIGNAL(signalClientDisconnected(Q_UINT32,bool)), - this, SLOT(slotClientDisconnected(Q_UINT32,bool))); - connect(this, SIGNAL(signalConnectionBroken()), - this, SLOT(slotServerDisconnected())); + connect(this, TQT_SIGNAL(signalClientConnected(Q_UINT32)), + this, TQT_SLOT(slotClientConnected(Q_UINT32))); + connect(this, TQT_SIGNAL(signalClientDisconnected(Q_UINT32,bool)), + this, TQT_SLOT(slotClientDisconnected(Q_UINT32,bool))); + connect(this, TQT_SIGNAL(signalConnectionBroken()), + this, TQT_SLOT(slotServerDisconnected())); setGameSequence(new KGameSequence()); // BL: FIXME This signal does no longer exist. When we are merging // MH: super....and how do I find out about the lost conenction now? // KGame and KGameNetwork, this could be improved! -// connect(this,SIGNAL(signalConnectionLost(KGameClient *)), -// this,SLOT(slotConnectionLost(KGameClient *))); +// connect(this,TQT_SIGNAL(signalConnectionLost(KGameClient *)), +// this,TQT_SLOT(slotConnectionLost(KGameClient *))); } KGame::~KGame() @@ -159,27 +159,27 @@ void KGame::deleteInactivePlayers() } } -bool KGame::load(QString filename,bool reset) +bool KGame::load(TQString filename,bool reset) { if (filename.isNull()) { return false; } - QFile f(filename); + TQFile f(filename); if (!f.open(IO_ReadOnly)) { return false; } - QDataStream s( &f ); + TQDataStream s( &f ); load(s,reset); f.close(); return true; } -bool KGame::load(QDataStream &stream,bool reset) +bool KGame::load(TQDataStream &stream,bool reset) { return loadgame(stream, false,reset); } -bool KGame::loadgame(QDataStream &stream, bool network,bool resetgame) +bool KGame::loadgame(TQDataStream &stream, bool network,bool resetgame) { // Load Game Data @@ -264,27 +264,27 @@ bool KGame::loadgame(QDataStream &stream, bool network,bool resetgame) return true; } -bool KGame::save(QString filename,bool saveplayers) +bool KGame::save(TQString filename,bool saveplayers) { if (filename.isNull()) { return false; } - QFile f(filename); + TQFile f(filename); if (!f.open(IO_WriteOnly)) { return false; } - QDataStream s( &f ); + TQDataStream s( &f ); save(s,saveplayers); f.close(); return true; } -bool KGame::save(QDataStream &stream,bool saveplayers) +bool KGame::save(TQDataStream &stream,bool saveplayers) { return savegame(stream, false,saveplayers); } -bool KGame::savegame(QDataStream &stream,bool /*network*/,bool saveplayers) +bool KGame::savegame(TQDataStream &stream,bool /*network*/,bool saveplayers) { // Save Game Data @@ -320,7 +320,7 @@ bool KGame::savegame(QDataStream &stream,bool /*network*/,bool saveplayers) return true; } -void KGame::savePlayer(QDataStream &stream,KPlayer* p) +void KGame::savePlayer(TQDataStream &stream,KPlayer* p) { // this could be in KGameMessage as well stream << (Q_INT32)p->rtti(); @@ -329,7 +329,7 @@ void KGame::savePlayer(QDataStream &stream,KPlayer* p) p->save(stream); } -void KGame::savePlayers(QDataStream &stream, KGamePlayerList *list) +void KGame::savePlayers(TQDataStream &stream, KGamePlayerList *list) { if (!list) { @@ -351,7 +351,7 @@ KPlayer *KGame::createPlayer(int /*rtti*/,int /*io*/,bool /*isvirtual*/) kdWarning(11001) << " No user defined player created. Creating default KPlayer. This crashes if you have overwritten KPlayer!!!! " << endl; return new KPlayer; } -KPlayer *KGame::loadPlayer(QDataStream& stream,bool isvirtual) +KPlayer *KGame::loadPlayer(TQDataStream& stream,bool isvirtual) { Q_INT32 rtti,id,iovalue; stream >> rtti >> id >> iovalue; @@ -385,14 +385,14 @@ KPlayer *KGame::loadPlayer(QDataStream& stream,bool isvirtual) KPlayer * KGame::findPlayer(Q_UINT32 id) const { - for (QPtrListIterator<KPlayer> it(d->mPlayerList); it.current(); ++it) + for (TQPtrListIterator<KPlayer> it(d->mPlayerList); it.current(); ++it) { if (it.current()->id() == id) { return it.current(); } } - for (QPtrListIterator<KPlayer> it(d->mInactivePlayerList); it.current(); ++it) + for (TQPtrListIterator<KPlayer> it(d->mInactivePlayerList); it.current(); ++it) { if (it.current()->id() == id) { @@ -438,8 +438,8 @@ void KGame::addPlayer(KPlayer* newplayer) kdDebug(11001) << k_funcinfo << "player " << newplayer << " already has an id: " << newplayer->id() << endl; } - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); // We distinguis here what policy we have if (policy()==PolicyLocal || policy()==PolicyDirty) { @@ -706,7 +706,7 @@ KRandomSequence* KGame::random() const { return d->mRandom; } -bool KGame::sendPlayerInput(QDataStream &msg, KPlayer *player, Q_UINT32 sender) +bool KGame::sendPlayerInput(TQDataStream &msg, KPlayer *player, Q_UINT32 sender) { if (!player) { @@ -724,7 +724,7 @@ bool KGame::sendPlayerInput(QDataStream &msg, KPlayer *player, Q_UINT32 sender) return true; } -bool KGame::systemPlayerInput(QDataStream &msg, KPlayer *player, Q_UINT32 sender) +bool KGame::systemPlayerInput(TQDataStream &msg, KPlayer *player, Q_UINT32 sender) { if (!player) { @@ -780,7 +780,7 @@ KPlayer * KGame::playerInputFinished(KPlayer *player) player->setTurn(false); // in turn based games we have to switch off input now if (gameSequence()) { - QTimer::singleShot(0,this,SLOT(prepareNext())); + TQTimer::singleShot(0,this,TQT_SLOT(prepareNext())); } } return player; @@ -840,7 +840,7 @@ void KGame::setGameStatus(int status) d->mGameStatus = status; } -void KGame::networkTransmission(QDataStream &stream, int msgid, Q_UINT32 receiver, Q_UINT32 sender, Q_UINT32 /*clientID*/) +void KGame::networkTransmission(TQDataStream &stream, int msgid, Q_UINT32 receiver, Q_UINT32 sender, Q_UINT32 /*clientID*/) {//clientID is unused // message targets a playerobject. If we find it we forward the message to the // player. Otherwise we proceed here and hope the best that the user processes @@ -1033,7 +1033,7 @@ void KGame::networkTransmission(QDataStream &stream, int msgid, Q_UINT32 receive << endl; } kdDebug(11001) << k_funcinfo << ": User data msgid " << msgid << endl; - emit signalNetworkData(msgid - KGameMessage::IdUser,((QBuffer*)stream.device())->readAll(),receiver,sender); + emit signalNetworkData(msgid - KGameMessage::IdUser,((TQBuffer*)stream.device())->readAll(),receiver,sender); } break; } @@ -1043,14 +1043,14 @@ void KGame::networkTransmission(QDataStream &stream, int msgid, Q_UINT32 receive // called by the IdSetupGameContinue Message - MASTER SIDE // Here the master needs to decide which players can take part at the game // and which will be deactivated -void KGame::setupGameContinue(QDataStream& stream, Q_UINT32 sender) +void KGame::setupGameContinue(TQDataStream& stream, Q_UINT32 sender) { KPlayer *player; Q_INT32 cnt; int i; stream >> cnt; - QValueList<int> inactivateIds; + TQValueList<int> inactivateIds; KGamePlayerList newPlayerList; newPlayerList.setAutoDelete(true); @@ -1135,7 +1135,7 @@ void KGame::setupGameContinue(QDataStream& stream, Q_UINT32 sender) kdDebug(11001) << "Alltogether deactivated " << inactivateIds.count() << " players" << endl; - QValueList<int>::Iterator it; + TQValueList<int>::Iterator it; for ( it = inactivateIds.begin(); it != inactivateIds.end(); ++it ) { int pid=*it; @@ -1143,7 +1143,7 @@ void KGame::setupGameContinue(QDataStream& stream, Q_UINT32 sender) } // Now deactivate the network players from the inactivateId list - //QValueList<int>::Iterator it; + //TQValueList<int>::Iterator it; for ( it = inactivateIds.begin(); it != inactivateIds.end(); ++it ) { int pid=*it; @@ -1182,8 +1182,8 @@ void KGame::setupGameContinue(QDataStream& stream, Q_UINT32 sender) } // Save the game over the network - QByteArray bufferS; - QDataStream streamS(bufferS,IO_WriteOnly); + TQByteArray bufferS; + TQDataStream streamS(bufferS,IO_WriteOnly); // Save game over netowrk and save players savegame(streamS,true,true); sendSystemMessage(streamS,KGameMessage::IdGameLoad,sender); @@ -1197,8 +1197,8 @@ void KGame::setupGameContinue(QDataStream& stream, Q_UINT32 sender) // Client needs to prepare for network transfer void KGame::setupGame(Q_UINT32 sender) { - QByteArray bufferS; - QDataStream streamS(bufferS,IO_WriteOnly); + TQByteArray bufferS; + TQDataStream streamS(bufferS,IO_WriteOnly); // Deactivate all players KGamePlayerList mTmpList(d->mPlayerList); // we need copy otherwise the removal crashes @@ -1207,7 +1207,7 @@ void KGame::setupGame(Q_UINT32 sender) streamS << cnt; - QPtrListIterator<KPlayer> it(mTmpList); + TQPtrListIterator<KPlayer> it(mTmpList); KPlayer *player; while (it.current()) { @@ -1356,7 +1356,7 @@ void KGame::slotClientDisconnected(Q_UINT32 clientID,bool /*broken*/) // server // TODO remove players from removed game for (unsigned int idx=0;idx<d->mInactiveIdList.count();idx++) { - QValueList<int>::Iterator it1 = d->mInactiveIdList.at(idx); + TQValueList<int>::Iterator it1 = d->mInactiveIdList.at(idx); player = findPlayer(*it1); if (((int)playerCount() < maxPlayers() || maxPlayers() < 0) && player && KGameMessage::rawGameId(*it1) != clientID) { @@ -1382,8 +1382,8 @@ void KGame::negotiateNetworkGame(Q_UINT32 clientID) return ; } - QByteArray buffer; - QDataStream streamGS(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream streamGS(buffer,IO_WriteOnly); // write Game setup specific data //streamGS << (Q_INT32)maxPlayers(); @@ -1396,7 +1396,7 @@ void KGame::negotiateNetworkGame(Q_UINT32 clientID) sendSystemMessage(streamGS, KGameMessage::IdSetupGame, clientID); } -bool KGame::sendGroupMessage(const QByteArray &msg, int msgid, Q_UINT32 sender, const QString& group) +bool KGame::sendGroupMessage(const TQByteArray &msg, int msgid, Q_UINT32 sender, const TQString& group) { // AB: group must not be i18n'ed!! we should better use an id for group and use // a groupName() for the name // FIXME @@ -1411,13 +1411,13 @@ bool KGame::sendGroupMessage(const QByteArray &msg, int msgid, Q_UINT32 sender, return true; } -bool KGame::sendGroupMessage(const QDataStream &msg, int msgid, Q_UINT32 sender, const QString& group) -{ return sendGroupMessage(((QBuffer*)msg.device())->buffer(), msgid, sender, group); } +bool KGame::sendGroupMessage(const TQDataStream &msg, int msgid, Q_UINT32 sender, const TQString& group) +{ return sendGroupMessage(((TQBuffer*)msg.device())->buffer(), msgid, sender, group); } -bool KGame::sendGroupMessage(const QString& msg, int msgid, Q_UINT32 sender, const QString& group) +bool KGame::sendGroupMessage(const TQString& msg, int msgid, Q_UINT32 sender, const TQString& group) { - QByteArray buffer; - QDataStream stream(buffer, IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer, IO_WriteOnly); stream << msg; return sendGroupMessage(stream, msgid, sender, group); } @@ -1425,10 +1425,10 @@ bool KGame::sendGroupMessage(const QString& msg, int msgid, Q_UINT32 sender, con bool KGame::addProperty(KGamePropertyBase* data) { return dataHandler()->addProperty(data); } -bool KGame::sendPlayerProperty(int msgid, QDataStream& s, Q_UINT32 playerId) +bool KGame::sendPlayerProperty(int msgid, TQDataStream& s, Q_UINT32 playerId) { return sendSystemMessage(s, msgid, playerId); } -void KGame::sendProperty(int msgid, QDataStream& stream, bool* sent) +void KGame::sendProperty(int msgid, TQDataStream& stream, bool* sent) { bool s = sendSystemMessage(stream, msgid); if (s) @@ -1459,11 +1459,11 @@ void KGame::setPolicy(GamePolicy p,bool recursive) dataHandler()->setPolicy((KGamePropertyBase::PropertyPolicy)p,false); // Set all KPLayer (active or inactive) property policy - for (QPtrListIterator<KPlayer> it(d->mPlayerList); it.current(); ++it) + for (TQPtrListIterator<KPlayer> it(d->mPlayerList); it.current(); ++it) { it.current()->dataHandler()->setPolicy((KGamePropertyBase::PropertyPolicy)p,false); } - for (QPtrListIterator<KPlayer> it(d->mInactivePlayerList); it.current(); ++it) + for (TQPtrListIterator<KPlayer> it(d->mInactivePlayerList); it.current(); ++it) { it.current()->dataHandler()->setPolicy((KGamePropertyBase::PropertyPolicy)p,false); } diff --git a/libkdegames/kgame/kgame.h b/libkdegames/kgame/kgame.h index 37d8d974..85a8356c 100644 --- a/libkdegames/kgame/kgame.h +++ b/libkdegames/kgame/kgame.h @@ -23,9 +23,9 @@ #ifndef __KGAME_H_ #define __KGAME_H_ -#include <qstring.h> -#include <qptrlist.h> -#include <qvaluelist.h> +#include <tqstring.h> +#include <tqptrlist.h> +#include <tqvaluelist.h> #include "kgamenetwork.h" #include <kdemacros.h> @@ -64,7 +64,7 @@ class KDE_EXPORT KGame : public KGameNetwork Q_OBJECT public: - typedef QPtrList<KPlayer> KGamePlayerList; + typedef TQPtrList<KPlayer> KGamePlayerList; /** * The policy of the property. This can be PolicyClean (setVale uses @@ -100,7 +100,7 @@ public: * game in load/save and network operations. Change this between * games. */ - KGame(int cookie=42,QObject* parent=0); + KGame(int cookie=42,TQObject* parent=0); /** * Destructs the game @@ -282,19 +282,19 @@ public: * Called by KPlayer to send a player input to the * KMessageServer. **/ - virtual bool sendPlayerInput(QDataStream &msg,KPlayer *player,Q_UINT32 sender=0); + virtual bool sendPlayerInput(TQDataStream &msg,KPlayer *player,Q_UINT32 sender=0); /** * Called when a player input arrives from KMessageServer. * - * Calls prepareNext (using QTimer::singleShot) if gameOver() + * Calls prepareNext (using TQTimer::singleShot) if gameOver() * returns 0. This function should normally not be used outside KGame. * It could be made non-virtual,protected in a later version. At the * moment it is a virtual function to give you more control over KGame. * * For documentation see playerInput. **/ - virtual bool systemPlayerInput(QDataStream &msg,KPlayer *player,Q_UINT32 sender=0); + virtual bool systemPlayerInput(TQDataStream &msg,KPlayer *player,Q_UINT32 sender=0); /** * This virtual function is called if the KGame needs to create a new player. @@ -337,7 +337,7 @@ public: * * @return true? */ - virtual bool load(QDataStream &stream,bool reset=true); + virtual bool load(TQDataStream &stream,bool reset=true); /** * Same as above function but with different parameters @@ -347,7 +347,7 @@ public: * * @return true? **/ - virtual bool load(QString filename,bool reset=true); + virtual bool load(TQString filename,bool reset=true); /** * Save a game to a file OR to network. Otherwise the same as @@ -358,7 +358,7 @@ public: * * @return true? */ - virtual bool save(QDataStream &stream,bool saveplayers=true); + virtual bool save(TQDataStream &stream,bool saveplayers=true); /** * Same as above function but with different parameters @@ -368,7 +368,7 @@ public: * * @return true? **/ - virtual bool save(QString filename,bool saveplayers=true); + virtual bool save(TQString filename,bool saveplayers=true); /** * Resets the game, i.e. puts it into a state where everything @@ -403,7 +403,7 @@ public: /** * This is called by KPlayer::sendProperty only! Internal function! **/ - bool sendPlayerProperty(int msgid, QDataStream& s, Q_UINT32 playerId); + bool sendPlayerProperty(int msgid, TQDataStream& s, Q_UINT32 playerId); /** * This function allows to find the pointer to a player @@ -435,10 +435,10 @@ public: * @param group the group of the receivers * @return true if worked */ - bool sendGroupMessage(const QByteArray& msg, int msgid, Q_UINT32 sender, const QString& group); - bool sendGroupMessage(const QDataStream &msg, int msgid, Q_UINT32 sender, const QString& group); - bool sendGroupMessage(int msg, int msgid, Q_UINT32 sender, const QString& group); - bool sendGroupMessage(const QString& msg, int msgid, Q_UINT32 sender, const QString& group); + bool sendGroupMessage(const TQByteArray& msg, int msgid, Q_UINT32 sender, const TQString& group); + bool sendGroupMessage(const TQDataStream &msg, int msgid, Q_UINT32 sender, const TQString& group); + bool sendGroupMessage(int msg, int msgid, Q_UINT32 sender, const TQString& group); + bool sendGroupMessage(const TQString& msg, int msgid, Q_UINT32 sender, const TQString& group); /** * This will either forward an incoming message to a specified player @@ -458,7 +458,7 @@ public: * @param sender * @param clientID the client from which we received the transmission - hardly used **/ - virtual void networkTransmission(QDataStream &stream, int msgid, Q_UINT32 receiver, Q_UINT32 sender, Q_UINT32 clientID); + virtual void networkTransmission(TQDataStream &stream, int msgid, Q_UINT32 receiver, Q_UINT32 sender, Q_UINT32 clientID); /** * Returns a pointer to the KGame property handler @@ -469,7 +469,7 @@ protected slots: /** * Called by KGamePropertyHandler only! Internal function! **/ - void sendProperty(int msgid, QDataStream& stream, bool* sent); + void sendProperty(int msgid, TQDataStream& stream, bool* sent); /** * Called by KGamePropertyHandler only! Internal function! @@ -539,7 +539,7 @@ signals: * * @param stream the load stream */ - void signalLoadPrePlayers(QDataStream &stream); + void signalLoadPrePlayers(TQDataStream &stream); /** * The game will be loaded from the given stream. Load from here @@ -548,7 +548,7 @@ signals: * * @param stream the load stream */ - void signalLoad(QDataStream &stream); + void signalLoad(TQDataStream &stream); /** * The game will be saved to the given stream. Fill this with data @@ -563,7 +563,7 @@ signals: * * @param stream the save stream **/ - void signalSavePrePlayers(QDataStream &stream); + void signalSavePrePlayers(TQDataStream &stream); /** * The game will be saved to the given stream. Fill this with data @@ -572,7 +572,7 @@ signals: * * @param stream the save stream */ - void signalSave(QDataStream &stream); + void signalSave(TQDataStream &stream); /** * Is emmited if a game with a different version cookie is loaded. @@ -585,7 +585,7 @@ signals: * @param cookie - the saved cookie. It differs from KGame::cookie() * @param result - set this to true if you managed to load the game */ - void signalLoadError(QDataStream &stream,bool network,int cookie, bool &result); + void signalLoadError(TQDataStream &stream,bool network,int cookie, bool &result); /** * We got an user defined update message. This is usually done @@ -593,7 +593,7 @@ signals: * own methods and has to syncronise them over the network. * Reaction to this is usually a call to a KGame function. */ - void signalNetworkData(int msgid,const QByteArray& buffer, Q_UINT32 receiver, Q_UINT32 sender); + void signalNetworkData(int msgid,const TQByteArray& buffer, Q_UINT32 receiver, Q_UINT32 sender); /** * We got an network message. this can be used to notify us that something @@ -686,7 +686,7 @@ protected: * and then manually call @ref playerInputFinished to resume it. * Example: * \code - * bool MyClass::playerInput(QDataStream &msg,KPlayer *player) + * bool MyClass::playerInput(TQDataStream &msg,KPlayer *player) * { * Q_INT32 move; * msg >> move; @@ -700,7 +700,7 @@ protected: * @param player the player who did the move * @return true - input ready, false: input manual */ - virtual bool playerInput(QDataStream &msg,KPlayer *player)=0; + virtual bool playerInput(TQDataStream &msg,KPlayer *player)=0; /** @@ -752,7 +752,7 @@ protected: **/ virtual void newPlayersJoin(KGamePlayerList *oldplayer, KGamePlayerList *newplayer, - QValueList<int> &inactivate) { + TQValueList<int> &inactivate) { Q_UNUSED( oldplayer ); Q_UNUSED( newplayer ); Q_UNUSED( inactivate ); @@ -766,7 +766,7 @@ protected: * @param list the optional list is the player list to be saved, default is playerList() * **/ - void savePlayers(QDataStream &stream,KGamePlayerList *list=0); + void savePlayers(TQDataStream &stream,KGamePlayerList *list=0); /** * Prepare a player for being added. Put all data about a player into the @@ -778,7 +778,7 @@ protected: * @param stream is the stream to add the player * @param player The player to add **/ - void savePlayer(QDataStream& stream,KPlayer* player); + void savePlayer(TQDataStream& stream,KPlayer* player); /** * Load the player list from a stream. Used for network game and load/save. @@ -788,7 +788,7 @@ protected: * @param isvirtual will set the virtual flag true/false * **/ - KPlayer *loadPlayer(QDataStream& stream,bool isvirtual=false); + KPlayer *loadPlayer(TQDataStream& stream,bool isvirtual=false); /** @@ -872,7 +872,7 @@ protected: * * @return true? */ - virtual bool loadgame(QDataStream &stream, bool network, bool reset); + virtual bool loadgame(TQDataStream &stream, bool network, bool reset); /** * Save a game, to file OR network. Internal. @@ -883,7 +883,7 @@ protected: * * @return true? */ - virtual bool savegame(QDataStream &stream, bool network,bool saveplayers); + virtual bool savegame(TQDataStream &stream, bool network,bool saveplayers); private: //AB: this is to hide the "receiver" parameter from the user. It shouldn't be @@ -913,7 +913,7 @@ private: /** * Helping function - game negotiation **/ - void setupGameContinue(QDataStream& msg, Q_UINT32 sender); + void setupGameContinue(TQDataStream& msg, Q_UINT32 sender); /** * Removes a player from all lists, removes the @ref KGame pointer from the diff --git a/libkdegames/kgame/kgamechat.cpp b/libkdegames/kgame/kgamechat.cpp index 16ec7c18..ddc1bd66 100644 --- a/libkdegames/kgame/kgamechat.cpp +++ b/libkdegames/kgame/kgamechat.cpp @@ -29,8 +29,8 @@ #include <klocale.h> #include <kdebug.h> -#include <qmap.h> -#include <qintdict.h> +#include <tqmap.h> +#include <tqintdict.h> //FIXME: #define FIRST_ID 2 // first id, that is free of use, aka not defined above @@ -51,24 +51,24 @@ public: int mMessageId; - QIntDict<KPlayer> mIndex2Player; + TQIntDict<KPlayer> mIndex2Player; - QMap<int, int> mSendId2PlayerId; + TQMap<int, int> mSendId2PlayerId; int mToMyGroup; // just as the above - but for the group, not for players }; -KGameChat::KGameChat(KGame* g, int msgid, QWidget* parent) : KChatBase(parent) +KGameChat::KGameChat(KGame* g, int msgid, TQWidget* parent) : KChatBase(parent) { init(g, msgid); } -KGameChat::KGameChat(KGame* g, int msgid, KPlayer* fromPlayer, QWidget* parent) : KChatBase(parent) +KGameChat::KGameChat(KGame* g, int msgid, KPlayer* fromPlayer, TQWidget* parent) : KChatBase(parent) { init(g, msgid); setFromPlayer(fromPlayer); } -KGameChat::KGameChat(QWidget* parent) : KChatBase(parent) +KGameChat::KGameChat(TQWidget* parent) : KChatBase(parent) { init(0, -1); } @@ -88,7 +88,7 @@ void KGameChat::init(KGame* g, int msgId) setKGame(g); } -void KGameChat::addMessage(int fromId, const QString& text) +void KGameChat::addMessage(int fromId, const TQString& text) { if (!d->mGame) { kdWarning(11001) << "no KGame object has been set" << endl; @@ -105,7 +105,7 @@ void KGameChat::addMessage(int fromId, const QString& text) } } -void KGameChat::returnPressed(const QString& text) +void KGameChat::returnPressed(const TQString& text) { if (!d->mFromPlayer) { kdWarning(11001) << k_funcinfo << ": You must set a player first!" << endl; @@ -123,7 +123,7 @@ void KGameChat::returnPressed(const QString& text) if (isToGroupMessage(id)) { // note: there is currently no support for other groups than the players // group! It might be useful to send to other groups, too - QString group = d->mFromPlayer->group(); + TQString group = d->mFromPlayer->group(); kdDebug(11001) << "send to group " << group << endl; int sender = d->mFromPlayer->id(); d->mGame->sendGroupMessage(text, messageId(), sender, group); @@ -164,7 +164,7 @@ bool KGameChat::isToPlayerMessage(int id) const { return d->mSendId2PlayerId.contains(id); } -QString KGameChat::sendToPlayerEntry(const QString& name) const +TQString KGameChat::sendToPlayerEntry(const TQString& name) const { return i18n("Send to %1").arg(name); } int KGameChat::playerId(int id) const @@ -178,7 +178,7 @@ int KGameChat::playerId(int id) const int KGameChat::sendingId(int playerId) const { - QMap<int, int>::Iterator it; + TQMap<int, int>::Iterator it; for (it = d->mSendId2PlayerId.begin(); it != d->mSendId2PlayerId.end(); ++it) { if (it.data() == playerId) { return it.key(); @@ -187,8 +187,8 @@ int KGameChat::sendingId(int playerId) const return -1; } -const QString& KGameChat::fromName() const -{ return d->mFromPlayer ? d->mFromPlayer->name() : QString::null; } +const TQString& KGameChat::fromName() const +{ return d->mFromPlayer ? d->mFromPlayer->name() : TQString::null; } bool KGameChat::hasPlayer(int id) const { @@ -227,15 +227,15 @@ void KGameChat::setKGame(KGame* g) d->mGame = g; if (d->mGame) { - connect(d->mGame, SIGNAL(signalPlayerJoinedGame(KPlayer*)), - this, SLOT(slotAddPlayer(KPlayer*))); - connect(d->mGame, SIGNAL(signalPlayerLeftGame(KPlayer*)), - this, SLOT(slotRemovePlayer(KPlayer*))); - connect(d->mGame, SIGNAL(signalNetworkData(int, const QByteArray&, Q_UINT32, Q_UINT32)), - this, SLOT(slotReceiveMessage(int, const QByteArray&, Q_UINT32, Q_UINT32))); - connect(d->mGame, SIGNAL(destroyed()), this, SLOT(slotUnsetKGame())); - - QPtrList<KPlayer> playerList = *d->mGame->playerList(); + connect(d->mGame, TQT_SIGNAL(signalPlayerJoinedGame(KPlayer*)), + this, TQT_SLOT(slotAddPlayer(KPlayer*))); + connect(d->mGame, TQT_SIGNAL(signalPlayerLeftGame(KPlayer*)), + this, TQT_SLOT(slotRemovePlayer(KPlayer*))); + connect(d->mGame, TQT_SIGNAL(signalNetworkData(int, const TQByteArray&, Q_UINT32, Q_UINT32)), + this, TQT_SLOT(slotReceiveMessage(int, const TQByteArray&, Q_UINT32, Q_UINT32))); + connect(d->mGame, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotUnsetKGame())); + + TQPtrList<KPlayer> playerList = *d->mGame->playerList(); for (int unsigned i = 0; i < playerList.count(); i++) { slotAddPlayer(playerList.at(i)); } @@ -261,7 +261,7 @@ void KGameChat::slotUnsetKGame() } disconnect(d->mGame, 0, this, 0); removeSendingEntry(d->mToMyGroup); - QMap<int, int>::Iterator it; + TQMap<int, int>::Iterator it; for (it = d->mSendId2PlayerId.begin(); it != d->mSendId2PlayerId.end(); ++it) { removeSendingEntry(it.data()); } @@ -281,10 +281,10 @@ void KGameChat::slotAddPlayer(KPlayer* p) int sendingId = nextId(); addSendingEntry(comboBoxItem(p->name()), sendingId); d->mSendId2PlayerId.insert(sendingId, p->id()); - connect(p, SIGNAL(signalPropertyChanged(KGamePropertyBase*, KPlayer*)), - this, SLOT(slotPropertyChanged(KGamePropertyBase*, KPlayer*))); - connect(p, SIGNAL(signalNetworkData(int, const QByteArray&, Q_UINT32, KPlayer*)), - this, SLOT(slotReceivePrivateMessage(int, const QByteArray&, Q_UINT32, KPlayer*))); + connect(p, TQT_SIGNAL(signalPropertyChanged(KGamePropertyBase*, KPlayer*)), + this, TQT_SLOT(slotPropertyChanged(KGamePropertyBase*, KPlayer*))); + connect(p, TQT_SIGNAL(signalNetworkData(int, const TQByteArray&, Q_UINT32, KPlayer*)), + this, TQT_SLOT(slotReceivePrivateMessage(int, const TQByteArray&, Q_UINT32, KPlayer*))); } void KGameChat::slotRemovePlayer(KPlayer* p) @@ -317,7 +317,7 @@ void KGameChat::slotPropertyChanged(KGamePropertyBase* prop, KPlayer* player) } } -void KGameChat::slotReceivePrivateMessage(int msgid, const QByteArray& buffer, Q_UINT32 sender, KPlayer* me) +void KGameChat::slotReceivePrivateMessage(int msgid, const TQByteArray& buffer, Q_UINT32 sender, KPlayer* me) { if (!me || me != fromPlayer()) { kdDebug() << k_funcinfo << "nope - not for us!" << endl; @@ -326,14 +326,14 @@ void KGameChat::slotReceivePrivateMessage(int msgid, const QByteArray& buffer, Q slotReceiveMessage(msgid, buffer, me->id(), sender); } -void KGameChat::slotReceiveMessage(int msgid, const QByteArray& buffer, Q_UINT32 , Q_UINT32 sender) +void KGameChat::slotReceiveMessage(int msgid, const TQByteArray& buffer, Q_UINT32 , Q_UINT32 sender) { - QDataStream msg(buffer, IO_ReadOnly); + TQDataStream msg(buffer, IO_ReadOnly); if (msgid != messageId()) { return; } - QString text; + TQString text; msg >> text; addMessage(sender, text); diff --git a/libkdegames/kgame/kgamechat.h b/libkdegames/kgame/kgamechat.h index 6f7ea65d..effcca22 100644 --- a/libkdegames/kgame/kgamechat.h +++ b/libkdegames/kgame/kgamechat.h @@ -21,7 +21,7 @@ #ifndef __KGAMECHAT_H__ #define __KGAMECHAT_H__ -#include <qstring.h> +#include <tqstring.h> #include "kchatbase.h" #include <kdemacros.h> @@ -49,14 +49,14 @@ public: * the chat message. The @p fromPlayer is the local player (see @ref * setFromPlayer). **/ - KGameChat(KGame* game, int msgid, KPlayer* fromPlayer, QWidget * parent); + KGameChat(KGame* game, int msgid, KPlayer* fromPlayer, TQWidget * parent); /** * @overload * To make use of this widget you need to call @ref setFromPlayer * manually. **/ - KGameChat(KGame* game, int msgId, QWidget* parent); + KGameChat(KGame* game, int msgId, TQWidget* parent); /** * @overload @@ -64,7 +64,7 @@ public: * setGame, setFromPlayer and setMessageId manually. * @since 3.2 **/ - KGameChat(QWidget* parent); + KGameChat(TQWidget* parent); virtual ~KGameChat(); @@ -114,14 +114,14 @@ public: * reimplemented from @ref KChatBase * @return @ref KPlayer::name() for the player set by @ref setFromPlayer **/ - virtual const QString& fromName() const; + virtual const TQString& fromName() const; public slots: - virtual void addMessage(const QString& fromName, const QString& text) { KChatBase::addMessage(fromName, text);} - virtual void addMessage(int fromId, const QString& text); + virtual void addMessage(const TQString& fromName, const TQString& text) { KChatBase::addMessage(fromName, text);} + virtual void addMessage(int fromId, const TQString& text); - void slotReceiveMessage(int, const QByteArray&, Q_UINT32 receiver, Q_UINT32 sender); + void slotReceiveMessage(int, const TQByteArray&, Q_UINT32 receiver, Q_UINT32 sender); protected: /** @@ -187,7 +187,7 @@ protected: * KChatBase. By default this is "send to name" where name is the name * that you specify. See also KChatBase::addSendingEntry **/ - virtual QString sendToPlayerEntry(const QString& name) const; + virtual TQString sendToPlayerEntry(const TQString& name) const; protected slots: @@ -208,10 +208,10 @@ protected slots: * gets forwarded to slotReceiveMessage if @p me equals * fromPlayer. **/ - void slotReceivePrivateMessage(int msgid, const QByteArray& buffer, Q_UINT32 sender, KPlayer* me); + void slotReceivePrivateMessage(int msgid, const TQByteArray& buffer, Q_UINT32 sender, KPlayer* me); protected: - virtual void returnPressed(const QString& text); + virtual void returnPressed(const TQString& text); private: void init(KGame* g, int msgid); diff --git a/libkdegames/kgame/kgameerror.cpp b/libkdegames/kgame/kgameerror.cpp index 93f40f93..eb98a797 100644 --- a/libkdegames/kgame/kgameerror.cpp +++ b/libkdegames/kgame/kgameerror.cpp @@ -26,33 +26,33 @@ #include <klocale.h> -QByteArray KGameError::errVersion(int remoteVersion) +TQByteArray KGameError::errVersion(int remoteVersion) { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); s << (Q_INT32)KGameMessage::version(); s << (Q_INT32)remoteVersion; return b; } -QByteArray KGameError::errCookie(int localCookie, int remoteCookie) +TQByteArray KGameError::errCookie(int localCookie, int remoteCookie) { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); s << (Q_INT32)localCookie; s << (Q_INT32)remoteCookie; return b; } -QString KGameError::errorText(int errorCode, const QByteArray& message) +TQString KGameError::errorText(int errorCode, const TQByteArray& message) { - QDataStream s(message, IO_ReadOnly); + TQDataStream s(message, IO_ReadOnly); return errorText(errorCode, s); } -QString KGameError::errorText(int errorCode, QDataStream& s) +TQString KGameError::errorText(int errorCode, TQDataStream& s) { - QString text; + TQString text; switch (errorCode) { case Cookie: { diff --git a/libkdegames/kgame/kgameerror.h b/libkdegames/kgame/kgameerror.h index 2916e891..071737cc 100644 --- a/libkdegames/kgame/kgameerror.h +++ b/libkdegames/kgame/kgameerror.h @@ -23,7 +23,7 @@ #ifndef __KGAMEERROR_H_ #define __KGAMEERROR_H_ -#include <qstring.h> +#include <tqstring.h> class KGameError @@ -40,19 +40,19 @@ public: /** * Generate an error message with Erorr Code = ErrCookie **/ - static QByteArray errCookie(int localCookie, int remoteCookie); - static QByteArray errVersion(int remoteVersion); + static TQByteArray errCookie(int localCookie, int remoteCookie); + static TQByteArray errVersion(int remoteVersion); /** - * Create an erorr text using a QDataStream (QByteArray) which was + * Create an erorr text using a TQDataStream (TQByteArray) which was * created using @ref KGameError. This is the opposite function to all * the errXYZ() function (e.g. @ref errVersion). * You want to use this to generate the message that shall be * displayed to the user. * @return an error message **/ - static QString errorText(int errorCode, QDataStream& message); - static QString errorText(int errorCode, const QByteArray& message); + static TQString errorText(int errorCode, TQDataStream& message); + static TQString errorText(int errorCode, const TQByteArray& message); }; diff --git a/libkdegames/kgame/kgameio.cpp b/libkdegames/kgame/kgameio.cpp index 9b3a55e8..7183d5d3 100644 --- a/libkdegames/kgame/kgameio.cpp +++ b/libkdegames/kgame/kgameio.cpp @@ -30,20 +30,20 @@ #include <kdebug.h> -#include <qwidget.h> -#include <qbuffer.h> -#include <qtimer.h> +#include <tqwidget.h> +#include <tqbuffer.h> +#include <tqtimer.h> #include <stdlib.h> // ----------------------- Generic IO ------------------------- -KGameIO::KGameIO() : QObject(0,0) +KGameIO::KGameIO() : TQObject(0,0) { kdDebug(11001) << k_funcinfo << ": this=" << this << ", sizeof(this)" << sizeof(KGameIO) << endl; mPlayer = 0; } -KGameIO::KGameIO(KPlayer* player) : QObject(0,0) +KGameIO::KGameIO(KPlayer* player) : TQObject(0,0) { kdDebug(11001) << k_funcinfo << ": this=" << this << ", sizeof(this)" << sizeof(KGameIO) << endl; mPlayer = 0; @@ -76,12 +76,12 @@ void KGameIO::notifyTurn(bool b) return; } bool sendit=false; - QByteArray buffer; - QDataStream stream(buffer, IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer, IO_WriteOnly); emit signalPrepareTurn(stream, b, this, &sendit); if (sendit) { - QDataStream ostream(buffer,IO_ReadOnly); + TQDataStream ostream(buffer,IO_ReadOnly); Q_UINT32 sender = player()->id(); // force correct sender kdDebug(11001) << "Prepare turn sendInput" << endl; sendInput(ostream, true, sender); @@ -97,7 +97,7 @@ KGame* KGameIO::game() const return player()->game(); } -bool KGameIO::sendInput(QDataStream& s, bool transmit, Q_UINT32 sender) +bool KGameIO::sendInput(TQDataStream& s, bool transmit, Q_UINT32 sender) { if (!player()) { @@ -117,7 +117,7 @@ void KGameIO::Debug() // ----------------------- Key IO --------------------------- -KGameKeyIO::KGameKeyIO(QWidget *parent) +KGameKeyIO::KGameKeyIO(TQWidget *parent) : KGameIO() { if (parent) @@ -137,7 +137,7 @@ KGameKeyIO::~KGameKeyIO() int KGameKeyIO::rtti() const { return KeyIO; } -bool KGameKeyIO::eventFilter( QObject *o, QEvent *e ) +bool KGameKeyIO::eventFilter( TQObject *o, TQEvent *e ) { if (!player()) { @@ -145,16 +145,16 @@ bool KGameKeyIO::eventFilter( QObject *o, QEvent *e ) } // key press/release - if ( e->type() == QEvent::KeyPress || - e->type() == QEvent::KeyRelease ) + if ( e->type() == TQEvent::KeyPress || + e->type() == TQEvent::KeyRelease ) { - QKeyEvent *k = (QKeyEvent*)e; + TQKeyEvent *k = (TQKeyEvent*)e; // kdDebug(11001) << "KGameKeyIO " << this << " key press/release " << k->key() << endl ; - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); bool eatevent=false; emit signalKeyEvent(this,stream,k,&eatevent); - QDataStream msg(buffer,IO_ReadOnly); + TQDataStream msg(buffer,IO_ReadOnly); if (eatevent && sendInput(msg)) { @@ -162,12 +162,12 @@ bool KGameKeyIO::eventFilter( QObject *o, QEvent *e ) } return false; // do not eat otherwise } - return QObject::eventFilter( o, e ); // standard event processing + return TQObject::eventFilter( o, e ); // standard event processing } // ----------------------- Mouse IO --------------------------- -KGameMouseIO::KGameMouseIO(QWidget *parent,bool trackmouse) +KGameMouseIO::KGameMouseIO(TQWidget *parent,bool trackmouse) : KGameIO() { if (parent) @@ -195,11 +195,11 @@ void KGameMouseIO::setMouseTracking(bool b) { if (parent()) { - ((QWidget*)parent())->setMouseTracking(b); + ((TQWidget*)parent())->setMouseTracking(b); } } -bool KGameMouseIO::eventFilter( QObject *o, QEvent *e ) +bool KGameMouseIO::eventFilter( TQObject *o, TQEvent *e ) { if (!player()) { @@ -208,28 +208,28 @@ bool KGameMouseIO::eventFilter( QObject *o, QEvent *e ) // kdDebug(11001) << "KGameMouseIO " << this << endl ; // mouse action - if ( e->type() == QEvent::MouseButtonPress || - e->type() == QEvent::MouseButtonRelease || - e->type() == QEvent::MouseButtonDblClick || - e->type() == QEvent::Wheel || - e->type() == QEvent::MouseMove + if ( e->type() == TQEvent::MouseButtonPress || + e->type() == TQEvent::MouseButtonRelease || + e->type() == TQEvent::MouseButtonDblClick || + e->type() == TQEvent::Wheel || + e->type() == TQEvent::MouseMove ) { - QMouseEvent *k = (QMouseEvent*)e; + TQMouseEvent *k = (TQMouseEvent*)e; // kdDebug(11001) << "KGameMouseIO " << this << endl ; - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); bool eatevent=false; emit signalMouseEvent(this,stream,k,&eatevent); // kdDebug(11001) << "################# eatevent=" << eatevent << endl; - QDataStream msg(buffer,IO_ReadOnly); + TQDataStream msg(buffer,IO_ReadOnly); if (eatevent && sendInput(msg)) { return eatevent; } return false; // do not eat otherwise } - return QObject::eventFilter( o, e ); // standard event processing + return TQObject::eventFilter( o, e ); // standard event processing } @@ -249,7 +249,7 @@ public: }; // ----------------------- Process IO --------------------------- -KGameProcessIO::KGameProcessIO(const QString& name) +KGameProcessIO::KGameProcessIO(const TQString& name) : KGameIO() { kdDebug(11001) << k_funcinfo << ": this=" << this << ", sizeof(this)=" << sizeof(KGameProcessIO) << endl; @@ -266,12 +266,12 @@ KGameProcessIO::KGameProcessIO(const QString& name) //kdDebug(11001) << "================= KMEssage SetSErver ==================== " << endl; //d->mMessageClient->setServer(d->mMessageServer); kdDebug(11001) << "================= KMEssage: Connect ==================== " << endl; - //connect(d->mMessageClient, SIGNAL(broadcastReceived(const QByteArray&, Q_UINT32)), - // this, SLOT(clientMessage(const QByteArray&, Q_UINT32))); - //connect(d->mMessageClient, SIGNAL(forwardReceived(const QByteArray&, Q_UINT32, const QValueList <Q_UINT32> &)), - // this, SLOT(clientMessage(const QByteArray&, Q_UINT32, const QValueList <Q_UINT32> &))); - connect(d->mProcessIO, SIGNAL(received(const QByteArray&)), - this, SLOT(receivedMessage(const QByteArray&))); + //connect(d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, Q_UINT32)), + // this, TQT_SLOT(clientMessage(const TQByteArray&, Q_UINT32))); + //connect(d->mMessageClient, TQT_SIGNAL(forwardReceived(const TQByteArray&, Q_UINT32, const TQValueList <Q_UINT32> &)), + // this, TQT_SLOT(clientMessage(const TQByteArray&, Q_UINT32, const TQValueList <Q_UINT32> &))); + connect(d->mProcessIO, TQT_SIGNAL(received(const TQByteArray&)), + this, TQT_SLOT(receivedMessage(const TQByteArray&))); //kdDebug(11001) << "Our client is id="<<d->mMessageClient->id() << endl; } @@ -300,8 +300,8 @@ void KGameProcessIO::initIO(KPlayer *p) { KGameIO::initIO(p); // Send 'hello' to process - QByteArray buffer; - QDataStream stream(buffer, IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer, IO_WriteOnly); Q_INT16 id = p->userId(); stream << id; @@ -326,8 +326,8 @@ void KGameProcessIO::notifyTurn(bool b) return; } bool sendit=true; - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); stream << (Q_INT8)b; emit signalPrepareTurn(stream,b,this,&sendit); if (sendit) @@ -338,17 +338,17 @@ void KGameProcessIO::notifyTurn(bool b) } } -void KGameProcessIO::sendSystemMessage(QDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender) +void KGameProcessIO::sendSystemMessage(TQDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender) { sendAllMessages(stream, msgid, receiver, sender, false); } -void KGameProcessIO::sendMessage(QDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender) +void KGameProcessIO::sendMessage(TQDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender) { sendAllMessages(stream, msgid, receiver, sender, true); } -void KGameProcessIO::sendAllMessages(QDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender, bool usermsg) +void KGameProcessIO::sendAllMessages(TQDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender, bool usermsg) { kdDebug(11001) << "==============> KGameProcessIO::sendMessage (usermsg="<<usermsg<<")" << endl; // if (!player()) return ; @@ -361,10 +361,10 @@ void KGameProcessIO::sendAllMessages(QDataStream &stream,int msgid, Q_UINT32 rec kdDebug(11001) << "=============* ProcessIO (" << msgid << "," << receiver << "," << sender << ") ===========" << endl; - QByteArray buffer; - QDataStream ostream(buffer,IO_WriteOnly); - QBuffer *device=(QBuffer *)stream.device(); - QByteArray data=device->buffer();; + TQByteArray buffer; + TQDataStream ostream(buffer,IO_WriteOnly); + TQBuffer *device=(TQBuffer *)stream.device(); + TQByteArray data=device->buffer();; KGameMessage::createHeader(ostream,sender,receiver,msgid); // ostream.writeRawBytes(data.data()+device->at(),data.size()-device->at()); @@ -377,10 +377,10 @@ void KGameProcessIO::sendAllMessages(QDataStream &stream,int msgid, Q_UINT32 rec } } -//void KGameProcessIO::clientMessage(const QByteArray& receiveBuffer, Q_UINT32 clientID, const QValueList <Q_UINT32> &recv) -void KGameProcessIO::receivedMessage(const QByteArray& receiveBuffer) +//void KGameProcessIO::clientMessage(const TQByteArray& receiveBuffer, Q_UINT32 clientID, const TQValueList <Q_UINT32> &recv) +void KGameProcessIO::receivedMessage(const TQByteArray& receiveBuffer) { - QDataStream stream(receiveBuffer,IO_ReadOnly); + TQDataStream stream(receiveBuffer,IO_ReadOnly); int msgid; Q_UINT32 sender; Q_UINT32 receiver; @@ -391,10 +391,10 @@ void KGameProcessIO::receivedMessage(const QByteArray& receiveBuffer) // Cut out the header part...to not confuse network code - QBuffer *buf=(QBuffer *)stream.device(); - QByteArray newbuffer; + TQBuffer *buf=(TQBuffer *)stream.device(); + TQByteArray newbuffer; newbuffer.setRawData(buf->buffer().data()+buf->at(),buf->size()-buf->at()); - QDataStream ostream(newbuffer,IO_ReadOnly); + TQDataStream ostream(newbuffer,IO_ReadOnly); kdDebug(11001) << "Newbuffer size=" << newbuffer.size() << endl; @@ -443,7 +443,7 @@ public: int mPauseCounter; - QTimer* mAdvanceTimer; + TQTimer* mAdvanceTimer; }; KGameComputerIO::KGameComputerIO() : KGameIO() @@ -488,8 +488,8 @@ int KGameComputerIO::reactionPeriod() const void KGameComputerIO::setAdvancePeriod(int ms) { stopAdvancePeriod(); - d->mAdvanceTimer = new QTimer(this); - connect(d->mAdvanceTimer, SIGNAL(timeout()), this, SLOT(advance())); + d->mAdvanceTimer = new TQTimer(this); + connect(d->mAdvanceTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(advance())); d->mAdvanceTimer->start(ms); } diff --git a/libkdegames/kgame/kgameio.h b/libkdegames/kgame/kgameio.h index 4d7e0f5b..82b84740 100644 --- a/libkdegames/kgame/kgameio.h +++ b/libkdegames/kgame/kgameio.h @@ -23,8 +23,8 @@ #ifndef __KGAMEIO_H__ #define __KGAMEIO_H__ -#include <qstring.h> -#include <qobject.h> +#include <tqstring.h> +#include <tqobject.h> #include <kdemacros.h> class KPlayer; class KGame; @@ -128,7 +128,7 @@ public: /** * Send an input message using @ref KPlayer::forwardInput **/ - bool sendInput(QDataStream& stream, bool transmit = true, Q_UINT32 sender = 0); + bool sendInput(TQDataStream& stream, bool transmit = true, Q_UINT32 sender = 0); signals: /** @@ -147,7 +147,7 @@ signals: * * Example: * \code - * void GameWindow::slotPrepareTurn(QDataStream &stream,bool b,KGameIO *input,bool * ) + * void GameWindow::slotPrepareTurn(TQDataStream &stream,bool b,KGameIO *input,bool * ) * { * KPlayer *player=input->player(); * if (!player->myTurn()) return ; @@ -162,7 +162,7 @@ signals: * @param send set this to true to send the generated move using @ref * sendInput **/ - void signalPrepareTurn(QDataStream & stream, bool turn, KGameIO *io, bool * send); + void signalPrepareTurn(TQDataStream & stream, bool turn, KGameIO *io, bool * send); private: @@ -193,13 +193,13 @@ public: * \code * KGameKeyIO *input; * input=new KGameKeyIO(myWidget); - * connect(input,SIGNAL(signalKeyEvent(KGameIO *,QDataStream &,QKeyEvent *,bool *)), - * this,SLOT(slotKeyInput(KGameIO *,QDataStream &,QKeyEvent *,bool *))); + * connect(input,TQT_SIGNAL(signalKeyEvent(KGameIO *,TQDataStream &,TQKeyEvent *,bool *)), + * this,TQT_SLOT(slotKeyInput(KGameIO *,TQDataStream &,TQKeyEvent *,bool *))); * \endcode * * @param parent The parents widget whose keyboard events * should be grabbed */ - KGameKeyIO(QWidget *parent); + KGameKeyIO(TQWidget *parent); virtual ~KGameKeyIO(); /** @@ -228,16 +228,16 @@ signals: * * @param io the IO device we belong to * @param stream the stream where we write our move into - * @param m The QKeyEvent we can evaluate + * @param m The TQKeyEvent we can evaluate * @param eatevent set this to true if we processed the event */ - void signalKeyEvent(KGameIO *io,QDataStream &stream,QKeyEvent *m,bool *eatevent); + void signalKeyEvent(KGameIO *io,TQDataStream &stream,TQKeyEvent *m,bool *eatevent); protected: /** * Internal method to process the events */ - bool eventFilter( QObject *o, QEvent *e ); + bool eventFilter( TQObject *o, TQEvent *e ); }; /** @@ -258,14 +258,14 @@ public: * \code * KGameMouseIO *input; * input=new KGameMouseIO(mView); - * connect(input,SIGNAL(signalMouseEvent(KGameIO *,QDataStream &,QMouseEvent *,bool *)), - * this,SLOT(slotMouseInput(KGameIO *,QDataStream &,QMouseEvent *,bool *))); + * connect(input,TQT_SIGNAL(signalMouseEvent(KGameIO *,TQDataStream &,TQMouseEvent *,bool *)), + * this,TQT_SLOT(slotMouseInput(KGameIO *,TQDataStream &,TQMouseEvent *,bool *))); * \endcode * * @param parent The widget whose events should be captured * @param trackmouse enables mouse tracking (gives mouse move events) */ - KGameMouseIO(QWidget *parent,bool trackmouse=false); + KGameMouseIO(TQWidget *parent,bool trackmouse=false); virtual ~KGameMouseIO(); /** @@ -298,16 +298,16 @@ signals: * * @param io the IO device we belong to * @param stream the stream where we write our move into - * @param m The QMouseEvent we can evaluate + * @param m The TQMouseEvent we can evaluate * @param eatevent set this to true if we processed the event */ - void signalMouseEvent(KGameIO *io,QDataStream &stream,QMouseEvent *m,bool *eatevent); + void signalMouseEvent(KGameIO *io,TQDataStream &stream,TQMouseEvent *m,bool *eatevent); protected: /** * Internal event filter */ - bool eventFilter( QObject *o, QEvent *e ); + bool eventFilter( TQObject *o, TQEvent *e ); }; @@ -332,15 +332,15 @@ public: * \code * KGameProcessIO *input; * input=new KGameProcessIO(executable_file); - * connect(input,SIGNAL(signalPrepareTurn(QDataStream &,bool,KGameIO *,bool *)), - * this,SLOT(slotPrepareTurn(QDataStream &,bool,KGameIO *,bool *))); - * connect(input,SIGNAL(signalProcessQuery(QDataStream &,KGameProcessIO *)), - * this,SLOT(slotProcessQuery(QDataStream &,KGameProcessIO *))); + * connect(input,TQT_SIGNAL(signalPrepareTurn(TQDataStream &,bool,KGameIO *,bool *)), + * this,TQT_SLOT(slotPrepareTurn(TQDataStream &,bool,KGameIO *,bool *))); + * connect(input,TQT_SIGNAL(signalProcessQuery(TQDataStream &,KGameProcessIO *)), + * this,TQT_SLOT(slotProcessQuery(TQDataStream &,KGameProcessIO *))); * \endcode * * @param name the filename of the process to start */ - KGameProcessIO(const QString& name); + KGameProcessIO(const TQString& name); /** * Deletes the process input devices @@ -364,7 +364,7 @@ public: * @param receiver - not used * @param sender - who send the message */ - void sendMessage(QDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender); + void sendMessage(TQDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender); /** * Send a system message to the process. This is analogous to the sendMessage @@ -376,7 +376,7 @@ public: * @param receiver - not used * @param sender - who send the message */ - void sendSystemMessage(QDataStream &stream, int msgid, Q_UINT32 receiver, Q_UINT32 sender); + void sendSystemMessage(TQDataStream &stream, int msgid, Q_UINT32 receiver, Q_UINT32 sender); /** * Init this device by setting the player and e.g. sending an @@ -403,13 +403,13 @@ public: /** * Internal ~ombined function for all message handling **/ - void sendAllMessages(QDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender, bool usermsg); + void sendAllMessages(TQDataStream &stream,int msgid, Q_UINT32 receiver, Q_UINT32 sender, bool usermsg); protected slots: /** * Internal message handler to receive data from the process */ - void receivedMessage(const QByteArray& receiveBuffer); + void receivedMessage(const TQByteArray& receiveBuffer); signals: @@ -423,20 +423,20 @@ signals: * * Example: * \code - * void GameWindow::slotProcessQuery(QDataStream &stream,KGameProcessIO *reply) + * void GameWindow::slotProcessQuery(TQDataStream &stream,KGameProcessIO *reply) * { * int no; * stream >> no; // We assume the process sends us an integer question numner * if (no==1) // but YOU have to do this in the process player * { - * QByteArray buffer; - * QDataStream out(buffer,IO_WriteOnly); + * TQByteArray buffer; + * TQDataStream out(buffer,IO_WriteOnly); * reply->sendSystemMessage(out,4242,0,0); // lets reply something... * } * } * \endcode */ - void signalProcessQuery(QDataStream &stream,KGameProcessIO *me); + void signalProcessQuery(TQDataStream &stream,KGameProcessIO *me); /** * Signal generated when the computer player is added. @@ -448,7 +448,7 @@ signals: * @param p the player itself * @param send set this to false if no move should be generated */ - void signalIOAdded(KGameIO *game,QDataStream &stream,KPlayer *p,bool *send); + void signalIOAdded(KGameIO *game,TQDataStream &stream,KPlayer *p,bool *send); protected: @@ -497,7 +497,7 @@ public: int reactionPeriod() const; /** - * Start a QTimer which calls advance every @p ms milli seconds. + * Start a TQTimer which calls advance every @p ms milli seconds. **/ void setAdvancePeriod(int ms); @@ -525,18 +525,18 @@ public: public slots: /** - * Works kind of similar to QCanvas::advance. Increase the internal + * Works kind of similar to TQCanvas::advance. Increase the internal * advance counter. If @p reactionPeriod is reached the counter is set back to * 0 and @ref signalReaction is emitted. This is when the player is meant * to do something (move its units or so). * - * This is very useful if you use QCanvas as you can use this in your - * QCanvas::advance call. The advantage is that if you change the speed - * of the game (i.e. change QCanvas::setAdvancePeriod) the computer + * This is very useful if you use TQCanvas as you can use this in your + * TQCanvas::advance call. The advantage is that if you change the speed + * of the game (i.e. change TQCanvas::setAdvancePeriod) the computer * player gets slower as well. * - * If you don't use QCanvas you can use setAdvancePeriod to get - * the same result. Alternatively you can just use a QTimer. + * If you don't use TQCanvas you can use setAdvancePeriod to get + * the same result. Alternatively you can just use a TQTimer. * **/ virtual void advance(); diff --git a/libkdegames/kgame/kgamemessage.cpp b/libkdegames/kgame/kgamemessage.cpp index 6464d407..228708e9 100644 --- a/libkdegames/kgame/kgamemessage.cpp +++ b/libkdegames/kgame/kgamemessage.cpp @@ -60,38 +60,38 @@ bool KGameMessage::isGame(Q_UINT32 msgid) } -void KGameMessage::createHeader(QDataStream &msg,Q_UINT32 sender,Q_UINT32 receiver,int msgid) +void KGameMessage::createHeader(TQDataStream &msg,Q_UINT32 sender,Q_UINT32 receiver,int msgid) { msg << (Q_INT16)sender << (Q_INT16)receiver << (Q_INT16)msgid; } -void KGameMessage::extractHeader(QDataStream &msg,Q_UINT32 &sender,Q_UINT32 &receiver,int &msgid) +void KGameMessage::extractHeader(TQDataStream &msg,Q_UINT32 &sender,Q_UINT32 &receiver,int &msgid) { Q_INT16 d3,d4,d5; msg >> d3 >> d4 >> d5; sender=d3;receiver=d4;msgid=d5; } -void KGameMessage::createPropertyHeader(QDataStream &msg,int id) +void KGameMessage::createPropertyHeader(TQDataStream &msg,int id) { msg << (Q_INT16)id; } -void KGameMessage::extractPropertyHeader(QDataStream &msg,int &id) +void KGameMessage::extractPropertyHeader(TQDataStream &msg,int &id) { Q_INT16 d1; msg >> d1; id=d1; } -void KGameMessage::createPropertyCommand(QDataStream &msg,int cmdid,int pid,int cmd) +void KGameMessage::createPropertyCommand(TQDataStream &msg,int cmdid,int pid,int cmd) { createPropertyHeader(msg,cmdid); msg << (Q_INT16)pid ; msg << (Q_INT8)cmd ; } -void KGameMessage::extractPropertyCommand(QDataStream &msg,int &pid,int &cmd) +void KGameMessage::extractPropertyCommand(TQDataStream &msg,int &pid,int &cmd) { Q_INT16 d1; Q_INT8 d2; @@ -105,7 +105,7 @@ int KGameMessage::version() return MESSAGE_VERSION; } -QString KGameMessage::messageId2Text(int msgid) +TQString KGameMessage::messageId2Text(int msgid) { // this should contain all KGameMessage::GameMessageIds // feel free to add missing ones, to remove obsolete one and even feel free to @@ -151,6 +151,6 @@ QString KGameMessage::messageId2Text(int msgid) return i18n("Player ID"); case KGameMessage::IdUser: // IdUser must be unknown for use, too! default: - return QString::null; + return TQString::null; } } diff --git a/libkdegames/kgame/kgamemessage.h b/libkdegames/kgame/kgamemessage.h index 4394b4fa..d671a948 100644 --- a/libkdegames/kgame/kgamemessage.h +++ b/libkdegames/kgame/kgamemessage.h @@ -23,7 +23,7 @@ #ifndef __KGAMEMSG_H_ #define __KGAMEMSG_H_ -#include <qdatastream.h> +#include <tqdatastream.h> #include <kdemacros.h> class KDE_EXPORT KGameMessage @@ -85,34 +85,34 @@ class KDE_EXPORT KGameMessage * (message length and magic cookie). If you don't need them remove them * with @ref dropExternalHeader */ - static void createHeader(QDataStream &msg, Q_UINT32 sender, Q_UINT32 receiver, int msgid); + static void createHeader(TQDataStream &msg, Q_UINT32 sender, Q_UINT32 receiver, int msgid); /** * Retrieves the information like cookie,sender,receiver,... from a message header * * Note that it could be necessary to call @ref dropExternalHeader first */ - static void extractHeader(QDataStream &msg,Q_UINT32 &sender, Q_UINT32 &receiver, int &msgid); + static void extractHeader(TQDataStream &msg,Q_UINT32 &sender, Q_UINT32 &receiver, int &msgid); /** * Creates a property header given the property id */ - static void createPropertyHeader(QDataStream &msg, int id); + static void createPropertyHeader(TQDataStream &msg, int id); /** * Retrieves the property id from a property message header */ - static void extractPropertyHeader(QDataStream &msg, int &id); + static void extractPropertyHeader(TQDataStream &msg, int &id); /** * Creates a property header given the property id */ - static void createPropertyCommand(QDataStream &msg, int cmdid, int pid, int cmd); + static void createPropertyCommand(TQDataStream &msg, int cmdid, int pid, int cmd); /** * Retrieves the property id from a property message header */ - static void extractPropertyCommand(QDataStream &msg, int &pid, int &cmd); + static void extractPropertyCommand(TQDataStream &msg, int &pid, int &cmd); /** * @return Version of the network library @@ -124,10 +124,10 @@ class KDE_EXPORT KGameMessage * suitable string for it. This string can't be used to identify a message * (as it is i18n'ed) but it can make debugging more easy. See also @ref * KGameDebugDialog. - * @return Either a i18n'ed string (the name of the id) or QString::null if + * @return Either a i18n'ed string (the name of the id) or TQString::null if * the msgid is unknown **/ - static QString messageId2Text(int msgid); + static TQString messageId2Text(int msgid); /** diff --git a/libkdegames/kgame/kgamenetwork.cpp b/libkdegames/kgame/kgamenetwork.cpp index 9eccb868..92669834 100644 --- a/libkdegames/kgame/kgamenetwork.cpp +++ b/libkdegames/kgame/kgamenetwork.cpp @@ -33,7 +33,7 @@ #include <kdebug.h> -#include <qbuffer.h> +#include <tqbuffer.h> class KGameNetworkPrivate @@ -52,14 +52,14 @@ public: KMessageServer* mMessageServer; Q_UINT32 mDisconnectId; // Stores gameId() over a disconnect process DNSSD::PublicService* mService; - QString mType; - QString mName; + TQString mType; + TQString mName; int mCookie; }; // ------------------- NETWORK GAME ------------------------ -KGameNetwork::KGameNetwork(int c, QObject* parent) : QObject(parent, 0) +KGameNetwork::KGameNetwork(int c, TQObject* parent) : TQObject(parent, 0) { d = new KGameNetworkPrivate; d->mCookie = (Q_INT16)c; @@ -120,25 +120,25 @@ void KGameNetwork::setMaster() } if (!d->mMessageClient) { d->mMessageClient = new KMessageClient (this); - connect (d->mMessageClient, SIGNAL(broadcastReceived(const QByteArray&, Q_UINT32)), - this, SLOT(receiveNetworkTransmission(const QByteArray&, Q_UINT32))); - connect (d->mMessageClient, SIGNAL(connectionBroken()), - this, SIGNAL(signalConnectionBroken())); - connect (d->mMessageClient, SIGNAL(aboutToDisconnect(Q_UINT32)), - this, SLOT(aboutToLoseConnection(Q_UINT32))); - connect (d->mMessageClient, SIGNAL(connectionBroken()), - this, SLOT(slotResetConnection())); - - connect (d->mMessageClient, SIGNAL(adminStatusChanged(bool)), - this, SLOT(slotAdminStatusChanged(bool))); - connect (d->mMessageClient, SIGNAL(eventClientConnected(Q_UINT32)), - this, SIGNAL(signalClientConnected(Q_UINT32))); - connect (d->mMessageClient, SIGNAL(eventClientDisconnected(Q_UINT32, bool)), - this, SIGNAL(signalClientDisconnected(Q_UINT32, bool))); + connect (d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, Q_UINT32)), + this, TQT_SLOT(receiveNetworkTransmission(const TQByteArray&, Q_UINT32))); + connect (d->mMessageClient, TQT_SIGNAL(connectionBroken()), + this, TQT_SIGNAL(signalConnectionBroken())); + connect (d->mMessageClient, TQT_SIGNAL(aboutToDisconnect(Q_UINT32)), + this, TQT_SLOT(aboutToLoseConnection(Q_UINT32))); + connect (d->mMessageClient, TQT_SIGNAL(connectionBroken()), + this, TQT_SLOT(slotResetConnection())); + + connect (d->mMessageClient, TQT_SIGNAL(adminStatusChanged(bool)), + this, TQT_SLOT(slotAdminStatusChanged(bool))); + connect (d->mMessageClient, TQT_SIGNAL(eventClientConnected(Q_UINT32)), + this, TQT_SIGNAL(signalClientConnected(Q_UINT32))); + connect (d->mMessageClient, TQT_SIGNAL(eventClientDisconnected(Q_UINT32, bool)), + this, TQT_SIGNAL(signalClientDisconnected(Q_UINT32, bool))); // broacast and direct messages are treated equally on receive. - connect (d->mMessageClient, SIGNAL(forwardReceived(const QByteArray&, Q_UINT32, const QValueList<Q_UINT32>&)), - d->mMessageClient, SIGNAL(broadcastReceived(const QByteArray&, Q_UINT32))); + connect (d->mMessageClient, TQT_SIGNAL(forwardReceived(const TQByteArray&, Q_UINT32, const TQValueList<Q_UINT32>&)), + d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, Q_UINT32))); } else { // should be no problem but still has to be tested @@ -147,7 +147,7 @@ void KGameNetwork::setMaster() d->mMessageClient->setServer(d->mMessageServer); } -void KGameNetwork::setDiscoveryInfo(const QString& type, const QString& name) +void KGameNetwork::setDiscoveryInfo(const TQString& type, const TQString& name) { kdDebug() << k_funcinfo << type << ":" << name << endl; d->mType = type; @@ -201,7 +201,7 @@ bool KGameNetwork::offerConnections(Q_UINT16 port) return true; } -bool KGameNetwork::connectToServer (const QString& host, Q_UINT16 port) +bool KGameNetwork::connectToServer (const TQString& host, Q_UINT16 port) { if (host.isEmpty()) { kdError(11001) << k_funcinfo << "No hostname given" << endl; @@ -251,7 +251,7 @@ Q_UINT16 KGameNetwork::port() const return 0; } -QString KGameNetwork::hostName() const +TQString KGameNetwork::hostName() const { return d->mMessageClient->peerName(); } @@ -276,8 +276,8 @@ void KGameNetwork::disconnect() kdDebug(11001) << k_funcinfo << endl; stopServerConnection(); if (d->mMessageServer) { - QValueList <Q_UINT32> list=d->mMessageServer->clientIDs(); - QValueList<Q_UINT32>::Iterator it; + TQValueList <Q_UINT32> list=d->mMessageServer->clientIDs(); + TQValueList<Q_UINT32>::Iterator it; for( it = list.begin(); it != list.end(); ++it ) { kdDebug(11001) << "Client id=" << (*it) << endl; @@ -338,8 +338,8 @@ void KGameNetwork::electAdmin(Q_UINT32 clientID) kdWarning(11001) << k_funcinfo << "only ADMIN is allowed to call this!" << endl; return; } - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); stream << static_cast<Q_UINT32>( KMessageServer::REQ_ADMIN_CHANGE ); stream << clientID; d->mMessageClient->sendServerMessage(buffer); @@ -351,8 +351,8 @@ void KGameNetwork::setMaxClients(int max) kdWarning(11001) << k_funcinfo << "only ADMIN is allowed to call this!" << endl; return; } - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); stream << static_cast<Q_UINT32>( KMessageServer::REQ_MAX_NUM_CLIENTS ); stream << (Q_INT32)max; d->mMessageClient->sendServerMessage(buffer); @@ -376,27 +376,27 @@ void KGameNetwork::unlock() bool KGameNetwork::sendSystemMessage(int data, int msgid, Q_UINT32 receiver, Q_UINT32 sender) { - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); stream << data; return sendSystemMessage(buffer,msgid,receiver,sender); } -bool KGameNetwork::sendSystemMessage(const QString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) +bool KGameNetwork::sendSystemMessage(const TQString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) { - QByteArray buffer; - QDataStream stream(buffer, IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer, IO_WriteOnly); stream << msg; return sendSystemMessage(buffer, msgid, receiver, sender); } -bool KGameNetwork::sendSystemMessage(const QDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) -{ return sendSystemMessage(((QBuffer*)msg.device())->buffer(), msgid, receiver, sender); } +bool KGameNetwork::sendSystemMessage(const TQDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) +{ return sendSystemMessage(((TQBuffer*)msg.device())->buffer(), msgid, receiver, sender); } -bool KGameNetwork::sendSystemMessage(const QByteArray& data, int msgid, Q_UINT32 receiver, Q_UINT32 sender) +bool KGameNetwork::sendSystemMessage(const TQByteArray& data, int msgid, Q_UINT32 receiver, Q_UINT32 sender) { - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); if (!sender) { sender = gameId(); } @@ -438,19 +438,19 @@ bool KGameNetwork::sendSystemMessage(const QByteArray& data, int msgid, Q_UINT32 bool KGameNetwork::sendMessage(int data, int msgid, Q_UINT32 receiver, Q_UINT32 sender) { return sendSystemMessage(data,msgid+KGameMessage::IdUser,receiver,sender); } -bool KGameNetwork::sendMessage(const QString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) +bool KGameNetwork::sendMessage(const TQString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) { return sendSystemMessage(msg,msgid+KGameMessage::IdUser,receiver,sender); } -bool KGameNetwork::sendMessage(const QDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) +bool KGameNetwork::sendMessage(const TQDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) { return sendSystemMessage(msg, msgid+KGameMessage::IdUser, receiver, sender); } -bool KGameNetwork::sendMessage(const QByteArray &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) +bool KGameNetwork::sendMessage(const TQByteArray &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender) { return sendSystemMessage(msg, msgid+KGameMessage::IdUser, receiver, sender); } -void KGameNetwork::sendError(int error,const QByteArray& message, Q_UINT32 receiver, Q_UINT32 sender) +void KGameNetwork::sendError(int error,const TQByteArray& message, Q_UINT32 receiver, Q_UINT32 sender) { - QByteArray buffer; - QDataStream stream(buffer,IO_WriteOnly); + TQByteArray buffer; + TQDataStream stream(buffer,IO_WriteOnly); stream << (Q_INT32) error; stream.writeRawBytes(message.data(), message.size()); sendSystemMessage(stream,KGameMessage::IdError,receiver,sender); @@ -458,9 +458,9 @@ void KGameNetwork::sendError(int error,const QByteArray& message, Q_UINT32 recei // ----------------- receive messages from the network -void KGameNetwork::receiveNetworkTransmission(const QByteArray& receiveBuffer, Q_UINT32 clientID) +void KGameNetwork::receiveNetworkTransmission(const TQByteArray& receiveBuffer, Q_UINT32 clientID) { - QDataStream stream(receiveBuffer, IO_ReadOnly); + TQDataStream stream(receiveBuffer, IO_ReadOnly); int msgid; Q_UINT32 sender; // the id of the KGame/KPlayer who sent the message Q_UINT32 receiver; // the id of the KGame/KPlayer the message is for @@ -480,7 +480,7 @@ void KGameNetwork::receiveNetworkTransmission(const QByteArray& receiveBuffer, Q } else if (msgid==KGameMessage::IdError) { - QString text; + TQString text; Q_INT32 error; stream >> error; kdDebug(11001) << k_funcinfo << "Got IdError " << error << endl; diff --git a/libkdegames/kgame/kgamenetwork.h b/libkdegames/kgame/kgamenetwork.h index 6ff5cf94..47276d06 100644 --- a/libkdegames/kgame/kgamenetwork.h +++ b/libkdegames/kgame/kgamenetwork.h @@ -23,8 +23,8 @@ #ifndef __KGAMENETWORK_H_ #define __KGAMENETWORK_H_ -#include <qstring.h> -#include <qobject.h> +#include <tqstring.h> +#include <tqobject.h> #include <kdemacros.h> class KGameIO; class KMessageClient; @@ -51,7 +51,7 @@ public: /** * Create a KGameNetwork object */ - KGameNetwork(int cookie=42,QObject* parent=0); + KGameNetwork(int cookie=42,TQObject* parent=0); virtual ~KGameNetwork(); /** @@ -120,7 +120,7 @@ public: * set hostname will be used. In case of name conflict -2, -3 and so on will be added to name. * @since 3.4 **/ - void setDiscoveryInfo(const QString& type, const QString& name=QString::null); + void setDiscoveryInfo(const TQString& type, const TQString& name=TQString::null); /** * Inits a network game as a network CLIENT @@ -130,7 +130,7 @@ public: * * @return true if connected **/ - bool connectToServer(const QString& host, Q_UINT16 port); + bool connectToServer(const TQString& host, Q_UINT16 port); /** * @since 3.2 @@ -146,7 +146,7 @@ public: * isNetwork is TRUE and we are not the MASTER, i.e. if connectToServer * was called. Otherwise this will return "localhost". **/ - QString hostName() const; + TQString hostName() const; /** * Stops offering server connections - only for game MASTER @@ -189,7 +189,7 @@ public: * @return true if worked */ // AB: TODO: doc on how "receiver" and "sender" should be created! - bool sendSystemMessage(const QByteArray& buffer, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); + bool sendSystemMessage(const TQByteArray& buffer, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); /** * @overload @@ -199,12 +199,12 @@ public: /** * @overload **/ - bool sendSystemMessage(const QDataStream &msg, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); + bool sendSystemMessage(const TQDataStream &msg, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); /** * @overload **/ - bool sendSystemMessage(const QString& msg, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); + bool sendSystemMessage(const TQString& msg, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); /** * Sends a network message @@ -217,7 +217,7 @@ public: * the correct value for you. You might want to use this if you send a * message from a specific player. **/ - void sendError(int error, const QByteArray& message, Q_UINT32 receiver=0, Q_UINT32 sender=0); + void sendError(int error, const TQByteArray& message, Q_UINT32 receiver=0, Q_UINT32 sender=0); /** * Are we still offer offering server connections - only for game MASTER @@ -265,17 +265,17 @@ public: * @return true if worked **/ // AB: TODO: doc on how "receiver" and "sender" should be created! - bool sendMessage(const QByteArray& buffer, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); + bool sendMessage(const TQByteArray& buffer, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); /** * This is an overloaded member function, provided for convenience. **/ - bool sendMessage(const QDataStream &msg, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); + bool sendMessage(const TQDataStream &msg, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); /** * This is an overloaded member function, provided for convenience. **/ - bool sendMessage(const QString& msg, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); + bool sendMessage(const TQString& msg, int msgid, Q_UINT32 receiver=0, Q_UINT32 sender=0); /** * This is an overloaded member function, provided for convenience. @@ -287,7 +287,7 @@ public: * Called by ReceiveNetworkTransmission(). Will be overwritten by * KGame and handle the incoming message. **/ - virtual void networkTransmission(QDataStream&, int, Q_UINT32, Q_UINT32, Q_UINT32 clientID) = 0; + virtual void networkTransmission(TQDataStream&, int, Q_UINT32, Q_UINT32, Q_UINT32 clientID) = 0; /** @@ -345,7 +345,7 @@ signals: * @param error the error code * @param text the error text */ - void signalNetworkErrorMessage(int error, QString text); + void signalNetworkErrorMessage(int error, TQString text); /** * Our connection to the KMessageServer has broken. @@ -401,7 +401,7 @@ protected slots: * If it is valid, the pure virtual method networkTransmission() is called. * (This one is overwritten in KGame.) **/ - void receiveNetworkTransmission(const QByteArray& a, Q_UINT32 clientID); + void receiveNetworkTransmission(const TQByteArray& a, Q_UINT32 clientID); /** * This KGame object receives or loses the admin status. diff --git a/libkdegames/kgame/kgameprocess.cpp b/libkdegames/kgame/kgameprocess.cpp index 96efe0ce..ffbf0936 100644 --- a/libkdegames/kgame/kgameprocess.cpp +++ b/libkdegames/kgame/kgameprocess.cpp @@ -29,9 +29,9 @@ #include <krandomsequence.h> -#include <qbuffer.h> -#include <qdatastream.h> -#include <qcstring.h> +#include <tqbuffer.h> +#include <tqdatastream.h> +#include <tqcstring.h> #include <assert.h> #include <stdio.h> @@ -43,7 +43,7 @@ // ----------------------- Process Child --------------------------- -KGameProcess::KGameProcess() : QObject(0,0) +KGameProcess::KGameProcess() : TQObject(0,0) { mTerminate=false; // Check whether a player is set. If not create one! @@ -52,10 +52,10 @@ KGameProcess::KGameProcess() : QObject(0,0) mMessageIO=new KMessageFilePipe(this,&rFile,&wFile); // mMessageClient=new KMessageClient(this); // mMessageClient->setServer(mMessageIO); -// connect (mMessageClient, SIGNAL(broadcastReceived(const QByteArray&, Q_UINT32)), -// this, SLOT(receivedMessage(const QByteArray&, Q_UINT32))); - connect (mMessageIO, SIGNAL(received(const QByteArray&)), - this, SLOT(receivedMessage(const QByteArray&))); +// connect (mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, Q_UINT32)), +// this, TQT_SLOT(receivedMessage(const TQByteArray&, Q_UINT32))); + connect (mMessageIO, TQT_SIGNAL(received(const TQByteArray&)), + this, TQT_SLOT(receivedMessage(const TQByteArray&))); fprintf(stderr,"KGameProcess::constructor %p %p\n",&rFile,&wFile); mRandom = new KRandomSequence; @@ -85,17 +85,17 @@ bool KGameProcess::exec(int argc, char *argv[]) } // You have to do this to create a message -// QByteArray buffer; -// QDataStream wstream(buffer,IO_WriteOnly); +// TQByteArray buffer; +// TQDataStream wstream(buffer,IO_WriteOnly); // then stream data into the stream and call this function -void KGameProcess::sendSystemMessage(QDataStream &stream,int msgid,Q_UINT32 receiver) +void KGameProcess::sendSystemMessage(TQDataStream &stream,int msgid,Q_UINT32 receiver) { fprintf(stderr,"KGameProcess::sendMessage id=%d recv=%d",msgid,receiver); - QByteArray a; - QDataStream outstream(a,IO_WriteOnly); + TQByteArray a; + TQDataStream outstream(a,IO_WriteOnly); - QBuffer *device=(QBuffer *)stream.device(); - QByteArray data=device->buffer();; + TQBuffer *device=(TQBuffer *)stream.device(); + TQByteArray data=device->buffer();; KGameMessage::createHeader(outstream,0,receiver,msgid); outstream.writeRawBytes(data.data(),data.size()); @@ -107,7 +107,7 @@ void KGameProcess::sendSystemMessage(QDataStream &stream,int msgid,Q_UINT32 rece if (mMessageIO) mMessageIO->send(a); } -void KGameProcess::sendMessage(QDataStream &stream,int msgid,Q_UINT32 receiver) +void KGameProcess::sendMessage(TQDataStream &stream,int msgid,Q_UINT32 receiver) { sendSystemMessage(stream,msgid+KGameMessage::IdUser,receiver); } @@ -129,9 +129,9 @@ void KGameProcess::processArgs(int argc, char *argv[]) fflush(stderr); } -void KGameProcess::receivedMessage(const QByteArray& receiveBuffer) +void KGameProcess::receivedMessage(const TQByteArray& receiveBuffer) { - QDataStream stream(receiveBuffer, IO_ReadOnly); + TQDataStream stream(receiveBuffer, IO_ReadOnly); int msgid; Q_UINT32 sender; Q_UINT32 receiver; diff --git a/libkdegames/kgame/kgameprocess.h b/libkdegames/kgame/kgameprocess.h index a8db4fcd..ac6389be 100644 --- a/libkdegames/kgame/kgameprocess.h +++ b/libkdegames/kgame/kgameprocess.h @@ -23,9 +23,9 @@ #ifndef __KGAMEPROCESS_H_ #define __KGAMEPROCESS_H_ -#include <qstring.h> -#include <qobject.h> -#include <qfile.h> +#include <tqstring.h> +#include <tqobject.h> +#include <tqfile.h> #include "kgameproperty.h" #include <krandomsequence.h> @@ -60,12 +60,12 @@ class KDE_EXPORT KGameProcess: public QObject * int main(int argc ,char * argv[]) * { * KGameProcess proc; - * connect(&proc,SIGNAL(signalCommand(QDataStream &,int ,int ,int )), - * this,SLOT(slotCommand(QDataStream & ,int ,int ,int ))); - * connect(&proc,SIGNAL(signalInit(QDataStream &,int)), - * this,SLOT(slotInit(QDataStream & ,int ))); - * connect(&proc,SIGNAL(signalTurn(QDataStream &,bool )), - * this,SLOT(slotTurn(QDataStream & ,bool ))); + * connect(&proc,TQT_SIGNAL(signalCommand(TQDataStream &,int ,int ,int )), + * this,TQT_SLOT(slotCommand(TQDataStream & ,int ,int ,int ))); + * connect(&proc,TQT_SIGNAL(signalInit(TQDataStream &,int)), + * this,TQT_SLOT(slotInit(TQDataStream & ,int ))); + * connect(&proc,TQT_SIGNAL(signalTurn(TQDataStream &,bool )), + * this,TQT_SLOT(slotTurn(TQDataStream & ,bool ))); * return proc.exec(argc,argv); * } * \endcode @@ -103,11 +103,11 @@ class KDE_EXPORT KGameProcess: public QObject * device. Works like the sendSystemMessage but * for user id's * - * @param stream the QDataStream containing the message + * @param stream the TQDataStream containing the message * @param msgid the message id for the message * @param receiver unused */ - void sendMessage(QDataStream &stream,int msgid,Q_UINT32 receiver=0); + void sendMessage(TQDataStream &stream,int msgid,Q_UINT32 receiver=0); /** * Sends a system message to the corresonding KGameIO device. @@ -117,18 +117,18 @@ class KDE_EXPORT KGameProcess: public QObject * game relevant data from here. * Exmaple for a query: * \code - * QByteArray buffer; - * QDataStream out(buffer,IO_WriteOnly); + * TQByteArray buffer; + * TQDataStream out(buffer,IO_WriteOnly); * int msgid=KGameMessage::IdProcessQuery; * out << (int)1; * proc.sendSystemMessage(out,msgid,0); * \endcode * - * @param stream the QDataStream containing the message + * @param stream the TQDataStream containing the message * @param msgid the message id for the message * @param receiver unused */ - void sendSystemMessage(QDataStream &stream,int msgid,Q_UINT32 receiver=0); + void sendSystemMessage(TQDataStream &stream,int msgid,Q_UINT32 receiver=0); /** * Returns a pointer to a KRandomSequence. You can generate @@ -153,7 +153,7 @@ class KDE_EXPORT KGameProcess: public QObject * A message is received via the interprocess connection. The * appropriate signals are called. */ - void receivedMessage(const QByteArray& receiveBuffer); + void receivedMessage(const TQByteArray& receiveBuffer); signals: /** @@ -162,7 +162,7 @@ class KDE_EXPORT KGameProcess: public QObject * All signals but IdIOAdded and IdTurn end up here! * Example: * \code - * void Computer::slotCommand(int &msgid,QDataStream &in,QDataStream &out) + * void Computer::slotCommand(int &msgid,TQDataStream &in,TQDataStream &out) * { * Q_INT32 data,move; * in >> data; @@ -177,7 +177,7 @@ class KDE_EXPORT KGameProcess: public QObject * @param receiver the id of the receiver * @param sender the id of the sender */ - void signalCommand(QDataStream &inputStream,int msgid,int receiver,int sender); + void signalCommand(TQDataStream &inputStream,int msgid,int receiver,int sender); /** * This signal is emmited if the computer player should perform a turn. @@ -190,12 +190,12 @@ class KDE_EXPORT KGameProcess: public QObject * stream here. * Example: * \code - * void slotTurn(QDataStream &in,bool turn) + * void slotTurn(TQDataStream &in,bool turn) * { * int id; * int recv; - * QByteArray buffer; - * QDataStream out(buffer,IO_WriteOnly); + * TQByteArray buffer; + * TQDataStream out(buffer,IO_WriteOnly); * if (turn) * { * // Create a move - the format is yours to decide @@ -216,7 +216,7 @@ class KDE_EXPORT KGameProcess: public QObject * @param turn True or false whether the turn is activated or deactivated * */ - void signalTurn(QDataStream &stream,bool turn); + void signalTurn(TQDataStream &stream,bool turn); /** * This signal is emmited when the process is initialized, i.e. added @@ -229,14 +229,14 @@ class KDE_EXPORT KGameProcess: public QObject * @param stream The datastream which contains user data * @param userid The userId of the player. (Careful to rely on it yet) */ - void signalInit(QDataStream &stream,int userid); + void signalInit(TQDataStream &stream,int userid); protected: bool mTerminate; KMessageFilePipe *mMessageIO; private: - QFile rFile; - QFile wFile; + TQFile rFile; + TQFile wFile; KRandomSequence* mRandom; }; #endif diff --git a/libkdegames/kgame/kgameproperty.cpp b/libkdegames/kgame/kgameproperty.cpp index 68a33bcb..3b8c3109 100644 --- a/libkdegames/kgame/kgameproperty.cpp +++ b/libkdegames/kgame/kgameproperty.cpp @@ -76,19 +76,19 @@ void KGamePropertyBase::init() setPolicy(PolicyLocal); } -int KGamePropertyBase::registerData(int id, KGame* owner, QString name) +int KGamePropertyBase::registerData(int id, KGame* owner, TQString name) { return registerData(id, owner->dataHandler(), name); } -int KGamePropertyBase::registerData(int id, KPlayer* owner, QString name) +int KGamePropertyBase::registerData(int id, KPlayer* owner, TQString name) { return registerData(id, owner->dataHandler(), name); } -int KGamePropertyBase::registerData( KGamePropertyHandler* owner,PropertyPolicy p, QString name) +int KGamePropertyBase::registerData( KGamePropertyHandler* owner,PropertyPolicy p, TQString name) { return registerData(-1, owner,p, name); } -int KGamePropertyBase::registerData(int id, KGamePropertyHandler* owner, QString name) +int KGamePropertyBase::registerData(int id, KGamePropertyHandler* owner, TQString name) { return registerData(id, owner,PolicyUndefined, name); } -int KGamePropertyBase::registerData(int id, KGamePropertyHandler* owner,PropertyPolicy p, QString name) +int KGamePropertyBase::registerData(int id, KGamePropertyHandler* owner,PropertyPolicy p, TQString name) { // we don't support changing the id if (!owner) { @@ -123,8 +123,8 @@ void KGamePropertyBase::unregisterData() bool KGamePropertyBase::sendProperty() { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyHeader(s, id()); save(s); if (mOwner) { @@ -135,10 +135,10 @@ bool KGamePropertyBase::sendProperty() } } -bool KGamePropertyBase::sendProperty(const QByteArray& data) +bool KGamePropertyBase::sendProperty(const TQByteArray& data) { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyHeader(s, id()); s.writeRawBytes(data.data(), data.size()); if (mOwner) { @@ -169,8 +169,8 @@ bool KGamePropertyBase::unlock(bool force) void KGamePropertyBase::setLock(bool l) { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyCommand(s, IdCommand, id(), CmdLock); s << (Q_INT8)l; @@ -192,7 +192,7 @@ void KGamePropertyBase::emitSignal() } } -void KGamePropertyBase::command(QDataStream& s, int cmd, bool isSender) +void KGamePropertyBase::command(TQDataStream& s, int cmd, bool isSender) { switch (cmd) { case CmdLock: diff --git a/libkdegames/kgame/kgameproperty.h b/libkdegames/kgame/kgameproperty.h index c6915606..04474603 100644 --- a/libkdegames/kgame/kgameproperty.h +++ b/libkdegames/kgame/kgameproperty.h @@ -21,7 +21,7 @@ #ifndef __KGAMEPROPERTY_H_ #define __KGAMEPROPERTY_H_ -#include <qdatastream.h> +#include <tqdatastream.h> #include <kdebug.h> #include <typeinfo> @@ -151,7 +151,7 @@ public: /** * Sets this property to emit a signal on value changed. - * As the proerties do not inehrit QObject for optimisation + * As the proerties do not inehrit TQObject for optimisation * this signal is emited via the KPlayer or KGame object **/ void setEmittingSignal(bool p) { mFlags.bits.emitsignal=p; } @@ -217,12 +217,12 @@ public: * overwrite this method in order to use this class * @param s The stream to read from **/ - virtual void load(QDataStream& s) = 0; + virtual void load(TQDataStream& s) = 0; /** * Write the value into a stream. MUST be overwritten **/ - virtual void save(QDataStream& s) = 0; + virtual void save(TQDataStream& s) = 0; /** * send a command to advanced properties like arrays @@ -230,7 +230,7 @@ public: * @param msgid The ID of the command - see PropertyCommandIds * @param isSender whether this client is also the sender of the command **/ - virtual void command(QDataStream &stream, int msgid, bool isSender=false); + virtual void command(TQDataStream &stream, int msgid, bool isSender=false); /** * @return The id of this property @@ -261,25 +261,25 @@ public: * @param name if not 0 you can assign a name to this property * **/ - int registerData(int id, KGamePropertyHandler* owner,PropertyPolicy p, QString name=0); + int registerData(int id, KGamePropertyHandler* owner,PropertyPolicy p, TQString name=0); /** * This is an overloaded member function, provided for convenience. * It differs from the above function only in what argument(s) it accepts. **/ - int registerData(int id, KGamePropertyHandler* owner, QString name=0); + int registerData(int id, KGamePropertyHandler* owner, TQString name=0); /** * This is an overloaded member function, provided for convenience. * It differs from the above function only in what argument(s) it accepts. **/ - int registerData(int id, KGame* owner, QString name=0); + int registerData(int id, KGame* owner, TQString name=0); /** * This is an overloaded member function, provided for convenience. * It differs from the above function only in what argument(s) it accepts. **/ - int registerData(int id, KPlayer* owner, QString name=0); + int registerData(int id, KPlayer* owner, TQString name=0); /** * This is an overloaded member function, provided for convenience. @@ -287,7 +287,7 @@ public: * In particular you can use this function to create properties which * will have an automatic id assigned. The new id is returned. **/ - int registerData(KGamePropertyHandler* owner,PropertyPolicy p=PolicyUndefined, QString name=0); + int registerData(KGamePropertyHandler* owner,PropertyPolicy p=PolicyUndefined, TQString name=0); void unregisterData(); @@ -341,7 +341,7 @@ protected: * @return TRUE if the message could be sent successfully, otherwise * FALSE **/ - bool sendProperty(const QByteArray& b); + bool sendProperty(const TQByteArray& b); /** * Causes the parent object to emit a signal on value change @@ -420,7 +420,7 @@ private: * queues the message. As soon as <em>all</em> messages in the message server * which are before the changed property have been transferred the message * server delivers the new value of the KGameProperty to all clients. A - * QTimer::singleShot is used to queue the messages inside the + * TQTimer::singleShot is used to queue the messages inside the * KMessageServer. * * This means that if you do the following: @@ -433,7 +433,7 @@ private: * then "value" will be "0". initData is used to initialize the property * (e.g. when the KMessageServer is not yet running or can not yet be * reached). This is because "myProperty = 10" or "myProperty.send(10)" send a - * message to the KMessageServer which uses QTimer::singleShot to + * message to the KMessageServer which uses TQTimer::singleShot to * queue the message. The game first has to go back into the event loop where * the message is received. The KGamePropertyHandler receives the new value * sets the property. So if you need the new value you need to store it in a @@ -536,7 +536,7 @@ private: * @section Custom classes: * * If you want to use a custum class with KGameProperty you have to implement the - * operators << and >> for QDataStream: + * operators << and >> for TQDataStream: * \code * class Card * { @@ -544,7 +544,7 @@ private: * int type; * int suite; * }; - * QDataStream& operator<<(QDataStream& stream, Card& card) + * TQDataStream& operator<<(TQDataStream& stream, Card& card) * { * Q_INT16 type = card.type; * Q_INT16 suite = card.suite; @@ -552,7 +552,7 @@ private: * s << suite; * return s; * } - * QDataStream& operator>>(QDataStream& stream, Card& card) + * TQDataStream& operator>>(TQDataStream& stream, Card& card) * { * Q_INT16 type; * Q_INT16 suite; @@ -635,7 +635,7 @@ public: * This function sends a new value over network. * * Note that the value DOES NOT change when you call this function. This - * function saves the value into a QDataStream and calls + * function saves the value into a TQDataStream and calls * sendProperty where it gets forwarded to the owner and finally the * value is sent over network. The KMessageServer now sends the * value to ALL clients - even the one who called this function. As soon @@ -675,8 +675,8 @@ public: if (isLocked()) { return false; } - QByteArray b; - QDataStream stream(b, IO_WriteOnly); + TQByteArray b; + TQDataStream stream(b, IO_WriteOnly); stream << v; if (!sendProperty(b)) { setLocal(v); @@ -751,7 +751,7 @@ public: * Saves the object to a stream. * @param stream The stream to save to **/ - virtual void save(QDataStream &stream) + virtual void save(TQDataStream &stream) { stream << mData; } @@ -777,7 +777,7 @@ public: * Also calls emitSignal if isEmittingSignal is TRUE. * @param s The stream to read from **/ - virtual void load(QDataStream& s) + virtual void load(TQDataStream& s) { s >> mData; setDirty(false); @@ -842,7 +842,7 @@ private: typedef KGameProperty<int> KGamePropertyInt; typedef KGameProperty<unsigned int> KGamePropertyUInt; -typedef KGameProperty<QString> KGamePropertyQString; +typedef KGameProperty<TQString> KGamePropertyQString; typedef KGameProperty<Q_INT8> KGamePropertyBool; #endif diff --git a/libkdegames/kgame/kgamepropertyarray.h b/libkdegames/kgame/kgamepropertyarray.h index f91bd75c..0bb1d1a1 100644 --- a/libkdegames/kgame/kgamepropertyarray.h +++ b/libkdegames/kgame/kgamepropertyarray.h @@ -21,7 +21,7 @@ #ifndef __KGAMEPROPERTYARRAY_H_ #define __KGAMEPROPERTYARRAY_H_ -#include <qdatastream.h> +#include <tqdatastream.h> #include <kdebug.h> #include "kgamemessage.h" @@ -30,10 +30,10 @@ template<class type> -class KGamePropertyArray : public QMemArray<type>, public KGamePropertyBase +class KGamePropertyArray : public TQMemArray<type>, public KGamePropertyBase { public: - KGamePropertyArray() :QMemArray<type>(), KGamePropertyBase() + KGamePropertyArray() :TQMemArray<type>(), KGamePropertyBase() { //kdDebug(11001) << "KGamePropertyArray init" << endl; } @@ -43,17 +43,17 @@ public: resize(size); } - KGamePropertyArray( const KGamePropertyArray<type> &a ) : QMemArray<type>(a) + KGamePropertyArray( const KGamePropertyArray<type> &a ) : TQMemArray<type>(a) { } bool resize( uint size ) { - if (size!=QMemArray<type>::size()) + if (size!=TQMemArray<type>::size()) { bool a=true; - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyCommand(s,KGamePropertyBase::IdCommand,id(),CmdResize); s << size ; if (policy()==PolicyClean || policy()==PolicyDirty) @@ -66,7 +66,7 @@ public: if (policy()==PolicyLocal || policy()==PolicyDirty) { extractProperty(b); -// a=QMemArray<type>::resize(size);// FIXME: return value! +// a=TQMemArray<type>::resize(size);// FIXME: return value! } return a; } @@ -75,8 +75,8 @@ public: void setAt(uint i,type data) { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyCommand(s,KGamePropertyBase::IdCommand,id(),CmdAt); s << i ; s << data; @@ -96,12 +96,12 @@ public: type at( uint i ) const { - return QMemArray<type>::at(i); + return TQMemArray<type>::at(i); } type operator[]( int i ) const { - return QMemArray<type>::at(i); + return TQMemArray<type>::at(i); } KGamePropertyArray<type> &operator=(const KGamePropertyArray<type> &a) @@ -117,8 +117,8 @@ public: bool fill( const type &data, int size = -1 ) { bool r=true; - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyCommand(s,KGamePropertyBase::IdCommand,id(),CmdFill); s << data; s << size ; @@ -132,7 +132,7 @@ public: if (policy()==PolicyLocal || policy()==PolicyDirty) { extractProperty(b); -// r=QMemArray<type>::fill(data,size);//FIXME: return value! +// r=TQMemArray<type>::fill(data,size);//FIXME: return value! } return r; } @@ -146,7 +146,7 @@ public: } if (policy()==PolicyLocal || policy()==PolicyDirty) { - QMemArray<type>::assign(a); + TQMemArray<type>::assign(a); } return *this; } @@ -158,7 +158,7 @@ public: } if (policy()==PolicyLocal || policy()==PolicyDirty) { - QMemArray<type>::assign(a,n); + TQMemArray<type>::assign(a,n); } return *this; } @@ -170,7 +170,7 @@ public: } if (policy()==PolicyLocal || policy()==PolicyDirty) { - QMemArray<type>::duplicate(a); + TQMemArray<type>::duplicate(a); } return *this; } @@ -182,7 +182,7 @@ public: } if (policy()==PolicyLocal || policy()==PolicyDirty) { - QMemArray<type>::duplicate(a,n); + TQMemArray<type>::duplicate(a,n); } return *this; } @@ -194,14 +194,14 @@ public: } if (policy()==PolicyLocal || policy()==PolicyDirty) { - QMemArray<type>::setRawData(a,n); + TQMemArray<type>::setRawData(a,n); } return *this; } void sort() { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyCommand(s,KGamePropertyBase::IdCommand,id(),CmdSort); if (policy()==PolicyLocal || policy()==PolicyDirty) { @@ -216,30 +216,30 @@ public: } } - void load(QDataStream& s) + void load(TQDataStream& s) { //kdDebug(11001) << "KGamePropertyArray load " << id() << endl; type data; - for (unsigned int i=0; i<QMemArray<type>::size(); i++) + for (unsigned int i=0; i<TQMemArray<type>::size(); i++) { s >> data; - QMemArray<type>::at(i)=data; + TQMemArray<type>::at(i)=data; } if (isEmittingSignal()) { emitSignal(); } } - void save(QDataStream &s) + void save(TQDataStream &s) { //kdDebug(11001) << "KGamePropertyArray save "<<id() << endl; - for (unsigned int i=0; i<QMemArray<type>::size(); i++) + for (unsigned int i=0; i<TQMemArray<type>::size(); i++) { s << at(i); } } - void command(QDataStream &s,int cmd,bool) + void command(TQDataStream &s,int cmd,bool) { KGamePropertyBase::command(s, cmd); //kdDebug(11001) << "Array id="<<id()<<" got command ("<<cmd<<") !!!" <<endl; @@ -250,7 +250,7 @@ public: uint i; type data; s >> i >> data; - QMemArray<type>::at(i)=data; + TQMemArray<type>::at(i)=data; //kdDebug(11001) << "CmdAt:id="<<id()<<" i="<<i<<" data="<<data <<endl; if (isEmittingSignal()) { @@ -262,10 +262,10 @@ public: { uint size; s >> size; - //kdDebug(11001) << "CmdResize:id="<<id()<<" oldsize="<<QMemArray<type>::size()<<" newsize="<<size <<endl; - if (QMemArray<type>::size() != size) + //kdDebug(11001) << "CmdResize:id="<<id()<<" oldsize="<<TQMemArray<type>::size()<<" newsize="<<size <<endl; + if (TQMemArray<type>::size() != size) { - QMemArray<type>::resize(size); + TQMemArray<type>::resize(size); } break; } @@ -275,7 +275,7 @@ public: type data; s >> data >> size; //kdDebug(11001) << "CmdFill:id="<<id()<<"size="<<size <<endl; - QMemArray<type>::fill(data,size); + TQMemArray<type>::fill(data,size); if (isEmittingSignal()) { emitSignal(); @@ -285,7 +285,7 @@ public: case CmdSort: { //kdDebug(11001) << "CmdSort:id="<<id()<<endl; - QMemArray<type>::sort(); + TQMemArray<type>::sort(); break; } default: @@ -294,9 +294,9 @@ public: } } protected: - void extractProperty(const QByteArray& b) + void extractProperty(const TQByteArray& b) { - QDataStream s(b, IO_ReadOnly); + TQDataStream s(b, IO_ReadOnly); int cmd; int propId; KGameMessage::extractPropertyHeader(s, propId); diff --git a/libkdegames/kgame/kgamepropertyhandler.cpp b/libkdegames/kgame/kgamepropertyhandler.cpp index 75b3e7e2..f395fc66 100644 --- a/libkdegames/kgame/kgamepropertyhandler.cpp +++ b/libkdegames/kgame/kgamepropertyhandler.cpp @@ -25,8 +25,8 @@ #include "kgameproperty.h" #include "kgamemessage.h" -#include <qmap.h> -#include <qptrqueue.h> +#include <tqmap.h> +#include <tqptrqueue.h> #include <klocale.h> #include <typeinfo> @@ -41,23 +41,23 @@ public: { } - QMap<int, QString> mNameMap; - QIntDict<KGamePropertyBase> mIdDict; + TQMap<int, TQString> mNameMap; + TQIntDict<KGamePropertyBase> mIdDict; int mUniqueId; int mId; KGamePropertyBase::PropertyPolicy mDefaultPolicy; bool mDefaultUserspace; int mIndirectEmit; - QPtrQueue<KGamePropertyBase> mSignalQueue; + TQPtrQueue<KGamePropertyBase> mSignalQueue; }; -KGamePropertyHandler::KGamePropertyHandler(int id, const QObject* receiver, const char * sendf, const char *emitf, QObject* parent) : QObject(parent) +KGamePropertyHandler::KGamePropertyHandler(int id, const TQObject* receiver, const char * sendf, const char *emitf, TQObject* parent) : TQObject(parent) { init(); registerHandler(id,receiver,sendf,emitf); } -KGamePropertyHandler::KGamePropertyHandler(QObject* parent) : QObject(parent) +KGamePropertyHandler::KGamePropertyHandler(TQObject* parent) : TQObject(parent) { init(); } @@ -90,20 +90,20 @@ void KGamePropertyHandler::setId(int id) d->mId = id; } -void KGamePropertyHandler::registerHandler(int id,const QObject * receiver, const char * sendf, const char *emitf) +void KGamePropertyHandler::registerHandler(int id,const TQObject * receiver, const char * sendf, const char *emitf) { setId(id); if (receiver && sendf) { - kdDebug(11001) << "Connecting SLOT " << sendf << endl; - connect(this, SIGNAL(signalSendMessage(int, QDataStream &, bool*)), receiver, sendf); + kdDebug(11001) << "Connecting TQT_SLOT " << sendf << endl; + connect(this, TQT_SIGNAL(signalSendMessage(int, TQDataStream &, bool*)), receiver, sendf); } if (receiver && emitf) { - kdDebug(11001) << "Connecting SLOT " << emitf << endl; - connect(this, SIGNAL(signalPropertyChanged(KGamePropertyBase *)), receiver, emitf); + kdDebug(11001) << "Connecting TQT_SLOT " << emitf << endl; + connect(this, TQT_SIGNAL(signalPropertyChanged(KGamePropertyBase *)), receiver, emitf); } } -bool KGamePropertyHandler::processMessage(QDataStream &stream, int id, bool isSender) +bool KGamePropertyHandler::processMessage(TQDataStream &stream, int id, bool isSender) { // kdDebug(11001) << k_funcinfo << ": id=" << id << " mId=" << d->mId << endl; if (id != d->mId) { @@ -148,7 +148,7 @@ bool KGamePropertyHandler::removeProperty(KGamePropertyBase* data) return d->mIdDict.remove(data->id()); } -bool KGamePropertyHandler::addProperty(KGamePropertyBase* data, QString name) +bool KGamePropertyHandler::addProperty(KGamePropertyBase* data, TQString name) { //kdDebug(11001) << k_funcinfo << ": " << data->id() << endl; if (d->mIdDict.find(data->id())) { @@ -169,9 +169,9 @@ bool KGamePropertyHandler::addProperty(KGamePropertyBase* data, QString name) return true; } -QString KGamePropertyHandler::propertyName(int id) const +TQString KGamePropertyHandler::propertyName(int id) const { - QString s; + TQString s; if (d->mIdDict.find(id)) { if (d->mNameMap.contains(id)) { s = i18n("%1 (%2)").arg(d->mNameMap[id]).arg(id); @@ -185,7 +185,7 @@ QString KGamePropertyHandler::propertyName(int id) const return s; } -bool KGamePropertyHandler::load(QDataStream &stream) +bool KGamePropertyHandler::load(TQDataStream &stream) { // Prevent direct emmiting until all is loaded lockDirectEmit(); @@ -207,11 +207,11 @@ bool KGamePropertyHandler::load(QDataStream &stream) return true; } -bool KGamePropertyHandler::save(QDataStream &stream) +bool KGamePropertyHandler::save(TQDataStream &stream) { kdDebug(11001) << k_funcinfo << ": " << d->mIdDict.count() << " KGameProperty objects " << endl; stream << (uint)d->mIdDict.count(); - QIntDictIterator<KGamePropertyBase> it(d->mIdDict); + TQIntDictIterator<KGamePropertyBase> it(d->mIdDict); while (it.current()) { KGamePropertyBase *base=it.current(); if (base) { @@ -234,7 +234,7 @@ void KGamePropertyHandler::setPolicy(KGamePropertyBase::PropertyPolicy p,bool us // kdDebug(11001) << k_funcinfo << ": " << p << endl; d->mDefaultPolicy=p; d->mDefaultUserspace=userspace; - QIntDictIterator<KGamePropertyBase> it(d->mIdDict); + TQIntDictIterator<KGamePropertyBase> it(d->mIdDict); while (it.current()) { if (!userspace || it.current()->id()>=KGamePropertyBase::IdUser) { it.current()->setPolicy((KGamePropertyBase::PropertyPolicy)p); @@ -245,7 +245,7 @@ void KGamePropertyHandler::setPolicy(KGamePropertyBase::PropertyPolicy p,bool us void KGamePropertyHandler::unlockProperties() { - QIntDictIterator<KGamePropertyBase> it(d->mIdDict); + TQIntDictIterator<KGamePropertyBase> it(d->mIdDict); while (it.current()) { it.current()->unlock(); ++it; @@ -254,7 +254,7 @@ void KGamePropertyHandler::unlockProperties() void KGamePropertyHandler::lockProperties() { - QIntDictIterator<KGamePropertyBase> it(d->mIdDict); + TQIntDictIterator<KGamePropertyBase> it(d->mIdDict); while (it.current()) { it.current()->lock(); ++it; @@ -268,7 +268,7 @@ int KGamePropertyHandler::uniquePropertyId() void KGamePropertyHandler::flush() { - QIntDictIterator<KGamePropertyBase> it(d->mIdDict); + TQIntDictIterator<KGamePropertyBase> it(d->mIdDict); while (it.current()) { if (it.current()->isDirty()) { it.current()->sendProperty(); @@ -319,7 +319,7 @@ void KGamePropertyHandler::emitSignal(KGamePropertyBase *prop) } } -bool KGamePropertyHandler::sendProperty(QDataStream &s) +bool KGamePropertyHandler::sendProperty(TQDataStream &s) { bool sent = false; emit signalSendMessage(id(), s, &sent); @@ -334,7 +334,7 @@ KGamePropertyBase *KGamePropertyHandler::find(int id) void KGamePropertyHandler::clear() { kdDebug(11001) << k_funcinfo << id() << endl; - QIntDictIterator<KGamePropertyBase> it(d->mIdDict); + TQIntDictIterator<KGamePropertyBase> it(d->mIdDict); while (it.toFirst()) { KGamePropertyBase* p = it.toFirst(); p->unregisterData(); @@ -346,31 +346,31 @@ void KGamePropertyHandler::clear() } } -QIntDict<KGamePropertyBase>& KGamePropertyHandler::dict() const +TQIntDict<KGamePropertyBase>& KGamePropertyHandler::dict() const { return d->mIdDict; } -QString KGamePropertyHandler::propertyValue(KGamePropertyBase* prop) +TQString KGamePropertyHandler::propertyValue(KGamePropertyBase* prop) { if (!prop) { return i18n("NULL pointer"); } int id = prop->id(); - QString name = propertyName(id); - QString value; + TQString name = propertyName(id); + TQString value; const type_info* t = prop->typeinfo(); if (*t == typeid(int)) { - value = QString::number(((KGamePropertyInt*)prop)->value()); + value = TQString::number(((KGamePropertyInt*)prop)->value()); } else if (*t == typeid(unsigned int)) { - value = QString::number(((KGamePropertyUInt *)prop)->value()); + value = TQString::number(((KGamePropertyUInt *)prop)->value()); } else if (*t == typeid(long int)) { - value = QString::number(((KGameProperty<long int> *)prop)->value()); + value = TQString::number(((KGameProperty<long int> *)prop)->value()); } else if (*t == typeid(unsigned long int)) { - value = QString::number(((KGameProperty<unsigned long int> *)prop)->value()); - } else if (*t == typeid(QString)) { + value = TQString::number(((KGameProperty<unsigned long int> *)prop)->value()); + } else if (*t == typeid(TQString)) { value = ((KGamePropertyQString*)prop)->value(); } else if (*t == typeid(Q_INT8)) { value = ((KGamePropertyBool*)prop)->value() ? i18n("True") : i18n("False"); @@ -390,7 +390,7 @@ void KGamePropertyHandler::Debug() kdDebug(11001) << "KGamePropertyHandler:: Debug this=" << this << endl; kdDebug(11001) << " Registered properties: (Policy,Lock,Emit,Optimized, Dirty)" << endl; - QIntDictIterator<KGamePropertyBase> it(d->mIdDict); + TQIntDictIterator<KGamePropertyBase> it(d->mIdDict); while (it.current()) { KGamePropertyBase *p=it.current(); kdDebug(11001) << " "<< p->id() << ": p=" << p->policy() diff --git a/libkdegames/kgame/kgamepropertyhandler.h b/libkdegames/kgame/kgamepropertyhandler.h index 6147c071..ec7fec06 100644 --- a/libkdegames/kgame/kgamepropertyhandler.h +++ b/libkdegames/kgame/kgamepropertyhandler.h @@ -21,8 +21,8 @@ #ifndef __KGAMEPROPERTYHANDLER_H_ #define __KGAMEPROPERTYHANDLER_H_ -#include <qobject.h> -#include <qintdict.h> +#include <tqobject.h> +#include <tqintdict.h> #include "kgameproperty.h" #include <kdemacros.h> @@ -63,7 +63,7 @@ class KGamePropertyHandlerPrivate; // wow - what a name ;-) * * A KGamePropertyHandler is also used - indirectly using emitSignal - to * emit a signal when the value of a property changes. This is done this way - * because a KGameProperty does not inherit QObject because of memory + * because a KGameProperty does not inherit TQObject because of memory * advantages. Many games can have dozens or even hundreds of KGameProperty * objects so every additional variable in KGameProperty would be * multiplied. @@ -80,14 +80,14 @@ public: * You have to call registerHandler before you can use this * handler! **/ - KGamePropertyHandler(QObject* parent = 0); + KGamePropertyHandler(TQObject* parent = 0); /** * Construct a registered handler. * * @see registerHandler **/ - KGamePropertyHandler(int id, const QObject* receiver, const char* sendf, const char* emitf, QObject* parent = 0); + KGamePropertyHandler(int id, const TQObject* receiver, const char* sendf, const char* emitf, TQObject* parent = 0); ~KGamePropertyHandler(); /** @@ -101,7 +101,7 @@ public: * @param send A slot that is being connected to signalSendMessage * @param emit A slot that is being connected to signalPropertyChanged **/ - void registerHandler(int id, const QObject *receiver, const char * send, const char *emit); + void registerHandler(int id, const TQObject *receiver, const char * send, const char *emit); /** * Main message process function. This has to be called by @@ -118,7 +118,7 @@ public: * @param isSender Whether the receiver is also the sender * @return true on message processed otherwise false **/ - bool processMessage(QDataStream &stream, int id, bool isSender ); + bool processMessage(TQDataStream &stream, int id, bool isSender ); /** * @return the id of the handler @@ -132,7 +132,7 @@ public: * propertyName. This is used for debugging, e.g. in KGameDebugDialog * @return true on success **/ - bool addProperty(KGamePropertyBase *data, QString name=0); + bool addProperty(KGamePropertyBase *data, TQString name=0); /** * Removes a property from the handler @@ -156,7 +156,7 @@ public: * @param stream the datastream to load from * @return true on success otherwise false **/ - virtual bool load(QDataStream &stream); + virtual bool load(TQDataStream &stream); /** * Saves properties into the datastream @@ -164,14 +164,14 @@ public: * @param stream the datastream to save to * @return true on success otherwise false **/ - virtual bool save(QDataStream &stream); + virtual bool save(TQDataStream &stream); /** * called by a property to send itself into the * datastream. This call is simply forwarded to * the parent object **/ - bool sendProperty(QDataStream &s); + bool sendProperty(TQDataStream &s); void sendLocked(bool l); @@ -188,7 +188,7 @@ public: * depend on this function! It it possible not to provide a name or to * provide the same name for multiple properties! **/ - QString propertyName(int id) const; + TQString propertyName(int id) const; /** * @param id The ID of the property. See KGamePropertyBase::id @@ -277,13 +277,13 @@ public: /** * Reference to the internal dictionary **/ - QIntDict<KGamePropertyBase> &dict() const; + TQIntDict<KGamePropertyBase> &dict() const; /** - * In several situations you just want to have a QString of a + * In several situations you just want to have a TQString of a * KGameProperty object. This is the case in the * KGameDebugDialog where the value of all properties is displayed. This - * function will provide you with such a QString for all the types + * function will provide you with such a TQString for all the types * used inside of all KGame classes. If you have a non-standard * property (probably a self defined class or something like this) you * also need to connect to signalRequestValue to make this function @@ -291,7 +291,7 @@ public: * @param property Return the value of this KGameProperty * @return The value of a KGameProperty **/ - QString propertyValue(KGamePropertyBase* property); + TQString propertyValue(KGamePropertyBase* property); /** @@ -320,20 +320,20 @@ signals: * @param sent set this to true if the property was sent successfully - * otherwise don't touch **/ - void signalSendMessage(int msgid, QDataStream &, bool* sent); // AB shall we change bool* into bool& again? + void signalSendMessage(int msgid, TQDataStream &, bool* sent); // AB shall we change bool* into bool& again? /** * If you call propertyValue with a non-standard KGameProperty * it is possible that the value cannot automatically be converted into a - * QString. Then this signal is emitted and asks you to provide the + * TQString. Then this signal is emitted and asks you to provide the * correct value. You probably want to use something like this to achieve * this: * \code * #include <typeinfo> - * void slotRequestValue(KGamePropertyBase* p, QString& value) + * void slotRequestValue(KGamePropertyBase* p, TQString& value) * { * if (*(p->typeinfo()) == typeid(MyType) { - * value = QString(((KGameProperty<MyType>*)p)->value()); + * value = TQString(((KGameProperty<MyType>*)p)->value()); * } * } * \endcode @@ -341,7 +341,7 @@ signals: * @param property The KGamePropertyBase the value is requested for * @param value The value of this property. You have to set this. **/ - void signalRequestValue(KGamePropertyBase* property, QString& value); + void signalRequestValue(KGamePropertyBase* property, TQString& value); private: void init(); diff --git a/libkdegames/kgame/kgamepropertylist.h b/libkdegames/kgame/kgamepropertylist.h index 3a304e70..df8eb604 100644 --- a/libkdegames/kgame/kgamepropertylist.h +++ b/libkdegames/kgame/kgamepropertylist.h @@ -21,7 +21,7 @@ #ifndef __KGAMEPROPERTYLIST_H_ #define __KGAMEPROPERTYLIST_H_ -#include <qvaluelist.h> +#include <tqvaluelist.h> #include <kdebug.h> @@ -32,20 +32,20 @@ // AB: also see README.LIB! template<class type> -class KGamePropertyList : public QValueList<type>, public KGamePropertyBase +class KGamePropertyList : public TQValueList<type>, public KGamePropertyBase { public: /** * Typedefs */ - typedef QValueListIterator<type> Iterator; - typedef QValueListConstIterator<type> ConstIterator; + typedef TQValueListIterator<type> Iterator; + typedef TQValueListConstIterator<type> ConstIterator; - KGamePropertyList() :QValueList<type>(), KGamePropertyBase() + KGamePropertyList() :TQValueList<type>(), KGamePropertyBase() { } - KGamePropertyList( const KGamePropertyList<type> &a ) : QValueList<type>(a) + KGamePropertyList( const KGamePropertyList<type> &a ) : TQValueList<type>(a) { } @@ -66,10 +66,10 @@ public: Iterator insert( Iterator it, const type& d ) { - it=QValueList<type>::insert(it,d); + it=TQValueList<type>::insert(it,d); - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyCommand(s,KGamePropertyBase::IdCommand,id(),CmdInsert); int i=findIterator(it); s << i; @@ -92,8 +92,8 @@ public: void append( const type& d ) { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyCommand(s,KGamePropertyBase::IdCommand,id(),CmdAppend); s << d; if (policy() == PolicyClean || policy() == PolicyDirty) @@ -111,8 +111,8 @@ public: Iterator erase( Iterator it ) { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyCommand(s,KGamePropertyBase::IdCommand,id(),CmdRemove); int i=findIterator(it); s << i; @@ -128,7 +128,7 @@ public: extractProperty(b); } //TODO: return value - is it correct for PolicyLocal|PolicyDirty? -// return QValueList<type>::remove(it); +// return TQValueList<type>::remove(it); return it; } @@ -145,8 +145,8 @@ public: void clear() { - QByteArray b; - QDataStream s(b, IO_WriteOnly); + TQByteArray b; + TQDataStream s(b, IO_WriteOnly); KGameMessage::createPropertyCommand(s,KGamePropertyBase::IdCommand,id(),CmdClear); if (policy() == PolicyClean || policy() == PolicyDirty) { @@ -161,10 +161,10 @@ public: } } - void load(QDataStream& s) + void load(TQDataStream& s) { kdDebug(11001) << "KGamePropertyList load " << id() << endl; - QValueList<type>::clear(); + TQValueList<type>::clear(); uint size; type data; s >> size; @@ -172,12 +172,12 @@ public: for (unsigned int i=0;i<size;i++) { s >> data; - QValueList<type>::append(data); + TQValueList<type>::append(data); } if (isEmittingSignal()) emitSignal(); } - void save(QDataStream &s) + void save(TQDataStream &s) { kdDebug(11001) << "KGamePropertyList save "<<id() << endl; type data; @@ -191,7 +191,7 @@ public: } } - void command(QDataStream &s,int cmd,bool) + void command(TQDataStream &s,int cmd,bool) { KGamePropertyBase::command(s, cmd); kdDebug(11001) << "---> LIST id="<<id()<<" got command ("<<cmd<<") !!!" <<endl; @@ -204,7 +204,7 @@ public: type data; s >> i >> data; it=this->at(i); - QValueList<type>::insert(it,data); + TQValueList<type>::insert(it,data); // kdDebug(11001) << "CmdInsert:id="<<id()<<" i="<<i<<" data="<<data <<endl; if (isEmittingSignal()) emitSignal(); break; @@ -213,7 +213,7 @@ public: { type data; s >> data; - QValueList<type>::append(data); + TQValueList<type>::append(data); // kdDebug(11001) << "CmdAppend:id=" << id() << " data=" << data << endl; if (isEmittingSignal()) emitSignal(); break; @@ -223,14 +223,14 @@ public: uint i; s >> i; it=this->at(i); - QValueList<type>::remove(it); + TQValueList<type>::remove(it); kdDebug(11001) << "CmdRemove:id="<<id()<<" i="<<i <<endl; if (isEmittingSignal()) emitSignal(); break; } case CmdClear: { - QValueList<type>::clear(); + TQValueList<type>::clear(); kdDebug(11001) << "CmdClear:id="<<id()<<endl; if (isEmittingSignal()) emitSignal(); break; @@ -241,11 +241,11 @@ public: } protected: - void extractProperty(const QByteArray& b) + void extractProperty(const TQByteArray& b) // this is called for Policy[Dirty|Local] after putting the stuff into the // stream { - QDataStream s(b, IO_ReadOnly); + TQDataStream s(b, IO_ReadOnly); int cmd; int propId; KGameMessage::extractPropertyHeader(s, propId); diff --git a/libkdegames/kgame/kgamesequence.cpp b/libkdegames/kgame/kgamesequence.cpp index 984a9315..9391ee04 100644 --- a/libkdegames/kgame/kgamesequence.cpp +++ b/libkdegames/kgame/kgamesequence.cpp @@ -27,7 +27,7 @@ #include "kplayer.h" #include "kgame.h" -KGameSequence::KGameSequence() : QObject() +KGameSequence::KGameSequence() : TQObject() { mGame = 0; mCurrentPlayer = 0; diff --git a/libkdegames/kgame/kgamesequence.h b/libkdegames/kgame/kgamesequence.h index 4d26ceee..19699d6b 100644 --- a/libkdegames/kgame/kgamesequence.h +++ b/libkdegames/kgame/kgamesequence.h @@ -23,7 +23,7 @@ #ifndef __KGAMESEQUENCE_H_ #define __KGAMESEQUENCE_H_ -#include <qobject.h> +#include <tqobject.h> class KPlayer; class KGame; diff --git a/libkdegames/kgame/kmessageclient.cpp b/libkdegames/kgame/kmessageclient.cpp index ed9cc966..e490a084 100644 --- a/libkdegames/kgame/kmessageclient.cpp +++ b/libkdegames/kgame/kmessageclient.cpp @@ -20,8 +20,8 @@ #include <kdebug.h> #include <stdio.h> -#include <qbuffer.h> -#include <qtimer.h> +#include <tqbuffer.h> +#include <tqtimer.h> #include "kmessageio.h" #include "kmessageserver.h" @@ -41,15 +41,15 @@ public: } Q_UINT32 adminID; - QValueList <Q_UINT32> clientList; + TQValueList <Q_UINT32> clientList; KMessageIO *connection; bool isLocked; - QValueList <QByteArray> delayedMessages; + TQValueList <TQByteArray> delayedMessages; }; -KMessageClient::KMessageClient (QObject *parent, const char *name) - : QObject (parent, name) +KMessageClient::KMessageClient (TQObject *parent, const char *name) + : TQObject (parent, name) { d = new KMessageClientPrivate (); d->isLocked = false; @@ -63,7 +63,7 @@ KMessageClient::~KMessageClient () // -- setServer stuff -void KMessageClient::setServer (const QString &host, Q_UINT16 port) +void KMessageClient::setServer (const TQString &host, Q_UINT16 port) { setServer (new KMessageSocket (host, port)); } @@ -86,10 +86,10 @@ void KMessageClient::setServer (KMessageIO *connection) d->connection = connection; if (connection ) { - connect (connection, SIGNAL (received(const QByteArray &)), - this, SLOT (processIncomingMessage(const QByteArray &))); - connect (connection, SIGNAL (connectionBroken()), - this, SLOT (removeBrokenConnection ())); + connect (connection, TQT_SIGNAL (received(const TQByteArray &)), + this, TQT_SLOT (processIncomingMessage(const TQByteArray &))); + connect (connection, TQT_SIGNAL (connectionBroken()), + this, TQT_SLOT (removeBrokenConnection ())); } } @@ -110,7 +110,7 @@ Q_UINT32 KMessageClient::adminId () const return d->adminID; } -const QValueList <Q_UINT32> &KMessageClient::clientList() const +const TQValueList <Q_UINT32> &KMessageClient::clientList() const { return d->clientList; } @@ -130,14 +130,14 @@ Q_UINT16 KMessageClient::peerPort () const return d->connection ? d->connection->peerPort() : 0; } -QString KMessageClient::peerName () const +TQString KMessageClient::peerName () const { - return d->connection ? d->connection->peerName() : QString::fromLatin1("localhost"); + return d->connection ? d->connection->peerName() : TQString::fromLatin1("localhost"); } // --------------------- Sending messages -void KMessageClient::sendServerMessage (const QByteArray &msg) +void KMessageClient::sendServerMessage (const TQByteArray &msg) { if (!d->connection) { @@ -147,39 +147,39 @@ void KMessageClient::sendServerMessage (const QByteArray &msg) d->connection->send (msg); } -void KMessageClient::sendBroadcast (const QByteArray &msg) +void KMessageClient::sendBroadcast (const TQByteArray &msg) { - QByteArray sendBuffer; - QBuffer buffer (sendBuffer); + TQByteArray sendBuffer; + TQBuffer buffer (sendBuffer); buffer.open (IO_WriteOnly); - QDataStream stream (&buffer); + TQDataStream stream (&buffer); stream << static_cast<Q_UINT32> ( KMessageServer::REQ_BROADCAST ); - buffer.QIODevice::writeBlock (msg); + buffer.TQIODevice::writeBlock (msg); sendServerMessage (sendBuffer); } -void KMessageClient::sendForward (const QByteArray &msg, const QValueList <Q_UINT32> &clients) +void KMessageClient::sendForward (const TQByteArray &msg, const TQValueList <Q_UINT32> &clients) { - QByteArray sendBuffer; - QBuffer buffer (sendBuffer); + TQByteArray sendBuffer; + TQBuffer buffer (sendBuffer); buffer.open (IO_WriteOnly); - QDataStream stream (&buffer); + TQDataStream stream (&buffer); stream << static_cast<Q_UINT32>( KMessageServer::REQ_FORWARD ) << clients; - buffer.QIODevice::writeBlock (msg); + buffer.TQIODevice::writeBlock (msg); sendServerMessage (sendBuffer); } -void KMessageClient::sendForward (const QByteArray &msg, Q_UINT32 client) +void KMessageClient::sendForward (const TQByteArray &msg, Q_UINT32 client) { - sendForward (msg, QValueList <Q_UINT32> () << client); + sendForward (msg, TQValueList <Q_UINT32> () << client); } // --------------------- Receiving and processing messages -void KMessageClient::processIncomingMessage (const QByteArray &msg) +void KMessageClient::processIncomingMessage (const TQByteArray &msg) { if (d->isLocked) { @@ -189,7 +189,7 @@ void KMessageClient::processIncomingMessage (const QByteArray &msg) if (d->delayedMessages.count() > 0) { d->delayedMessages.append (msg); - QByteArray first = d->delayedMessages.front(); + TQByteArray first = d->delayedMessages.front(); d->delayedMessages.pop_front(); processMessage (first); } @@ -199,16 +199,16 @@ void KMessageClient::processIncomingMessage (const QByteArray &msg) } } -void KMessageClient::processMessage (const QByteArray &msg) +void KMessageClient::processMessage (const TQByteArray &msg) { if (d->isLocked) { // must NOT happen, since we check in processIncomingMessage as well as in processFirstMessage d->delayedMessages.append(msg); return; } - QBuffer in_buffer (msg); + TQBuffer in_buffer (msg); in_buffer.open (IO_ReadOnly); - QDataStream in_stream (&in_buffer); + TQDataStream in_stream (&in_buffer); bool unknown = false; @@ -228,7 +228,7 @@ void KMessageClient::processMessage (const QByteArray &msg) case KMessageServer::MSG_FORWARD: { Q_UINT32 clientID; - QValueList <Q_UINT32> receivers; + TQValueList <Q_UINT32> receivers; in_stream >> clientID >> receivers; emit forwardReceived (in_buffer.readAll(), clientID, receivers); } @@ -313,7 +313,7 @@ void KMessageClient::processFirstMessage() kdDebug(11001) << k_funcinfo << ": no messages delayed" << endl; return; } - QByteArray first = d->delayedMessages.front(); + TQByteArray first = d->delayedMessages.front(); d->delayedMessages.pop_front(); processMessage (first); } @@ -321,8 +321,8 @@ void KMessageClient::processFirstMessage() void KMessageClient::removeBrokenConnection () { kdDebug (11001) << k_funcinfo << ": timer single shot for removeBrokenConnection"<<this << endl; - // MH We cannot directly delete the socket. otherwise QSocket crashes - QTimer::singleShot( 0, this, SLOT(removeBrokenConnection2()) ); + // MH We cannot directly delete the socket. otherwise TQSocket crashes + TQTimer::singleShot( 0, this, TQT_SLOT(removeBrokenConnection2()) ); return; } @@ -361,7 +361,7 @@ void KMessageClient::unlock () d->isLocked = false; for (unsigned int i = 0; i < d->delayedMessages.count(); i++) { - QTimer::singleShot(0, this, SLOT(processFirstMessage())); + TQTimer::singleShot(0, this, TQT_SLOT(processFirstMessage())); } } diff --git a/libkdegames/kgame/kmessageclient.h b/libkdegames/kgame/kmessageclient.h index 90364c8d..71ab7a1e 100644 --- a/libkdegames/kgame/kmessageclient.h +++ b/libkdegames/kgame/kmessageclient.h @@ -20,9 +20,9 @@ #ifndef __KMESSAGECLIENT_H__ #define __KMESSAGECLIENT_H__ -#include <qobject.h> -#include <qstring.h> -#include <qvaluelist.h> +#include <tqobject.h> +#include <tqstring.h> +#include <tqvaluelist.h> class KMessageIO; class KMessageServer; @@ -58,7 +58,7 @@ public: Creates an unconnected KMessageClient object. Use setServer() later to connect to a KMessageServer object. */ - KMessageClient (QObject *parent = 0, const char *name = 0); + KMessageClient (TQObject *parent = 0, const char *name = 0); /** Destructor. @@ -95,7 +95,7 @@ public: /** @return The list of the IDs of all the message clients connected to the message server. */ - const QValueList <Q_UINT32> &clientList() const; + const TQValueList <Q_UINT32> &clientList() const; /** Connects the client to (another) server. @@ -108,7 +108,7 @@ public: be resolved to an IP or just an IP @param port The port to connect to */ - void setServer (const QString &host, Q_UINT16 port); + void setServer (const TQString &host, Q_UINT16 port); /** Connects the client to (another) server. @@ -165,7 +165,7 @@ public: /** @return 0 if isConnected() is FALSE, otherwise the port number this client is - connected to. See also KMessageIO::peerPort and QSocket::peerPort. + connected to. See also KMessageIO::peerPort and TQSocket::peerPort. @since 3.2 */ Q_UINT16 peerPort () const; @@ -173,9 +173,9 @@ public: /** @since 3.2 @return "localhost" if isConnected() is FALSE, otherwise the hostname this client is - connected to. See also KMessageIO::peerName() and QSocket::peerName(). + connected to. See also KMessageIO::peerName() and TQSocket::peerName(). */ - QString peerName() const; + TQString peerName() const; /** Sends a message to the KMessageServer. If we are not yet connected to one, nothing @@ -188,7 +188,7 @@ public: and sendForward(). @param msg The message to be sent to the server. Must be in the format specified in KMessageServer. */ - void sendServerMessage (const QByteArray &msg); + void sendServerMessage (const TQByteArray &msg); /** Sends a message to all the clients connected to the server, including ourself. @@ -199,7 +199,7 @@ public: @param msg The message to be sent to the clients */ //AB: processBroadcast doesn't exist!! is processIncomingMessage meant? - void sendBroadcast (const QByteArray &msg); + void sendBroadcast (const TQByteArray &msg); /** Sends a message to all the clients in a list. @@ -218,11 +218,11 @@ public: @param clients A list of clients the message should be sent to */ //AB: processForward doesn't exist!! is processIncomingMessage meant? - void sendForward (const QByteArray &msg, const QValueList <Q_UINT32> &clients); + void sendForward (const TQByteArray &msg, const TQValueList <Q_UINT32> &clients); /** Sends a message to a single client. This is a convenieance method. It calls - sendForward (const QByteArray &msg, const QValueList <Q_UINT32> &clients) + sendForward (const TQByteArray &msg, const TQValueList <Q_UINT32> &clients) with a list containing only one client ID. To send a message to the admin of the KMessageServer, you can use 0 as clientID, @@ -230,7 +230,7 @@ public: @param msg The message to be sent to the client @param client The id of the client the message shall be sent to */ - void sendForward (const QByteArray &msg, Q_UINT32 client); + void sendForward (const TQByteArray &msg, Q_UINT32 client); /** Once this function is called no message will be received anymore. @@ -263,7 +263,7 @@ signals: to ignore broadcast messages that were sent by yourself: \code - void myObject::myBroadcastSlot (const QByteArray &msg, Q_UINT32 senderID) + void myObject::myBroadcastSlot (const TQByteArray &msg, Q_UINT32 senderID) { if (senderID == ((KMessageClient *)sender())->id()) return; @@ -273,7 +273,7 @@ signals: @param msg The message that has been sent to us @param senderID The ID of the client which sent the message */ - void broadcastReceived (const QByteArray &msg, Q_UINT32 senderID); + void broadcastReceived (const TQByteArray &msg, Q_UINT32 senderID); /** This signal is emitted when the client receives a forward message from the @@ -294,8 +294,8 @@ signals: \code KMessageClient *client = new KMessageClient (); - connect (client, SIGNAL (forwardReceived (const QByteArray &, Q_UINT32, const QValueList <Q_UINT32>&)), - client, SIGNAL (broadcastReceived (const QByteArray &, Q_UINT32))); + connect (client, TQT_SIGNAL (forwardReceived (const TQByteArray &, Q_UINT32, const TQValueList <Q_UINT32>&)), + client, TQT_SIGNAL (broadcastReceived (const TQByteArray &, Q_UINT32))); \endcode Then connect the broadcast signal to your slot that analyzes the message. @@ -303,7 +303,7 @@ signals: @param senderID The ID of the client which sent the message @param receivers All clients which receive this message */ - void forwardReceived (const QByteArray &msg, Q_UINT32 senderID, const QValueList <Q_UINT32> &receivers); + void forwardReceived (const TQByteArray &msg, Q_UINT32 senderID, const TQValueList <Q_UINT32> &receivers); /** This signal is emitted when the connection to the KMessageServer is broken. @@ -360,7 +360,7 @@ signals: //AB: maybe add a setNoEmit() so that the other signals can be deactivated? //Could be a performance benefit (note: KMessageClient is a time critical //class!!!) - void serverMessageReceived (const QByteArray &msg, bool &unknown); + void serverMessageReceived (const TQByteArray &msg, bool &unknown); protected: /** @@ -380,7 +380,7 @@ protected: @param msg The incoming message */ - virtual void processMessage (const QByteArray& msg); + virtual void processMessage (const TQByteArray& msg); protected slots: /** @@ -398,10 +398,10 @@ protected slots: MSG_BROADCAST, MSG_FORWARD, ANS_CLIENT_ID, ANS_ADMIN_ID, ANS_CLIENT_LIST @param msg The incoming message */ - virtual void processIncomingMessage (const QByteArray &msg); + virtual void processIncomingMessage (const TQByteArray &msg); /** - Called from unlock() (using QTimer::singleShot) until all delayed + Called from unlock() (using TQTimer::singleShot) until all delayed messages are delivered. */ void processFirstMessage(); diff --git a/libkdegames/kgame/kmessageio.cpp b/libkdegames/kgame/kmessageio.cpp index f3353277..7057a621 100644 --- a/libkdegames/kgame/kmessageio.cpp +++ b/libkdegames/kgame/kmessageio.cpp @@ -22,15 +22,15 @@ */ #include "kmessageio.h" -#include <qsocket.h> +#include <tqsocket.h> #include <kdebug.h> #include <kprocess.h> -#include <qfile.h> +#include <tqfile.h> // ----------------------- KMessageIO ------------------------- -KMessageIO::KMessageIO (QObject *parent, const char *name) - : QObject (parent, name), m_id (0) +KMessageIO::KMessageIO (TQObject *parent, const char *name) + : TQObject (parent, name), m_id (0) {} KMessageIO::~KMessageIO () @@ -48,25 +48,25 @@ Q_UINT32 KMessageIO::id () // ----------------------KMessageSocket ----------------------- -KMessageSocket::KMessageSocket (QString host, Q_UINT16 port, QObject *parent, +KMessageSocket::KMessageSocket (TQString host, Q_UINT16 port, TQObject *parent, const char *name) : KMessageIO (parent, name) { - mSocket = new QSocket (); + mSocket = new TQSocket (); mSocket->connectToHost (host, port); initSocket (); } -KMessageSocket::KMessageSocket (QHostAddress host, Q_UINT16 port, QObject +KMessageSocket::KMessageSocket (TQHostAddress host, Q_UINT16 port, TQObject *parent, const char *name) : KMessageIO (parent, name) { - mSocket = new QSocket (); + mSocket = new TQSocket (); mSocket->connectToHost (host.toString(), port); initSocket (); } -KMessageSocket::KMessageSocket (QSocket *socket, QObject *parent, const char +KMessageSocket::KMessageSocket (TQSocket *socket, TQObject *parent, const char *name) : KMessageIO (parent, name) { @@ -74,11 +74,11 @@ KMessageSocket::KMessageSocket (QSocket *socket, QObject *parent, const char initSocket (); } -KMessageSocket::KMessageSocket (int socketFD, QObject *parent, const char +KMessageSocket::KMessageSocket (int socketFD, TQObject *parent, const char *name) : KMessageIO (parent, name) { - mSocket = new QSocket (); + mSocket = new TQSocket (); mSocket->setSocket (socketFD); initSocket (); } @@ -90,12 +90,12 @@ KMessageSocket::~KMessageSocket () bool KMessageSocket::isConnected () const { - return mSocket->state() == QSocket::Connection; + return mSocket->state() == TQSocket::Connection; } -void KMessageSocket::send (const QByteArray &msg) +void KMessageSocket::send (const TQByteArray &msg) { - QDataStream str (mSocket); + TQDataStream str (mSocket); str << Q_UINT8 ('M'); // magic number for begin of message str.writeBytes (msg.data(), msg.size()); // writes the length (as Q_UINT32) and the data } @@ -106,7 +106,7 @@ void KMessageSocket::processNewData () return; isRecursive = true; - QDataStream str (mSocket); + TQDataStream str (mSocket); while (mSocket->bytesAvailable() > 0) { if (mAwaitingHeader) @@ -141,7 +141,7 @@ void KMessageSocket::processNewData () return; } - QByteArray msg (mNextBlockLength); + TQByteArray msg (mNextBlockLength); str.readRawBytes (msg.data(), mNextBlockLength); // send the received message @@ -157,9 +157,9 @@ void KMessageSocket::processNewData () void KMessageSocket::initSocket () { - connect (mSocket, SIGNAL (error(int)), SIGNAL (connectionBroken())); - connect (mSocket, SIGNAL (connectionClosed()), SIGNAL (connectionBroken())); - connect (mSocket, SIGNAL (readyRead()), SLOT (processNewData())); + connect (mSocket, TQT_SIGNAL (error(int)), TQT_SIGNAL (connectionBroken())); + connect (mSocket, TQT_SIGNAL (connectionClosed()), TQT_SIGNAL (connectionBroken())); + connect (mSocket, TQT_SIGNAL (readyRead()), TQT_SLOT (processNewData())); mAwaitingHeader = true; mNextBlockLength = 0; isRecursive = false; @@ -170,14 +170,14 @@ Q_UINT16 KMessageSocket::peerPort () const return mSocket->peerPort(); } -QString KMessageSocket::peerName () const +TQString KMessageSocket::peerName () const { return mSocket->peerName(); } // ----------------------KMessageDirect ----------------------- -KMessageDirect::KMessageDirect (KMessageDirect *partner, QObject *parent, +KMessageDirect::KMessageDirect (KMessageDirect *partner, TQObject *parent, const char *name) : KMessageIO (parent, name), mPartner (0) { @@ -213,7 +213,7 @@ bool KMessageDirect::isConnected () const return mPartner != 0; } -void KMessageDirect::send (const QByteArray &msg) +void KMessageDirect::send (const TQByteArray &msg) { if (mPartner) emit mPartner->received (msg); @@ -238,24 +238,24 @@ KMessageProcess::~KMessageProcess() // Maybe todo: delete mSendBuffer } } -KMessageProcess::KMessageProcess(QObject *parent, QString file) : KMessageIO(parent,0) +KMessageProcess::KMessageProcess(TQObject *parent, TQString file) : KMessageIO(parent,0) { // Start process kdDebug(11001) << "@@@KMessageProcess::Start process" << endl; mProcessName=file; mProcess=new KProcess; int id=0; - *mProcess << mProcessName << QString("%1").arg(id); + *mProcess << mProcessName << TQString("%1").arg(id); kdDebug(11001) << "@@@KMessageProcess::Init:Id= " << id << endl; kdDebug(11001) << "@@@KMessgeProcess::Init:Processname: " << mProcessName << endl; - connect(mProcess, SIGNAL(receivedStdout(KProcess *, char *, int )), - this, SLOT(slotReceivedStdout(KProcess *, char * , int ))); - connect(mProcess, SIGNAL(receivedStderr(KProcess *, char *, int )), - this, SLOT(slotReceivedStderr(KProcess *, char * , int ))); - connect(mProcess, SIGNAL(processExited(KProcess *)), - this, SLOT(slotProcessExited(KProcess *))); - connect(mProcess, SIGNAL(wroteStdin(KProcess *)), - this, SLOT(slotWroteStdin(KProcess *))); + connect(mProcess, TQT_SIGNAL(receivedStdout(KProcess *, char *, int )), + this, TQT_SLOT(slotReceivedStdout(KProcess *, char * , int ))); + connect(mProcess, TQT_SIGNAL(receivedStderr(KProcess *, char *, int )), + this, TQT_SLOT(slotReceivedStderr(KProcess *, char * , int ))); + connect(mProcess, TQT_SIGNAL(processExited(KProcess *)), + this, TQT_SLOT(slotProcessExited(KProcess *))); + connect(mProcess, TQT_SIGNAL(wroteStdin(KProcess *)), + this, TQT_SLOT(slotWroteStdin(KProcess *))); mProcess->start(KProcess::NotifyOnExit,KProcess::All); mSendBuffer=0; mReceiveCount=0; @@ -267,7 +267,7 @@ bool KMessageProcess::isConnected() const if (!mProcess) return false; return mProcess->isRunning(); } -void KMessageProcess::send(const QByteArray &msg) +void KMessageProcess::send(const TQByteArray &msg) { kdDebug(11001) << "@@@KMessageProcess:: SEND("<<msg.size()<<") to process" << endl; unsigned int size=msg.size()+2*sizeof(long); @@ -280,7 +280,7 @@ void KMessageProcess::send(const QByteArray &msg) *p1=0x4242aeae; *p2=size; - QByteArray *buffer=new QByteArray(); + TQByteArray *buffer=new TQByteArray(); buffer->assign(tmpbuffer,size); // buffer->duplicate(msg); mQueue.enqueue(buffer); @@ -330,9 +330,9 @@ void KMessageProcess::slotReceivedStderr(KProcess * proc, char *buffer, int bufl if (!p) len=buflen; else len=p-pos; - QByteArray a; + TQByteArray a; a.setRawData(pos,len); - QString s(a); + TQString s(a); kdDebug(11001) << "PID" <<pid<< ":" << s << endl; a.resetRawData(pos,len); if (p) pos=p+1; @@ -371,7 +371,7 @@ void KMessageProcess::slotReceivedStdout(KProcess * , char *buffer, int buflen) { kdDebug(11001) << k_funcinfo << ": Got message with len " << len << endl; - QByteArray msg; + TQByteArray msg; // msg.setRawData(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long)); msg.duplicate(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long)); emit received(msg); @@ -397,7 +397,7 @@ void KMessageProcess::slotProcessExited(KProcess * /*p*/) // ----------------------- KMessageFilePipe --------------------------- -KMessageFilePipe::KMessageFilePipe(QObject *parent,QFile *readfile,QFile *writefile) : KMessageIO(parent,0) +KMessageFilePipe::KMessageFilePipe(TQObject *parent,TQFile *readfile,TQFile *writefile) : KMessageIO(parent,0) { mReadFile=readfile; mWriteFile=writefile; @@ -414,7 +414,7 @@ bool KMessageFilePipe::isConnected () const return (mReadFile!=0)&&(mWriteFile!=0); } -void KMessageFilePipe::send(const QByteArray &msg) +void KMessageFilePipe::send(const TQByteArray &msg) { unsigned int size=msg.size()+2*sizeof(long); @@ -425,7 +425,7 @@ void KMessageFilePipe::send(const QByteArray &msg) *p1=0x4242aeae; *p2=size; - QByteArray buffer; + TQByteArray buffer; buffer.assign(tmpbuffer,size); mWriteFile->writeBlock(buffer); mWriteFile->flush(); @@ -464,7 +464,7 @@ void KMessageFilePipe::exec() { //fprintf(stderr,"KMessageFilePipe::exec:: Got Message with len %d\n",len); - QByteArray msg; + TQByteArray msg; //msg.setRawData(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long)); msg.duplicate(mReceiveBuffer.data()+2*sizeof(long),len-2*sizeof(long)); emit received(msg); diff --git a/libkdegames/kgame/kmessageio.h b/libkdegames/kgame/kmessageio.h index 37cf35cd..8ffa4377 100644 --- a/libkdegames/kgame/kmessageio.h +++ b/libkdegames/kgame/kmessageio.h @@ -24,12 +24,12 @@ #ifndef _KMESSAGEIO_H_ #define _KMESSAGEIO_H_ -#include <qcstring.h> -#include <qhostaddress.h> -#include <qobject.h> -#include <qstring.h> -#include <qptrqueue.h> -#include <qfile.h> +#include <tqcstring.h> +#include <tqhostaddress.h> +#include <tqobject.h> +#include <tqstring.h> +#include <tqptrqueue.h> +#include <tqfile.h> #include <kdebug.h> class QSocket; @@ -59,9 +59,9 @@ class KMessageIO : public QObject public: /** - * The usual QObject constructor, does nothing else. + * The usual TQObject constructor, does nothing else. **/ - KMessageIO (QObject *parent = 0, const char *name = 0); + KMessageIO (TQObject *parent = 0, const char *name = 0); /** * The usual destructor, does nothing special. @@ -122,7 +122,7 @@ public: @since 3.2 @return "localhost" in the default implementation. Reimplemented in @ref KMessageSocket */ - virtual QString peerName () const { return QString::fromLatin1("localhost"); } + virtual TQString peerName () const { return TQString::fromLatin1("localhost"); } signals: @@ -131,7 +131,7 @@ signals: object is called. The parameter contains the same data array in /e msg as was used in /e send(). */ - void received (const QByteArray &msg); + void received (const TQByteArray &msg); /** This signal is emitted when the connection is closed. This can be caused @@ -154,7 +154,7 @@ public slots: as a slot! (Otherwise another slot would be defined. It would work, but uses more memory and time.) See /e KMessageSocket for an example implementation. */ - virtual void send (const QByteArray &msg) = 0; + virtual void send (const TQByteArray &msg) = 0; protected: Q_UINT32 m_id; @@ -181,7 +181,7 @@ public: If the connection could not be established (e.g. unknown host or no server socket at this port), the signal /e connectionBroken is emitted. */ - KMessageSocket (QString host, Q_UINT16 port, QObject *parent = 0, + KMessageSocket (TQString host, Q_UINT16 port, TQObject *parent = 0, const char *name = 0); /** @@ -192,7 +192,7 @@ public: If the connection could not be established (e.g. unknown host or no server socket at this port), the signal /e connectionBroken is emitted. */ - KMessageSocket (QHostAddress host, Q_UINT16 port, QObject *parent = 0, + KMessageSocket (TQHostAddress host, Q_UINT16 port, TQObject *parent = 0, const char *name = 0); /** @@ -206,20 +206,20 @@ public: together with this KMessageSocket object. (Use 0 as parent for the QSocket object t ensure it is not deleted.) */ - KMessageSocket (QSocket *socket, QObject *parent = 0, const char *name = 0); + KMessageSocket (TQSocket *socket, TQObject *parent = 0, const char *name = 0); /** Uses the socket specified by the socket descriptor socketFD to do the communication. The socket must already be connected. - This constructor can be used with a QServerSocket within the (pure + This constructor can be used with a TQServerSocket within the (pure virtual) method /e newConnection. Note: The socket is then owned by the /e KMessageSocket object. So don't manipulate the socket afterwards, especially don't close it. The socket is automatically closed when KMessageSocket is deleted. */ - KMessageSocket (int socketFD, QObject *parent = 0, const char *name = 0); + KMessageSocket (int socketFD, TQObject *parent = 0, const char *name = 0); /** Destructor, closes the socket. @@ -233,15 +233,15 @@ public: /** @since 3.2 - @return The port that this object is connected to. See QSocket::peerPort + @return The port that this object is connected to. See TQSocket::peerPort */ virtual Q_UINT16 peerPort () const; /** @since 3.2 - @return The hostname this object is connected to. See QSocket::peerName. + @return The hostname this object is connected to. See TQSocket::peerName. */ - virtual QString peerName () const; + virtual TQString peerName () const; /** @return TRUE as this is a network IO. @@ -259,18 +259,18 @@ public: Note: It is not declared as a slot method, since the slot is already defined in KMessageIO as a virtual method. */ - void send (const QByteArray &msg); + void send (const TQByteArray &msg); protected slots: virtual void processNewData (); protected: void initSocket (); - QSocket *mSocket; + TQSocket *mSocket; bool mAwaitingHeader; Q_UINT32 mNextBlockLength; - bool isRecursive; // workaround for "bug" in QSocket, Qt 2.2.3 or older + bool isRecursive; // workaround for "bug" in TQSocket, Qt 2.2.3 or older }; @@ -304,7 +304,7 @@ public: If that object is already connected, the object remains unconnected. */ - KMessageDirect (KMessageDirect *partner = 0, QObject *parent = 0, const char + KMessageDirect (KMessageDirect *partner = 0, TQObject *parent = 0, const char *name = 0); /** @@ -339,7 +339,7 @@ public: Note: It is not declared as a slot method, since the slot is already defined in KMessageIO as a virtual method. */ - void send (const QByteArray &msg); + void send (const TQByteArray &msg); protected: KMessageDirect *mPartner; @@ -350,10 +350,10 @@ class KMessageProcess : public KMessageIO Q_OBJECT public: - KMessageProcess(QObject *parent, QString file); + KMessageProcess(TQObject *parent, TQString file); ~KMessageProcess(); bool isConnected() const; - void send (const QByteArray &msg); + void send (const TQByteArray &msg); void writeToProcess(); /** @@ -375,11 +375,11 @@ class KMessageProcess : public KMessageIO void slotWroteStdin(KProcess *p); private: - QString mProcessName; + TQString mProcessName; KProcess *mProcess; - QPtrQueue <QByteArray> mQueue; - QByteArray *mSendBuffer; - QByteArray mReceiveBuffer; + TQPtrQueue <TQByteArray> mQueue; + TQByteArray *mSendBuffer; + TQByteArray mReceiveBuffer; unsigned int mReceiveCount; }; @@ -388,10 +388,10 @@ class KMessageFilePipe : public KMessageIO Q_OBJECT public: - KMessageFilePipe(QObject *parent,QFile *readFile,QFile *writeFile); + KMessageFilePipe(TQObject *parent,TQFile *readFile,TQFile *writeFile); ~KMessageFilePipe(); bool isConnected() const; - void send (const QByteArray &msg); + void send (const TQByteArray &msg); void exec(); /** @@ -407,9 +407,9 @@ class KMessageFilePipe : public KMessageIO private: - QFile *mReadFile; - QFile *mWriteFile; - QByteArray mReceiveBuffer; + TQFile *mReadFile; + TQFile *mWriteFile; + TQByteArray mReceiveBuffer; unsigned int mReceiveCount; }; diff --git a/libkdegames/kgame/kmessageserver.cpp b/libkdegames/kgame/kmessageserver.cpp index e857ea31..105f35da 100644 --- a/libkdegames/kgame/kmessageserver.cpp +++ b/libkdegames/kgame/kmessageserver.cpp @@ -17,12 +17,12 @@ Boston, MA 02110-1301, USA. */ -#include <qiodevice.h> -#include <qbuffer.h> -#include <qptrlist.h> -#include <qptrqueue.h> -#include <qtimer.h> -#include <qvaluelist.h> +#include <tqiodevice.h> +#include <tqbuffer.h> +#include <tqptrlist.h> +#include <tqptrqueue.h> +#include <tqtimer.h> +#include <tqvaluelist.h> #include <kdebug.h> @@ -31,8 +31,8 @@ // --------------- internal class KMessageServerSocket -KMessageServerSocket::KMessageServerSocket (Q_UINT16 port, QObject *parent) - : QServerSocket (port, 0, parent) +KMessageServerSocket::KMessageServerSocket (Q_UINT16 port, TQObject *parent) + : TQServerSocket (port, 0, parent) { } @@ -50,11 +50,11 @@ void KMessageServerSocket::newConnection (int socket) class MessageBuffer { public: - MessageBuffer (Q_UINT32 clientID, const QByteArray &messageData) + MessageBuffer (Q_UINT32 clientID, const TQByteArray &messageData) : id (clientID), data (messageData) { } ~MessageBuffer () {} Q_UINT32 id; - QByteArray data; + TQByteArray data; }; // ---------------- KMessageServer's private class @@ -77,23 +77,23 @@ public: KMessageServerSocket* mServerSocket; - QPtrList <KMessageIO> mClientList; - QPtrQueue <MessageBuffer> mMessageQueue; - QTimer mTimer; + TQPtrList <KMessageIO> mClientList; + TQPtrQueue <MessageBuffer> mMessageQueue; + TQTimer mTimer; bool mIsRecursive; }; // ------------------ KMessageServer -KMessageServer::KMessageServer (Q_UINT16 cookie,QObject* parent) - : QObject(parent, 0) +KMessageServer::KMessageServer (Q_UINT16 cookie,TQObject* parent) + : TQObject(parent, 0) { d = new KMessageServerPrivate; d->mIsRecursive=false; d->mCookie=cookie; - connect (&(d->mTimer), SIGNAL (timeout()), - this, SLOT (processOneMessage())); + connect (&(d->mTimer), TQT_SIGNAL (timeout()), + this, TQT_SLOT (processOneMessage())); kdDebug(11001) << "CREATE(KMessageServer=" << this << ") cookie=" @@ -138,8 +138,8 @@ bool KMessageServer::initNetwork (Q_UINT16 port) kdDebug (11001) << k_funcinfo << ": Now listening to port " << d->mServerSocket->port() << endl; - connect (d->mServerSocket, SIGNAL (newClientConnected (KMessageIO*)), - this, SLOT (addClient (KMessageIO*))); + connect (d->mServerSocket, TQT_SIGNAL (newClientConnected (KMessageIO*)), + this, TQT_SLOT (addClient (KMessageIO*))); return true; } @@ -169,7 +169,7 @@ bool KMessageServer::isOfferingConnections() const void KMessageServer::addClient (KMessageIO* client) { - QByteArray msg; + TQByteArray msg; // maximum number of clients reached? if (d->mMaxClients >= 0 && d->mMaxClients <= clientCount()) @@ -183,25 +183,25 @@ void KMessageServer::addClient (KMessageIO* client) kdDebug (11001) << k_funcinfo << ": " << client->id() << endl; // connect its signals - connect (client, SIGNAL (connectionBroken()), - this, SLOT (removeBrokenClient())); - connect (client, SIGNAL (received (const QByteArray &)), - this, SLOT (getReceivedMessage (const QByteArray &))); + connect (client, TQT_SIGNAL (connectionBroken()), + this, TQT_SLOT (removeBrokenClient())); + connect (client, TQT_SIGNAL (received (const TQByteArray &)), + this, TQT_SLOT (getReceivedMessage (const TQByteArray &))); // Tell everyone about the new guest // Note: The new client doesn't get this message! - QDataStream (msg, IO_WriteOnly) << Q_UINT32 (EVNT_CLIENT_CONNECTED) << client->id(); + TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (EVNT_CLIENT_CONNECTED) << client->id(); broadcastMessage (msg); // add to our list d->mClientList.append (client); // tell it its ID - QDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_CLIENT_ID) << client->id(); + TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_CLIENT_ID) << client->id(); client->send (msg); // Give it the complete list of client IDs - QDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_CLIENT_LIST) << clientIDs(); + TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_CLIENT_LIST) << clientIDs(); client->send (msg); @@ -213,7 +213,7 @@ void KMessageServer::addClient (KMessageIO* client) else { // otherwise tell it who is the admin - QDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_ADMIN_ID) << adminID(); + TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_ADMIN_ID) << adminID(); client->send (msg); } @@ -230,8 +230,8 @@ void KMessageServer::removeClient (KMessageIO* client, bool broken) } // tell everyone about the removed client - QByteArray msg; - QDataStream (msg, IO_WriteOnly) << Q_UINT32 (EVNT_CLIENT_DISCONNECTED) << client->id() << (Q_INT8)broken; + TQByteArray msg; + TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (EVNT_CLIENT_DISCONNECTED) << client->id() << (Q_INT8)broken; broadcastMessage (msg); // If it was the admin, select a new admin. @@ -280,10 +280,10 @@ int KMessageServer::clientCount() const return d->mClientList.count(); } -QValueList <Q_UINT32> KMessageServer::clientIDs () const +TQValueList <Q_UINT32> KMessageServer::clientIDs () const { - QValueList <Q_UINT32> list; - for (QPtrListIterator <KMessageIO> iter (d->mClientList); *iter; ++iter) + TQValueList <Q_UINT32> list; + for (TQPtrListIterator <KMessageIO> iter (d->mClientList); *iter; ++iter) list.append ((*iter)->id()); return list; } @@ -293,7 +293,7 @@ KMessageIO* KMessageServer::findClient (Q_UINT32 no) const if (no == 0) no = d->mAdminID; - QPtrListIterator <KMessageIO> iter (d->mClientList); + TQPtrListIterator <KMessageIO> iter (d->mClientList); while (*iter) { if ((*iter)->id() == no) @@ -322,8 +322,8 @@ void KMessageServer::setAdmin (Q_UINT32 adminID) d->mAdminID = adminID; - QByteArray msg; - QDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_ADMIN_ID) << adminID; + TQByteArray msg; + TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_ADMIN_ID) << adminID; // Tell everyone about the new master broadcastMessage (msg); @@ -339,26 +339,26 @@ Q_UINT32 KMessageServer::uniqueClientNumber() const // --------------------- Messages --------------------------- -void KMessageServer::broadcastMessage (const QByteArray &msg) +void KMessageServer::broadcastMessage (const TQByteArray &msg) { - for (QPtrListIterator <KMessageIO> iter (d->mClientList); *iter; ++iter) + for (TQPtrListIterator <KMessageIO> iter (d->mClientList); *iter; ++iter) (*iter)->send (msg); } -void KMessageServer::sendMessage (Q_UINT32 id, const QByteArray &msg) +void KMessageServer::sendMessage (Q_UINT32 id, const TQByteArray &msg) { KMessageIO *client = findClient (id); if (client) client->send (msg); } -void KMessageServer::sendMessage (const QValueList <Q_UINT32> &ids, const QByteArray &msg) +void KMessageServer::sendMessage (const TQValueList <Q_UINT32> &ids, const TQByteArray &msg) { - for (QValueListConstIterator <Q_UINT32> iter = ids.begin(); iter != ids.end(); ++iter) + for (TQValueListConstIterator <Q_UINT32> iter = ids.begin(); iter != ids.end(); ++iter) sendMessage (*iter, msg); } -void KMessageServer::getReceivedMessage (const QByteArray &msg) +void KMessageServer::getReceivedMessage (const TQByteArray &msg) { if (!sender() || !sender()->inherits("KMessageIO")) { @@ -369,7 +369,7 @@ void KMessageServer::getReceivedMessage (const QByteArray &msg) KMessageIO *client = (KMessageIO *) sender(); Q_UINT32 clientID = client->id(); - //QByteArray *ta=new QByteArray; + //TQByteArray *ta=new QByteArray; //ta->duplicate(msg); //d->mMessageQueue.enqueue (new MessageBuffer (clientID, *ta)); @@ -396,18 +396,18 @@ void KMessageServer::processOneMessage () MessageBuffer *msg_buf = d->mMessageQueue.head(); Q_UINT32 clientID = msg_buf->id; - QBuffer in_buffer (msg_buf->data); + TQBuffer in_buffer (msg_buf->data); in_buffer.open (IO_ReadOnly); - QDataStream in_stream (&in_buffer); + TQDataStream in_stream (&in_buffer); - QByteArray out_msg; - QBuffer out_buffer (out_msg); + TQByteArray out_msg; + TQBuffer out_buffer (out_msg); out_buffer.open (IO_WriteOnly); - QDataStream out_stream (&out_buffer); + TQDataStream out_stream (&out_buffer); bool unknown = false; - QByteArray ttt=in_buffer.buffer(); + TQByteArray ttt=in_buffer.buffer(); Q_UINT32 messageID; in_stream >> messageID; //kdDebug(11001) << k_funcinfo << ": got message with messageID=" << messageID << endl; @@ -416,19 +416,19 @@ void KMessageServer::processOneMessage () case REQ_BROADCAST: out_stream << Q_UINT32 (MSG_BROADCAST) << clientID; // FIXME, compiler bug? - // this should be okay, since QBuffer is subclass of QIODevice! : + // this should be okay, since TQBuffer is subclass of QIODevice! : // out_buffer.writeBlock (in_buffer.readAll()); - out_buffer.QIODevice::writeBlock (in_buffer.readAll()); + out_buffer.TQIODevice::writeBlock (in_buffer.readAll()); broadcastMessage (out_msg); break; case REQ_FORWARD: { - QValueList <Q_UINT32> clients; + TQValueList <Q_UINT32> clients; in_stream >> clients; out_stream << Q_UINT32 (MSG_FORWARD) << clientID << clients; // see above! - out_buffer.QIODevice::writeBlock (in_buffer.readAll()); + out_buffer.TQIODevice::writeBlock (in_buffer.readAll()); sendMessage (clients, out_msg); } break; @@ -455,9 +455,9 @@ void KMessageServer::processOneMessage () case REQ_REMOVE_CLIENT: if (clientID == d->mAdminID) { - QValueList <Q_UINT32> client_list; + TQValueList <Q_UINT32> client_list; in_stream >> client_list; - for (QValueListIterator <Q_UINT32> iter = client_list.begin(); iter != client_list.end(); ++iter) + for (TQValueListIterator <Q_UINT32> iter = client_list.begin(); iter != client_list.end(); ++iter) { KMessageIO *client = findClient (*iter); if (client) diff --git a/libkdegames/kgame/kmessageserver.h b/libkdegames/kgame/kmessageserver.h index 0049a2e7..3d0b1055 100644 --- a/libkdegames/kgame/kmessageserver.h +++ b/libkdegames/kgame/kmessageserver.h @@ -20,10 +20,10 @@ #ifndef __KMESSAGESERVER_H__ #define __KMESSAGESERVER_H__ -#include <qobject.h> -#include <qserversocket.h> -#include <qstring.h> -#include <qvaluelist.h> +#include <tqobject.h> +#include <tqserversocket.h> +#include <tqstring.h> +#include <tqvaluelist.h> class KMessageIO; class KMessageServerPrivate; @@ -42,7 +42,7 @@ class KMessageServerPrivate; KMessageDirect.) This object already has to be connected. The messages are always packages of an arbitrary length. The format of the messages - is given below. All the data is stored and received with QDataStream, to be + is given below. All the data is stored and received with TQDataStream, to be platform independant. Setting up a KMessageServer can be done like this: @@ -72,53 +72,53 @@ class KMessageServerPrivate; This is always interpreted as the admin client, independant of its real clientID. Here is a list of the messages the KMessageServer understands: - << means, the value is inserted into the QByteArray using QDataStream. The + << means, the value is inserted into the TQByteArray using TQDataStream. The messageIDs (REQ_BROADCAST, ...) are of type Q_UINT32. - - QByteArray << static_cast<Q_UINT32>( REQ_BROADCAST ) << raw_data + - TQByteArray << static_cast<Q_UINT32>( REQ_BROADCAST ) << raw_data When the server receives this message, it sends the following message to ALL connected clients (a broadcast), where the raw_data is left unchanged: - QByteArray << static_cast <Q_UINT32>( MSG_BROADCAST ) << clientID << raw_data + TQByteArray << static_cast <Q_UINT32>( MSG_BROADCAST ) << clientID << raw_data Q_UINT32 clientID; // the ID of the client that sent the broadcast request - - QByteArray << static_cast<Q_UINT32>( REQ_FORWARD ) << client_list << raw_data - QValueList <Q_UINT32> client_list; // list of receivers + - TQByteArray << static_cast<Q_UINT32>( REQ_FORWARD ) << client_list << raw_data + TQValueList <Q_UINT32> client_list; // list of receivers When the server receives this message, it sends the following message to the clients in client_list: - QByteArray << static_cast<Q_UINT32>( MSG_FORWARD ) << senderID << client_list << raw_data + TQByteArray << static_cast<Q_UINT32>( MSG_FORWARD ) << senderID << client_list << raw_data Q_UINT32 senderID; // the sender of the forward request - QValueList <Q_UINT32> client_list; // a copy of the receiver list + TQValueList <Q_UINT32> client_list; // a copy of the receiver list Note: Every client receives the message as many times as he is in the client_list. Note: Since the client_list is sent to all the clients, every client can see who else got the message. If you want to prevent this, send a single REQ_FORWARD message for every receiver. - - QByteArray << static_cast<Q_UINT32>( REQ_CLIENT_ID ) + - TQByteArray << static_cast<Q_UINT32>( REQ_CLIENT_ID ) When the server receives this message, it sends the following message to the asking client: - QByteArray << static_cast<Q_UINT32>( ANS_CLIENT_ID ) << clientID + TQByteArray << static_cast<Q_UINT32>( ANS_CLIENT_ID ) << clientID Q_UINT32 clientID; // The ID of the client who asked for it Note: This answer is also automatically sent to a new connected client, so that he can store his ID. The ID of a client doesn't change during his lifetime, and is unique for this KMessageServer. - - QByteArray << static_cast<Q_UINT32>( REQ_ADMIN_ID ) + - TQByteArray << static_cast<Q_UINT32>( REQ_ADMIN_ID ) When the server receives this message, it sends the following message to the asking client: - QByteArray << ANS_ADMIN_ID << adminID + TQByteArray << ANS_ADMIN_ID << adminID Q_UINT32 adminID; // The ID of the admin Note: This answer is also automatically sent to a new connected client, so that he can see if he is the admin or not. It will also be sent to all connected clients when a new admin is set (see REQ_ADMIN_CHANGE). - - QByteArray << static_cast<Q_UINT32>( REQ_ADMIN_CHANGE ) << new_admin + - TQByteArray << static_cast<Q_UINT32>( REQ_ADMIN_CHANGE ) << new_admin Q_UINT32 new_admin; // the ID of the new admin, or 0 for no admin When the server receives this message, it sets the admin to the new ID. If no client @@ -127,8 +127,8 @@ class KMessageServerPrivate; Note: The server sends a ANS_ADMIN_ID message to every connected client. - - QByteArray << static_cast<Q_UINT32>( REQ_REMOVE_CLIENT ) << client_list - QValueList <Q_UINT32> client_list; // The list of clients to be removed + - TQByteArray << static_cast<Q_UINT32>( REQ_REMOVE_CLIENT ) << client_list + TQValueList <Q_UINT32> client_list; // The list of clients to be removed When the server receives this message, it removes the clients with the ids stored in client_list, disconnecting the connection to them. @@ -137,7 +137,7 @@ class KMessageServerPrivate; Note: If one of the clients is the admin himself, he will also be deleted. Another client (if any left) will become the new admin. - - QByteArray << static_cast<Q_UINT32>( REQ_MAX_NUM_CLIENTS ) << maximum_clients + - TQByteArray << static_cast<Q_UINT32>( REQ_MAX_NUM_CLIENTS ) << maximum_clients Q_INT32 maximum_clients; // The maximum of clients connected, or infinite if -1 When the server receives this message, it limits the number of clients to the number given, @@ -147,12 +147,12 @@ class KMessageServerPrivate; Note: If there are already more clients, they are not affected. It only prevents new Clients to be added. To assure this limit, remove clients afterwards (REQ_REMOVE_CLIENT) - - QByteArray << static_cast<Q_UINT32>( REQ_CLIENT_LIST ) + - TQByteArray << static_cast<Q_UINT32>( REQ_CLIENT_LIST ) When the server receives this message, it answers by sending a list of IDs of all the clients that are connected at the moment. So it sends the following message to the asking client: - QByteArray << static_cast<Q_UINT32>( ANS_CLIENT_LIST ) << clientList - QValueList <Q_UINT32> clientList; // The IDs of the connected clients + TQByteArray << static_cast<Q_UINT32>( ANS_CLIENT_LIST ) << clientList + TQValueList <Q_UINT32> clientList; // The IDs of the connected clients Note: This message is also sent to every new connected client, so that he knows the other clients. @@ -160,10 +160,10 @@ class KMessageServerPrivate; There are two more messages that are sent from the server to the every client automatically when a new client connects or a connection to a client is lost: - QByteArray << static_cast<Q_UINT32>( EVNT_CLIENT_CONNECTED ) << clientID; + TQByteArray << static_cast<Q_UINT32>( EVNT_CLIENT_CONNECTED ) << clientID; Q_UINT32 clientID; // the ID of the new connected client - QByteArray << static_cast<Q_UINT32>( EVNT_CLIENT_DISCONNECTED ) << clientID; + TQByteArray << static_cast<Q_UINT32>( EVNT_CLIENT_DISCONNECTED ) << clientID; Q_UINT32 clientID; // the ID of the client that lost the connection Q_UINT8 broken; // 1 if the network connection was closed, 0 if it was disconnected // on purpose @@ -208,7 +208,7 @@ public: /** * Create a KGameNetwork object **/ - KMessageServer(Q_UINT16 cookie = 42, QObject* parent = 0); + KMessageServer(Q_UINT16 cookie = 42, TQObject* parent = 0); ~KMessageServer(); @@ -325,7 +325,7 @@ public: /** * returns a list of the unique IDs of all clients. **/ - QValueList <Q_UINT32> clientIDs() const; + TQValueList <Q_UINT32> clientIDs() const; /** * Find the @ref KMessageIO object to the given client number. @@ -375,7 +375,7 @@ public: * The message is NOT translated in any way. This method calls * @ref KMessageIO::send for every client added. **/ - virtual void broadcastMessage (const QByteArray &msg); + virtual void broadcastMessage (const TQByteArray &msg); /** * Sends a message to a single client with the given ID. @@ -385,7 +385,7 @@ public: * @ref findClient (id)->send(msg) manually, but this method checks for * errors. **/ - virtual void sendMessage (Q_UINT32 id, const QByteArray &msg); + virtual void sendMessage (Q_UINT32 id, const TQByteArray &msg); /** * Sends a message to a list of clients. Their ID is given in ids. If @@ -394,7 +394,7 @@ public: * This is just a convenience method. You could also iterate over the * list of IDs. **/ - virtual void sendMessage (const QValueList <Q_UINT32> &ids, const QByteArray &msg); + virtual void sendMessage (const TQValueList <Q_UINT32> &ids, const TQByteArray &msg); protected slots: /** @@ -406,7 +406,7 @@ protected slots: * @ref KMessageIO::received, since the sender() object is used to find out * the client that sent the message! **/ - virtual void getReceivedMessage (const QByteArray &msg); + virtual void getReceivedMessage (const TQByteArray &msg); /** * This slot is called whenever there are elements in the message queue. This queue @@ -448,7 +448,7 @@ signals: * @param clientID the ID of the KMessageIO object that received the message * @param unknown true, if the message type is not known by the KMessageServer **/ - void messageReceived (const QByteArray &data, Q_UINT32 clientID, bool &unknown); + void messageReceived (const TQByteArray &data, Q_UINT32 clientID, bool &unknown); protected: /** @@ -468,7 +468,7 @@ private: connections. NOTE: This has to be here in the header file, because it is a subclass from - QObject and has to go through the moc. + TQObject and has to go through the moc. @short An internal class for KServerSocket @author Burkhard Lehner <Burkhard.Lehner@gmx.de> @@ -478,7 +478,7 @@ class KMessageServerSocket : public QServerSocket Q_OBJECT public: - KMessageServerSocket (Q_UINT16 port, QObject *parent = 0); + KMessageServerSocket (Q_UINT16 port, TQObject *parent = 0); ~KMessageServerSocket (); void newConnection (int socket); diff --git a/libkdegames/kgame/kplayer.cpp b/libkdegames/kgame/kplayer.cpp index 0f8ea184..fdde20d9 100644 --- a/libkdegames/kgame/kplayer.cpp +++ b/libkdegames/kgame/kplayer.cpp @@ -31,7 +31,7 @@ #include <kdebug.h> #include <klocale.h> -#include <qbuffer.h> +#include <tqbuffer.h> #include <stdio.h> #include <assert.h> @@ -59,12 +59,12 @@ public: KGamePropertyQString mGroup; }; -KPlayer::KPlayer() : QObject(0,0) +KPlayer::KPlayer() : TQObject(0,0) { init(); } -KPlayer::KPlayer(KGame* game) : QObject(0, 0) +KPlayer::KPlayer(KGame* game) : TQObject(0, 0) { init(); game->addPlayer(this); @@ -78,8 +78,8 @@ void KPlayer::init() d = new KPlayerPrivate; d->mProperties.registerHandler(KGameMessage::IdPlayerProperty, - this,SLOT(sendProperty(int, QDataStream&, bool*)), - SLOT(emitSignal(KGamePropertyBase *))); + this,TQT_SLOT(sendProperty(int, TQDataStream&, bool*)), + TQT_SLOT(emitSignal(KGamePropertyBase *))); d->mVirtual=false; mActive=true; mGame=0; @@ -125,7 +125,7 @@ KPlayer::~KPlayer() // kdDebug(11001) << k_funcinfo << " done" << endl; } -bool KPlayer::forwardMessage(QDataStream &msg,int msgid,Q_UINT32 receiver,Q_UINT32 sender) +bool KPlayer::forwardMessage(TQDataStream &msg,int msgid,Q_UINT32 receiver,Q_UINT32 sender) { if (!isActive()) { @@ -139,7 +139,7 @@ bool KPlayer::forwardMessage(QDataStream &msg,int msgid,Q_UINT32 receiver,Q_UINT return game()->sendSystemMessage(msg,msgid,receiver,sender); } -bool KPlayer::forwardInput(QDataStream &msg,bool transmit,Q_UINT32 sender) +bool KPlayer::forwardInput(TQDataStream &msg,bool transmit,Q_UINT32 sender) { if (!isActive()) { @@ -180,16 +180,16 @@ void KPlayer::setId(Q_UINT32 newid) } -void KPlayer::setGroup(const QString& group) +void KPlayer::setGroup(const TQString& group) { d->mGroup = group; } -const QString& KPlayer::group() const +const TQString& KPlayer::group() const { return d->mGroup.value(); } -void KPlayer::setName(const QString& name) +void KPlayer::setName(const TQString& name) { d->mName = name; } -const QString& KPlayer::name() const +const TQString& KPlayer::name() const { return d->mName.value(); } Q_UINT32 KPlayer::id() const @@ -258,7 +258,7 @@ bool KPlayer::removeGameIO(KGameIO *targetinput,bool deleteit) KGameIO * KPlayer::findRttiIO(int rtti) const { - QPtrListIterator<KGameIO> it(mInputList); + TQPtrListIterator<KGameIO> it(mInputList); while (it.current()) { if (it.current()->rtti() == rtti) @@ -273,7 +273,7 @@ KGameIO * KPlayer::findRttiIO(int rtti) const int KPlayer::calcIOValue() { int value=0; - QPtrListIterator<KGameIO> it(mInputList); + TQPtrListIterator<KGameIO> it(mInputList); while (it.current()) { value|=it.current()->rtti(); @@ -311,7 +311,7 @@ bool KPlayer::setTurn(bool b, bool exclusive) return true; } -bool KPlayer::load(QDataStream &stream) +bool KPlayer::load(TQDataStream &stream) { Q_INT32 id,priority; stream >> id >> priority; @@ -337,7 +337,7 @@ bool KPlayer::load(QDataStream &stream) return true; } -bool KPlayer::save(QDataStream &stream) +bool KPlayer::save(TQDataStream &stream) { stream << (Q_INT32)id() << (Q_INT32)networkPriority(); @@ -350,7 +350,7 @@ bool KPlayer::save(QDataStream &stream) } -void KPlayer::networkTransmission(QDataStream &stream,int msgid,Q_UINT32 sender) +void KPlayer::networkTransmission(TQDataStream &stream,int msgid,Q_UINT32 sender) { //kdDebug(11001) << k_funcinfo ": msgid=" << msgid << " sender=" << sender << " we are=" << id() << endl; // PlayerProperties processed @@ -378,7 +378,7 @@ void KPlayer::networkTransmission(QDataStream &stream,int msgid,Q_UINT32 sender) break; default: emit signalNetworkData(msgid - KGameMessage::IdUser, - ((QBuffer*)stream.device())->readAll(),sender,this); + ((TQBuffer*)stream.device())->readAll(),sender,this); kdDebug(11001) << k_funcinfo << ": " << "User data msgid " << msgid << endl; break; @@ -396,7 +396,7 @@ bool KPlayer::addProperty(KGamePropertyBase* data) return d->mProperties.addProperty(data); } -void KPlayer::sendProperty(int msgid, QDataStream& stream, bool* sent) +void KPlayer::sendProperty(int msgid, TQDataStream& stream, bool* sent) { if (game()) { @@ -414,7 +414,7 @@ void KPlayer::emitSignal(KGamePropertyBase *me) if (me->id()==KGamePropertyBase::IdTurn) { //kdDebug(11001) << k_funcinfo << ": for KGamePropertyBase::IdTurn " << endl; - QPtrListIterator<KGameIO> it(mInputList); + TQPtrListIterator<KGameIO> it(mInputList); while (it.current()) { it.current()->notifyTurn(mMyTurn.value()); diff --git a/libkdegames/kgame/kplayer.h b/libkdegames/kgame/kplayer.h index 0e511ac3..a2d78929 100644 --- a/libkdegames/kgame/kplayer.h +++ b/libkdegames/kgame/kplayer.h @@ -21,9 +21,9 @@ #ifndef __KPLAYER_H_ #define __KPLAYER_H_ -#include <qstring.h> -#include <qobject.h> -#include <qptrlist.h> +#include <tqstring.h> +#include <tqobject.h> +#include <tqptrlist.h> #include "kgameproperty.h" #include <kdemacros.h> @@ -71,7 +71,7 @@ class KDE_EXPORT KPlayer : public QObject Q_OBJECT public: - typedef QPtrList<KGameIO> KGameIOList; + typedef TQPtrList<KGameIO> KGameIOList; // KPlayer(KGame *,KGameIO * input=0); /** @@ -259,24 +259,24 @@ public: * A group the player belongs to. This * Can be set arbitrary by you. */ - void setGroup(const QString& group); + void setGroup(const TQString& group); /** * Query the group the player belongs to. */ - virtual const QString& group() const; + virtual const TQString& group() const; /** * Sets the name of the player. * This can be chosen arbitrary. * @param name The player's name */ - void setName(const QString& name); + void setName(const TQString& name); /** * @return The name of the player. */ - virtual const QString& name() const; + virtual const TQString& name() const; // set devices @@ -333,12 +333,12 @@ public: * KGame::playerInput() (if player=false, ie the message *was* sent through * KGame::sendPlayerInput). */ - virtual bool forwardInput(QDataStream &msg,bool transmit=true, Q_UINT32 sender=0); + virtual bool forwardInput(TQDataStream &msg,bool transmit=true, Q_UINT32 sender=0); /** * Forwards Message to the game object..internal use only */ - virtual bool forwardMessage(QDataStream &msg,int msgid,Q_UINT32 receiver=0,Q_UINT32 sender=0); + virtual bool forwardMessage(TQDataStream &msg,int msgid,Q_UINT32 receiver=0,Q_UINT32 sender=0); // Game logic /** @@ -372,7 +372,7 @@ public: * * @return true? */ - virtual bool load(QDataStream &stream); + virtual bool load(TQDataStream &stream); /** * Save a player to a file OR to network. See also load @@ -381,7 +381,7 @@ public: * * @return true? */ - virtual bool save(QDataStream &stream); + virtual bool save(TQDataStream &stream); /** * Receives a message @@ -390,7 +390,7 @@ public: * @param stream The message itself * @param sender **/ - void networkTransmission(QDataStream &stream,int msgid,Q_UINT32 sender); + void networkTransmission(TQDataStream &stream,int msgid,Q_UINT32 sender); /** * Searches for a property of the player given its id. @@ -430,7 +430,7 @@ signals: * means probably a user message. Connecting to this signal * allowed to process it. */ - void signalNetworkData(int msgid, const QByteArray& buffer, Q_UINT32 sender, KPlayer *me); + void signalNetworkData(int msgid, const TQByteArray& buffer, Q_UINT32 sender, KPlayer *me); /** * This signal is emmited if a player property changes its value and @@ -444,7 +444,7 @@ protected slots: /** * Called by KGameProperty only! Internal function! **/ - void sendProperty(int msgid, QDataStream& stream, bool* sent); + void sendProperty(int msgid, TQDataStream& stream, bool* sent); /** * Called by KGameProperty only! Internal function! **/ |