diff options
Diffstat (limited to 'knights/io_internet.cpp')
-rw-r--r-- | knights/io_internet.cpp | 342 |
1 files changed, 171 insertions, 171 deletions
diff --git a/knights/io_internet.cpp b/knights/io_internet.cpp index e5325cd..b51dfb2 100644 --- a/knights/io_internet.cpp +++ b/knights/io_internet.cpp @@ -20,13 +20,13 @@ #include <kprocess.h> #include <kmessagebox.h> -/* Qt */ -#include <qobject.h> -#include <qwidget.h> -#include <qregexp.h> -#include <qdns.h> -#include <qsocket.h> -#include <qptrlist.h> +/* TQt */ +#include <tqobject.h> +#include <tqwidget.h> +#include <tqregexp.h> +#include <tqdns.h> +#include <tqsocket.h> +#include <tqptrlist.h> /* Local */ #include "io_internet.moc" @@ -45,7 +45,7 @@ static const int TXT_Sht = 3; static const int TXT_Wsp = 4; static const int TXT_Not = 5; -io_internet::io_internet( QWidget *parent, resource *rsrc ) +io_internet::io_internet( TQWidget *tqparent, resource *rsrc ) { myResource = rsrc; challenge = NULL; @@ -60,14 +60,14 @@ io_internet::io_internet( QWidget *parent, resource *rsrc ) /* initialize various variables */ this->waiting_for_move_list = false; - this->myParent = parent; + this->myParent = tqparent; connected = false; /* we are not connected to a server */ /* create the login dialog and show it to the user */ loginDlg = new dlg_login( myParent, "LoginDialog", myResource); - connect(loginDlg, SIGNAL( okClicked() ), this, SLOT( connectToServer() ) ); - connect(loginDlg, SIGNAL( cancelClicked() ), this, SLOT( selfDestruct() ) ); - connect(loginDlg, SIGNAL( login(QString, QString) ), this, SLOT( setUserInfo(QString, QString) ) ); + connect(loginDlg, TQT_SIGNAL( okClicked() ), this, TQT_SLOT( connectToServer() ) ); + connect(loginDlg, TQT_SIGNAL( cancelClicked() ), this, TQT_SLOT( selfDestruct() ) ); + connect(loginDlg, TQT_SIGNAL( login(TQString, TQString) ), this, TQT_SLOT( setUserInfo(TQString, TQString) ) ); } /////////////////////////////////////////////////////////// @@ -105,7 +105,7 @@ io_internet::~io_internet() { if(myResource->tabManager->isTab(*i)) { - myResource->tabManager->removeTab(*i); + myResource->tabManager->removeTab(TQT_TQOBJECT(*i)); } } } @@ -113,11 +113,11 @@ io_internet::~io_internet() void io_internet::connectToServer() { serverList::iterator i; - QWidget *tempTab; - QWidget *consoleTab; - QValueList<Command>::iterator j; + TQWidget *tempTab; + TQWidget *consoleTab; + TQValueList<Command>::iterator j; - qApp->mainWidget()->setCursor( myResource->CURSOR_Thinking ); + tqApp->mainWidget()->setCursor( myResource->CURSOR_Thinking ); /* Get and parse server config from resource */ myServer = NULL; for( i = myResource->servers.begin(); i != myResource->servers.end(); i++ ) @@ -130,10 +130,10 @@ void io_internet::connectToServer() if(myServer == NULL) { /* No server configured. Notify User and die gracefully */ - qApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); + tqApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); kdError() << "internetio::internetio: Can not find server resource CurrentRef " << endl; - KMessageBox::sorry( (QWidget*)myParent, i18n( "There are no servers configured.\nPlease make sure you have at least one server configured." ), i18n( "Cannot find a server.")); - QApplication::postEvent( qApp->mainWidget(), new QCustomEvent( EVENT_Del_IO_Net ) ); + KMessageBox::sorry( (TQWidget*)myParent, i18n( "There are no servers configured.\nPlease make sure you have at least one server configured." ), i18n( "Cannot find a server.")); + TQApplication::postEvent( tqApp->mainWidget(), new TQCustomEvent( EVENT_Del_IO_Net ) ); return; } @@ -145,14 +145,14 @@ void io_internet::connectToServer() if(!myServer->Timeseal.isEmpty()) { myTimeseal = new KProcess(); - (*myTimeseal) << myServer->Timeseal << myServer->URL << QString().setNum( myServer->Port ) - << QString( "-p" ) << QString().setNum(myServer->Port + 1); + (*myTimeseal) << myServer->Timeseal << myServer->URL << TQString().setNum( myServer->Port ) + << TQString( "-p" ) << TQString().setNum(myServer->Port + 1); if(!myTimeseal->start()) { /* Couldn't start Timeseal. Notify User and die gracefully */ - qApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); - KMessageBox::sorry( (QWidget*)myParent, i18n( "Knights can not start Timeseal.\nPlease make sure you have the correct path and filename configured." ), i18n( "Cannot find Timeseal.")); - QApplication::postEvent( qApp->mainWidget(), new QCustomEvent( EVENT_Del_IO_Net ) ); + tqApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); + KMessageBox::sorry( (TQWidget*)myParent, i18n( "Knights can not start Timeseal.\nPlease make sure you have the correct path and filename configured." ), i18n( "Cannot find Timeseal.")); + TQApplication::postEvent( tqApp->mainWidget(), new TQCustomEvent( EVENT_Del_IO_Net ) ); return; } socket = new KSocket("127.0.0.1", myServer->Port + 1, 30); @@ -163,14 +163,14 @@ void io_internet::connectToServer() myTimeseal->kill(); myTimeseal = new KProcess(); - (*myTimeseal) << myServer->Timeseal << myServer->URL << QString().setNum( myServer->Port ) - << QString( "-p" ) << QString().setNum(myServer->Port + 2); + (*myTimeseal) << myServer->Timeseal << myServer->URL << TQString().setNum( myServer->Port ) + << TQString( "-p" ) << TQString().setNum(myServer->Port + 2); if(!myTimeseal->start()) { /* Couldn't start Timeseal. Notify User and die gracefully */ - qApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); - KMessageBox::sorry( (QWidget*)myParent, i18n( "Knights can not start Timeseal.\nPlease make sure you have the correct path and filename configured." ), i18n( "Cannot find Timeseal.")); - QApplication::postEvent( qApp->mainWidget(), new QCustomEvent( EVENT_Del_IO_Net ) ); + tqApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); + KMessageBox::sorry( (TQWidget*)myParent, i18n( "Knights can not start Timeseal.\nPlease make sure you have the correct path and filename configured." ), i18n( "Cannot find Timeseal.")); + TQApplication::postEvent( tqApp->mainWidget(), new TQCustomEvent( EVENT_Del_IO_Net ) ); return; } socket = new KSocket("127.0.0.1", myServer->Port + 2, 30); @@ -178,9 +178,9 @@ void io_internet::connectToServer() { /* if we can't do it the second time, give up */ /* Couldn't connect to server through Timeseal. Notify User and die gracefully */ - qApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); - KMessageBox::sorry( (QWidget*)myParent, i18n( "Knights is unable to connect to the server.\n Please make sure your internet connection is working and try again."), i18n( "Cannot connect to server(timeseal).")); - QApplication::postEvent( qApp->mainWidget(), new QCustomEvent( EVENT_Del_IO_Net ) ); + tqApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); + KMessageBox::sorry( (TQWidget*)myParent, i18n( "Knights is unable to connect to the server.\n Please make sure your internet connection is working and try again."), i18n( "Cannot connect to server(timeseal).")); + TQApplication::postEvent( tqApp->mainWidget(), new TQCustomEvent( EVENT_Del_IO_Net ) ); return; } } @@ -191,9 +191,9 @@ void io_internet::connectToServer() if(socket->socket() == -1) { /* Couldn't connect to server. Notify User and die gracefully */ - qApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); - KMessageBox::sorry( (QWidget*)myParent, i18n( "Knights is unable to connect to the server.\n Please make sure your internet connection is working and try again."), i18n( "Cannot connect to server.")); - QApplication::postEvent( qApp->mainWidget(), new QCustomEvent( EVENT_Del_IO_Net ) ); + tqApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); + KMessageBox::sorry( (TQWidget*)myParent, i18n( "Knights is unable to connect to the server.\n Please make sure your internet connection is working and try again."), i18n( "Cannot connect to server.")); + TQApplication::postEvent( tqApp->mainWidget(), new TQCustomEvent( EVENT_Del_IO_Net ) ); return; } } @@ -201,11 +201,11 @@ void io_internet::connectToServer() socket->enableWrite(true); /* connect a signal to readReady */ - connect(socket, SIGNAL(readEvent(KSocket *)), this, SLOT(readCommand(KSocket *))); + connect(socket, TQT_SIGNAL(readEvent(KSocket *)), this, TQT_SLOT(readCommand(KSocket *))); /* setup the seekTimer and turn it off by default */ - seekTimer = new QTimer(this); - connect(seekTimer, SIGNAL(timeout()), this, SLOT(processSeekTimer())); + seekTimer = new TQTimer(this); + connect(seekTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(processSeekTimer())); /* succesfully connected to the server, turn connected on and flush the command buffer */ connected = true; @@ -223,28 +223,28 @@ void io_internet::connectToServer() */ consoleTab = new Console( 0, myServer->Name, myResource ); myTabList[consoleTab] = consoleTab; - myResource->tabManager->addTab( myTabList[consoleTab], i18n( "%1 Console" ).arg( myServer->Name ) ); - connect( myTabList[consoleTab], SIGNAL( sendCMD( const Command& ) ), this, SLOT( recvCMD( const Command& ) ) ); - connect( this, SIGNAL( sendCMD( const Command& ) ), myTabList[consoleTab], SLOT( recvCMD( const Command& ) ) ); + myResource->tabManager->addTab( myTabList[consoleTab], i18n( "%1 Console" ).tqarg( myServer->Name ) ); + connect( myTabList[consoleTab], TQT_SIGNAL( sendCMD( const Command& ) ), this, TQT_SLOT( recvCMD( const Command& ) ) ); + connect( this, TQT_SIGNAL( sendCMD( const Command& ) ), myTabList[consoleTab], TQT_SLOT( recvCMD( const Command& ) ) ); tempTab = new tab_SeekList( 0, "seekList", myResource ); myTabList[tempTab] = tempTab; myResource->tabManager->addTab( myTabList[tempTab], i18n( "Sought Matches List" ) ); - connect( myTabList[tempTab], SIGNAL( sendCMD( const Command& ) ), this, SLOT( recvCMD( const Command& ) ) ); - connect( this, SIGNAL( sendCMD( const Command& ) ), myTabList[tempTab], SLOT( recvCMD( const Command& ) ) ); + connect( myTabList[tempTab], TQT_SIGNAL( sendCMD( const Command& ) ), this, TQT_SLOT( recvCMD( const Command& ) ) ); + connect( this, TQT_SIGNAL( sendCMD( const Command& ) ), myTabList[tempTab], TQT_SLOT( recvCMD( const Command& ) ) ); tempTab = new Challenge_Graph( 0, "seekGraph", myResource ); myTabList[tempTab] = tempTab; myResource->tabManager->addTab( myTabList[tempTab], i18n( "Sought Matches Graph" ) ); - connect( myTabList[tempTab], SIGNAL( sendCMD( const Command& ) ), this, SLOT( recvCMD( const Command& ) ) ); - connect( this, SIGNAL( sendCMD( const Command& ) ), myTabList[tempTab], SLOT( recvCMD( const Command& ) ) ); + connect( myTabList[tempTab], TQT_SIGNAL( sendCMD( const Command& ) ), this, TQT_SLOT( recvCMD( const Command& ) ) ); + connect( this, TQT_SIGNAL( sendCMD( const Command& ) ), myTabList[tempTab], TQT_SLOT( recvCMD( const Command& ) ) ); myResource->tabManager->showTab(consoleTab); /* ...log file */ if( !myServer->LogFile.isEmpty() ) { - Log = new QFile( myServer->LogFile ); + Log = new TQFile( myServer->LogFile ); if( !Log->open( IO_WriteOnly | IO_Append ) ) { if( !Log->open( IO_WriteOnly ) ) @@ -253,12 +253,12 @@ void io_internet::connectToServer() } } } - qApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); + tqApp->mainWidget()->setCursor( myResource->CURSOR_Standard ); } void io_internet::recvCMD(const Command& command) { - QString error_message; + TQString error_message; if(!connected) { @@ -311,7 +311,7 @@ void io_internet::recvCMD(const Command& command) sendCMD( command ); break; case CMD_Send_To_ICS: - if(((Command)command).getData().contains(QRegExp("^(?:\\.|tell)"))) + if(((Command)command).getData().tqcontains(TQRegExp("^(?:\\.|tell)"))) { writeToConsole(((Command)command).getData(), "K_PVT"); } @@ -344,9 +344,9 @@ void io_internet::recvCMD(const Command& command) // io_internet::send // /////////////////////////////////////// -void io_internet::send(const QString& msg) +void io_internet::send(const TQString& msg) { - QString tmp(msg); + TQString tmp(msg); ssize_t len; /* Attach events to specific outgoing text */ @@ -369,7 +369,7 @@ void io_internet::send(const QString& msg) if( Log ) { - Log->writeBlock( QString("<< ").latin1(), 3 ); + Log->writeBlock( TQString("<< ").latin1(), 3 ); Log->writeBlock( tmp.latin1(), tmp.length() ); } if( len < (signed)tmp.length() ) @@ -386,8 +386,8 @@ void io_internet::send(const QString& msg) void io_internet::readCommand(KSocket* socket) { char buffer[READ_BUFFER_SIZE]; - QString tmp; - QStringList lines; + TQString tmp; + TQStringList lines; memset(buffer, 0, READ_BUFFER_SIZE); read(socket->socket(), buffer, READ_BUFFER_SIZE); @@ -406,7 +406,7 @@ void io_internet::readCommand(KSocket* socket) } else { - lines = QStringList::split( QRegExp("\n\r?"), tmp, FALSE ); + lines = TQStringList::split( TQRegExp("\n\r?"), tmp, FALSE ); if(!(tmp.endsWith("\n\r") || tmp.endsWith("\n"))) { lineBuffer = (*(--lines.end())); @@ -415,11 +415,11 @@ void io_internet::readCommand(KSocket* socket) { lineBuffer = ""; } - for(QStringList::iterator i = lines.begin(); i != lines.end(); i++) + for(TQStringList::iterator i = lines.begin(); i != lines.end(); i++) { if(lineBuffer == "" || i != --lines.end()) { - (*i).replace( QRegExp( "\\a" ), "" ); + (*i).tqreplace( TQRegExp( "\\a" ), "" ); parseLine(*i); } } @@ -450,37 +450,37 @@ void io_internet::sendPassword() // io_internet::parseLoginData // /////////////////////////////////////// -void io_internet::parseLoginData( QString data ) +void io_internet::parseLoginData( TQString data ) { - QStringList lines; + TQStringList lines; if(loginStage == LOGIN_STAGE_NAME) { - if(data.contains( "login:" )) + if(data.tqcontains( "login:" )) { sendUserName(); } - lines = QStringList::split( QRegExp("\n\r?"), data, FALSE ); - for(QStringList::iterator i = lines.begin(); i != lines.end(); i++) + lines = TQStringList::split( TQRegExp("\n\r?"), data, FALSE ); + for(TQStringList::iterator i = lines.begin(); i != lines.end(); i++) { writeToConsole((*i), "K_STD"); } } else if(loginStage == LOGIN_STAGE_PASSWORD) { - if(data.contains("**** Invalid password! ****") || - data.contains("Sorry, names can only consist of lower and upper case letters. Try again.") || - data.contains("If you are not a registered player, enter guest or a unique ID.")) + if(data.tqcontains("**** Invalid password! ****") || + data.tqcontains("Sorry, names can only consist of lower and upper case letters. Try again.") || + data.tqcontains("If you are not a registered player, enter guest or a unique ID.")) { loginDlg = new dlg_login( myParent, "LoginDialog", myResource); loginDlg->disableServerSelect(); - connect(loginDlg, SIGNAL( okClicked() ), this, SLOT( sendUserName() ) ); - connect(loginDlg, SIGNAL( cancelClicked() ), this, SLOT( selfDestruct() ) ); - connect(loginDlg, SIGNAL( login(QString, QString) ), this, SLOT( setUserInfo(QString, QString) ) ); + connect(loginDlg, TQT_SIGNAL( okClicked() ), this, TQT_SLOT( sendUserName() ) ); + connect(loginDlg, TQT_SIGNAL( cancelClicked() ), this, TQT_SLOT( selfDestruct() ) ); + connect(loginDlg, TQT_SIGNAL( login(TQString, TQString) ), this, TQT_SLOT( setUserInfo(TQString, TQString) ) ); } - else if(data.contains("Press return to enter the server as")) + else if(data.tqcontains("Press return to enter the server as")) { - QRegExp guestName("Logging you in as \"(\\w*)\""); + TQRegExp guestName("Logging you in as \"(\\w*)\""); int pos = guestName.search(data); if(pos > -1) { @@ -488,7 +488,7 @@ void io_internet::parseLoginData( QString data ) } send("\n"); } - else if(data.contains("password:")) + else if(data.tqcontains("password:")) { sendPassword(); } @@ -497,16 +497,16 @@ void io_internet::parseLoginData( QString data ) loginStage = LOGIN_STAGE_LOGGED_IN; sendUserSettings(); } - lines = QStringList::split( QRegExp("\n\r?"), data, FALSE ); - for(QStringList::iterator i = lines.begin(); i != lines.end(); i++) + lines = TQStringList::split( TQRegExp("\n\r?"), data, FALSE ); + for(TQStringList::iterator i = lines.begin(); i != lines.end(); i++) { writeToConsole((*i), "K_STD"); } } else { - lines = QStringList::split( QRegExp("\n\r?"), data, FALSE ); - for(QStringList::iterator i = lines.begin(); i != lines.end(); i++) + lines = TQStringList::split( TQRegExp("\n\r?"), data, FALSE ); + for(TQStringList::iterator i = lines.begin(); i != lines.end(); i++) { writeToConsole((*i), "K_STD"); } @@ -518,21 +518,21 @@ void io_internet::parseLoginData( QString data ) // io_internet::ParseLine // /////////////////////////////////////// -void io_internet::parseLine( QString line ) +void io_internet::parseLine( TQString line ) { int i, j; - QString tmp; + TQString tmp; switch(parseMode) { case NORMAL_MODE: /* determine which mode we should go into */ - if(line.contains(QRegExp("^\\s*\\d{1,3}\\s+(?:\\d{1,4}|\\+\\+\\+\\+|\\-\\-\\-\\-)\\s+\\w{3,17}(\\(C\\))?\\s+\\d{1,3}\\s+\\d{1,3}"))) + if(line.tqcontains(TQRegExp("^\\s*\\d{1,3}\\s+(?:\\d{1,4}|\\+\\+\\+\\+|\\-\\-\\-\\-)\\s+\\w{3,17}(\\(C\\))?\\s+\\d{1,3}\\s+\\d{1,3}"))) { updateSoughtList(line); parseMode = UPDATE_SOUGHT_MODE; } /* CHALLENGE */ - else if( line.contains(QRegExp("^\\s*Challenge: "))) + else if( line.tqcontains(TQRegExp("^\\s*Challenge: "))) { myResource->play( SND_CHALLENGE ); if( challenge != NULL ) @@ -540,10 +540,10 @@ void io_internet::parseLine( QString line ) delete challenge; } challenge = new dlg_challenge( 0, "Challenge", myResource ); - connect( challenge, SIGNAL( destroyed() ), this, SLOT( nullifyChallenge() ) ); - connect( challenge, SIGNAL( user1Clicked() ), this, SLOT( acceptChallenge() ) ); - connect( challenge, SIGNAL( user2Clicked() ), this, SLOT( declineChallenge() ) ); - line.replace(QRegExp("^\\s*Challenge: "), ""); + connect( challenge, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( nullifyChallenge() ) ); + connect( challenge, TQT_SIGNAL( user1Clicked() ), this, TQT_SLOT( acceptChallenge() ) ); + connect( challenge, TQT_SIGNAL( user2Clicked() ), this, TQT_SLOT( declineChallenge() ) ); + line.tqreplace(TQRegExp("^\\s*Challenge: "), ""); challenge->setValues( line, userName ); parseMode = CHALLENGE_MODE; } @@ -555,12 +555,12 @@ void io_internet::parseLine( QString line ) } } /* SOUGHT GAME */ - else if(line.contains("seeking")) + else if(line.tqcontains("seeking")) { // writeToConsole("seeking", "K_CH"); } /* PRIVATE TELL */ - else if(line.contains(QRegExp(".+ tells you: .*"))) + else if(line.tqcontains(TQRegExp(".+ tells you: .*"))) { /* First grab the user name so we can auto-respond later */ emit sendCMD( Command( 0, CMD_Set_Src_Tell, line.section(' ', 0, 0) ) ); @@ -568,19 +568,19 @@ void io_internet::parseLine( QString line ) writeToConsole(line, "K_PVT"); } /* SAY */ - else if(line.contains( QRegExp(".+ says: .*"))) + else if(line.tqcontains( TQRegExp(".+ says: .*"))) { myResource->play(SND_SAY); writeToConsole(line, "K_PVT"); return; } /* WHISPER & KIBITZ */ - else if(line.contains(QRegExp(".+ whispers: .*")) || line.contains(QRegExp(".+ kibitzes: .*"))) + else if(line.tqcontains(TQRegExp(".+ whispers: .*")) || line.tqcontains(TQRegExp(".+ kibitzes: .*"))) { writeToConsole(line, "K_WSP"); } /* Important System Messages: Use Whisper Color */ - else if(line.contains(QRegExp("declines the draw request\\.$" ))) + else if(line.tqcontains(TQRegExp("declines the draw request\\.$" ))) { writeToConsole(line, "K_WSP"); } @@ -589,57 +589,57 @@ void io_internet::parseLine( QString line ) { writeToConsole(line, "K_WSP"); } - else if( line.contains( QRegExp(".+rating adjustment:.+" ) ) ) + else if( line.tqcontains( TQRegExp(".+rating adjustment:.+" ) ) ) { writeToConsole(line, "K_WSP"); } /* SHOUTS */ - else if( line.contains( QRegExp("^c?t?s?-?shouts: ") ) ) + else if( line.tqcontains( TQRegExp("^c?t?s?-?shouts: ") ) ) { writeToConsole(line, "K_SHT"); } /* NOTIFY */ - else if((line.contains(QRegExp("\\s*Notification:"))) || - (line.contains(QRegExp("\\s*Present company includes:"))) || - (line.contains(QRegExp("\\s*Your arrival was noted by:")))) + else if((line.tqcontains(TQRegExp("\\s*Notification:"))) || + (line.tqcontains(TQRegExp("\\s*Present company includes:"))) || + (line.tqcontains(TQRegExp("\\s*Your arrival was noted by:")))) { writeToConsole(line, "K_NOT"); myResource->play( SND_NOTIFICATION ); } /* CHANNEL TELLS */ - else if(line.contains(QRegExp( ".\\(\\d+\\):" ))) + else if(line.tqcontains(TQRegExp( ".\\(\\d+\\):" ))) { /* First grab the channel # so we can auto-respond later */ - j = line.find(QString("):")); - i = line.findRev(QString("("), j) + 1; + j = line.tqfind(TQString("):")); + i = line.tqfindRev(TQString("("), j) + 1; emit sendCMD( Command( 0, CMD_Set_Src_Channel, line.mid(i, j - i) ) ); writeToConsole(line, "K_CH"); } - else if(line.contains(QRegExp("^<12>\\s"))) + else if(line.tqcontains(TQRegExp("^<12>\\s"))) { /* a game move */ parseStyle12(line, PARSE12_MODE_MOVE); } - else if(line.contains(QRegExp("^<b1>\\s"))) + else if(line.tqcontains(TQRegExp("^<b1>\\s"))) { /* a bughouse piece has been passed or a piece has been captured in crazyhouse */ writeToConsole(line, "K_CH"); } - else if(line.contains(QRegExp("^\\\\"))) + else if(line.tqcontains(TQRegExp("^\\\\"))) { writeToConsole(line, lastTag); } - else if(line.contains(QRegExp("^\\{?Game \\d+")) && line.contains("Creating", TRUE)) + else if(line.tqcontains(TQRegExp("^\\{?Game \\d+")) && line.tqcontains("Creating", TRUE)) { parseMode = NEW_GAME_MODE; } - else if(line.contains("You are now observing game")) + else if(line.tqcontains("You are now observing game")) { parseMode = OBSERVE_GAME_MODE; } else if(line.startsWith("Movelist for game")) { - QRegExp gameNumber("\\d+"); + TQRegExp gameNumber("\\d+"); int pos = gameNumber.search(line); if(pos > -1) { @@ -647,21 +647,21 @@ void io_internet::parseLine( QString line ) } parseMode = PARSE_MOVE_LIST_MODE; } - else if((line.contains(QRegExp("^\\{?Game \\d+")) || line.contains(QRegExp("Game \\d+"))) && + else if((line.tqcontains(TQRegExp("^\\{?Game \\d+")) || line.tqcontains(TQRegExp("Game \\d+"))) && ( - line.contains(" forfeits by disconnection", TRUE) || - line.contains(" forfeits by disconnection}", TRUE) || - line.contains(" forfeits on time} ", TRUE) || - line.contains(" forfeits on time ", TRUE) || - line.contains(" resigns} ", TRUE) || - line.contains(" resigns ", TRUE) || - line.contains(" Game drawn by mutual agreement ", TRUE) || - line.contains(" Game drawn by mutual agreement} ", TRUE) || - line.contains(", has lost contact or quit.", TRUE) || - line.contains(" checkmated ", TRUE) || - line.contains(" checkmated} ", TRUE) || - line.contains("lost connection", TRUE) || - line.contains("has no material to mate", TRUE) + line.tqcontains(" forfeits by disconnection", TRUE) || + line.tqcontains(" forfeits by disconnection}", TRUE) || + line.tqcontains(" forfeits on time} ", TRUE) || + line.tqcontains(" forfeits on time ", TRUE) || + line.tqcontains(" resigns} ", TRUE) || + line.tqcontains(" resigns ", TRUE) || + line.tqcontains(" Game drawn by mutual agreement ", TRUE) || + line.tqcontains(" Game drawn by mutual agreement} ", TRUE) || + line.tqcontains(", has lost contact or quit.", TRUE) || + line.tqcontains(" checkmated ", TRUE) || + line.tqcontains(" checkmated} ", TRUE) || + line.tqcontains("lost connection", TRUE) || + line.tqcontains("has no material to mate", TRUE) ) ) { @@ -671,15 +671,15 @@ void io_internet::parseLine( QString line ) { /* don't know what to do with it, just send it to the console */ /* don't write the prompt to the console */ - if( line.contains( QRegExp( "^a?d?f?g?s?z?ics% " ) ) || - line.contains( QRegExp( "^cex% " ) ) || - line.contains( QRegExp( "^chess% " ) ) ) + if( line.tqcontains( TQRegExp( "^a?d?f?g?s?z?ics% " ) ) || + line.tqcontains( TQRegExp( "^cex% " ) ) || + line.tqcontains( TQRegExp( "^chess% " ) ) ) break; writeToConsole(line, "K_STD"); } break; case UPDATE_SOUGHT_MODE: - if(line.contains(QRegExp("\\d+\\s+ads? displayed."))) + if(line.tqcontains(TQRegExp("\\d+\\s+ads? displayed."))) { updateSoughtList(line); parseMode = NORMAL_MODE; @@ -690,7 +690,7 @@ void io_internet::parseLine( QString line ) } break; case NEW_GAME_MODE: - if(line.contains(QRegExp("<12>\\s"))) + if(line.tqcontains(TQRegExp("<12>\\s"))) { /* a game move */ parseStyle12(line, PARSE12_MODE_NEW); @@ -701,7 +701,7 @@ void io_internet::parseLine( QString line ) } break; case OBSERVE_GAME_MODE: - if(line.contains(QRegExp("<12>\\s"))) + if(line.tqcontains(TQRegExp("<12>\\s"))) { /* a game move */ parseStyle12(line, PARSE12_MODE_NEW); @@ -716,9 +716,9 @@ void io_internet::parseLine( QString line ) } break; case PARSE_MOVE_LIST_MODE: - if(!line.contains("{Still in progress}")) + if(!line.tqcontains("{Still in progress}")) { - if(line.contains(QRegExp("\\d\\."))) + if(line.tqcontains(TQRegExp("\\d\\."))) { parseMoveList(line); } @@ -738,13 +738,13 @@ void io_internet::parseLine( QString line ) // io_internet::ParseStyle12 // /////////////////////////////////////// -void io_internet::parseStyle12(QString line, const unsigned int Mode) +void io_internet::parseStyle12(TQString line, const unsigned int Mode) { // kdWarning() << line << endl; struct ChessMove move; - QStringList fields; - QString position_line = ""; + TQStringList fields; + TQString position_line = ""; match_param *param = NULL; Command::clearMove(&move); switch(Mode) @@ -753,7 +753,7 @@ void io_internet::parseStyle12(QString line, const unsigned int Mode) { /* a new game that we are playing, or observing */ param = new match_param(this->myResource); - fields = QStringList::split( QChar(' '), line, FALSE ); + fields = TQStringList::split( TQChar(' '), line, FALSE ); /* set white time control */ TCPList tmpListWhite(param->time(WHITE)); @@ -808,7 +808,7 @@ void io_internet::parseStyle12(QString line, const unsigned int Mode) } case PARSE12_MODE_MOVE: { - fields = QStringList::split( QChar(' '), line, FALSE ); + fields = TQStringList::split( TQChar(' '), line, FALSE ); /* various ICS stuff for ChessMove */ move.ICS_ClockTicking = fields[31].toInt(); @@ -847,9 +847,9 @@ void io_internet::parseStyle12(QString line, const unsigned int Mode) } /* Verbose Coordinate Notation of previous move ( USE AS CAN ) */ - strcpy(move.CAN, fields[27].right(fields[27].length() - 2).replace(QRegExp("-"), "")); + strcpy(move.CAN, fields[27].right(fields[27].length() - 2).tqreplace(TQRegExp("-"), "")); /* SAN */ - strcpy(move.SAN, fields[29].replace(QRegExp("\\+"), "").replace(QRegExp("#"), "")); + strcpy(move.SAN, fields[29].tqreplace(TQRegExp("\\+"), "").tqreplace(TQRegExp("#"), "")); /* fill the line for the command */ position_line += fields[1]; /* Internal Rank #7 */ @@ -885,35 +885,35 @@ void io_internet::parseStyle12(QString line, const unsigned int Mode) // io_internet::ParsePlayer // /////////////////////////////////////// -//void io_internet::ParsePlayer( QString Handle ) +//void io_internet::ParsePlayer( TQString Handle ) //{ // player.Raw = Handle; /* SysAdmin */ -// if( Handle.contains( QRegExp("\\(\\*\\)") ) ) +// if( Handle.tqcontains( TQRegExp("\\(\\*\\)") ) ) // { // player.SysAdmin = TRUE; -// Handle.replace( QRegExp("\\(\\*\\)"), QString("") ); +// Handle.tqreplace( TQRegExp("\\(\\*\\)"), TQString("") ); // } // else player.SysAdmin = FALSE; /* ServiceRep */ -// if( Handle.contains( QRegExp("\\(SR\\)") ) ) +// if( Handle.tqcontains( TQRegExp("\\(SR\\)") ) ) // { // player.ServiceRep = TRUE; -// Handle.replace( QRegExp("\\(SR\\)"), QString("") ); +// Handle.tqreplace( TQRegExp("\\(SR\\)"), TQString("") ); // } // else player.ServiceRep = FALSE; /* Computer */ -// if( Handle.contains( QRegExp("\\(C\\)") ) ) +// if( Handle.tqcontains( TQRegExp("\\(C\\)") ) ) // { // player.Computer = TRUE; -// Handle.replace( QRegExp("\\(C\\)"), QString("") ); +// Handle.tqreplace( TQRegExp("\\(C\\)"), TQString("") ); // } // else player.Computer = FALSE; /* Unregistered */ -// if( Handle.contains( QRegExp("\\(U\\)") ) ) +// if( Handle.tqcontains( TQRegExp("\\(U\\)") ) ) // { // player.Unregistered = TRUE; -// Handle.replace( QRegExp("\\(U\\)"), QString("") ); +// Handle.tqreplace( TQRegExp("\\(U\\)"), TQString("") ); // } // else player.Unregistered = FALSE; // return; @@ -956,17 +956,17 @@ void io_internet::acceptChallenge( void ) // io_internet::writeToConsole // /////////////////////////////////////// -void io_internet::writeToConsole(QString text, QString tag) +void io_internet::writeToConsole(TQString text, TQString tag) { lastTag = tag; /* Remove Bells */ - text.replace( QRegExp("\\x0007") , "" ); + text.tqreplace( TQRegExp("\\x0007") , "" ); /* Replace misc characters with rich-text friendly counterparts */ - text.replace( QRegExp("\\x003c"), "<" ); - text.replace( QRegExp("\\x007c"), "|" ); - text.replace( QRegExp( "\\f"), ""); - text.replace( QRegExp( "\\n"), ""); - text.replace( QRegExp( "\\r*" ), "" ); + text.tqreplace( TQRegExp("\\x003c"), "<" ); + text.tqreplace( TQRegExp("\\x007c"), "|" ); + text.tqreplace( TQRegExp( "\\f"), ""); + text.tqreplace( TQRegExp( "\\n"), ""); + text.tqreplace( TQRegExp( "\\r*" ), "" ); emit sendCMD( Command( 0, CMD_Append_To_Console, "<" + tag + ">" + text + "</" + tag + ">" ) ); } @@ -975,10 +975,10 @@ void io_internet::writeToConsole(QString text, QString tag) // io_internet::updateSoughtList // /////////////////////////////////////// -void io_internet::updateSoughtList(QString soughtLine) +void io_internet::updateSoughtList(TQString soughtLine) { /* "ADS DISPLAYED" MESSAGE */ - if(soughtLine.contains(QRegExp("\\d+\\s+ads? displayed."))) + if(soughtLine.tqcontains(TQRegExp("\\d+\\s+ads? displayed."))) { emit sendCMD( Command( 0, CMD_Show_Sought_List ) ); } @@ -996,29 +996,29 @@ void io_internet::updateSoughtList(QString soughtLine) void io_internet::sendUserSettings() { send("set style 12"); - send(QString("set interface Knights %1").arg(_VERSION_)); - send(QString("set private %1").arg(myResource->OPTION_Private)); - send(QString("set kibitz %1").arg(myResource->OPTION_Kibitz)); - send(QString("set tell %1").arg(myResource->OPTION_Tell)); - send(QString("set shout %1").arg(myResource->OPTION_Shout)); - send(QString("set seek %1").arg(myResource->OPTION_Seek)); - send(QString("set tolerance %1").arg(myResource->OPTION_Profanity)); + send(TQString("set interface Knights %1").tqarg(_VERSION_)); + send(TQString("set private %1").tqarg(myResource->OPTION_Private)); + send(TQString("set kibitz %1").tqarg(myResource->OPTION_Kibitz)); + send(TQString("set tell %1").tqarg(myResource->OPTION_Tell)); + send(TQString("set shout %1").tqarg(myResource->OPTION_Shout)); + send(TQString("set seek %1").tqarg(myResource->OPTION_Seek)); + send(TQString("set tolerance %1").tqarg(myResource->OPTION_Profanity)); } /////////////////////////////////////// // -// io_internet::parseMoveList(QString data) +// io_internet::parseMoveList(TQString data) // /////////////////////////////////////// -void io_internet::parseMoveList(QString line) +void io_internet::parseMoveList(TQString line) { - QStringList two_plys; + TQStringList two_plys; struct ChessMove move; Command command; int move_counter = 0; /* white */ - two_plys = QStringList::split(QRegExp("\\s+"), line, FALSE); + two_plys = TQStringList::split(TQRegExp("\\s+"), line, FALSE); Command::clearMove(&move); move_counter = two_plys[0].left(two_plys[0].length() - 1).length(); /* remove the . */ move.ICS_MoveCounter = move_counter; @@ -1047,15 +1047,15 @@ void io_internet::parseMoveList(QString line) /////////////////////////////////////// // -// io_internet::sendEndOfGameCommand(QString line) +// io_internet::sendEndOfGameCommand(TQString line) // /////////////////////////////////////// -void io_internet::sendEndOfGameCommand(QString line) +void io_internet::sendEndOfGameCommand(TQString line) { - QStringList fields; + TQStringList fields; Command command; - fields = QStringList::split( QChar(' '), line, FALSE ); + fields = TQStringList::split( TQChar(' '), line, FALSE ); if(fields[1].endsWith(":")) { fields[1] = fields[1].left(fields[1].length() - 1); @@ -1064,11 +1064,11 @@ void io_internet::sendEndOfGameCommand(QString line) fields[fields.count() - 1] = fields[fields.count() - 1].stripWhiteSpace(); if(fields[fields.count() - 1] == "1-0" ) { - if(fields[fields.count() - 2].contains("resigns")) + if(fields[fields.count() - 2].tqcontains("resigns")) { command.setCommand((int&)CMD_Black_Resign); } - else if(fields[fields.count() - 2].contains("time")) + else if(fields[fields.count() - 2].tqcontains("time")) { command.setCommand((int&)CMD_White_Called_Flag); } @@ -1079,11 +1079,11 @@ void io_internet::sendEndOfGameCommand(QString line) } else if(fields[fields.count() - 1] == "0-1") { - if(fields[fields.count() - 2].contains("resigns")) + if(fields[fields.count() - 2].tqcontains("resigns")) { command.setCommand((int&)CMD_White_Resign); } - else if(fields[fields.count() - 2].contains("time")) + else if(fields[fields.count() - 2].tqcontains("time")) { command.setCommand((int&)CMD_Black_Called_Flag); } @@ -1122,7 +1122,7 @@ void io_internet::processSeekTimer() void io_internet::selfDestruct() { /* cause the io_internet to delete itself */ - QApplication::postEvent( qApp->mainWidget(), new QCustomEvent( EVENT_Del_IO_Net ) ); + TQApplication::postEvent( tqApp->mainWidget(), new TQCustomEvent( EVENT_Del_IO_Net ) ); } /////////////////////////////////////// @@ -1130,7 +1130,7 @@ void io_internet::selfDestruct() // io_internet::setUserInfo() // /////////////////////////////////////// -void io_internet::setUserInfo(QString userName, QString passWord) +void io_internet::setUserInfo(TQString userName, TQString passWord) { this->userName = userName; this->passWord = passWord; |