Commit 9bc97e53 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Test if creator can connect to the puppet

Task-number: QTCREATORBUG-12612
Change-Id: I44ea38fafb1835be159ca4b757cb4d3d662aa8c5
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent 49cc0c9d
......@@ -98,6 +98,16 @@ static bool hasQtQuick1(NodeInstanceView *nodeInstanceView)
return false;
}
static void showCannotConnectToPuppetWarningAndSwitchToEditMode()
{
QmlDesignerWarning::show(QCoreApplication::translate("NodeInstanceServerProxy", "Cannot Connect to Qml Emulation Layer (Qml Puppet)"),
QCoreApplication::translate("NodeInstanceServerProxy", "The executable of the emulation layer process is maybe hanging. "
"Switching to an other kit maybe helps."));
QmlDesignerPlugin::instance()->switchToTextModeDeferred();
}
NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView, RunModus runModus, ProjectExplorer::Kit *kit)
: NodeInstanceServerInterface(nodeInstanceView),
m_localServer(new QLocalServer(this)),
......@@ -155,24 +165,38 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int)), m_qmlPuppetRenderProcess.data(),SLOT(deleteLater()));
}
if (!m_localServer->hasPendingConnections())
m_localServer->waitForNewConnection(10000);
m_firstSocket = m_localServer->nextPendingConnection();
connect(m_firstSocket.data(), SIGNAL(readyRead()), this, SLOT(readFirstDataStream()));
if (runModus == NormalModus) {
if (!m_localServer->hasPendingConnections())
m_localServer->waitForNewConnection(10000);
m_secondSocket = m_localServer->nextPendingConnection();
connect(m_secondSocket.data(), SIGNAL(readyRead()), this, SLOT(readSecondDataStream()));
if (!m_localServer->hasPendingConnections())
m_localServer->waitForNewConnection(10000);
bool connectedToPuppet = true;
m_thirdSocket = m_localServer->nextPendingConnection();
connect(m_thirdSocket.data(), SIGNAL(readyRead()), this, SLOT(readThirdDataStream()));
if (!m_localServer->hasPendingConnections())
connectedToPuppet = m_localServer->waitForNewConnection(3000);
if (connectedToPuppet) {
m_firstSocket = m_localServer->nextPendingConnection();
connect(m_firstSocket.data(), SIGNAL(readyRead()), this, SLOT(readFirstDataStream()));
if (runModus == NormalModus) {
if (!m_localServer->hasPendingConnections())
connectedToPuppet = m_localServer->waitForNewConnection(3000);
if (connectedToPuppet) {
m_secondSocket = m_localServer->nextPendingConnection();
connect(m_secondSocket.data(), SIGNAL(readyRead()), this, SLOT(readSecondDataStream()));
if (!m_localServer->hasPendingConnections())
connectedToPuppet = m_localServer->waitForNewConnection(3000);
if (connectedToPuppet) {
m_thirdSocket = m_localServer->nextPendingConnection();
connect(m_thirdSocket.data(), SIGNAL(readyRead()), this, SLOT(readThirdDataStream()));
} else {
showCannotConnectToPuppetWarningAndSwitchToEditMode();
}
} else {
showCannotConnectToPuppetWarningAndSwitchToEditMode();
}
}
} else {
showCannotConnectToPuppetWarningAndSwitchToEditMode();
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment