blob: 12c595a63e50e9ecd6c09453e879d4c705e28720 (
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
52
53
54
55
56
|
// Copyright (C) 2017 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 "qqmldebugmessageclient_p.h"
#include <QtCore/qdatastream.h>
QT_BEGIN_NAMESPACE
/*!
\class QQmlDebugMessageClient
\internal
\brief Client for the debug message service
The QQmlDebugMessageClient receives debug messages routed through the QML
debug connection via QDebugMessageService.
*/
QQmlDebugMessageClient::QQmlDebugMessageClient(QQmlDebugConnection *client)
: QQmlDebugClient(QLatin1String("DebugMessages"), client)
{
}
void QQmlDebugMessageClient::messageReceived(const QByteArray &data)
{
QDataStream ds(data);
QByteArray command;
ds >> command;
if (command == "MESSAGE") {
int type;
int line;
QByteArray debugMessage;
QByteArray file;
QByteArray function;
ds >> type >> debugMessage >> file >> line >> function;
QQmlDebugContextInfo info;
info.line = line;
info.file = QString::fromUtf8(file);
info.function = QString::fromUtf8(function);
info.timestamp = -1;
if (!ds.atEnd()) {
QByteArray category;
ds >> category;
info.category = QString::fromUtf8(category);
if (!ds.atEnd())
ds >> info.timestamp;
}
emit message(QtMsgType(type), QString::fromUtf8(debugMessage), info);
}
}
QT_END_NAMESPACE
#include "moc_qqmldebugmessageclient_p.cpp"
|