Commit 966292b7 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.NodeInstances: detailed error for missing puppet

Since we will not ship qml2puppet with all version of Qt Creator,
we need a detailed error message.

Change-Id: I5b3f1475ce0c77253e318712897a39cea774bb60
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent a574edb3
......@@ -78,6 +78,24 @@
#include <QMessageBox>
namespace {
#ifdef Q_OS_MAC
# define SHARE_PATH "/../Resources/qmldesigner"
#else
# define SHARE_PATH "/../share/qtcreator/qmldesigner"
#endif
static QString applicationDirPath()
{
return QCoreApplication::applicationDirPath();
}
static inline QString sharedDirPath()
{
QString appPath = applicationDirPath();
return QFileInfo(appPath + SHARE_PATH).absoluteFilePath();
}
static QLatin1String qmlPuppetApplicationDirectoryForTests()
{
if (Utils::HostOsInfo::isWindowsHost())
......@@ -209,21 +227,13 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
}
} else {
QMessageBox::warning(0, tr("Cannot Start QML Puppet Executable"),
tr("The executable of the QML Puppet process (%1) cannot be started. "
"Please check your installation. "
"QML Puppet is a process which runs in the background to render the items.").
arg(applicationPath));
QMessageBox::warning(0, tr("Cannot Start QML Puppet Executable"), missingQmlPuppetErrorMessage(applicationPath));
}
m_localServer->close();
} else {
QMessageBox::warning(0, tr("Cannot Find QML Puppet Executable"),
tr("The executable of the QML Puppet process (%1) cannot be found. "
"Please check your installation. "
"QML Puppet is a process which runs in the background to render the items.").
arg(applicationPath));
QMessageBox::warning(0, tr("Cannot Find QML Puppet Executable"), missingQmlPuppetErrorMessage(applicationPath));
}
}
......@@ -293,6 +303,24 @@ NodeInstanceClientInterface *NodeInstanceServerProxy::nodeInstanceClient() const
return m_nodeInstanceView.data();
}
QString NodeInstanceServerProxy::missingQmlPuppetErrorMessage(const QString &applicationPath) const
{
QString message = tr("The executable of the QML Puppet process (%1) cannot be found."
"Check your installation."
"QML Puppet is a process which runs in the background to render the items.").
arg(applicationPath);
if (hasQtQuick2(m_nodeInstanceView.data())) {
message += tr("You can build qml2puppet yourself with Qt 5.0.1 or higher"
"The source can be found in %1/qml/qmlpuppet/qml2puppet/").arg(sharedDirPath());
message += tr("The qml2puppet will get installed to the bin directory of your Qt."
"Qt Quick Designer will check the bin direcotry of the Qt currently active"
"for your project.");
}
return message;
}
static void writeCommandToSocket(const QVariant &command, QLocalSocket *socket, unsigned int commandCounter)
{
if (socket) {
......
......@@ -75,6 +75,7 @@ protected:
void writeCommand(const QVariant &command);
void dispatchCommand(const QVariant &command);
NodeInstanceClientInterface *nodeInstanceClient() const;
QString missingQmlPuppetErrorMessage(const QString &applicationPath) const;
signals:
void processCrashed();
......
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