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
57
58
59
|
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "capturingconnectionmanager.h"
#include <coreplugin/messagebox.h>
#include <QCoreApplication>
#include <QDebug>
#include <QTimer>
#include <QVariant>
namespace QmlDesigner {
void CapturingConnectionManager::setUp(NodeInstanceServerInterface *nodeInstanceServer,
const QString &qrcMappingString,
ProjectExplorer::Target *target,
AbstractView *view)
{
InteractiveConnectionManager::setUp(nodeInstanceServer, qrcMappingString, target, view);
int indexOfCapturePuppetStream = QCoreApplication::arguments().indexOf(
"-capture-puppet-stream");
if (indexOfCapturePuppetStream > 0) {
const QString filePath = QCoreApplication::arguments().at(indexOfCapturePuppetStream + 1);
m_captureFileForTest.setFileName(filePath);
bool isOpen = m_captureFileForTest.open(QIODevice::WriteOnly);
if (isOpen)
qDebug() << "capture file is open:" << filePath;
else
qDebug() << "capture file could not be opened!";
}
}
void CapturingConnectionManager::processFinished(int exitCode, QProcess::ExitStatus exitStatus, const QString &connectionName)
{
if (m_captureFileForTest.isOpen()) {
m_captureFileForTest.close();
Core::AsynchronousMessageBox::warning(
tr("QML Emulation Layer (QML Puppet - %1) Crashed").arg(connectionName),
tr("You are recording a puppet stream and the emulations layer crashed. "
"It is recommended to reopen the Qt Quick Designer and start again."));
}
InteractiveConnectionManager::processFinished(exitCode, exitStatus, connectionName);
}
void CapturingConnectionManager::writeCommand(const QVariant &command)
{
InteractiveConnectionManager::writeCommand(command);
if (m_captureFileForTest.isWritable()) {
qDebug() << "command name: " << QMetaType::typeName(command.userType());
writeCommandToIODevice(command, &m_captureFileForTest, writeCommandCounter());
qDebug() << "\tcatpure file offset: " << m_captureFileForTest.pos();
}
}
} // namespace QmlDesigner
|