OSDN Git Service

QDeclarativeDebugClient: Expose internal error string
authorKai Koehne <kai.koehne@nokia.com>
Fri, 7 Oct 2011 13:00:05 +0000 (15:00 +0200)
committerKai Koehne <kai.koehne@nokia.com>
Tue, 11 Oct 2011 07:01:29 +0000 (09:01 +0200)
Forward error string from real device to QDeclarativeDebugClient.

Change-Id: I7ae63a6e8799b42fed387562b91ebfb594956f44
Reviewed-on: http://codereview.qt-project.org/6245
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>

src/libs/qmljsdebugclient/qdeclarativedebugclient.cpp
src/libs/qmljsdebugclient/qdeclarativedebugclient.h

index f12eaf6..c7a80b0 100644 (file)
@@ -222,6 +222,12 @@ qint64 QDeclarativeDebugConnection::writeData(const char *data, qint64 maxSize)
     return d->device->write(data, maxSize);
 }
 
+void QDeclarativeDebugConnection::internalError(QAbstractSocket::SocketError socketError)
+{
+    setErrorString(d->device->errorString());
+    emit error(socketError);
+}
+
 qint64 QDeclarativeDebugConnection::bytesAvailable() const
 {
     return d->device->bytesAvailable();
@@ -300,7 +306,7 @@ void QDeclarativeDebugConnection::connectToHost(const QString &hostName, quint16
     d->connectDeviceSignals();
     d->gotHello = false;
     connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
-    connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
+    connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(internalError(QAbstractSocket::SocketError)));
     connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
     socket->connectToHost(hostName, port);
     QIODevice::open(ReadWrite | Unbuffered);
index fe118de..57a331c 100644 (file)
@@ -66,6 +66,9 @@ protected:
     qint64 readData(char *data, qint64 maxSize);
     qint64 writeData(const char *data, qint64 maxSize);
 
+private slots:
+    void internalError(QAbstractSocket::SocketError error);
+
 private:
     QDeclarativeDebugConnectionPrivate *d;
     friend class QDeclarativeDebugClient;