Commit 187cd682 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Marco Bubke

QmlDesigner.nodeInstances: use a Qt qmlpuppet if present

Use a Qt qmlpuppet if present, otherwise fallack to the
puppet provided by Qt Creator.

We look into bin/qmlpuppet(.app/.exe)

Change-Id: I057e9ce7cbcc6f3e9926eef482f7f2a34d902aa3
Reviewed-on: http://codereview.qt.nokia.com/441Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarMarco Bubke <marco.bubke@nokia.com>
parent 96d19fff
......@@ -108,21 +108,19 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
m_localServer->listen(socketToken);
m_localServer->setMaxPendingConnections(3);
QString applicationPath = QCoreApplication::applicationDirPath();
if (runModus == TestModus)
applicationPath += QLatin1String("/../../../../../bin");
#ifdef Q_OS_MACX
applicationPath += QLatin1String("/qmlpuppet.app/Contents/MacOS");
#endif
if (hasQtQuick1(nodeInstanceView)) {
applicationPath += QLatin1String("/qmlpuppet");
QString applicationPath = pathToQt + QLatin1String("/bin");
if (runModus == TestModus) {
applicationPath = QCoreApplication::applicationDirPath() + QLatin1String("/../../../../../bin");
} else {
applicationPath += QLatin1String("/qml2puppet");
applicationPath = macOSBundlePath(applicationPath);
applicationPath += "/" + qmlPuppetApplicationName();
if (!QFileInfo(applicationPath).exists()) { //No qmlpuppet in Qt
//We have to find out how to give not too intrusive feedback
applicationPath = QCoreApplication::applicationDirPath();
applicationPath = macOSBundlePath(applicationPath);
applicationPath += "/" + qmlPuppetApplicationName();
}
}
#ifdef Q_OS_WIN
applicationPath += QLatin1String(".exe");
#endif
QByteArray envImportPath = qgetenv("QTCREATOR_QMLPUPPET_PATH");
if (!envImportPath.isEmpty()) {
......@@ -431,6 +429,29 @@ void NodeInstanceServerProxy::readThirdDataStream()
}
}
QString NodeInstanceServerProxy::qmlPuppetApplicationName() const
{
QString appName;
if (hasQtQuick1(m_nodeInstanceView.data())) {
appName = QLatin1String("qmlpuppet");
} else {
appName = QLatin1String("qml2puppet");
}
#ifdef Q_OS_WIN
appName += QLatin1String(".exe");
#endif
return appName;
}
QString NodeInstanceServerProxy::macOSBundlePath(const QString &path) const
{
QString applicationPath = path;
#ifdef Q_OS_MACX
applicationPath += QLatin1String("/qmlpuppet.app/Contents/MacOS");
#endif
return applicationPath;
}
void NodeInstanceServerProxy::createInstances(const CreateInstancesCommand &command)
{
......
......@@ -87,6 +87,9 @@ private slots:
void readThirdDataStream();
private:
QString qmlPuppetApplicationName() const;
QString macOSBundlePath(const QString &path) const;
QWeakPointer<QLocalServer> m_localServer;
QWeakPointer<QLocalSocket> m_firstSocket;
QWeakPointer<QLocalSocket> m_secondSocket;
......
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