blob: debc9d5f55384dd9f322dabdc1c93f7ae351338a (
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
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "qdebugmessageclient.h"
#include <QDataStream>
namespace QmlDebug {
QDebugMessageClient::QDebugMessageClient(QmlDebugConnection *client)
: QmlDebugClient(QLatin1String("DebugMessages"), client)
{
}
void QDebugMessageClient::stateChanged(State state)
{
emit newState(state);
}
void QDebugMessageClient::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;
QDebugContextInfo 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);
}
}
} // namespace QmlDebug
|