aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-06-08 16:43:23 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-06-10 09:52:09 +0000
commitf9cf4595edd22180989ec59e74c9f8b460c29680 (patch)
tree6f0e0ed33317d5350416ff76801754972441f54b
parent78bffbca60b12cccad4d79770a6933b8b2e6b5f8 (diff)
Make argument to QQmlDebuggingEnabler::startTcpServer an enum
The bool argument is less intuitive as you don't know if e.g. true means "Yes, run the QML" or "Yes, block the QML engine". Task-number: QTBUG-46565 Change-Id: I6d268e1354cebeb794b065e118bc0c353d7dd59a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
-rw-r--r--src/qml/debugger/qqmldebug.h7
-rw-r--r--src/qml/qml/qqmlengine.cpp25
-rw-r--r--tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp4
3 files changed, 26 insertions, 10 deletions
diff --git a/src/qml/debugger/qqmldebug.h b/src/qml/debugger/qqmldebug.h
index bb90c4f1b8..559c492dfd 100644
--- a/src/qml/debugger/qqmldebug.h
+++ b/src/qml/debugger/qqmldebug.h
@@ -42,8 +42,13 @@ QT_BEGIN_NAMESPACE
struct Q_QML_EXPORT QQmlDebuggingEnabler
{
+ enum StartMode {
+ DoNotWaitForClient,
+ WaitForClient
+ };
+
QQmlDebuggingEnabler(bool printWarning = true);
- static bool startTcpDebugServer(int port, bool block = false,
+ static bool startTcpDebugServer(int port, StartMode mode = DoNotWaitForClient,
const QString &hostName = QString());
};
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 8a7e4b84e7..8cf3d2064d 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1491,18 +1491,29 @@ QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning)
}
/*!
+ * \enum QQmlDebuggingEnabler::StartMode
+ *
+ * Defines the debug server's start behavior. You can interrupt QML engines starting while a debug
+ * client is connecting, in order to set breakpoints in or profile startup code.
+ *
+ * \value DoNotWaitForClient Run any QML engines as usual while the debug services are connecting.
+ * \value WaitForClient If a QML engine starts while the debug services are connecting,
+ * interrupt it until they are done.
+ */
+
+/*!
* Enables debugging for QML engines created after calling this function. The debug server will
* listen on \a port at \a hostName and block the QML engine until it receives a connection if
- * \a block is true. If \a block is not specified it won't block and if \a hostName isn't specified
- * it will listen on all available interfaces. You can only start one debug server at a time. A
- * debug server may have already been started if the -qmljsdebugger= command line argument was
- * given. This method returns \c true if a new debug server was successfully started, or \c false
- * otherwise.
+ * \a mode is \c WaitForClient. If \a mode is not specified it won't block and if \a hostName is not
+ * specified it will listen on all available interfaces. You can only start one debug server at a
+ * time. A debug server may have already been started if the -qmljsdebugger= command line argument
+ * was given. This method returns \c true if a new debug server was successfully started, or
+ * \c false otherwise.
*/
-bool QQmlDebuggingEnabler::startTcpDebugServer(int port, bool block, const QString &hostName)
+bool QQmlDebuggingEnabler::startTcpDebugServer(int port, StartMode mode, const QString &hostName)
{
#ifndef QQML_NO_DEBUG_PROTOCOL
- return QQmlDebugServer::enable(port, port, block, hostName);
+ return QQmlDebugServer::enable(port, port, mode == WaitForClient, hostName);
#else
Q_UNUSED(port);
Q_UNUSED(block);
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
index 68279413e0..bddece6452 100644
--- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
+++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp
@@ -36,7 +36,7 @@
int main(int argc, char *argv[])
{
- bool block = false;
+ QQmlDebuggingEnabler::StartMode block = QQmlDebuggingEnabler::DoNotWaitForClient;
int portFrom = 0;
int portTo = 0;
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
arguments.removeFirst();
if (arguments.size() && arguments.first() == QLatin1String("-block")) {
- block = true;
+ block = QQmlDebuggingEnabler::WaitForClient;
arguments.removeFirst();
}