Commit 6e2de168 authored by Friedemann Kleint's avatar Friedemann Kleint

Reduce duplication in messages for QML Puppet checks.

Change-Id: I490c89f854465baf160bc55a65f3c3e24490a947
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 2f0642f9
...@@ -401,6 +401,25 @@ static QString generatePuppetCompilingHelp(const QString &puppetName, const QStr ...@@ -401,6 +401,25 @@ static QString generatePuppetCompilingHelp(const QString &puppetName, const QStr
return puppetCompileHelp; return puppetCompileHelp;
} }
static void formatQmlPuppetCompilationMessage(const QString &puppetName,
const QString &sharedDirPath,
const QString &pathToQt,
QTextStream &messageStream)
{
const QString sourcePath = sharedDirPath + QStringLiteral("/qml/qmlpuppet/") + puppetName + QLatin1Char('/');
messageStream << "<p>"
//: %1 Puppet binary name ("qmlpuppet", "qml2puppet"), %2 source path.
<< NodeInstanceServerProxy::tr("You can build <code>%1</code> yourself with Qt 5.2.0 or higher. "
"The source can be found in <code>%2</code>.")
.arg(puppetName, QDir::toNativeSeparators(sourcePath))
<< "</p><p>"
<< NodeInstanceServerProxy::tr("<code>%1</code> will be installed to the <code>bin</code> directory of your Qt version. "
"Qt Quick Designer will check the <code>bin</code> directory of the currently active Qt version "
"of your project.").arg(puppetName)
<< "</p>"
<< generatePuppetCompilingHelp(puppetName, pathToQt);
}
QString NodeInstanceServerProxy::missingQmlPuppetErrorMessage(const QString &pathToQt, const QString &preMessage) const QString NodeInstanceServerProxy::missingQmlPuppetErrorMessage(const QString &pathToQt, const QString &preMessage) const
{ {
QString message; QString message;
...@@ -408,29 +427,10 @@ QString NodeInstanceServerProxy::missingQmlPuppetErrorMessage(const QString &pat ...@@ -408,29 +427,10 @@ QString NodeInstanceServerProxy::missingQmlPuppetErrorMessage(const QString &pat
messageStream << "<html><head/><body><p>" messageStream << "<html><head/><body><p>"
<< preMessage << preMessage
<< "</p>"; << "</p>";
if (hasQtQuick2(m_nodeInstanceView.data())) { if (hasQtQuick2(m_nodeInstanceView.data()))
messageStream << "<p>" formatQmlPuppetCompilationMessage(QStringLiteral("qml2puppet"), sharedDirPath(), pathToQt, messageStream);
<< tr("You can build <code>qml2puppet</code> yourself with Qt 5.2.0 or higher. " else if (hasQtQuick1(m_nodeInstanceView.data()))
"The source can be found in <code>%1</code>."). formatQmlPuppetCompilationMessage(QStringLiteral("qmlpuppet"), sharedDirPath(), pathToQt, messageStream);
arg(QDir::toNativeSeparators(sharedDirPath() + QLatin1String("/qml/qmlpuppet/qml2puppet/")))
<< "</p><p>"
<< tr("<code>qml2puppet</code> will be installed to the <code>bin</code> directory of your Qt version. "
"Qt Quick Designer will check the <code>bin</code> directory of the currently active Qt version "
"of your project.")
<< "</p>"
<< generatePuppetCompilingHelp(QStringLiteral("qml2puppet"), pathToQt);
} else if (hasQtQuick1(m_nodeInstanceView.data())) {
messageStream << "<p>"
<< tr("You can build <code>qml2puppet</code> yourself with Qt 5.2.0 or higher. "
"The source can be found in <code>%1</code>.").
arg(QDir::toNativeSeparators(sharedDirPath() + QLatin1String("/qml/qmlpuppet/qmlpuppet/")))
<< "</p><p>"
<< tr("<code>qmlpuppet</code> will be installed to the <code>bin</code> directory of your Qt version. "
"Qt Quick Designer will check the <code>bin</code> directory of the currently active Qt version "
"of your project.")
<< "</p>"
<< generatePuppetCompilingHelp(QStringLiteral("qmlpuppet"), pathToQt);
}
messageStream << "</p></body></html>"; messageStream << "</p></body></html>";
return message; return message;
} }
......
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