diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-04 15:08:24 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-05 08:42:59 +0000 |
commit | fcc5a39d60b14e8ec2345b3695b84b552501dfa1 (patch) | |
tree | 74470e28a50f7d1934649a921fb5b0cd42cd5293 /src/plugins | |
parent | a773d3646769ba6134adfc7353b64d7f73b2e543 (diff) |
QmlDebug: Extract header from native connector
We will need to access the connector from the hook functions. Having a
header makes that easier.
Change-Id: Idbab8f6c73e3c61d82cdfc7a91ff6c4e408ee1fd
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
Diffstat (limited to 'src/plugins')
3 files changed, 87 insertions, 44 deletions
diff --git a/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro b/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro index 7dc16b8c44..8621238eff 100644 --- a/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro +++ b/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro @@ -5,6 +5,9 @@ PLUGIN_TYPE = qmltooling PLUGIN_CLASS_NAME = QQmlNativeDebugConnectorFactory load(qt_plugin) +HEADERS += \ + $$PWD/qqmlnativedebugconnector.h + SOURCES += \ $$PWD/qqmlnativedebugconnector.cpp diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp index 018b10d3e7..faddaefdc7 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp @@ -31,7 +31,7 @@ ** ****************************************************************************/ -#include <private/qqmldebugconnector_p.h> +#include "qqmlnativedebugconnector.h" #include <private/qhooks_p.h> #include <private/qpacket_p.h> @@ -43,7 +43,6 @@ #include <QtCore/qjsonobject.h> #include <QtCore/qjsonvalue.h> #include <QtCore/qpointer.h> -#include <QtCore/qvector.h> //#define TRACE_PROTOCOL(s) qDebug() << s #define TRACE_PROTOCOL(s) @@ -173,33 +172,6 @@ Q_DECL_EXPORT void qt_qmlDebugConnectorOpen() QT_BEGIN_NAMESPACE -class QQmlNativeDebugConnector : public QQmlDebugConnector -{ - Q_OBJECT - -public: - QQmlNativeDebugConnector(); - ~QQmlNativeDebugConnector(); - - bool blockingMode() const; - QQmlDebugService *service(const QString &name) const; - void addEngine(QQmlEngine *engine); - void removeEngine(QQmlEngine *engine); - bool addService(const QString &name, QQmlDebugService *service); - bool removeService(const QString &name); - bool open(const QVariantHash &configuration); - -private slots: - void sendMessage(const QString &name, const QByteArray &message); - void sendMessages(const QString &name, const QList<QByteArray> &messages); - -private: - void announceObjectAvailability(const QString &objectType, QObject *object, bool available); - - QVector<QQmlDebugService *> m_services; - bool m_blockingMode; -}; - QQmlNativeDebugConnector::QQmlNativeDebugConnector() : m_blockingMode(false) { @@ -364,21 +336,9 @@ void QQmlNativeDebugConnector::sendMessages(const QString &name, const QList<QBy sendMessage(name, messages.at(i)); } -class QQmlNativeDebugConnectorFactory : public QQmlDebugConnectorFactory +QQmlDebugConnector *QQmlNativeDebugConnectorFactory::create(const QString &key) { - Q_OBJECT - - Q_PLUGIN_METADATA(IID QQmlDebugConnectorFactory_iid FILE "qqmlnativedebugconnector.json") - -public: - QQmlNativeDebugConnectorFactory() {} - - QQmlDebugConnector *create(const QString &key) - { - return key == QLatin1String("QQmlNativeDebugConnector") ? new QQmlNativeDebugConnector : 0; - } -}; + return key == QLatin1String("QQmlNativeDebugConnector") ? new QQmlNativeDebugConnector : 0; +} QT_END_NAMESPACE - -#include "qqmlnativedebugconnector.moc" diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h new file mode 100644 index 0000000000..f0d11957a7 --- /dev/null +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQMLNATIVEDEBUGCONNECTOR_H +#define QQMLNATIVEDEBUGCONNECTOR_H + +#include <private/qqmldebugconnector_p.h> +#include <QtCore/qvector.h> + +QT_BEGIN_NAMESPACE + +class QQmlNativeDebugConnector : public QQmlDebugConnector +{ + Q_OBJECT + +public: + QQmlNativeDebugConnector(); + ~QQmlNativeDebugConnector(); + + bool blockingMode() const; + QQmlDebugService *service(const QString &name) const; + void addEngine(QQmlEngine *engine); + void removeEngine(QQmlEngine *engine); + bool addService(const QString &name, QQmlDebugService *service); + bool removeService(const QString &name); + bool open(const QVariantHash &configuration); + +private slots: + void sendMessage(const QString &name, const QByteArray &message); + void sendMessages(const QString &name, const QList<QByteArray> &messages); + +private: + void announceObjectAvailability(const QString &objectType, QObject *object, bool available); + + QVector<QQmlDebugService *> m_services; + bool m_blockingMode; +}; + +class QQmlNativeDebugConnectorFactory : public QQmlDebugConnectorFactory +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlDebugConnectorFactory_iid FILE "qqmlnativedebugconnector.json") +public: + QQmlDebugConnector *create(const QString &key); +}; + +QT_END_NAMESPACE + +#endif // QQMLNATIVEDEBUGCONNECTOR_H + |