summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2011-03-22 10:13:08 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2011-05-10 09:52:50 (GMT)
commitbde58ad1e7d2b38d2882aaf869e93b0415128836 (patch)
treed938fa5585d5b48dc9cd19b3ccf292660926053d /src/plugins
parentc2016ecdb3e1d493a3fb300193856caaec848e89 (diff)
downloadQt-bde58ad1e7d2b38d2882aaf869e93b0415128836.zip
Qt-bde58ad1e7d2b38d2882aaf869e93b0415128836.tar.gz
Qt-bde58ad1e7d2b38d2882aaf869e93b0415128836.tar.bz2
Enable performance monitoring at application startup.
Reviewed-by: Michael Brasser (cherry picked from commit 8765bdaebf5db409dc2121bce3b9838f3663bd7e)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp14
-rw-r--r--src/plugins/qmltooling/tcpserver/qtcpserverconnection.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp
index 44b2886..1da3043 100644
--- a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp
+++ b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp
@@ -55,6 +55,7 @@ public:
QTcpServerConnectionPrivate();
int port;
+ bool block;
QTcpSocket *socket;
QPacketProtocol *protocol;
QTcpServer *tcpServer;
@@ -64,6 +65,7 @@ public:
QTcpServerConnectionPrivate::QTcpServerConnectionPrivate() :
port(0),
+ block(false),
socket(0),
protocol(0),
tcpServer(0),
@@ -118,10 +120,17 @@ void QTcpServerConnection::disconnect()
d->socket = 0;
}
+bool QTcpServerConnection::waitForMessage()
+{
+ Q_D(QTcpServerConnection);
+ return d->protocol->waitForReadyRead(-1);
+}
+
void QTcpServerConnection::setPort(int port, bool block)
{
Q_D(QTcpServerConnection);
d->port = port;
+ d->block = block;
listen();
if (block)
@@ -165,8 +174,11 @@ void QTcpServerConnection::newConnection()
d->socket->setParent(this);
d->protocol = new QPacketProtocol(d->socket, this);
QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
-}
+ if (d->block) {
+ d->protocol->waitForReadyRead(-1);
+ }
+}
Q_EXPORT_PLUGIN2(tcpserver, QTcpServerConnection)
diff --git a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h
index 62791d3..dd5a5ec 100644
--- a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h
+++ b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h
@@ -66,6 +66,7 @@ public:
bool isConnected() const;
void send(const QByteArray &message);
void disconnect();
+ bool waitForMessage();
void listen();
void waitForConnection();