aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmltooling')
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro4
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservice.json2
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.h2
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp14
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp16
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp44
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h23
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp38
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp23
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/highlight.h4
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservicefactory.h2
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.h2
-rw-r--r--src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp12
-rw-r--r--src/plugins/qmltooling/qmldbg_local/qlocalclientconnectionfactory.h2
-rw-r--r--src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp (renamed from src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.cpp)0
-rw-r--r--src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.h (renamed from src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.h)4
-rw-r--r--src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.json3
-rw-r--r--src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.cpp54
-rw-r--r--src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.h57
-rw-r--r--src/plugins/qmltooling/qmldbg_messages/qmldbg_messages.pro21
-rw-r--r--src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp14
-rw-r--r--src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h2
-rw-r--r--src/plugins/qmltooling/qmldbg_nativedebugger/qmldbg_nativedebugger.pro21
-rw-r--r--src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp (renamed from src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp)39
-rw-r--r--src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h (renamed from src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.h)2
-rw-r--r--src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.json3
-rw-r--r--src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp54
-rw-r--r--src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.h57
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp9
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h1
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp51
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservicefactory.h2
-rw-r--r--src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapterfactory.h2
-rw-r--r--src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp16
-rw-r--r--src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.h2
-rw-r--r--src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnectionfactory.h2
-rw-r--r--src/plugins/qmltooling/qmltooling.pro6
38 files changed, 460 insertions, 158 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro b/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro
index 27b3a5b513..f3f8a21ff8 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro
+++ b/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro
@@ -2,10 +2,8 @@ TARGET = qmldbg_debugger
QT = qml-private core-private packetprotocol-private
SOURCES += \
- $$PWD/qdebugmessageservice.cpp \
$$PWD/qqmldebuggerservicefactory.cpp \
$$PWD/qqmlenginedebugservice.cpp \
- $$PWD/qqmlnativedebugservice.cpp \
$$PWD/qqmlwatcher.cpp \
$$PWD/qv4debugservice.cpp \
$$PWD/qv4debugger.cpp \
@@ -16,10 +14,8 @@ SOURCES += \
HEADERS += \
$$PWD/../shared/qqmlconfigurabledebugservice.h \
$$PWD/../shared/qqmldebugpacket.h \
- $$PWD/qdebugmessageservice.h \
$$PWD/qqmldebuggerservicefactory.h \
$$PWD/qqmlenginedebugservice.h \
- $$PWD/qqmlnativedebugservice.h \
$$PWD/qqmlwatcher.h \
$$PWD/qv4debugservice.h \
$$PWD/qv4debugger.h \
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservice.json b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservice.json
index 967a725903..442d7781a1 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservice.json
+++ b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservice.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "DebugMessages", "QmlDebugger", "V8Debugger", "NativeQmlDebugger" ]
+ "Keys": [ "QmlDebugger", "V8Debugger" ]
}
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp
index ca3f07323d..9315adf4ce 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp
@@ -39,27 +39,19 @@
#include "qqmldebuggerservicefactory.h"
#include "qqmlenginedebugservice.h"
-#include "qdebugmessageservice.h"
#include "qv4debugservice.h"
-#include "qqmlnativedebugservice.h"
#include <private/qqmldebugserviceinterfaces_p.h>
QT_BEGIN_NAMESPACE
QQmlDebugService *QQmlDebuggerServiceFactory::create(const QString &key)
{
- if (key == QDebugMessageServiceImpl::s_key)
- return new QDebugMessageServiceImpl(this);
-
if (key == QQmlEngineDebugServiceImpl::s_key)
return new QQmlEngineDebugServiceImpl(this);
if (key == QV4DebugServiceImpl::s_key)
return new QV4DebugServiceImpl(this);
- if (key == QQmlNativeDebugServiceImpl::s_key)
- return new QQmlNativeDebugServiceImpl(this);
-
return 0;
}
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.h b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.h
index 99d6679833..50eed2369c 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.h
+++ b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.h
@@ -49,7 +49,7 @@ class QQmlDebuggerServiceFactory : public QQmlDebugServiceFactory
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlDebugServiceFactory_iid FILE "qqmldebuggerservice.json")
public:
- QQmlDebugService *create(const QString &key);
+ QQmlDebugService *create(const QString &key) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
index 2b8dcc19ee..151e44c4d4 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
@@ -289,10 +289,12 @@ void QQmlEngineDebugServiceImpl::buildObjectDump(QDataStream &message,
prop.value = expr->expression();
QObject *scope = expr->scopeObject();
if (scope) {
- QString methodName = QString::fromLatin1(QMetaObjectPrivate::signal(scope->metaObject(), signalHandler->signalIndex()).name());
- if (!methodName.isEmpty()) {
- prop.name = QLatin1String("on") + methodName[0].toUpper()
- + methodName.mid(1);
+ const QByteArray methodName = QMetaObjectPrivate::signal(scope->metaObject(),
+ signalHandler->signalIndex()).name();
+ const QLatin1String methodNameStr(methodName);
+ if (methodNameStr.size() != 0) {
+ prop.name = QLatin1String("on") + QChar(methodNameStr.at(0)).toUpper()
+ + methodNameStr.mid(1);
}
}
}
@@ -520,12 +522,12 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message)
ds >> file >> lineNumber >> columnNumber >> recurse >> dumpProperties;
- QList<QObject*> objects = objectForLocationInfo(file, lineNumber, columnNumber);
+ const QList<QObject*> objects = objectForLocationInfo(file, lineNumber, columnNumber);
rs << QByteArray("FETCH_OBJECTS_FOR_LOCATION_R") << queryId
<< objects.count();
- foreach (QObject *object, objects) {
+ for (QObject *object : objects) {
if (recurse)
prepareDeferredObjects(object);
buildObjectDump(rs, object, recurse, dumpProperties);
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
index 756b6b28be..773bc937f5 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
@@ -52,7 +52,7 @@ QV4DebuggerAgent::QV4DebuggerAgent(QV4DebugServiceImpl *debugService)
QV4Debugger *QV4DebuggerAgent::pausedDebugger() const
{
- foreach (QV4Debugger *debugger, m_debuggers) {
+ for (QV4Debugger *debugger : m_debuggers) {
if (debugger->state() == QV4Debugger::Paused)
return debugger;
}
@@ -147,13 +147,13 @@ void QV4DebuggerAgent::pause(QV4Debugger *debugger) const
void QV4DebuggerAgent::pauseAll() const
{
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : m_debuggers)
pause(debugger);
}
void QV4DebuggerAgent::resumeAll() const
{
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : m_debuggers)
if (debugger->state() == QV4Debugger::Paused)
debugger->resume(QV4Debugger::FullThrottle);
}
@@ -161,7 +161,7 @@ void QV4DebuggerAgent::resumeAll() const
int QV4DebuggerAgent::addBreakPoint(const QString &fileName, int lineNumber, bool enabled, const QString &condition)
{
if (enabled)
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : qAsConst(m_debuggers))
debugger->addBreakPoint(fileName, lineNumber, condition);
int id = m_breakPoints.size();
@@ -178,7 +178,7 @@ void QV4DebuggerAgent::removeBreakPoint(int id)
m_breakPoints.remove(id);
if (breakPoint.enabled)
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : qAsConst(m_debuggers))
debugger->removeBreakPoint(breakPoint.fileName, breakPoint.lineNr);
}
@@ -195,7 +195,7 @@ void QV4DebuggerAgent::enableBreakPoint(int id, bool onoff)
return;
breakPoint.enabled = onoff;
- foreach (QV4Debugger *debugger, m_debuggers) {
+ for (QV4Debugger *debugger : qAsConst(m_debuggers)) {
if (onoff)
debugger->addBreakPoint(breakPoint.fileName, breakPoint.lineNr, breakPoint.condition);
else
@@ -218,14 +218,14 @@ void QV4DebuggerAgent::setBreakOnThrow(bool onoff)
{
if (onoff != m_breakOnThrow) {
m_breakOnThrow = onoff;
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : qAsConst(m_debuggers))
debugger->setBreakOnThrow(onoff);
}
}
void QV4DebuggerAgent::clearAllPauseRequests()
{
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : qAsConst(m_debuggers))
debugger->clearPauseRequest();
}
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
index d5cc765ea8..df316c1ae6 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
@@ -43,6 +43,7 @@
#include <private/qqmlcontext_p.h>
#include <private/qv4qmlcontext_p.h>
#include <private/qv4qobjectwrapper_p.h>
+#include <private/qqmldebugservice_p.h>
#include <QtQml/qqmlengine.h>
@@ -52,9 +53,10 @@ QV4DebugJob::~QV4DebugJob()
{
}
-JavaScriptJob::JavaScriptJob(QV4::ExecutionEngine *engine, int frameNr,
- const QString &script) :
- engine(engine), frameNr(frameNr), script(script), resultIsException(false)
+JavaScriptJob::JavaScriptJob(QV4::ExecutionEngine *engine, int frameNr, int context,
+ const QString &script) :
+ engine(engine), frameNr(frameNr), context(context), script(script),
+ resultIsException(false)
{}
void JavaScriptJob::run()
@@ -65,7 +67,23 @@ void JavaScriptJob::run()
QV4::ExecutionContext *ctx = engine->currentContext;
QObject scopeObject;
- if (frameNr < 0) { // Use QML context if available
+
+ if (frameNr > 0) {
+ for (int i = 0; i < frameNr; ++i) {
+ ctx = engine->parentContext(ctx);
+ }
+ engine->pushContext(ctx);
+ ctx = engine->currentContext;
+ }
+
+ if (context >= 0) {
+ QQmlContext *extraContext = qmlContext(QQmlDebugService::objectForId(context));
+ if (extraContext) {
+ engine->pushContext(QV4::QmlContext::create(ctx, QQmlContextData::get(extraContext),
+ &scopeObject));
+ ctx = engine->currentContext;
+ }
+ } else if (frameNr < 0) { // Use QML context if available
QQmlEngine *qmlEngine = engine->qmlEngine();
if (qmlEngine) {
QQmlContext *qmlRootContext = qmlEngine->rootContext();
@@ -89,13 +107,6 @@ void JavaScriptJob::run()
engine->pushContext(ctx->newWithContext(withContext->toObject(engine)));
ctx = engine->currentContext;
}
- } else {
- if (frameNr > 0) {
- for (int i = 0; i < frameNr; ++i) {
- ctx = engine->parentContext(ctx);
- }
- engine->pushContext(ctx);
- }
}
QV4::Script script(ctx, this->script);
@@ -206,7 +217,7 @@ void ValueLookupJob::run()
QQmlContextData::get(engine->qmlEngine()->rootContext()),
scopeObject.data()));
}
- foreach (const QJsonValue &handle, handles) {
+ for (const QJsonValue &handle : handles) {
QV4DataCollector::Ref ref = handle.toInt();
if (!collector->isValidRef(ref)) {
exception = QString::fromLatin1("Invalid Ref: %1").arg(ref);
@@ -225,8 +236,9 @@ const QString &ValueLookupJob::exceptionMessage() const
}
ExpressionEvalJob::ExpressionEvalJob(QV4::ExecutionEngine *engine, int frameNr,
- const QString &expression, QV4DataCollector *collector) :
- JavaScriptJob(engine, frameNr, expression), collector(collector)
+ int context, const QString &expression,
+ QV4DataCollector *collector) :
+ JavaScriptJob(engine, frameNr, context, expression), collector(collector)
{
}
@@ -259,7 +271,7 @@ GatherSourcesJob::GatherSourcesJob(QV4::ExecutionEngine *engine)
void GatherSourcesJob::run()
{
- foreach (QV4::CompiledData::CompilationUnit *unit, engine->compilationUnits) {
+ for (QV4::CompiledData::CompilationUnit *unit : qAsConst(engine->compilationUnits)) {
QString fileName = unit->fileName();
if (!fileName.isEmpty())
sources.append(fileName);
@@ -272,7 +284,7 @@ const QStringList &GatherSourcesJob::result() const
}
EvalJob::EvalJob(QV4::ExecutionEngine *engine, const QString &script) :
- JavaScriptJob(engine, /*frameNr*/-1, script), result(false)
+ JavaScriptJob(engine, /*frameNr*/-1, /*context*/ -1, script), result(false)
{}
void EvalJob::handleResult(QV4::ScopedValue &result)
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h
index 721f42b7c2..00d3e6206a 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h
@@ -60,12 +60,13 @@ class JavaScriptJob : public QV4DebugJob
{
QV4::ExecutionEngine *engine;
int frameNr;
+ int context;
const QString &script;
bool resultIsException;
public:
- JavaScriptJob(QV4::ExecutionEngine *engine, int frameNr, const QString &script);
- void run();
+ JavaScriptJob(QV4::ExecutionEngine *engine, int frameNr, int context, const QString &script);
+ void run() override;
bool hasExeption() const;
protected:
@@ -90,7 +91,7 @@ class BacktraceJob: public CollectJob
int toFrame;
public:
BacktraceJob(QV4DataCollector *collector, int fromFrame, int toFrame);
- void run();
+ void run() override;
};
class FrameJob: public CollectJob
@@ -100,7 +101,7 @@ class FrameJob: public CollectJob
public:
FrameJob(QV4DataCollector *collector, int frameNr);
- void run();
+ void run() override;
bool wasSuccessful() const;
};
@@ -112,7 +113,7 @@ class ScopeJob: public CollectJob
public:
ScopeJob(QV4DataCollector *collector, int frameNr, int scopeNr);
- void run();
+ void run() override;
bool wasSuccessful() const;
};
@@ -123,7 +124,7 @@ class ValueLookupJob: public CollectJob
public:
ValueLookupJob(const QJsonArray &handles, QV4DataCollector *collector);
- void run();
+ void run() override;
const QString &exceptionMessage() const;
};
@@ -135,9 +136,9 @@ class ExpressionEvalJob: public JavaScriptJob
QJsonArray collectedRefs;
public:
- ExpressionEvalJob(QV4::ExecutionEngine *engine, int frameNr, const QString &expression,
- QV4DataCollector *collector);
- virtual void handleResult(QV4::ScopedValue &value);
+ ExpressionEvalJob(QV4::ExecutionEngine *engine, int frameNr, int context,
+ const QString &expression, QV4DataCollector *collector);
+ void handleResult(QV4::ScopedValue &value) override;
const QString &exceptionMessage() const;
const QJsonObject &returnValue() const;
const QJsonArray &refs() const;
@@ -150,7 +151,7 @@ class GatherSourcesJob: public QV4DebugJob
public:
GatherSourcesJob(QV4::ExecutionEngine *engine);
- void run();
+ void run() override;
const QStringList &result() const;
};
@@ -161,7 +162,7 @@ class EvalJob: public JavaScriptJob
public:
EvalJob(QV4::ExecutionEngine *engine, const QString &script);
- virtual void handleResult(QV4::ScopedValue &result);
+ void handleResult(QV4::ScopedValue &result) override;
bool resultAsBoolean() const;
};
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp
index 00c5c1ad77..1d2cc092dc 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp
@@ -152,7 +152,7 @@ class UnknownV8CommandHandler: public V8CommandHandler
public:
UnknownV8CommandHandler(): V8CommandHandler(QString()) {}
- virtual void handleRequest()
+ void handleRequest() override
{
QString msg = QLatin1String("unimplemented command \"")
+ req.value(QLatin1String("command")).toString()
@@ -167,7 +167,7 @@ class V8VersionRequest: public V8CommandHandler
public:
V8VersionRequest(): V8CommandHandler(QStringLiteral("version")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
addCommand();
addRequestSequence();
@@ -177,6 +177,7 @@ public:
body.insert(QStringLiteral("V8Version"),
QLatin1String("this is not V8, this is V4 in Qt " QT_VERSION_STR));
body.insert(QStringLiteral("UnpausedEvaluate"), true);
+ body.insert(QStringLiteral("ContextEvaluate"), true);
addBody(body);
}
};
@@ -186,7 +187,7 @@ class V8SetBreakPointRequest: public V8CommandHandler
public:
V8SetBreakPointRequest(): V8CommandHandler(QStringLiteral("setbreakpoint")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject args = req.value(QLatin1String("arguments")).toObject();
@@ -237,7 +238,7 @@ class V8ClearBreakPointRequest: public V8CommandHandler
public:
V8ClearBreakPointRequest(): V8CommandHandler(QStringLiteral("clearbreakpoint")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject args = req.value(QLatin1String("arguments")).toObject();
@@ -270,7 +271,7 @@ class V8BacktraceRequest: public V8CommandHandler
public:
V8BacktraceRequest(): V8CommandHandler(QStringLiteral("backtrace")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
@@ -303,7 +304,7 @@ class V8FrameRequest: public V8CommandHandler
public:
V8FrameRequest(): V8CommandHandler(QStringLiteral("frame")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -345,7 +346,7 @@ class V8ScopeRequest: public V8CommandHandler
public:
V8ScopeRequest(): V8CommandHandler(QStringLiteral("scope")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -390,7 +391,7 @@ class V8LookupRequest: public V8CommandHandler
public:
V8LookupRequest(): V8CommandHandler(QStringLiteral("lookup")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -430,7 +431,7 @@ class V8ContinueRequest: public V8CommandHandler
public:
V8ContinueRequest(): V8CommandHandler(QStringLiteral("continue")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -476,7 +477,7 @@ class V8DisconnectRequest: public V8CommandHandler
public:
V8DisconnectRequest(): V8CommandHandler(QStringLiteral("disconnect")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
debugService->debuggerAgent.removeAllBreakPoints();
debugService->debuggerAgent.resumeAll();
@@ -494,7 +495,7 @@ class V8SetExceptionBreakRequest: public V8CommandHandler
public:
V8SetExceptionBreakRequest(): V8CommandHandler(QStringLiteral("setexceptionbreak")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
bool wasEnabled = debugService->debuggerAgent.breakOnThrow();
@@ -534,7 +535,7 @@ class V8ScriptsRequest: public V8CommandHandler
public:
V8ScriptsRequest(): V8CommandHandler(QStringLiteral("scripts")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
//decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -558,7 +559,7 @@ public:
debugger->runInEngine(&job);
QJsonArray body;
- foreach (const QString &source, job.result()) {
+ for (const QString &source : job.result()) {
QJsonObject src;
src[QLatin1String("name")] = source;
src[QLatin1String("scriptType")] = 4;
@@ -606,10 +607,11 @@ class V8EvaluateRequest: public V8CommandHandler
public:
V8EvaluateRequest(): V8CommandHandler(QStringLiteral("evaluate")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
QString expression = arguments.value(QLatin1String("expression")).toString();
+ int context = arguments.value(QLatin1String("context")).toInt(-1);
int frame = -1;
QV4Debugger *debugger = debugService->debuggerAgent.pausedDebugger();
@@ -627,7 +629,8 @@ public:
frame = arguments.value(QLatin1String("frame")).toInt(0);
}
- ExpressionEvalJob job(debugger->engine(), frame, expression, debugger->collector());
+ ExpressionEvalJob job(debugger->engine(), frame, context, expression,
+ debugger->collector());
debugger->runInEngine(&job);
if (job.hasExeption()) {
createErrorResponse(job.exceptionMessage());
@@ -718,7 +721,8 @@ void QV4DebugServiceImpl::stateAboutToBeChanged(State state)
{
QMutexLocker lock(&m_configMutex);
if (state == Enabled) {
- foreach (QV4Debugger *debugger, debuggerAgent.debuggers()) {
+ const auto debuggers = debuggerAgent.debuggers();
+ for (QV4Debugger *debugger : debuggers) {
QV4::ExecutionEngine *ee = debugger->engine();
if (!ee->debugger())
ee->setDebugger(debugger);
@@ -737,7 +741,7 @@ void QV4DebugServiceImpl::signalEmitted(const QString &signal)
//Normalize to Lower case.
QString signalName = signal.left(signal.indexOf(QLatin1Char('('))).toLower();
- foreach (const QString &signal, breakOnSignals) {
+ for (const QString &signal : qAsConst(breakOnSignals)) {
if (signal == signalName) {
// TODO: pause debugger
break;
diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
index ca7c76ab50..7145645609 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
@@ -92,7 +92,7 @@ void GlobalInspector::setSelectedItems(const QList<QQuickItem *> &items)
QList<QObject*> objectList;
objectList.reserve(items.count());
- foreach (QQuickItem *item, items)
+ for (QQuickItem *item : items)
objectList << item;
sendCurrentObjects(objectList);
@@ -113,7 +113,7 @@ void GlobalInspector::sendCurrentObjects(const QList<QObject*> &objects)
QList<int> debugIds;
debugIds.reserve(objects.count());
- foreach (QObject *object, objects)
+ for (QObject *object : objects)
debugIds << QQmlDebugService::idForObject(object);
ds << debugIds;
@@ -194,7 +194,7 @@ bool GlobalInspector::createQmlObject(int requestId, const QString &qml, QObject
return false;
QString imports;
- foreach (const QString &s, importList)
+ for (const QString &s : importList)
imports += s + QLatin1Char('\n');
ObjectCreator *objectCreator = new ObjectCreator(requestId, parentContext->engine(), parent);
@@ -223,7 +223,7 @@ void GlobalInspector::removeWindow(QQuickWindow *window)
void GlobalInspector::setParentWindow(QQuickWindow *window, QWindow *parentWindow)
{
- foreach (QmlJSDebugger::QQuickWindowInspector *inspector, m_windowInspectors) {
+ for (QmlJSDebugger::QQuickWindowInspector *inspector : qAsConst(m_windowInspectors)) {
if (inspector->quickWindow() == window)
inspector->setParentWindow(parentWindow);
}
@@ -234,7 +234,8 @@ bool GlobalInspector::syncSelectedItems(const QList<QQuickItem *> &items)
bool selectionChanged = false;
// Disconnect and remove items that are no longer selected
- foreach (QQuickItem *item, m_selectedItems) {
+ const auto selectedItemsCopy = m_selectedItems;
+ for (QQuickItem *item : selectedItemsCopy) {
if (items.contains(item))
continue;
@@ -245,14 +246,14 @@ bool GlobalInspector::syncSelectedItems(const QList<QQuickItem *> &items)
}
// Connect and add newly selected items
- foreach (QQuickItem *item, items) {
+ for (QQuickItem *item : items) {
if (m_selectedItems.contains(item))
continue;
selectionChanged = true;
connect(item, &QObject::destroyed, this, &GlobalInspector::removeFromSelectedItems);
m_selectedItems.append(item);
- foreach (QQuickWindowInspector *inspector, m_windowInspectors) {
+ for (QQuickWindowInspector *inspector : qAsConst(m_windowInspectors)) {
if (inspector->isEnabled() && inspector->quickWindow() == item->window()) {
m_highlightItems.insert(item, new SelectionHighlight(titleForItem(item), item,
inspector->overlay()));
@@ -312,12 +313,12 @@ void GlobalInspector::processMessage(const QByteArray &message)
ds >> requestId >> command;
if (command == ENABLE) {
- foreach (QQuickWindowInspector *inspector, m_windowInspectors)
+ for (QQuickWindowInspector *inspector : qAsConst(m_windowInspectors))
inspector->setEnabled(true);
success = !m_windowInspectors.isEmpty();
} else if (command == DISABLE) {
setSelectedItems(QList<QQuickItem*>());
- foreach (QQuickWindowInspector *inspector, m_windowInspectors)
+ for (QQuickWindowInspector *inspector : qAsConst(m_windowInspectors))
inspector->setEnabled(false);
success = !m_windowInspectors.isEmpty();
} else if (command == SELECT) {
@@ -325,7 +326,7 @@ void GlobalInspector::processMessage(const QByteArray &message)
ds >> debugIds;
QList<QQuickItem *> selectedObjects;
- foreach (int debugId, debugIds) {
+ for (int debugId : qAsConst(debugIds)) {
if (QQuickItem *obj =
qobject_cast<QQuickItem *>(QQmlDebugService::objectForId(debugId)))
selectedObjects << obj;
@@ -339,7 +340,7 @@ void GlobalInspector::processMessage(const QByteArray &message)
} else if (command == SHOW_APP_ON_TOP) {
bool showOnTop;
ds >> showOnTop;
- foreach (QmlJSDebugger::QQuickWindowInspector *inspector, m_windowInspectors)
+ for (QmlJSDebugger::QQuickWindowInspector *inspector : qAsConst(m_windowInspectors))
inspector->setShowAppOnTop(showOnTop);
success = !m_windowInspectors.isEmpty();
} else if (command == CREATE_OBJECT) {
diff --git a/src/plugins/qmltooling/qmldbg_inspector/highlight.h b/src/plugins/qmltooling/qmldbg_inspector/highlight.h
index 2bf4fc1ad5..3f910e833b 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/highlight.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/highlight.h
@@ -81,7 +81,7 @@ class SelectionHighlight : public Highlight
public:
SelectionHighlight(const QString &name, QQuickItem *item, QQuickItem *parent);
- void paint(QPainter *painter);
+ void paint(QPainter *painter) override;
void showName(const QPointF &displayPoint);
private:
@@ -104,7 +104,7 @@ public:
setZ(1); // hover highlight on top of selection highlight
}
- void paint(QPainter *painter);
+ void paint(QPainter *painter) override;
};
} // namespace QmlJSDebugger
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservicefactory.h b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservicefactory.h
index 09e6a01f96..3214532c8d 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservicefactory.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservicefactory.h
@@ -64,7 +64,7 @@ class QQmlInspectorServiceFactory : public QQmlDebugServiceFactory
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlDebugServiceFactory_iid FILE "qqmlinspectorservice.json")
public:
- QQmlDebugService *create(const QString &key);
+ QQmlDebugService *create(const QString &key) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.h b/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.h
index b37a9face1..fc18f33ad3 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.h
+++ b/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.h
@@ -78,7 +78,7 @@ public:
void setEnabled(bool enabled);
protected:
- bool eventFilter(QObject *, QEvent *);
+ bool eventFilter(QObject *, QEvent *) override;
private:
QQuickItem *m_overlay;
diff --git a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp
index 64b26bdd0d..6152853917 100644
--- a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp
+++ b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp
@@ -43,6 +43,8 @@
#include <QtCore/qplugin.h>
#include <QtNetwork/qlocalsocket.h>
+Q_DECLARE_METATYPE(QLocalSocket::LocalSocketError)
+
QT_BEGIN_NAMESPACE
@@ -133,8 +135,14 @@ bool QLocalClientConnection::connectToServer()
{
m_socket = new QLocalSocket;
m_socket->setParent(this);
- QObject::connect(m_socket, &QLocalSocket::connected,
- this, &QLocalClientConnection::connectionEstablished);
+ connect(m_socket, &QLocalSocket::connected,
+ this, &QLocalClientConnection::connectionEstablished);
+ connect(m_socket, static_cast<void(QLocalSocket::*)(QLocalSocket::LocalSocketError)>(
+ &QLocalSocket::error), m_socket, [this](QLocalSocket::LocalSocketError) {
+ m_socket->disconnectFromServer();
+ m_socket->connectToServer(m_filename);
+ }, Qt::QueuedConnection);
+
m_socket->connectToServer(m_filename);
qDebug("QML Debugger: Connecting to socket %s...", m_filename.toLatin1().constData());
return true;
diff --git a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnectionfactory.h b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnectionfactory.h
index b884a1ec23..b64a1fff95 100644
--- a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnectionfactory.h
+++ b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnectionfactory.h
@@ -50,7 +50,7 @@ class QLocalClientConnectionFactory : public QQmlDebugServerConnectionFactory
Q_PLUGIN_METADATA(IID QQmlDebugServerConnectionFactory_iid FILE "qlocalclientconnection.json")
Q_INTERFACES(QQmlDebugServerConnectionFactory)
public:
- QQmlDebugServerConnection *create(const QString &key);
+ QQmlDebugServerConnection *create(const QString &key) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.cpp b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp
index b0f59717ac..b0f59717ac 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.h b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.h
index c25e756c2d..24fd27514b 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.h
+++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.h
@@ -68,10 +68,10 @@ public:
QDebugMessageServiceImpl(QObject *parent = 0);
void sendDebugMessage(QtMsgType type, const QMessageLogContext &ctxt, const QString &buf);
- void synchronizeTime(const QElapsedTimer &otherTimer);
+ void synchronizeTime(const QElapsedTimer &otherTimer) override;
protected:
- void stateChanged(State);
+ void stateChanged(State) override;
private:
friend class QQmlDebuggerServiceFactory;
diff --git a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.json b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.json
new file mode 100644
index 0000000000..2e8dc65cf5
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "DebugMessages" ]
+}
diff --git a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.cpp b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.cpp
new file mode 100644
index 0000000000..a066237e77
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdebugmessageservicefactory.h"
+#include "qdebugmessageservice.h"
+#include <private/qqmldebugserviceinterfaces_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQmlDebugService *QDebugMessageServiceFactory::create(const QString &key)
+{
+ if (key == QDebugMessageServiceImpl::s_key)
+ return new QDebugMessageServiceImpl(this);
+
+ return 0;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.h b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.h
new file mode 100644
index 0000000000..0c5f0f5d0a
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDEBUGMESSAGESERVICEFACTORY_H
+#define QDEBUGMESSAGESERVICEFACTORY_H
+
+#include <private/qqmldebugservicefactory_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDebugMessageServiceFactory : public QQmlDebugServiceFactory
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlDebugServiceFactory_iid FILE "qdebugmessageservice.json")
+public:
+ QQmlDebugService *create(const QString &key) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDEBUGMESSAGESERVICEFACTORY_H
diff --git a/src/plugins/qmltooling/qmldbg_messages/qmldbg_messages.pro b/src/plugins/qmltooling/qmldbg_messages/qmldbg_messages.pro
new file mode 100644
index 0000000000..5ddf7c615d
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_messages/qmldbg_messages.pro
@@ -0,0 +1,21 @@
+TARGET = qmldbg_messages
+QT = qml-private core packetprotocol-private
+
+SOURCES += \
+ $$PWD/qdebugmessageservice.cpp \
+ $$PWD/qdebugmessageservicefactory.cpp
+
+HEADERS += \
+ $$PWD/../shared/qqmldebugpacket.h \
+ $$PWD/qdebugmessageservice.h \
+ $$PWD/qdebugmessageservicefactory.h
+
+INCLUDEPATH += $$PWD \
+ $$PWD/../shared
+
+OTHER_FILES += \
+ $$PWD/qdebugmessageservice.json
+
+PLUGIN_TYPE = qmltooling
+PLUGIN_CLASS_NAME = QDebugMessageServiceFactory
+load(qt_plugin)
diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp
index 3145601612..1a318b3ca2 100644
--- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp
+++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp
@@ -183,7 +183,7 @@ QQmlNativeDebugConnector::QQmlNativeDebugConnector()
: m_blockingMode(false)
{
const QString args = commandLineArguments();
- const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','));
+ const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), QString::SkipEmptyParts);
QStringList services;
for (const QStringRef &strArgument : lstjsDebugArguments) {
if (strArgument == QLatin1String("block")) {
@@ -195,7 +195,7 @@ QQmlNativeDebugConnector::QQmlNativeDebugConnector()
services.append(strArgument.mid(9).toString());
} else if (!services.isEmpty()) {
services.append(strArgument.toString());
- } else {
+ } else if (!strArgument.startsWith(QLatin1String("connector:"))) {
qWarning("QML Debugger: Invalid argument \"%s\" detected. Ignoring the same.",
strArgument.toUtf8().constData());
}
@@ -205,7 +205,7 @@ QQmlNativeDebugConnector::QQmlNativeDebugConnector()
QQmlNativeDebugConnector::~QQmlNativeDebugConnector()
{
- foreach (QQmlDebugService *service, m_services) {
+ for (QQmlDebugService *service : qAsConst(m_services)) {
service->stateAboutToBeChanged(QQmlDebugService::NotConnected);
service->setState(QQmlDebugService::NotConnected);
service->stateChanged(QQmlDebugService::NotConnected);
@@ -232,12 +232,12 @@ void QQmlNativeDebugConnector::addEngine(QJSEngine *engine)
Q_ASSERT(!m_engines.contains(engine));
TRACE_PROTOCOL("Add engine to connector:" << engine);
- foreach (QQmlDebugService *service, m_services)
+ for (QQmlDebugService *service : qAsConst(m_services))
service->engineAboutToBeAdded(engine);
announceObjectAvailability(QLatin1String("qmlengine"), engine, true);
- foreach (QQmlDebugService *service, m_services)
+ for (QQmlDebugService *service : qAsConst(m_services))
service->engineAdded(engine);
m_engines.append(engine);
@@ -248,12 +248,12 @@ void QQmlNativeDebugConnector::removeEngine(QJSEngine *engine)
Q_ASSERT(m_engines.contains(engine));
TRACE_PROTOCOL("Remove engine from connector:" << engine);
- foreach (QQmlDebugService *service, m_services)
+ for (QQmlDebugService *service : qAsConst(m_services))
service->engineAboutToBeRemoved(engine);
announceObjectAvailability(QLatin1String("qmlengine"), engine, false);
- foreach (QQmlDebugService *service, m_services)
+ for (QQmlDebugService *service : qAsConst(m_services))
service->engineRemoved(engine);
m_engines.removeOne(engine);
diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h
index 1184925e53..f8b7e1d527 100644
--- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h
+++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h
@@ -78,7 +78,7 @@ class QQmlNativeDebugConnectorFactory : public QQmlDebugConnectorFactory
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlDebugConnectorFactory_iid FILE "qqmlnativedebugconnector.json")
public:
- QQmlDebugConnector *create(const QString &key);
+ QQmlDebugConnector *create(const QString &key) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qmldbg_nativedebugger.pro b/src/plugins/qmltooling/qmldbg_nativedebugger/qmldbg_nativedebugger.pro
new file mode 100644
index 0000000000..1873a6a77c
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qmldbg_nativedebugger.pro
@@ -0,0 +1,21 @@
+TARGET = qmldbg_nativedebugger
+QT = qml-private core packetprotocol-private
+
+SOURCES += \
+ $$PWD/qqmlnativedebugservicefactory.cpp \
+ $$PWD/qqmlnativedebugservice.cpp
+
+HEADERS += \
+ $$PWD/../shared/qqmldebugpacket.h \
+ $$PWD/qqmlnativedebugservicefactory.h \
+ $$PWD/qqmlnativedebugservice.h \
+
+INCLUDEPATH += $$PWD \
+ $$PWD/../shared
+
+OTHER_FILES += \
+ $$PWD/qqmlnativedebugservice.json
+
+PLUGIN_TYPE = qmltooling
+PLUGIN_CLASS_NAME = QQmlNativeDebugServiceFactory
+load(qt_plugin)
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
index 14dfc5356e..7f842419e7 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
@@ -287,7 +287,7 @@ void NativeDebugger::signalEmitted(const QString &signal)
//Normalize to Lower case.
QString signalName = signal.left(signal.indexOf(QLatin1Char('('))).toLower();
- foreach (const QString &signal, breakOnSignals) {
+ for (const QString &signal : qAsConst(breakOnSignals)) {
if (signal == signalName) {
// TODO: pause debugger
break;
@@ -339,15 +339,15 @@ void NativeDebugger::handleBacktrace(QJsonObject *response, const QJsonObject &a
if (QV4::Function *function = executionContext->getFunction()) {
QJsonObject frame;
- frame[QStringLiteral("language")] = QStringLiteral("js");
- frame[QStringLiteral("context")] = encodeContext(executionContext);
+ frame.insert(QStringLiteral("language"), QStringLiteral("js"));
+ frame.insert(QStringLiteral("context"), encodeContext(executionContext));
if (QV4::Heap::String *functionName = function->name())
- frame[QStringLiteral("function")] = functionName->toQString();
- frame[QStringLiteral("file")] = function->sourceFile();
+ frame.insert(QStringLiteral("function"), functionName->toQString());
+ frame.insert(QStringLiteral("file"), function->sourceFile());
int line = executionContext->d()->lineNumber;
- frame[QStringLiteral("line")] = (line < 0 ? -line : line);
+ frame.insert(QStringLiteral("line"), (line < 0 ? -line : line));
frameArray.push_back(frame);
}
@@ -473,8 +473,8 @@ void NativeDebugger::handleVariables(QJsonObject *response, const QJsonObject &a
TRACE_PROTOCOL("Engine: " << engine);
Collector collector(engine);
- QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray();
- foreach (const QJsonValue &ex, expanded)
+ const QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray();
+ for (const QJsonValue &ex : expanded)
collector.m_expanded.append(ex.toString());
TRACE_PROTOCOL("Expanded: " << collector.m_expanded);
@@ -525,16 +525,16 @@ void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject
TRACE_PROTOCOL("Engines: " << engine << m_engine);
Collector collector(engine);
- QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray();
- foreach (const QJsonValue &ex, expanded)
+ const QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray();
+ for (const QJsonValue &ex : expanded)
collector.m_expanded.append(ex.toString());
TRACE_PROTOCOL("Expanded: " << collector.m_expanded);
QJsonArray output;
QV4::Scope scope(engine);
- QJsonArray expressions = arguments.value(QLatin1String("expressions")).toArray();
- foreach (const QJsonValue &expr, expressions) {
+ const QJsonArray expressions = arguments.value(QLatin1String("expressions")).toArray();
+ for (const QJsonValue &expr : expressions) {
QString expression = expr.toObject().value(QLatin1String("expression")).toString();
QString name = expr.toObject().value(QLatin1String("name")).toString();
TRACE_PROTOCOL("Evaluate expression: " << expression);
@@ -546,15 +546,15 @@ void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject
m_runningJob = false;
if (result->isUndefined()) {
QJsonObject dict;
- dict[QStringLiteral("name")] = name;
- dict[QStringLiteral("valueencoded")] = QStringLiteral("undefined");
+ dict.insert(QStringLiteral("name"), name);
+ dict.insert(QStringLiteral("valueencoded"), QStringLiteral("undefined"));
output.append(dict);
} else if (result.ptr && result.ptr->rawValue()) {
collector.collect(&output, QString(), name, *result);
} else {
QJsonObject dict;
- dict[QStringLiteral("name")] = name;
- dict[QStringLiteral("valueencoded")] = QStringLiteral("notaccessible");
+ dict.insert(QStringLiteral("name"), name);
+ dict.insert(QStringLiteral("valueencoded"), QStringLiteral("notaccessible"));
output.append(dict);
}
TRACE_PROTOCOL("EXCEPTION: " << engine->hasException);
@@ -742,7 +742,8 @@ void QQmlNativeDebugServiceImpl::engineAboutToBeRemoved(QJSEngine *engine)
TRACE_PROTOCOL("Removing engine" << engine);
if (engine) {
QV4::ExecutionEngine *executionEngine = QV8Engine::getV4(engine->handle());
- foreach (NativeDebugger *debugger, m_debuggers) {
+ const auto debuggersCopy = m_debuggers;
+ for (NativeDebugger *debugger : debuggersCopy) {
if (debugger->engine() == executionEngine)
m_debuggers.removeAll(debugger);
}
@@ -753,7 +754,7 @@ void QQmlNativeDebugServiceImpl::engineAboutToBeRemoved(QJSEngine *engine)
void QQmlNativeDebugServiceImpl::stateAboutToBeChanged(QQmlDebugService::State state)
{
if (state == Enabled) {
- foreach (NativeDebugger *debugger, m_debuggers) {
+ for (NativeDebugger *debugger : qAsConst(m_debuggers)) {
QV4::ExecutionEngine *engine = debugger->engine();
if (!engine->debugger())
engine->setDebugger(debugger);
@@ -777,7 +778,7 @@ void QQmlNativeDebugServiceImpl::messageReceived(const QByteArray &message)
} else if (cmd == QLatin1String("echo")) {
response.insert(QStringLiteral("result"), arguments);
} else {
- foreach (NativeDebugger *debugger, m_debuggers)
+ for (NativeDebugger *debugger : qAsConst(m_debuggers))
if (debugger)
debugger->handleCommand(&response, cmd, arguments);
}
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.h b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h
index 8015513f9e..58bf1bc94a 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.h
+++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h
@@ -67,7 +67,6 @@ QT_BEGIN_NAMESPACE
class NativeDebugger;
class BreakPointHandler;
-class QQmlDebuggerServiceFactory;
class QQmlNativeDebugServiceImpl : public QQmlNativeDebugService
{
@@ -86,7 +85,6 @@ public:
void emitAsynchronousMessageToClient(const QJsonObject &message);
private:
- friend class QQmlDebuggerServiceFactory;
friend class NativeDebugger;
QList<QPointer<NativeDebugger> > m_debuggers;
diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.json b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.json
new file mode 100644
index 0000000000..2951166298
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "NativeQmlDebugger" ]
+}
diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp
new file mode 100644
index 0000000000..1841c82d5d
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmlnativedebugservice.h"
+#include "qqmlnativedebugservicefactory.h"
+#include <private/qqmldebugserviceinterfaces_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQmlDebugService *QQmlNativeDebugServiceFactory::create(const QString &key)
+{
+ if (key == QQmlNativeDebugServiceImpl::s_key)
+ return new QQmlNativeDebugServiceImpl(this);
+
+ return 0;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.h b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.h
new file mode 100644
index 0000000000..f2b2e4792e
--- /dev/null
+++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLNATIVEDEBUGSERVICEFACTORY_H
+#define QQMLNATIVEDEBUGSERVICEFACTORY_H
+
+#include <private/qqmldebugservicefactory_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlNativeDebugServiceFactory : public QQmlDebugServiceFactory
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlDebugServiceFactory_iid FILE "qqmlnativedebugservice.json")
+public:
+ QQmlDebugService *create(const QString &key) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQMLNATIVEDEBUGSERVICEFACTORY_H
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp
index 6b653d5a54..9918a95116 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp
@@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE
QQmlEngineControlServiceImpl::QQmlEngineControlServiceImpl(QObject *parent) :
QQmlEngineControlService(1, parent)
{
+ blockingMode = QQmlDebugConnector::instance()->blockingMode();
}
void QQmlEngineControlServiceImpl::messageReceived(const QByteArray &message)
@@ -68,7 +69,7 @@ void QQmlEngineControlServiceImpl::messageReceived(const QByteArray &message)
void QQmlEngineControlServiceImpl::engineAboutToBeAdded(QJSEngine *engine)
{
QMutexLocker lock(&dataMutex);
- if (state() == Enabled) {
+ if (blockingMode && state() == Enabled) {
Q_ASSERT(!stoppingEngines.contains(engine));
Q_ASSERT(!startingEngines.contains(engine));
startingEngines.append(engine);
@@ -81,7 +82,7 @@ void QQmlEngineControlServiceImpl::engineAboutToBeAdded(QJSEngine *engine)
void QQmlEngineControlServiceImpl::engineAboutToBeRemoved(QJSEngine *engine)
{
QMutexLocker lock(&dataMutex);
- if (state() == Enabled) {
+ if (blockingMode && state() == Enabled) {
Q_ASSERT(!stoppingEngines.contains(engine));
Q_ASSERT(!startingEngines.contains(engine));
stoppingEngines.append(engine);
@@ -122,10 +123,10 @@ void QQmlEngineControlServiceImpl::stateChanged(State)
{
// We flush everything for any kind of state change, to avoid complicated timing issues.
QMutexLocker lock(&dataMutex);
- foreach (QJSEngine *engine, startingEngines)
+ for (QJSEngine *engine : qAsConst(startingEngines))
emit attachedToEngine(engine);
startingEngines.clear();
- foreach (QJSEngine *engine, stoppingEngines)
+ for (QJSEngine *engine : qAsConst(stoppingEngines))
emit detachedFromEngine(engine);
stoppingEngines.clear();
}
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h
index 1138310820..6392944519 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h
@@ -79,6 +79,7 @@ protected:
QMutex dataMutex;
QList<QJSEngine *> startingEngines;
QList<QJSEngine *> stoppingEngines;
+ bool blockingMode;
void messageReceived(const QByteArray &) Q_DECL_OVERRIDE;
void engineAboutToBeAdded(QJSEngine *) Q_DECL_OVERRIDE;
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
index dba2fd3cc3..c1f6f93ef1 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
@@ -51,6 +51,8 @@
#include <QtCore/qthread.h>
#include <QtCore/qcoreapplication.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
Q_QML_DEBUG_PLUGIN_LOADER(QQmlAbstractProfilerAdapter)
@@ -92,16 +94,18 @@ void QQmlProfilerServiceImpl::dataReady(QQmlAbstractProfilerAdapter *profiler)
m_startTimes.insert(0, profiler);
if (dataComplete) {
QList<QJSEngine *> enginesToRelease;
- foreach (QJSEngine *engine, m_stoppingEngines) {
- foreach (QQmlAbstractProfilerAdapter *engineProfiler, m_engineProfilers.values(engine)) {
- if (m_startTimes.values().contains(engineProfiler)) {
+ for (QJSEngine *engine : qAsConst(m_stoppingEngines)) {
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ const auto startTimesEnd = m_startTimes.cend();
+ for (auto it = range.first; it != range.second; ++it) {
+ if (std::find(m_startTimes.cbegin(), startTimesEnd, *it) != startTimesEnd) {
enginesToRelease.append(engine);
break;
}
}
}
sendMessages();
- foreach (QJSEngine *engine, enginesToRelease) {
+ for (QJSEngine *engine : qAsConst(enginesToRelease)) {
m_stoppingEngines.removeOne(engine);
emit detachedFromEngine(engine);
}
@@ -130,8 +134,9 @@ void QQmlProfilerServiceImpl::engineAdded(QJSEngine *engine)
"QML profilers have to be added from the engine thread");
QMutexLocker lock(&m_configMutex);
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers.values(engine))
- profiler->stopWaiting();
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ for (auto it = range.first; it != range.second; ++it)
+ (*it)->stopWaiting();
}
void QQmlProfilerServiceImpl::engineAboutToBeRemoved(QJSEngine *engine)
@@ -141,7 +146,9 @@ void QQmlProfilerServiceImpl::engineAboutToBeRemoved(QJSEngine *engine)
QMutexLocker lock(&m_configMutex);
bool isRunning = false;
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers.values(engine)) {
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ for (auto it = range.first; it != range.second; ++it) {
+ QQmlAbstractProfilerAdapter *profiler = *it;
if (profiler->isRunning())
isRunning = true;
profiler->startWaiting();
@@ -160,7 +167,9 @@ void QQmlProfilerServiceImpl::engineRemoved(QJSEngine *engine)
"QML profilers have to be removed from the engine thread");
QMutexLocker lock(&m_configMutex);
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers.values(engine)) {
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ for (auto it = range.first; it != range.second; ++it) {
+ QQmlAbstractProfilerAdapter *profiler = *it;
removeProfilerFromStartTimes(profiler);
delete profiler;
}
@@ -183,7 +192,7 @@ void QQmlProfilerServiceImpl::addGlobalProfiler(QQmlAbstractProfilerAdapter *pro
// Global profilers are started whenever any engine profiler is started and stopped when
// all engine profilers are stopped.
quint64 features = 0;
- foreach (QQmlAbstractProfilerAdapter *engineProfiler, m_engineProfilers)
+ for (QQmlAbstractProfilerAdapter *engineProfiler : qAsConst(m_engineProfilers))
features |= engineProfiler->features();
if (features != 0)
@@ -231,7 +240,9 @@ void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features
d << m_timer.nsecsElapsed() << (int)Event << (int)StartTrace;
bool startedAny = false;
if (engine != 0) {
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers.values(engine)) {
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ for (auto it = range.first; it != range.second; ++it) {
+ QQmlAbstractProfilerAdapter *profiler = *it;
if (!profiler->isRunning()) {
profiler->startProfiling(features);
startedAny = true;
@@ -249,12 +260,12 @@ void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features
startedAny = true;
}
}
- foreach (QJSEngine *profiledEngine, engines)
+ for (QJSEngine *profiledEngine : qAsConst(engines))
d << idForObject(profiledEngine);
}
if (startedAny) {
- foreach (QQmlAbstractProfilerAdapter *profiler, m_globalProfilers) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_globalProfilers)) {
if (!profiler->isRunning())
profiler->startProfiling(features);
}
@@ -294,7 +305,7 @@ void QQmlProfilerServiceImpl::stopProfiling(QJSEngine *engine)
if (stopping.isEmpty())
return;
- foreach (QQmlAbstractProfilerAdapter *profiler, m_globalProfilers) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_globalProfilers)) {
if (!profiler->isRunning())
continue;
m_startTimes.insert(-1, profiler);
@@ -308,10 +319,10 @@ void QQmlProfilerServiceImpl::stopProfiling(QJSEngine *engine)
emit stopFlushTimer();
m_waitingForStop = true;
- foreach (QQmlAbstractProfilerAdapter *profiler, reporting)
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(reporting))
profiler->reportData(m_useMessageTypes);
- foreach (QQmlAbstractProfilerAdapter *profiler, stopping)
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(stopping))
profiler->stopProfiling();
}
@@ -327,7 +338,7 @@ void QQmlProfilerServiceImpl::sendMessages()
traceEnd << m_timer.nsecsElapsed() << (int)Event << (int)EndTrace;
QSet<QJSEngine *> seen;
- foreach (QQmlAbstractProfilerAdapter *profiler, m_startTimes) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_startTimes)) {
for (QMultiHash<QJSEngine *, QQmlAbstractProfilerAdapter *>::iterator i(m_engineProfilers.begin());
i != m_engineProfilers.end(); ++i) {
if (i.value() == profiler && !seen.contains(i.key())) {
@@ -367,7 +378,7 @@ void QQmlProfilerServiceImpl::sendMessages()
emit messagesToClient(name(), messages);
// Restart flushing if any profilers are still running
- foreach (const QQmlAbstractProfilerAdapter *profiler, m_engineProfilers) {
+ for (const QQmlAbstractProfilerAdapter *profiler : qAsConst(m_engineProfilers)) {
if (profiler->isRunning()) {
emit startFlushTimer();
break;
@@ -438,21 +449,21 @@ void QQmlProfilerServiceImpl::flush()
QMutexLocker lock(&m_configMutex);
QList<QQmlAbstractProfilerAdapter *> reporting;
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_engineProfilers)) {
if (profiler->isRunning()) {
m_startTimes.insert(-1, profiler);
reporting.append(profiler);
}
}
- foreach (QQmlAbstractProfilerAdapter *profiler, m_globalProfilers) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_globalProfilers)) {
if (profiler->isRunning()) {
m_startTimes.insert(-1, profiler);
reporting.append(profiler);
}
}
- foreach (QQmlAbstractProfilerAdapter *profiler, reporting)
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(reporting))
profiler->reportData(m_useMessageTypes);
}
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservicefactory.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservicefactory.h
index 772e53bde7..cdce4cd240 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservicefactory.h
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservicefactory.h
@@ -60,7 +60,7 @@ class QQmlProfilerServiceFactory : public QQmlDebugServiceFactory
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlDebugServiceFactory_iid FILE "qqmlprofilerservice.json")
public:
- QQmlDebugService *create(const QString &key);
+ QQmlDebugService *create(const QString &key) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapterfactory.h b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapterfactory.h
index 489545b504..41b9875c03 100644
--- a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapterfactory.h
+++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapterfactory.h
@@ -61,7 +61,7 @@ class QQuickProfilerAdapterFactory : public QQmlAbstractProfilerAdapterFactory
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlAbstractProfilerAdapterFactory_iid FILE "qquickprofileradapter.json")
public:
- QQmlAbstractProfilerAdapter *create(const QString &key);
+ QQmlAbstractProfilerAdapter *create(const QString &key) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
index 96b3455790..f6f48e43a4 100644
--- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
+++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
@@ -346,7 +346,7 @@ void QQmlDebugServerImpl::parseArguments()
QString fileName;
QStringList services;
- const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','));
+ const auto lstjsDebugArguments = args.splitRef(QLatin1Char(','), QString::SkipEmptyParts);
for (auto argsIt = lstjsDebugArguments.begin(), argsItEnd = lstjsDebugArguments.end(); argsIt != argsItEnd; ++argsIt) {
const QStringRef &strArgument = *argsIt;
if (strArgument.startsWith(QLatin1String("port:"))) {
@@ -377,7 +377,7 @@ void QQmlDebugServerImpl::parseArguments()
services.append(strArgument.mid(9).toString());
} else if (!services.isEmpty()) {
services.append(strArgument.toString());
- } else {
+ } else if (!strArgument.startsWith(QLatin1String("connector:"))) {
const QString message = tr("QML Debugger: Invalid argument \"%1\" detected."
" Ignoring the same.").arg(strArgument.toString());
qWarning("%s", qPrintable(message));
@@ -589,12 +589,12 @@ void QQmlDebugServerImpl::addEngine(QJSEngine *engine)
QMutexLocker locker(&m_helloMutex);
Q_ASSERT(!m_engineConditions.contains(engine));
- foreach (QQmlDebugService *service, m_plugins)
+ for (QQmlDebugService *service : qAsConst(m_plugins))
service->engineAboutToBeAdded(engine);
m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.count());
- foreach (QQmlDebugService *service, m_plugins)
+ for (QQmlDebugService *service : qAsConst(m_plugins))
service->engineAdded(engine);
}
@@ -606,12 +606,12 @@ void QQmlDebugServerImpl::removeEngine(QJSEngine *engine)
QMutexLocker locker(&m_helloMutex);
Q_ASSERT(m_engineConditions.contains(engine));
- foreach (QQmlDebugService *service, m_plugins)
+ for (QQmlDebugService *service : qAsConst(m_plugins))
service->engineAboutToBeRemoved(engine);
m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.count());
- foreach (QQmlDebugService *service, m_plugins)
+ for (QQmlDebugService *service : qAsConst(m_plugins))
service->engineRemoved(engine);
m_engineConditions.remove(engine);
@@ -703,11 +703,11 @@ void QQmlDebugServerImpl::sendMessages(const QString &name, const QList<QByteArr
if (m_clientSupportsMultiPackets) {
QQmlDebugPacket out;
out << name;
- foreach (const QByteArray &message, messages)
+ for (const QByteArray &message : messages)
out << message;
m_protocol->send(out.data());
} else {
- foreach (const QByteArray &message, messages)
+ for (const QByteArray &message : messages)
doSendMessage(name, message);
}
m_connection->flush();
diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.h b/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.h
index fd71b03019..2debabaeb2 100644
--- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.h
+++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.h
@@ -63,7 +63,7 @@ class QQmlDebugServerFactory : public QQmlDebugConnectorFactory
// QQmlDebugServer is for connection plugins.
Q_PLUGIN_METADATA(IID QQmlDebugConnectorFactory_iid FILE "qqmldebugserver.json")
public:
- QQmlDebugConnector *create(const QString &key);
+ QQmlDebugConnector *create(const QString &key) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnectionfactory.h b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnectionfactory.h
index 52d9f4b709..d3b0e00584 100644
--- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnectionfactory.h
+++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnectionfactory.h
@@ -50,7 +50,7 @@ class QTcpServerConnectionFactory : public QQmlDebugServerConnectionFactory
Q_PLUGIN_METADATA(IID QQmlDebugServerConnectionFactory_iid FILE "qtcpserverconnection.json")
Q_INTERFACES(QQmlDebugServerConnectionFactory)
public:
- QQmlDebugServerConnection *create(const QString &key);
+ QQmlDebugServerConnection *create(const QString &key) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro
index 907fbe9273..8123e2999e 100644
--- a/src/plugins/qmltooling/qmltooling.pro
+++ b/src/plugins/qmltooling/qmltooling.pro
@@ -19,12 +19,16 @@ qtConfig(qml-network) {
# Services
SUBDIRS += \
qmldbg_debugger \
- qmldbg_profiler
+ qmldbg_profiler \
+ qmldbg_messages \
+ qmldbg_nativedebugger
qmldbg_server.depends = packetprotocol
qmldbg_native.depends = packetprotocol
qmldbg_debugger.depends = packetprotocol
qmldbg_profiler.depends = packetprotocol
+qmldbg_messages.depends = packetprotocol
+qmldbg_nativedebugger.depends = packetprotocol
qtHaveModule(quick) {
SUBDIRS += \