From ffe8a83e053396df448e9413828527613ca3bd46 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:46:43 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- dcop/testdcop.cpp | 112 +++++++++++++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'dcop/testdcop.cpp') diff --git a/dcop/testdcop.cpp b/dcop/testdcop.cpp index a718442fc..e43b41c31 100644 --- a/dcop/testdcop.cpp +++ b/dcop/testdcop.cpp @@ -24,7 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#include +#include #include @@ -35,31 +35,31 @@ DCOPClientTransaction *countDownAction2 = 0; int countDownCount2 = 0; DCOPClient *client = 0; -bool MyDCOPObject::process(const QCString &fun, const QByteArray &data, - QCString& replyType, QByteArray &replyData) +bool MyDCOPObject::process(const TQCString &fun, const TQByteArray &data, + TQCString& replyType, TQByteArray &replyData) { qDebug("in MyDCOPObject::process, fun = %s", fun.data()); // note "fun" is normlized here (i.e. whitespace clean) - if (fun == "aFunction(QString,int)") { - QDataStream args(data, IO_ReadOnly); - QString arg1; + if (fun == "aFunction(TQString,int)") { + TQDataStream args(data, IO_ReadOnly); + TQString arg1; int arg2; args >> arg1 >> arg2; function(arg1, arg2); replyType = "void"; return true; } - if (fun == "canLaunchRockets(QRect)") { - QDataStream args(data, IO_ReadOnly); - QRect arg1; + if (fun == "canLaunchRockets(TQRect)") { + TQDataStream args(data, IO_ReadOnly); + TQRect arg1; args >> arg1; printf("Rect x = %d, y = %d, w = %d, h = %d\n", arg1.x(), arg1.y(), arg1.width(), arg1.height()); - replyType = "QRect"; - QDataStream reply( replyData, IO_WriteOnly ); - QRect r(10,20,100,200); + replyType = "TQRect"; + TQDataStream reply( replyData, IO_WriteOnly ); + TQRect r(10,20,100,200); reply << r; return true; } @@ -74,9 +74,9 @@ bool MyDCOPObject::process(const QCString &fun, const QByteArray &data, qDebug("countDown() countDownAction = %p", countDownAction); if (countDownAction2) { - replyType = "QString"; - QDataStream reply( replyData, IO_WriteOnly ); - reply << QString("Hey"); + replyType = "TQString"; + TQDataStream reply( replyData, IO_WriteOnly ); + reply << TQString("Hey"); return true; } @@ -84,13 +84,13 @@ qDebug("countDown() countDownAction = %p", countDownAction); { countDownCount = 10; countDownAction = client->beginTransaction(); - QTimer::singleShot(1000, this, SLOT(slotTimeout())); + TQTimer::singleShot(1000, this, TQT_SLOT(slotTimeout())); } else { countDownCount2 = 10; countDownAction2 = client->beginTransaction(); - QTimer::singleShot(1000, this, SLOT(slotTimeout2())); + TQTimer::singleShot(1000, this, TQT_SLOT(slotTimeout2())); } return true; } @@ -104,16 +104,16 @@ void MyDCOPObject::slotTimeout() countDownCount--; if (countDownCount == 0) { - QCString replyType = "QString"; - QByteArray replyData; - QDataStream reply( replyData, IO_WriteOnly ); - reply << QString("Hello World"); + TQCString replyType = "TQString"; + TQByteArray replyData; + TQDataStream reply( replyData, IO_WriteOnly ); + reply << TQString("Hello World"); client->endTransaction(countDownAction, replyType, replyData); countDownAction = 0; } else { - QTimer::singleShot(1000, this, SLOT(slotTimeout())); + TQTimer::singleShot(1000, this, TQT_SLOT(slotTimeout())); } } @@ -123,36 +123,36 @@ void MyDCOPObject::slotTimeout2() countDownCount2--; if (countDownCount2 == 0) { - QCString replyType = "QString"; - QByteArray replyData; - QDataStream reply( replyData, IO_WriteOnly ); - reply << QString("Hello World"); + TQCString replyType = "TQString"; + TQByteArray replyData; + TQDataStream reply( replyData, IO_WriteOnly ); + reply << TQString("Hello World"); client->endTransaction(countDownAction2, replyType, replyData); countDownAction2 = 0; } else { - QTimer::singleShot(1000, this, SLOT(slotTimeout2())); + TQTimer::singleShot(1000, this, TQT_SLOT(slotTimeout2())); } } QCStringList MyDCOPObject::functions() { QCStringList result = DCOPObject::functions(); - result << "QRect canLaunchRockets(QRect)"; + result << "TQRect canLaunchRockets(TQRect)"; return result; } -TestObject::TestObject(const QCString& app) +TestObject::TestObject(const TQCString& app) : m_app(app) { - QTimer::singleShot(2500, this, SLOT(slotTimeout())); + TQTimer::singleShot(2500, this, TQT_SLOT(slotTimeout())); } void TestObject::slotTimeout() { - QCString replyType; - QByteArray data, reply; + TQCString replyType; + TQByteArray data, reply; qWarning("#3 Calling countDown"); if (!client->call(m_app, "object1", "countDown()", data, replyType, reply)) @@ -162,13 +162,13 @@ void TestObject::slotTimeout() } -void TestObject::slotCallBack(int callId, const QCString &replyType, const QByteArray &replyData) +void TestObject::slotCallBack(int callId, const TQCString &replyType, const TQByteArray &replyData) { qWarning("Call Back! callId = %d", callId); qWarning("Type = %s", replyType.data()); - QDataStream args(replyData, IO_ReadOnly); - QString arg1; + TQDataStream args(replyData, IO_ReadOnly); + TQString arg1; args >> arg1; qWarning("Value = %s", arg1.latin1()); @@ -180,21 +180,21 @@ void TestObject::slotCallBack(int callId, const QCString &replyType, const QByte int main(int argc, char **argv) { - QApplication app(argc, argv, "testdcop"); + TQApplication app(argc, argv, "testdcop"); - QCString replyType; - QByteArray data, reply; + TQCString replyType; + TQByteArray data, reply; client = new DCOPClient(); if (argc == 2) { - QCString appId = argv[1]; + TQCString appId = argv[1]; TestObject obj(appId); qWarning("#1 Calling countDown"); - int result = client->callAsync(appId, "object1", "countDown()", data, &obj, SLOT(slotCallBack(int, const QCString&, const QByteArray&))); + int result = client->callAsync(appId, "object1", "countDown()", data, &obj, TQT_SLOT(slotCallBack(int, const TQCString&, const TQByteArray&))); qDebug("#1 countDown() call id = %d", result); qWarning("#2 Calling countDown"); - result = client->callAsync(appId, "object1", "countDown()", data, &obj, SLOT(slotCallBack(int, const QCString&, const QByteArray&))); + result = client->callAsync(appId, "object1", "countDown()", data, &obj, TQT_SLOT(slotCallBack(int, const TQCString&, const TQByteArray&))); qDebug("#2 countDown() call id = %d", result); app.exec(); @@ -209,18 +209,18 @@ int main(int argc, char **argv) if ( client->isApplicationRegistered( app.name() ) ) qDebug("indeed, we are registered!"); - QDataStream dataStream( data, IO_WriteOnly ); + TQDataStream dataStream( data, IO_WriteOnly ); dataStream << (int) 43; - client->emitDCOPSignal("alive(int,QCString)", data); + client->emitDCOPSignal("alive(int,TQCString)", data); MyDCOPObject *obj1 = new MyDCOPObject("object1"); - bool connectResult = client->connectDCOPSignal("", "alive(int , QCString)", "object1", "isAliveSlot(int)", false); + bool connectResult = client->connectDCOPSignal("", "alive(int , TQCString)", "object1", "isAliveSlot(int)", false); qDebug("connectDCOPSignal returns %s", connectResult ? "true" : "false"); - QDataStream ds(data, IO_WriteOnly); - ds << QString("fourty-two") << 42; - if (!client->call(app.name(), "object1", "aFunction(QString,int)", data, replyType, reply)) { + TQDataStream ds(data, IO_WriteOnly); + ds << TQString("fourty-two") << 42; + if (!client->call(app.name(), "object1", "aFunction(TQString,int)", data, replyType, reply)) { qDebug("I couldn't call myself"); assert( 0 ); } @@ -229,22 +229,22 @@ int main(int argc, char **argv) assert( replyType == "void" ); } - client->send(app.name(), "object1", "aFunction(QString,int)", data ); + client->send(app.name(), "object1", "aFunction(TQString,int)", data ); int n = client->registeredApplications().count(); qDebug("number of attached applications = %d", n ); - QObject::connect( client, SIGNAL( applicationRegistered( const QCString&)), - obj1, SLOT( registered( const QCString& ))); + TQObject::connect( client, TQT_SIGNAL( applicationRegistered( const TQCString&)), + obj1, TQT_SLOT( registered( const TQCString& ))); - QObject::connect( client, SIGNAL( applicationRemoved( const QCString&)), - obj1, SLOT( unregistered( const QCString& ))); + TQObject::connect( client, TQT_SIGNAL( applicationRemoved( const TQCString&)), + obj1, TQT_SLOT( unregistered( const TQCString& ))); // Enable the above signals client->setNotifications( true ); - QCString foundApp; - QCString foundObj; + TQCString foundApp; + TQCString foundObj; // Find a object called "object1" in any application that // meets the criteria "canLaunchRockets()" @@ -272,10 +272,10 @@ int main(int argc, char **argv) qDebug("I2 registered as '%s'", client2->appId().data() ); qDebug("Sending to object1"); - client2->send(app.name(), "object1", "aFunction(QString,int)", data ); + client2->send(app.name(), "object1", "aFunction(TQString,int)", data ); qDebug("Calling object1"); - if (!client2->call(app.name(), "object1", "aFunction(QString,int)", data, replyType, reply)) + if (!client2->call(app.name(), "object1", "aFunction(TQString,int)", data, replyType, reply)) qDebug("I couldn't call myself"); else qDebug("return type was '%s'", replyType.data() ); -- cgit v1.2.1