aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/debugger/debugger.pri4
-rw-r--r--tests/auto/qml/debugger/debugger.pro2
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro7
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro7
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro7
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro8
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro7
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro (renamed from tests/auto/qml/debugger/qqmlenginedebug/qqmlenginedebug.pro)9
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp (renamed from tests/auto/qml/debugger/qqmlenginedebug/tst_qqmlenginedebug.cpp)70
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro7
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro10
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp3
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro9
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp3
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp3
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.pri9
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h2
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.cpp (renamed from src/qml/debugger/qqmldebugclient.cpp)25
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.h (renamed from src/qml/debugger/qqmldebugclient_p.h)21
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebug.cpp (renamed from src/qml/debugger/qqmlenginedebug.cpp)10
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebug_p.h (renamed from src/qml/debugger/qqmlenginedebug_p.h)9
-rw-r--r--tools/qmlprofiler/profileclient.h2
-rw-r--r--tools/qmlprofiler/qmlprofiler.pro8
-rw-r--r--tools/qmlprofiler/qqmldebugclient.cpp410
-rw-r--r--tools/qmlprofiler/qqmldebugclient.h109
30 files changed, 629 insertions, 148 deletions
diff --git a/src/qml/debugger/debugger.pri b/src/qml/debugger/debugger.pri
index f85663c01f..f5abd2c196 100644
--- a/src/qml/debugger/debugger.pri
+++ b/src/qml/debugger/debugger.pri
@@ -1,8 +1,6 @@
SOURCES += \
$$PWD/qpacketprotocol.cpp \
$$PWD/qqmldebugservice.cpp \
- $$PWD/qqmldebugclient.cpp \
- $$PWD/qqmlenginedebug.cpp \
$$PWD/qqmlprofilerservice.cpp \
$$PWD/qqmldebugserver.cpp \
$$PWD/qqmlinspectorservice.cpp \
@@ -15,8 +13,6 @@ HEADERS += \
$$PWD/qpacketprotocol_p.h \
$$PWD/qqmldebugservice_p.h \
$$PWD/qqmldebugservice_p_p.h \
- $$PWD/qqmldebugclient_p.h \
- $$PWD/qqmlenginedebug_p.h \
$$PWD/qqmlprofilerservice_p.h \
$$PWD/qqmldebugserver_p.h \
$$PWD/qqmldebugserverconnection_p.h \
diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro
index 4f9ebbc350..7669aaa83c 100644
--- a/tests/auto/qml/debugger/debugger.pro
+++ b/tests/auto/qml/debugger/debugger.pro
@@ -1,7 +1,7 @@
TEMPLATE = subdirs
PRIVATETESTS += \
- qqmlenginedebug \
+ qqmlenginedebugservice \
qqmldebugclient \
qqmldebugservice \
qqmldebugjs \
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
index d62a262d2f..4b5bf60ace 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
+++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
@@ -3,14 +3,11 @@ TARGET = tst_qdebugmessageservice
QT += network qml-private testlib
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-
-SOURCES += tst_qdebugmessageservice.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qdebugmessageservice.cpp
INCLUDEPATH += ../shared
-
include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
TESTDATA = data/*
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index a19fd4b766..8473774ae6 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include <QtQml/private/qqmldebugclient_p.h>
+#include "qqmldebugclient.h"
//QQmlDebugTest
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
#include "../../../shared/util.h"
#include <QtCore/QString>
diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
index 88439196a7..f631929427 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
+++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qpacketprotocol
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qpacketprotocol.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qpacketprotocol.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
CONFIG += parallel_test
QT += qml-private network testlib
diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
index c02dd2d8fa..4a6efb469d 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
+++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
@@ -48,7 +48,7 @@
#include <private/qpacketprotocol_p.h>
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
class tst_QPacketProtocol : public QObject
{
diff --git a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
index d298b5c087..22a4df7dc9 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
+++ b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmldebugclient
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmldebugclient.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmldebugclient.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
CONFIG += declarative_debug
diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
index b18f30ffb3..9377ef6a8f 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -47,7 +47,7 @@
#include <QtQml/qqmlengine.h>
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
#define PORT 13770
#define STR_PORT "13770"
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
index 7bb5161ed6..7c3a2ea042 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
@@ -3,13 +3,11 @@ TARGET = tst_qqmldebugjs
QT += qml-private testlib
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmldebugjs.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmldebugjs.cpp
INCLUDEPATH += ../shared
-
-include (../../../shared/util.pri)
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
TESTDATA = data/*
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index 9a8b00bb6c..9cd021d5e9 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -46,11 +46,11 @@
#include <QtCore/QDir>
#include <QtCore/QMutex>
#include <QtCore/QLibraryInfo>
-#include <QtQml/private/qqmldebugclient_p.h>
#include <QtQml/QJSEngine>
//QQmlDebugTest
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#include "../../../shared/util.h"
const char *V8REQUEST = "v8request";
diff --git a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
index ecb3b2ca2c..dc2039615a 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
+++ b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmldebugservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmldebugservice.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmldebugservice.cpp
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index 3699530e00..a7fc284443 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -47,11 +47,11 @@
#include <QtQml/qqmlengine.h>
-#include <private/qqmldebugclient_p.h>
#include <private/qqmldebugservice_p.h>
#include "../../../shared/util.h"
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#define PORT 13769
#define STR_PORT "13769"
diff --git a/tests/auto/qml/debugger/qqmlenginedebug/qqmlenginedebug.pro b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
index 529c4667cf..0b92a726b5 100644
--- a/tests/auto/qml/debugger/qqmlenginedebug/qqmlenginedebug.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
@@ -1,10 +1,11 @@
CONFIG += testcase
-TARGET = tst_qqmlenginedebug
+TARGET = tst_qqmlenginedebugservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmlenginedebug.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmlenginedebugservice.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmlenginedebug/tst_qqmlenginedebug.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index df8109abfb..a35aafff4d 100644
--- a/tests/auto/qml/debugger/qqmlenginedebug/tst_qqmlenginedebug.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -54,16 +54,16 @@
#include <private/qqmlbinding_p.h>
#include <private/qqmlboundsignal_p.h>
-#include <private/qqmlenginedebug_p.h>
#include <private/qqmldebugservice_p.h>
#include <private/qqmlmetatype_p.h>
#include <private/qqmlproperty_p.h>
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmlenginedebug_p.h"
Q_DECLARE_METATYPE(QQmlDebugWatch::State)
-class tst_QQmlEngineDebug : public QObject
+class tst_QQmlEngineDebugService : public QObject
{
Q_OBJECT
@@ -127,7 +127,7 @@ signals:
QML_DECLARE_TYPE(NonScriptProperty)
-QQmlDebugObjectReference tst_QQmlEngineDebug::findRootObject(int context, bool recursive)
+QQmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(int context, bool recursive)
{
QQmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
@@ -153,7 +153,7 @@ QQmlDebugObjectReference tst_QQmlEngineDebug::findRootObject(int context, bool r
return result;
}
-QQmlDebugPropertyReference tst_QQmlEngineDebug::findProperty(const QList<QQmlDebugPropertyReference> &props, const QString &name) const
+QQmlDebugPropertyReference tst_QQmlEngineDebugService::findProperty(const QList<QQmlDebugPropertyReference> &props, const QString &name) const
{
foreach(const QQmlDebugPropertyReference &p, props) {
if (p.name() == name)
@@ -162,7 +162,7 @@ QQmlDebugPropertyReference tst_QQmlEngineDebug::findProperty(const QList<QQmlDeb
return QQmlDebugPropertyReference();
}
-void tst_QQmlEngineDebug::waitForQuery(QQmlDebugQuery *query)
+void tst_QQmlEngineDebugService::waitForQuery(QQmlDebugQuery *query)
{
QVERIFY(query);
QCOMPARE(query->parent(), qobject_cast<QObject*>(this));
@@ -171,7 +171,7 @@ void tst_QQmlEngineDebug::waitForQuery(QQmlDebugQuery *query)
QFAIL("query timed out");
}
-void tst_QQmlEngineDebug::recursiveObjectTest(QObject *o, const QQmlDebugObjectReference &oref, bool recursive) const
+void tst_QQmlEngineDebugService::recursiveObjectTest(QObject *o, const QQmlDebugObjectReference &oref, bool recursive) const
{
const QMetaObject *meta = o->metaObject();
@@ -248,7 +248,7 @@ void tst_QQmlEngineDebug::recursiveObjectTest(QObject *o, const QQmlDebugObjectR
}
}
-void tst_QQmlEngineDebug::recursiveCompareObjects(const QQmlDebugObjectReference &a, const QQmlDebugObjectReference &b) const
+void tst_QQmlEngineDebugService::recursiveCompareObjects(const QQmlDebugObjectReference &a, const QQmlDebugObjectReference &b) const
{
QCOMPARE(a.debugId(), b.debugId());
QCOMPARE(a.className(), b.className());
@@ -272,7 +272,7 @@ void tst_QQmlEngineDebug::recursiveCompareObjects(const QQmlDebugObjectReference
recursiveCompareObjects(a.children()[i], b.children()[i]);
}
-void tst_QQmlEngineDebug::recursiveCompareContexts(const QQmlDebugContextReference &a, const QQmlDebugContextReference &b) const
+void tst_QQmlEngineDebugService::recursiveCompareContexts(const QQmlDebugContextReference &a, const QQmlDebugContextReference &b) const
{
QCOMPARE(a.debugId(), b.debugId());
QCOMPARE(a.name(), b.name());
@@ -286,7 +286,7 @@ void tst_QQmlEngineDebug::recursiveCompareContexts(const QQmlDebugContextReferen
recursiveCompareContexts(a.contexts()[i], b.contexts()[i]);
}
-void tst_QQmlEngineDebug::compareProperties(const QQmlDebugPropertyReference &a, const QQmlDebugPropertyReference &b) const
+void tst_QQmlEngineDebugService::compareProperties(const QQmlDebugPropertyReference &a, const QQmlDebugPropertyReference &b) const
{
QCOMPARE(a.objectDebugId(), b.objectDebugId());
QCOMPARE(a.name(), b.name());
@@ -296,7 +296,7 @@ void tst_QQmlEngineDebug::compareProperties(const QQmlDebugPropertyReference &a,
QCOMPARE(a.hasNotifySignal(), b.hasNotifySignal());
}
-void tst_QQmlEngineDebug::initTestCase()
+void tst_QQmlEngineDebugService::initTestCase()
{
qRegisterMetaType<QQmlDebugWatch::State>();
qmlRegisterType<NonScriptProperty>("Test", 1, 0, "NonScriptPropertyElement");
@@ -394,7 +394,7 @@ void tst_QQmlEngineDebug::initTestCase()
QTRY_VERIFY(m_dbg->state() == QQmlEngineDebug::Enabled);
}
-void tst_QQmlEngineDebug::cleanupTestCase()
+void tst_QQmlEngineDebugService::cleanupTestCase()
{
delete m_dbg;
delete m_conn;
@@ -402,7 +402,7 @@ void tst_QQmlEngineDebug::cleanupTestCase()
delete m_engine;
}
-void tst_QQmlEngineDebug::setMethodBody()
+void tst_QQmlEngineDebugService::setMethodBody()
{
QQmlDebugObjectReference obj = findRootObject(2);
@@ -439,7 +439,7 @@ void tst_QQmlEngineDebug::setMethodBody()
}
}
-void tst_QQmlEngineDebug::watch_property()
+void tst_QQmlEngineDebugService::watch_property()
{
QQmlDebugObjectReference obj = findRootObject();
QQmlDebugPropertyReference prop = findProperty(obj.properties(), "width");
@@ -484,7 +484,7 @@ void tst_QQmlEngineDebug::watch_property()
QCOMPARE(spy.at(0).at(1).value<QVariant>(), qVariantFromValue(origWidth*2));
}
-void tst_QQmlEngineDebug::watch_object()
+void tst_QQmlEngineDebugService::watch_object()
{
QQmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
@@ -557,7 +557,7 @@ void tst_QQmlEngineDebug::watch_object()
QCOMPARE(newHeight, origHeight * 2);
}
-void tst_QQmlEngineDebug::watch_expression()
+void tst_QQmlEngineDebugService::watch_expression()
{
QFETCH(QString, expr);
QFETCH(int, increment);
@@ -620,7 +620,7 @@ void tst_QQmlEngineDebug::watch_expression()
}
}
-void tst_QQmlEngineDebug::watch_expression_data()
+void tst_QQmlEngineDebugService::watch_expression_data()
{
QTest::addColumn<QString>("expr");
QTest::addColumn<int>("increment");
@@ -630,21 +630,21 @@ void tst_QQmlEngineDebug::watch_expression_data()
QTest::newRow("width+10") << "width + 10" << 10 << 5;
}
-void tst_QQmlEngineDebug::watch_context()
+void tst_QQmlEngineDebugService::watch_context()
{
QQmlDebugContextReference c;
QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebug::addWatch(): Not implemented");
QVERIFY(!m_dbg->addWatch(c, QString(), this));
}
-void tst_QQmlEngineDebug::watch_file()
+void tst_QQmlEngineDebugService::watch_file()
{
QQmlDebugFileReference f;
QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebug::addWatch(): Not implemented");
QVERIFY(!m_dbg->addWatch(f, this));
}
-void tst_QQmlEngineDebug::queryAvailableEngines()
+void tst_QQmlEngineDebugService::queryAvailableEngines()
{
QQmlDebugEnginesQuery *q_engines;
@@ -679,7 +679,7 @@ void tst_QQmlEngineDebug::queryAvailableEngines()
m_dbg = new QQmlEngineDebug(m_conn, this);
}
-void tst_QQmlEngineDebug::queryRootContexts()
+void tst_QQmlEngineDebugService::queryRootContexts()
{
QQmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
@@ -725,7 +725,7 @@ void tst_QQmlEngineDebug::queryRootContexts()
m_dbg = new QQmlEngineDebug(m_conn, this);
}
-void tst_QQmlEngineDebug::queryObject()
+void tst_QQmlEngineDebugService::queryObject()
{
QFETCH(bool, recursive);
@@ -797,7 +797,7 @@ void tst_QQmlEngineDebug::queryObject()
}
}
-void tst_QQmlEngineDebug::queryObject_data()
+void tst_QQmlEngineDebugService::queryObject_data()
{
QTest::addColumn<bool>("recursive");
@@ -805,7 +805,7 @@ void tst_QQmlEngineDebug::queryObject_data()
QTest::newRow("recursive") << true;
}
-void tst_QQmlEngineDebug::queryExpressionResult()
+void tst_QQmlEngineDebugService::queryExpressionResult()
{
QFETCH(QString, expr);
QFETCH(QVariant, result);
@@ -846,7 +846,7 @@ void tst_QQmlEngineDebug::queryExpressionResult()
m_dbg = new QQmlEngineDebug(m_conn, this);
}
-void tst_QQmlEngineDebug::queryExpressionResult_data()
+void tst_QQmlEngineDebugService::queryExpressionResult_data()
{
QTest::addColumn<QString>("expr");
QTest::addColumn<QVariant>("result");
@@ -861,7 +861,7 @@ void tst_QQmlEngineDebug::queryExpressionResult_data()
QTest::newRow("varObjMap") << "varObjMap" << qVariantFromValue(map);
}
-void tst_QQmlEngineDebug::tst_QQmlDebugFileReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugFileReference()
{
QQmlDebugFileReference ref;
QVERIFY(ref.url().isEmpty());
@@ -885,7 +885,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugFileReference()
}
}
-void tst_QQmlEngineDebug::tst_QQmlDebugEngineReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugEngineReference()
{
QQmlDebugEngineReference ref;
QCOMPARE(ref.debugId(), -1);
@@ -909,7 +909,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugEngineReference()
}
}
-void tst_QQmlEngineDebug::tst_QQmlDebugObjectReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugObjectReference()
{
QQmlDebugObjectReference ref;
QCOMPARE(ref.debugId(), -1);
@@ -942,7 +942,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugObjectReference()
recursiveCompareObjects(r, ref);
}
-void tst_QQmlEngineDebug::tst_QQmlDebugContextReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugContextReference()
{
QQmlDebugContextReference ref;
QCOMPARE(ref.debugId(), -1);
@@ -967,7 +967,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugContextReference()
recursiveCompareContexts(r, ref);
}
-void tst_QQmlEngineDebug::tst_QQmlDebugPropertyReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugPropertyReference()
{
QQmlDebugObjectReference rootObject = findRootObject();
QQmlDebugObjectQuery *query = m_dbg->queryObject(rootObject, this);
@@ -990,7 +990,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugPropertyReference()
compareProperties(r, ref);
}
-void tst_QQmlEngineDebug::setBindingForObject()
+void tst_QQmlEngineDebugService::setBindingForObject()
{
QQmlDebugObjectReference rootObject = findRootObject();
QVERIFY(rootObject.debugId() != -1);
@@ -1061,7 +1061,7 @@ void tst_QQmlEngineDebug::setBindingForObject()
QCOMPARE(onEnteredRef.value(), QVariant("{console.log('hello, world') }"));
}
-void tst_QQmlEngineDebug::setBindingInStates()
+void tst_QQmlEngineDebugService::setBindingInStates()
{
// Check if changing bindings of propertychanges works
@@ -1153,7 +1153,7 @@ void tst_QQmlEngineDebug::setBindingInStates()
QCOMPARE(findProperty(obj.properties(),"width").value().toInt(), 300);
}
-void tst_QQmlEngineDebug::queryObjectTree()
+void tst_QQmlEngineDebugService::queryObjectTree()
{
const int sourceIndex = 3;
@@ -1227,9 +1227,9 @@ int main(int argc, char *argv[])
_argv[_argc - 1] = arg;
QGuiApplication app(_argc, _argv);
- tst_QQmlEngineDebug tc;
+ tst_QQmlEngineDebugService tc;
return QTest::qExec(&tc, _argc, _argv);
delete _argv;
}
-#include "tst_qqmlenginedebug.moc"
+#include "tst_qqmlenginedebugservice.moc"
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
index 010e97cef7..c24accac1a 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmlinspector
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmlinspector.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmlinspector.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
DEFINES += SRCDIR=\\\"$$PWD\\\"
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index 81fe3d5943..2bf43c92a2 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -2,13 +2,13 @@ CONFIG += testcase
TARGET = tst_qqmlprofilerservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
+SOURCES += tst_qqmlprofilerservice.cpp
-SOURCES += tst_qqmlprofilerservice.cpp \
- ../shared/debugutil.cpp
-OTHER_FILES += data/test.qml
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
-include (../../../shared/util.pri)
+OTHER_FILES += data/test.qml
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index edc120ba85..2b33ab3944 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -43,7 +43,8 @@
#include <QLibraryInfo>
#include "QtQml/private/qqmlprofilerservice_p.h"
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#include "../../../shared/util.h"
#define PORT 13773
diff --git a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
index e980d6594d..a8dd634855 100644
--- a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
+++ b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
@@ -2,12 +2,11 @@ CONFIG += testcase
TARGET = tst_qv8profilerservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
+SOURCES += tst_qv8profilerservice.cpp
-SOURCES += tst_qv8profilerservice.cpp \
- ../shared/debugutil.cpp
-
-include (../../../shared/util.pri)
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
OTHER_FILES += data/test.qml
diff --git a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
index c5992a4403..7b9cda937c 100644
--- a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
+++ b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
@@ -43,7 +43,8 @@
#include <QLibraryInfo>
#include "QtQml/private/qv8profilerservice_p.h"
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#include "../../../shared/util.h"
#define PORT 13774
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index a3d3dce644..3d2f460456 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -44,9 +44,6 @@
#include <QEventLoop>
#include <QTimer>
-#include <private/qqmldebugclient_p.h>
-#include <private/qqmldebugservice_p.h>
-
bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
QEventLoop loop;
QTimer timer;
diff --git a/tests/auto/qml/debugger/shared/debugutil.pri b/tests/auto/qml/debugger/shared/debugutil.pri
new file mode 100644
index 0000000000..b74f6b08b0
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/debugutil.pri
@@ -0,0 +1,9 @@
+QT += core-private
+
+HEADERS += $$PWD/debugutil_p.h \
+ $$PWD/qqmldebugclient.h \
+ $$PWD/qqmlenginedebug_p.h
+SOURCES += $$PWD/debugutil.cpp \
+ $$PWD/qqmldebugclient.cpp \
+ $$PWD/qqmlenginedebug.cpp
+
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index 194f8fa14c..177c712833 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -51,7 +51,7 @@
#include <QtQml/qqmlengine.h>
-#include <private/qqmldebugclient_p.h>
+#include "qqmldebugclient.h"
#include <private/qqmldebugservice_p.h>
class QQmlDebugTest
diff --git a/src/qml/debugger/qqmldebugclient.cpp b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
index fcb0861c21..0453f88350 100644
--- a/src/qml/debugger/qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
@@ -39,25 +39,20 @@
**
****************************************************************************/
-#include "qqmldebugclient_p.h"
+#include "qqmldebugclient.h"
-#include "qpacketprotocol_p.h"
+#include <private/qpacketprotocol_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
#include <QtNetwork/qnetworkproxy.h>
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
const int protocolVersion = 1;
const QString serverId = QLatin1String("QDeclarativeDebugServer");
const QString clientId = QLatin1String("QDeclarativeDebugClient");
-class QQmlDebugClientPrivate : public QObjectPrivate
+class QQmlDebugClientPrivate
{
- Q_DECLARE_PUBLIC(QQmlDebugClient)
public:
QQmlDebugClientPrivate();
@@ -241,7 +236,7 @@ QQmlDebugConnection::~QQmlDebugConnection()
{
QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
for (; iter != d->plugins.end(); ++iter) {
- iter.value()->d_func()->connection = 0;
+ iter.value()->d->connection = 0;
iter.value()->stateChanged(QQmlDebugClient::NotConnected);
}
}
@@ -341,9 +336,9 @@ QQmlDebugClientPrivate::QQmlDebugClientPrivate()
QQmlDebugClient::QQmlDebugClient(const QString &name,
QQmlDebugConnection *parent)
- : QObject(*(new QQmlDebugClientPrivate), parent)
+ : QObject(parent),
+ d(new QQmlDebugClientPrivate)
{
- Q_D(QQmlDebugClient);
d->name = name;
d->connection = parent;
@@ -361,22 +356,20 @@ QQmlDebugClient::QQmlDebugClient(const QString &name,
QQmlDebugClient::~QQmlDebugClient()
{
- Q_D(QQmlDebugClient);
if (d->connection && d->connection->d) {
d->connection->d->plugins.remove(d->name);
d->connection->d->advertisePlugins();
}
+ delete d;
}
QString QQmlDebugClient::name() const
{
- Q_D(const QQmlDebugClient);
return d->name;
}
float QQmlDebugClient::serviceVersion() const
{
- Q_D(const QQmlDebugClient);
if (d->connection->d->serverPlugins.contains(d->name))
return d->connection->d->serverPlugins.value(d->name);
return -1;
@@ -384,7 +377,6 @@ float QQmlDebugClient::serviceVersion() const
QQmlDebugClient::State QQmlDebugClient::state() const
{
- Q_D(const QQmlDebugClient);
if (!d->connection
|| !d->connection->isConnected()
|| !d->connection->d->gotHello)
@@ -398,7 +390,6 @@ QQmlDebugClient::State QQmlDebugClient::state() const
void QQmlDebugClient::sendMessage(const QByteArray &message)
{
- Q_D(QQmlDebugClient);
if (state() != Enabled)
return;
@@ -416,6 +407,4 @@ void QQmlDebugClient::messageReceived(const QByteArray &)
{
}
-QT_END_NAMESPACE
-
#include <qqmldebugclient.moc>
diff --git a/src/qml/debugger/qqmldebugclient_p.h b/tests/auto/qml/debugger/shared/qqmldebugclient.h
index 064e15cf49..d3e5cd59a4 100644
--- a/src/qml/debugger/qqmldebugclient_p.h
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.h
@@ -42,26 +42,10 @@
#ifndef QQMLDEBUGCLIENT_H
#define QQMLDEBUGCLIENT_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
#include <QtNetwork/qtcpsocket.h>
#include <private/qtqmlglobal_p.h>
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-
class QQmlDebugConnectionPrivate;
class Q_QML_PRIVATE_EXPORT QQmlDebugConnection : public QIODevice
{
@@ -120,12 +104,9 @@ protected:
virtual void messageReceived(const QByteArray &);
private:
+ QQmlDebugClientPrivate *d;
friend class QQmlDebugConnection;
friend class QQmlDebugConnectionPrivate;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
#endif // QQMLDEBUGCLIENT_H
diff --git a/src/qml/debugger/qqmlenginedebug.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebug.cpp
index 65af181f1b..8a46c7617c 100644
--- a/src/qml/debugger/qqmlenginedebug.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebug.cpp
@@ -41,13 +41,11 @@
#include "qqmlenginedebug_p.h"
-#include "qqmldebugclient_p.h"
+#include "qqmldebugclient.h"
-#include "qqmlenginedebugservice_p.h"
+#include <private/qqmlenginedebugservice_p.h>
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
+#include <QtCore/private/qobject_p.h>
class QQmlEngineDebugClient : public QQmlDebugClient
{
@@ -1068,5 +1066,3 @@ bool QQmlDebugPropertyReference::hasNotifySignal() const
return m_hasNotifySignal;
}
-QT_END_NAMESPACE
-
diff --git a/src/qml/debugger/qqmlenginedebug_p.h b/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h
index 0562d8755b..70f04d3a19 100644
--- a/src/qml/debugger/qqmlenginedebug_p.h
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h
@@ -59,11 +59,6 @@
#include <private/qtqmlglobal_p.h>
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-
class QQmlDebugConnection;
class QQmlDebugWatch;
class QQmlDebugPropertyWatch;
@@ -385,13 +380,9 @@ private:
QVariant m_result;
};
-QT_END_NAMESPACE
-
Q_DECLARE_METATYPE(QQmlDebugEngineReference)
Q_DECLARE_METATYPE(QQmlDebugObjectReference)
Q_DECLARE_METATYPE(QQmlDebugContextReference)
Q_DECLARE_METATYPE(QQmlDebugPropertyReference)
-QT_END_HEADER
-
#endif // QQMLENGINEDEBUG_H
diff --git a/tools/qmlprofiler/profileclient.h b/tools/qmlprofiler/profileclient.h
index 8aa4e67982..54826a291a 100644
--- a/tools/qmlprofiler/profileclient.h
+++ b/tools/qmlprofiler/profileclient.h
@@ -44,7 +44,7 @@
#include "profiledata.h"
-#include <QtQml/private/qqmldebugclient_p.h>
+#include "qqmldebugclient.h"
#include <QtQml/private/qqmlprofilerservice_p.h>
class ProfileClientPrivate;
diff --git a/tools/qmlprofiler/qmlprofiler.pro b/tools/qmlprofiler/qmlprofiler.pro
index ec5f50e376..db7e357b70 100644
--- a/tools/qmlprofiler/qmlprofiler.pro
+++ b/tools/qmlprofiler/qmlprofiler.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
TARGET = qmlprofiler
DESTDIR = $$QT.qml.bins
-QT += qml qml-private network
+QT += qml qml-private network core-private
target.path = $$[QT_INSTALL_BINS]
INSTALLS += target
@@ -15,11 +15,13 @@ SOURCES += main.cpp \
qmlprofilerapplication.cpp \
commandlistener.cpp \
profileclient.cpp \
- profiledata.cpp
+ profiledata.cpp \
+ qqmldebugclient.cpp
HEADERS += \
qmlprofilerapplication.h \
commandlistener.h \
constants.h \
profileclient.h \
- profiledata.h
+ profiledata.h \
+ qqmldebugclient.h
diff --git a/tools/qmlprofiler/qqmldebugclient.cpp b/tools/qmlprofiler/qqmldebugclient.cpp
new file mode 100644
index 0000000000..0453f88350
--- /dev/null
+++ b/tools/qmlprofiler/qqmldebugclient.cpp
@@ -0,0 +1,410 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmldebugclient.h"
+
+#include <private/qpacketprotocol_p.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qstringlist.h>
+#include <QtNetwork/qnetworkproxy.h>
+
+const int protocolVersion = 1;
+const QString serverId = QLatin1String("QDeclarativeDebugServer");
+const QString clientId = QLatin1String("QDeclarativeDebugClient");
+
+class QQmlDebugClientPrivate
+{
+public:
+ QQmlDebugClientPrivate();
+
+ QString name;
+ QQmlDebugConnection *connection;
+};
+
+class QQmlDebugConnectionPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QQmlDebugConnectionPrivate(QQmlDebugConnection *c);
+ QQmlDebugConnection *q;
+ QPacketProtocol *protocol;
+ QIODevice *device;
+
+ bool gotHello;
+ QHash <QString, float> serverPlugins;
+ QHash<QString, QQmlDebugClient *> plugins;
+
+ void advertisePlugins();
+ void connectDeviceSignals();
+
+public Q_SLOTS:
+ void connected();
+ void readyRead();
+ void deviceAboutToClose();
+};
+
+QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate(QQmlDebugConnection *c)
+ : QObject(c), q(c), protocol(0), device(0), gotHello(false)
+{
+ protocol = new QPacketProtocol(q, this);
+ QObject::connect(c, SIGNAL(connected()), this, SLOT(connected()));
+ QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+}
+
+void QQmlDebugConnectionPrivate::advertisePlugins()
+{
+ if (!q->isConnected())
+ return;
+
+ QPacket pack;
+ pack << serverId << 1 << plugins.keys();
+ protocol->send(pack);
+ q->flush();
+}
+
+void QQmlDebugConnectionPrivate::connected()
+{
+ QPacket pack;
+ pack << serverId << 0 << protocolVersion << plugins.keys();
+ protocol->send(pack);
+ q->flush();
+}
+
+void QQmlDebugConnectionPrivate::readyRead()
+{
+ if (!gotHello) {
+ QPacket pack = protocol->read();
+ QString name;
+
+ pack >> name;
+
+ bool validHello = false;
+ if (name == clientId) {
+ int op = -1;
+ pack >> op;
+ if (op == 0) {
+ int version = -1;
+ pack >> version;
+ if (version == protocolVersion) {
+ QStringList pluginNames;
+ QList<float> pluginVersions;
+ pack >> pluginNames;
+ if (!pack.isEmpty())
+ pack >> pluginVersions;
+
+ const int pluginNamesSize = pluginNames.size();
+ const int pluginVersionsSize = pluginVersions.size();
+ for (int i = 0; i < pluginNamesSize; ++i) {
+ float pluginVersion = 1.0;
+ if (i < pluginVersionsSize)
+ pluginVersion = pluginVersions.at(i);
+ serverPlugins.insert(pluginNames.at(i), pluginVersion);
+ }
+
+ validHello = true;
+ }
+ }
+ }
+
+ if (!validHello) {
+ qWarning("QQmlDebugConnection: Invalid hello message");
+ QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+ return;
+ }
+ gotHello = true;
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
+ for (; iter != plugins.end(); ++iter) {
+ QQmlDebugClient::State newState = QQmlDebugClient::Unavailable;
+ if (serverPlugins.contains(iter.key()))
+ newState = QQmlDebugClient::Enabled;
+ iter.value()->stateChanged(newState);
+ }
+ }
+
+ while (protocol->packetsAvailable()) {
+ QPacket pack = protocol->read();
+ QString name;
+ pack >> name;
+
+ if (name == clientId) {
+ int op = -1;
+ pack >> op;
+
+ if (op == 1) {
+ // Service Discovery
+ QHash<QString, float> oldServerPlugins = serverPlugins;
+ serverPlugins.clear();
+
+ QStringList pluginNames;
+ QList<float> pluginVersions;
+ pack >> pluginNames;
+ if (!pack.isEmpty())
+ pack >> pluginVersions;
+
+ const int pluginNamesSize = pluginNames.size();
+ const int pluginVersionsSize = pluginVersions.size();
+ for (int i = 0; i < pluginNamesSize; ++i) {
+ float pluginVersion = 1.0;
+ if (i < pluginVersionsSize)
+ pluginVersion = pluginVersions.at(i);
+ serverPlugins.insert(pluginNames.at(i), pluginVersion);
+ }
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
+ for (; iter != plugins.end(); ++iter) {
+ const QString pluginName = iter.key();
+ QQmlDebugClient::State newSate = QQmlDebugClient::Unavailable;
+ if (serverPlugins.contains(pluginName))
+ newSate = QQmlDebugClient::Enabled;
+
+ if (oldServerPlugins.contains(pluginName)
+ != serverPlugins.contains(pluginName)) {
+ iter.value()->stateChanged(newSate);
+ }
+ }
+ } else {
+ qWarning() << "QQmlDebugConnection: Unknown control message id" << op;
+ }
+ } else {
+ QByteArray message;
+ pack >> message;
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter =
+ plugins.find(name);
+ if (iter == plugins.end()) {
+ qWarning() << "QQmlDebugConnection: Message received for missing plugin" << name;
+ } else {
+ (*iter)->messageReceived(message);
+ }
+ }
+ }
+}
+
+void QQmlDebugConnectionPrivate::deviceAboutToClose()
+{
+ // This is nasty syntax but we want to emit our own aboutToClose signal (by calling QIODevice::close())
+ // without calling the underlying device close fn as that would cause an infinite loop
+ q->QIODevice::close();
+}
+
+QQmlDebugConnection::QQmlDebugConnection(QObject *parent)
+ : QIODevice(parent), d(new QQmlDebugConnectionPrivate(this))
+{
+}
+
+QQmlDebugConnection::~QQmlDebugConnection()
+{
+ QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
+ for (; iter != d->plugins.end(); ++iter) {
+ iter.value()->d->connection = 0;
+ iter.value()->stateChanged(QQmlDebugClient::NotConnected);
+ }
+}
+
+bool QQmlDebugConnection::isConnected() const
+{
+ return state() == QAbstractSocket::ConnectedState;
+}
+
+qint64 QQmlDebugConnection::readData(char *data, qint64 maxSize)
+{
+ return d->device->read(data, maxSize);
+}
+
+qint64 QQmlDebugConnection::writeData(const char *data, qint64 maxSize)
+{
+ return d->device->write(data, maxSize);
+}
+
+qint64 QQmlDebugConnection::bytesAvailable() const
+{
+ return d->device->bytesAvailable();
+}
+
+bool QQmlDebugConnection::isSequential() const
+{
+ return true;
+}
+
+void QQmlDebugConnection::close()
+{
+ if (isOpen()) {
+ QIODevice::close();
+ d->device->close();
+ emit stateChanged(QAbstractSocket::UnconnectedState);
+
+ QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
+ for (; iter != d->plugins.end(); ++iter) {
+ iter.value()->stateChanged(QQmlDebugClient::NotConnected);
+ }
+ }
+}
+
+bool QQmlDebugConnection::waitForConnected(int msecs)
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket)
+ return socket->waitForConnected(msecs);
+ return false;
+}
+
+QAbstractSocket::SocketState QQmlDebugConnection::state() const
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket)
+ return socket->state();
+
+ return QAbstractSocket::UnconnectedState;
+}
+
+void QQmlDebugConnection::flush()
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket) {
+ socket->flush();
+ return;
+ }
+}
+
+void QQmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
+{
+ QTcpSocket *socket = new QTcpSocket(d);
+ socket->setProxy(QNetworkProxy::NoProxy);
+ d->device = socket;
+ d->connectDeviceSignals();
+ d->gotHello = false;
+ connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
+ connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
+ connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
+ socket->connectToHost(hostName, port);
+ QIODevice::open(ReadWrite | Unbuffered);
+}
+
+void QQmlDebugConnectionPrivate::connectDeviceSignals()
+{
+ connect(device, SIGNAL(bytesWritten(qint64)), q, SIGNAL(bytesWritten(qint64)));
+ connect(device, SIGNAL(readyRead()), q, SIGNAL(readyRead()));
+ connect(device, SIGNAL(aboutToClose()), this, SLOT(deviceAboutToClose()));
+}
+
+//
+
+QQmlDebugClientPrivate::QQmlDebugClientPrivate()
+ : connection(0)
+{
+}
+
+QQmlDebugClient::QQmlDebugClient(const QString &name,
+ QQmlDebugConnection *parent)
+ : QObject(parent),
+ d(new QQmlDebugClientPrivate)
+{
+ d->name = name;
+ d->connection = parent;
+
+ if (!d->connection)
+ return;
+
+ if (d->connection->d->plugins.contains(name)) {
+ qWarning() << "QQmlDebugClient: Conflicting plugin name" << name;
+ d->connection = 0;
+ } else {
+ d->connection->d->plugins.insert(name, this);
+ d->connection->d->advertisePlugins();
+ }
+}
+
+QQmlDebugClient::~QQmlDebugClient()
+{
+ if (d->connection && d->connection->d) {
+ d->connection->d->plugins.remove(d->name);
+ d->connection->d->advertisePlugins();
+ }
+ delete d;
+}
+
+QString QQmlDebugClient::name() const
+{
+ return d->name;
+}
+
+float QQmlDebugClient::serviceVersion() const
+{
+ if (d->connection->d->serverPlugins.contains(d->name))
+ return d->connection->d->serverPlugins.value(d->name);
+ return -1;
+}
+
+QQmlDebugClient::State QQmlDebugClient::state() const
+{
+ if (!d->connection
+ || !d->connection->isConnected()
+ || !d->connection->d->gotHello)
+ return NotConnected;
+
+ if (d->connection->d->serverPlugins.contains(d->name))
+ return Enabled;
+
+ return Unavailable;
+}
+
+void QQmlDebugClient::sendMessage(const QByteArray &message)
+{
+ if (state() != Enabled)
+ return;
+
+ QPacket pack;
+ pack << d->name << message;
+ d->connection->d->protocol->send(pack);
+ d->connection->flush();
+}
+
+void QQmlDebugClient::stateChanged(State)
+{
+}
+
+void QQmlDebugClient::messageReceived(const QByteArray &)
+{
+}
+
+#include <qqmldebugclient.moc>
diff --git a/tools/qmlprofiler/qqmldebugclient.h b/tools/qmlprofiler/qqmldebugclient.h
new file mode 100644
index 0000000000..0f140a1db1
--- /dev/null
+++ b/tools/qmlprofiler/qqmldebugclient.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLDEBUGCLIENT_H
+#define QQMLDEBUGCLIENT_H
+
+#include <QtNetwork/qtcpsocket.h>
+
+class QQmlDebugConnectionPrivate;
+class QQmlDebugConnection : public QIODevice
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QQmlDebugConnection)
+public:
+ QQmlDebugConnection(QObject * = 0);
+ ~QQmlDebugConnection();
+
+ void connectToHost(const QString &hostName, quint16 port);
+
+ qint64 bytesAvailable() const;
+ bool isConnected() const;
+ QAbstractSocket::SocketState state() const;
+ void flush();
+ bool isSequential() const;
+ void close();
+ bool waitForConnected(int msecs = 30000);
+
+signals:
+ void connected();
+ void stateChanged(QAbstractSocket::SocketState socketState);
+ void error(QAbstractSocket::SocketError socketError);
+
+protected:
+ qint64 readData(char *data, qint64 maxSize);
+ qint64 writeData(const char *data, qint64 maxSize);
+
+private:
+ QQmlDebugConnectionPrivate *d;
+ friend class QQmlDebugClient;
+ friend class QQmlDebugClientPrivate;
+};
+
+class QQmlDebugClientPrivate;
+class QQmlDebugClient : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QQmlDebugClient)
+
+public:
+ enum State { NotConnected, Unavailable, Enabled };
+
+ QQmlDebugClient(const QString &, QQmlDebugConnection *parent);
+ ~QQmlDebugClient();
+
+ QString name() const;
+ float serviceVersion() const;
+ State state() const;
+
+ virtual void sendMessage(const QByteArray &);
+
+protected:
+ virtual void stateChanged(State);
+ virtual void messageReceived(const QByteArray &);
+
+private:
+ QQmlDebugClientPrivate *d;
+ friend class QQmlDebugConnection;
+ friend class QQmlDebugConnectionPrivate;
+};
+
+#endif // QQMLDEBUGCLIENT_H