Commit e3158d0e authored by Kai Koehne's avatar Kai Koehne

DebuggingHelper: Show tooltip on why a helper cannot be built

Change-Id: I56a93ae98d73ac174f39da8e8a4d3eab05f02800
parent 2ee28281
......@@ -66,9 +66,14 @@ QString QmlDebuggingLibrary::libraryByInstallData(const QString &qtInstallData,
return byInstallDataHelper(sourcePath(), sourceFileNames(), directories, binFilenames, false);
}
bool QmlDebuggingLibrary::canBuild(const BaseQtVersion *qtVersion)
bool QmlDebuggingLibrary::canBuild(const BaseQtVersion *qtVersion, QString *reason)
{
return qtVersion->qtVersion() >= QtVersionNumber(4, 7, 1);
if (qtVersion->qtVersion() < QtVersionNumber(4, 7, 1)) {
if (reason)
*reason = QCoreApplication::translate("Qt4ProjectManager::QmlDebuggingLibrary", "Only available for Qt 4.7.1 or newer.");
return false;
}
return true;
}
bool QmlDebuggingLibrary::build(BuildHelperArguments arguments, QString *log, QString *errorMessage)
......
......@@ -55,7 +55,7 @@ class QmlDebuggingLibrary : public Utils::BuildableHelperLibrary
public:
static QString libraryByInstallData(const QString &qtInstallData, bool debugBuild);
static bool canBuild(const BaseQtVersion *qtVersion);
static bool canBuild(const BaseQtVersion *qtVersion, QString *reason = 0);
static bool build(BuildHelperArguments arguments, QString *log, QString *errorMessage);
static QString copy(const QString &qtInstallData, QString *errorMessage);
......
......@@ -181,14 +181,28 @@ static bool hasPrivateHeaders(const QString &qtInstallHeaders) {
return QFile::exists(header);
}
bool QmlDumpTool::canBuild(const BaseQtVersion *qtVersion)
bool QmlDumpTool::canBuild(const BaseQtVersion *qtVersion, QString *reason)
{
const QString installHeaders = qtVersion->versionInfo().value("QT_INSTALL_HEADERS");
return (qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|| (qtVersion->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID)
&& (qtVersion->qtVersion() > QtVersionNumber(4, 7, 1))))
&& hasPrivateHeaders(installHeaders);
if (!qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
&& !(qtVersion->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID))) {
if (reason)
*reason = QCoreApplication::translate("Qt4ProjectManager::QmlDumpTool", "Only available for Qt for Desktop and Qt for Qt Simulator.");
return false;
}
if (qtVersion->qtVersion() < QtVersionNumber(4, 7, 1)) {
if (reason)
*reason = QCoreApplication::translate("Qt4ProjectManager::QmlDumpTool", "Only available for Qt 4.7.1 or newer.");
return false;
}
if (!hasPrivateHeaders(installHeaders)) {
if (reason)
*reason = QCoreApplication::translate("Qt4ProjectManager::QmlDumpTool", "Private headers are missing for this Qt version.");
return false;
}
return true;
}
static BaseQtVersion *qtVersionForProject(ProjectExplorer::Project *project)
......
......@@ -51,7 +51,7 @@ class BaseQtVersion;
class QT4PROJECTMANAGER_EXPORT QmlDumpTool : public Utils::BuildableHelperLibrary
{
public:
static bool canBuild(const BaseQtVersion *qtVersion);
static bool canBuild(const BaseQtVersion *qtVersion, QString *reason = 0);
static QString toolForProject(ProjectExplorer::Project *project, bool debugDump);
static QString toolByInstallData(const QString &qtInstallData, const QString &qtInstallHeaders,
bool debugDump);
......
......@@ -55,11 +55,21 @@ static inline QStringList validBinaryFilenames()
<< QLatin1String("QMLObserver.app/Contents/MacOS/QMLObserver");
}
bool QmlObserverTool::canBuild(const BaseQtVersion *qtVersion)
bool QmlObserverTool::canBuild(const BaseQtVersion *qtVersion, QString *reason)
{
return (qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|| qtVersion->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID))
&& (qtVersion->qtVersion() >= QtVersionNumber(4, 7, 1));
if (!qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
&& !qtVersion->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID)) {
if (reason)
*reason = QCoreApplication::translate("Qt4ProjectManager::QmlObserverTool", "Only available for Qt for Desktop or Qt for Qt Simulator.");
return false;
}
if (qtVersion->qtVersion() < QtVersionNumber(4, 7, 1)) {
if (reason)
*reason = QCoreApplication::translate("Qt4ProjectManager::QmlObserverTool", "Only available for Qt 4.7.1 or newer.");
return false;
}
return true;
}
QString QmlObserverTool::toolForProject(ProjectExplorer::Project *project)
......
......@@ -53,7 +53,7 @@ class BaseQtVersion;
class QT4PROJECTMANAGER_EXPORT QmlObserverTool : public Utils::BuildableHelperLibrary
{
public:
static bool canBuild(const BaseQtVersion *qtVersion);
static bool canBuild(const BaseQtVersion *qtVersion, QString *reason = 0);
static QString toolForProject(ProjectExplorer::Project *project);
static QString toolByInstallData(const QString &qtInstallData);
static QStringList locationsByInstallData(const QString &qtInstallData);
......
......@@ -38,6 +38,9 @@
#include "qt4projectmanagerconstants.h"
#include "qtversionmanager.h"
#include "qtversionfactory.h"
#include "qmldumptool.h"
#include "qmldebugginglibrary.h"
#include "qmlobservertool.h"
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
......@@ -546,7 +549,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
m_debuggingHelperUi->gdbHelperStatus->setTextInteractionFlags(gdbHelperTextFlags);
m_debuggingHelperUi->gdbHelperBuildButton->setEnabled(canBuildGdbHelper && !isBuildingGdbHelper);
QString qmlDumpStatusText;
QString qmlDumpStatusText, qmlDumpStatusToolTip;
Qt::TextInteractionFlags qmlDumpStatusTextFlags = Qt::NoTextInteraction;
if (hasQmlDumper) {
qmlDumpStatusText = QDir::toNativeSeparators(version->qmlDumpTool(false));
......@@ -563,13 +566,15 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
qmlDumpStatusText = tr("<i>Not yet built.</i>");
} else {
qmlDumpStatusText = tr("<i>Cannot be compiled.</i>");
QmlDumpTool::canBuild(version, &qmlDumpStatusToolTip);
}
}
m_debuggingHelperUi->qmlDumpStatus->setText(qmlDumpStatusText);
m_debuggingHelperUi->qmlDumpStatus->setTextInteractionFlags(qmlDumpStatusTextFlags);
m_debuggingHelperUi->qmlDumpStatus->setToolTip(qmlDumpStatusToolTip);
m_debuggingHelperUi->qmlDumpBuildButton->setEnabled(canBuildQmlDumper & !isBuildingQmlDumper);
QString qmlDebuggingLibStatusText;
QString qmlDebuggingLibStatusText, qmlDebuggingLibToolTip;
Qt::TextInteractionFlags qmlDebuggingLibStatusTextFlags = Qt::NoTextInteraction;
if (hasQmlDebuggingLib) {
qmlDebuggingLibStatusText = QDir::toNativeSeparators(
......@@ -592,15 +597,17 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
qmlDebuggingLibStatusText = tr("<i>Not yet built.</i>");
} else {
qmlDebuggingLibStatusText = tr("<i>Cannot be compiled.</i>");
QmlDebuggingLibrary::canBuild(version, &qmlDebuggingLibToolTip);
}
}
m_debuggingHelperUi->qmlDebuggingLibStatus->setText(qmlDebuggingLibStatusText);
m_debuggingHelperUi->qmlDebuggingLibStatus->setTextInteractionFlags(qmlDebuggingLibStatusTextFlags);
m_debuggingHelperUi->qmlDebuggingLibStatus->setToolTip(qmlDebuggingLibToolTip);
m_debuggingHelperUi->qmlDebuggingLibBuildButton->setEnabled(needsQmlDebuggingLib
&& canBuildQmlDebuggingLib
&& !isBuildingQmlDebuggingLib);
QString qmlObserverStatusText;
QString qmlObserverStatusText, qmlObserverToolTip;
Qt::TextInteractionFlags qmlObserverStatusTextFlags = Qt::NoTextInteraction;
if (hasQmlObserver) {
qmlObserverStatusText = QDir::toNativeSeparators(version->qmlObserverTool());
......@@ -612,10 +619,12 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
qmlObserverStatusText = tr("<i>Not yet built.</i>");
} else {
qmlObserverStatusText = tr("<i>Cannot be compiled.</i>");
QmlObserverTool::canBuild(version, &qmlObserverToolTip);
}
}
m_debuggingHelperUi->qmlObserverStatus->setText(qmlObserverStatusText);
m_debuggingHelperUi->qmlObserverStatus->setTextInteractionFlags(qmlObserverStatusTextFlags);
m_debuggingHelperUi->qmlObserverStatus->setToolTip(qmlObserverToolTip);
m_debuggingHelperUi->qmlObserverBuildButton->setEnabled(canBuildQmlObserver
& !isBuildingQmlObserver);
......
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