aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmldebug/qqmldebugtranslationclient.cpp
blob: 071cce9f04aea59cd95ab8a35fb3ed1565492873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "qqmldebugtranslationclient_p.h"
#include "qqmldebugconnection_p.h"

#include <QDebug>

#include <private/qqmldebugconnector_p.h>
#include <private/qversionedpacket_p.h>

QT_BEGIN_NAMESPACE

QQmlDebugTranslationClient::QQmlDebugTranslationClient(QQmlDebugConnection *client)
    : QQmlDebugClient(QLatin1String("DebugTranslation"), client)
{
}

void QQmlDebugTranslationClient::messageReceived(const QByteArray &message)
{
    QVersionedPacket<QQmlDebugConnector> packet(message);
    QQmlDebugTranslation::Reply type;

    packet >> type;
    switch (type) {
    case QQmlDebugTranslation::Reply::TranslationIssues: {
        packet >> translationIssues;
        break;
    }
    case QQmlDebugTranslation::Reply::LanguageChanged: {
        languageChanged = true;
        break;
    }
    case QQmlDebugTranslation::Reply::TranslatableTextOccurrences: {
        packet >> qmlElements;
        break;
    }
    case QQmlDebugTranslation::Reply::StateList: {
        packet >> qmlStates;
        break;
    }

    default:
        qWarning() << "TestDebugTranslationClient: received unknown command: " << static_cast<int>(type);
        break;
    }
}

QT_END_NAMESPACE

#include "moc_qqmldebugtranslationclient_p.cpp"