Debugger: Simplify protocol of QDebugMessageService
authorKai Koehne <kai.koehne@nokia.com>
Mon, 16 Jan 2012 13:11:53 +0000 (14:11 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 17 Jan 2012 10:35:59 +0000 (11:35 +0100)
Change-Id: I3f97a344b8d0e0d73a75e84310c1e8ed59573ee7
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
src/declarative/debugger/qdebugmessageservice.cpp
tests/auto/declarative/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp

index 9b764d5..e7e8c28 100644 (file)
@@ -66,7 +66,7 @@ public:
 
 QDebugMessageService::QDebugMessageService(QObject *parent) :
     QDeclarativeDebugService(*(new QDebugMessageServicePrivate()),
-                                   QLatin1String("DebugMessages"), 1, parent)
+                                   QLatin1String("DebugMessages"), 2, parent)
 {
     Q_D(QDebugMessageService);
 
@@ -89,13 +89,9 @@ void QDebugMessageService::sendDebugMessage(QtMsgType type, const char *buf)
     //We do not want to alter the message handling mechanism
     //We just eavesdrop and forward the messages to a port
     //only if a client is connected to it.
-    QByteArray debugMessage;
-    QDataStream rs(&debugMessage, QIODevice::WriteOnly);
-    rs << type << QString::fromLocal8Bit(buf).toUtf8();
-
     QByteArray message;
     QDataStream ws(&message, QIODevice::WriteOnly);
-    ws << QByteArray("MESSAGE") << debugMessage;
+    ws << QByteArray("MESSAGE") << type << QString::fromLocal8Bit(buf).toUtf8();
 
     sendMessage(message);
     if (d->oldMsgHandler)
index 2ce3ffa..bfc018f 100644 (file)
@@ -119,16 +119,10 @@ void QDeclarativeDebugMsgClient::messageReceived(const QByteArray &data)
     ds >> command;
 
     if (command == "MESSAGE") {
-        QByteArray container;
-        ds >> container;
-
-        QVERIFY(ds.atEnd());
-
-        QDataStream containerDs(container);
         int type;
         QByteArray message;
-        containerDs >> type >> message;
-        QVERIFY(containerDs.atEnd());
+        ds >> type >> message;
+        QVERIFY(ds.atEnd());
 
         QVERIFY(type >= QtDebugMsg);
         QVERIFY(type <= QtFatalMsg);