aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/shared
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-03 14:32:25 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-17 18:42:07 +0000
commit0b67dd7e132d7d618fa538e8c4a275c874543342 (patch)
tree3c6c7cdf8fbae8c6a7d0d333d96c22d130413980 /src/plugins/qmltooling/shared
parente010b64d38cb8533d779ac0fe8d609f00a6793e7 (diff)
QmlDebug: Restructure QPacket and QPacketProtocol
We cannot use the same data stream version for the client and server versions of QPacket and QPacketProtocol should not deal with QPackets but with simple byte arrays because the underlying QDataStream is hard to copy. The new QQmlDebugPacket picks its data stream version from QQmlDebugConnector now, which adjusts it when connecting. As there can only ever be one QQmlDebugConnector, we can keep the version static. The clients need to query the connection for the correct version. We may connect to several different servers sequentially or we may have a server running while using a client, and we don't want to confuse the versions between those. With this in place, all remaining occurrences of QDataStream are replaced with QPacket or QQmlDebugPacket. Change-Id: I3f6ba73fcbfad5e8df917c5feb9308116738a614 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmltooling/shared')
-rw-r--r--src/plugins/qmltooling/shared/qqmldebugpacket.h64
-rw-r--r--src/plugins/qmltooling/shared/qqmldebugserver.h2
2 files changed, 66 insertions, 0 deletions
diff --git a/src/plugins/qmltooling/shared/qqmldebugpacket.h b/src/plugins/qmltooling/shared/qqmldebugpacket.h
new file mode 100644
index 0000000000..459937f411
--- /dev/null
+++ b/src/plugins/qmltooling/shared/qqmldebugpacket.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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 QQMLDEBUGPACKET_P_H
+#define QQMLDEBUGPACKET_P_H
+
+#include <QtCore/qbuffer.h>
+#include <QtQml/private/qqmldebugconnector_p.h>
+#include <QtPacketProtocol/private/qpacket_p.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.
+//
+
+QT_BEGIN_NAMESPACE
+
+// QPacket with a fixed data stream version, centrally set by QQmlDebugServer
+class QQmlDebugPacket : public QPacket
+{
+public:
+ QQmlDebugPacket() : QPacket(QQmlDebugConnector::dataStreamVersion()) {}
+ QQmlDebugPacket(const QByteArray &ba) : QPacket(QQmlDebugConnector::dataStreamVersion(), ba) {}
+};
+
+QT_END_NAMESPACE
+
+#endif // QQMLDEBUGPACKET_P_H
diff --git a/src/plugins/qmltooling/shared/qqmldebugserver.h b/src/plugins/qmltooling/shared/qqmldebugserver.h
index a7c17075d9..3807f12214 100644
--- a/src/plugins/qmltooling/shared/qqmldebugserver.h
+++ b/src/plugins/qmltooling/shared/qqmldebugserver.h
@@ -37,6 +37,8 @@
#include <private/qqmldebugconnector_p.h>
#include <private/qtqmlglobal_p.h>
+#include <QtCore/QIODevice>
+
//
// W A R N I N G
// -------------