summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@digia.com>2014-07-09 12:55:32 +0200
committerMarco Bubke <marco.bubke@digia.com>2014-07-09 13:07:35 +0200
commit9bc97e53b386f749b95c1859da6ddfdab91b68f1 (patch)
tree1c2a0606d34256cbb8eb91cb04ed8120856aefcc /src/plugins
parent49cc0c9df140d375a7342c3dc5ddedca776ea968 (diff)
downloadqt-creator-9bc97e53b386f749b95c1859da6ddfdab91b68f1.tar.gz
QmlDesigner: Test if creator can connect to the puppet
Task-number: QTCREATORBUG-12612 Change-Id: I44ea38fafb1835be159ca4b757cb4d3d662aa8c5 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp58
1 files changed, 41 insertions, 17 deletions
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
index ac002491e3..875671a04f 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
@@ -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 {