summaryrefslogtreecommitdiffstats
path: root/src/declarative/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/debugger')
-rw-r--r--src/declarative/debugger/qmldebugservice.cpp24
-rw-r--r--src/declarative/debugger/qmldebugservice.h2
2 files changed, 19 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);
diff --git a/src/declarative/debugger/qmldebugservice.h b/src/declarative/debugger/qmldebugservice.h
index b1344c4..c3c3b01 100644
--- a/src/declarative/debugger/qmldebugservice.h
+++ b/src/declarative/debugger/qmldebugservice.h
@@ -70,6 +70,8 @@ public:
static bool isDebuggingEnabled();
static QString objectToString(QObject *obj);
+ static void waitForClients();
+
protected:
virtual void enabledChanged(bool);
virtual void messageReceived(const QByteArray &);