| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qqmldebugtranslationclient_p.h" |
| 5 | #include "qqmldebugconnection_p.h" |
| 6 | |
| 7 | #include <QDebug> |
| 8 | |
| 9 | #include <private/qqmldebugconnector_p.h> |
| 10 | #include <private/qversionedpacket_p.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | QQmlDebugTranslationClient::QQmlDebugTranslationClient(QQmlDebugConnection *client) |
| 15 | : QQmlDebugClient(QLatin1String("DebugTranslation"), client) |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | void QQmlDebugTranslationClient::messageReceived(const QByteArray &message) |
| 20 | { |
| 21 | QVersionedPacket<QQmlDebugConnector> packet(message); |
| 22 | QQmlDebugTranslation::Reply type; |
| 23 | |
| 24 | packet >> type; |
| 25 | switch (type) { |
| 26 | case QQmlDebugTranslation::Reply::TranslationIssues: { |
| 27 | packet >> translationIssues; |
| 28 | break; |
| 29 | } |
| 30 | case QQmlDebugTranslation::Reply::LanguageChanged: { |
| 31 | languageChanged = true; |
| 32 | break; |
| 33 | } |
| 34 | case QQmlDebugTranslation::Reply::TranslatableTextOccurrences: { |
| 35 | packet >> qmlElements; |
| 36 | break; |
| 37 | } |
| 38 | case QQmlDebugTranslation::Reply::StateList: { |
| 39 | packet >> qmlStates; |
| 40 | break; |
| 41 | } |
| 42 | |
| 43 | default: |
| 44 | qWarning() << "TestDebugTranslationClient: received unknown command: "<< static_cast<int>(type); |
| 45 | break; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | QT_END_NAMESPACE |
| 50 | |
| 51 | #include "moc_qqmldebugtranslationclient_p.cpp" |
| 52 |
