summaryrefslogtreecommitdiffstats
path: root/src/declarative/debugger/qmldebugservice.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2009-08-10 11:15:20 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2009-08-13 12:41:46 (GMT)
commitb5b29ba7744c6fc44ae2ac3f7c86dd424e9cf021 (patch)
treebb6d94c8238ca3eff8e5e19ef9f1510fcdc6d041 /src/declarative/debugger/qmldebugservice.cpp
parentb800d684b9c807eb13359d78710df6a1da9ce44a (diff)
downloadQt-b5b29ba7744c6fc44ae2ac3f7c86dd424e9cf021.zip
Qt-b5b29ba7744c6fc44ae2ac3f7c86dd424e9cf021.tar.gz
Qt-b5b29ba7744c6fc44ae2ac3f7c86dd424e9cf021.tar.bz2
Wait for connections to remote debugging interface
The tcp server was waiting for connections right when instantiated ... even before the different debugging services could register themselves. This is fixed by first letting the different services register, and only block for incoming connections when explicitly registered (QmlDebugService::waitForConnectons).
Diffstat (limited to 'src/declarative/debugger/qmldebugservice.cpp')
-rw-r--r--src/declarative/debugger/qmldebugservice.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/declarative/debugger/qmldebugservice.cpp b/src/declarative/debugger/qmldebugservice.cpp
index 9725494..3576a94 100644
--- a/src/declarative/debugger/qmldebugservice.cpp
+++ b/src/declarative/debugger/qmldebugservice.cpp
@@ -57,6 +57,7 @@ class QmlDebugServer : public QObject
Q_DISABLE_COPY(QmlDebugServer)
public:
static QmlDebugServer *instance();
+ void wait();
private slots:
void readyRead();
@@ -72,8 +73,9 @@ class QmlDebugServerPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QmlDebugServer)
public:
QmlDebugServerPrivate();
- void init(int port);
+ void wait();
+ int port;
QTcpSocket *connection;
QPacketProtocol *protocol;
QHash<QString, QmlDebugService *> plugins;
@@ -95,7 +97,7 @@ QmlDebugServerPrivate::QmlDebugServerPrivate()
{
}
-void QmlDebugServerPrivate::init(int port)
+void QmlDebugServerPrivate::wait()
{
Q_Q(QmlDebugServer);
QTcpServer server;
@@ -151,17 +153,20 @@ QmlDebugServer *QmlDebugServer::instance()
server = new QmlDebugServer(port);
}
- if (server && server->d_func()->connection)
- return server;
- else
- return 0;
+ return server;
+}
+
+void QmlDebugServer::wait()
+{
+ Q_D(QmlDebugServer);
+ d->wait();
}
QmlDebugServer::QmlDebugServer(int port)
: QObject(*(new QmlDebugServerPrivate))
{
Q_D(QmlDebugServer);
- d->init(port);
+ d->port = port;
}
void QmlDebugServer::readyRead()
@@ -354,6 +359,11 @@ QString QmlDebugService::objectToString(QObject *obj)
return rv;
}
+void QmlDebugService::waitForClients()
+{
+ QmlDebugServer::instance()->wait();
+}
+
void QmlDebugService::sendMessage(const QByteArray &message)
{
Q_D(QmlDebugService);