Commit 646ec206 authored by Christian Kamm's avatar Christian Kamm
Browse files

Debugging helpers: Only fail if there was a chance of success.

Task-number: QTCREATORBUG-2563
Reviewed-by: Kai Koehne
parent 48168936
...@@ -126,7 +126,7 @@ static inline QStringList validBinaryFilenames() ...@@ -126,7 +126,7 @@ static inline QStringList validBinaryFilenames()
<< QLatin1String("qmldump.app/Contents/MacOS/qmldump"); << QLatin1String("qmldump.app/Contents/MacOS/qmldump");
} }
bool QmlDumpTool::canBuild(QtVersion *qtVersion) bool QmlDumpTool::canBuild(const QtVersion *qtVersion)
{ {
const QString installHeaders = qtVersion->versionInfo().value("QT_INSTALL_HEADERS"); const QString installHeaders = qtVersion->versionInfo().value("QT_INSTALL_HEADERS");
const QString header = installHeaders + QLatin1String("/QtDeclarative/private/qdeclarativemetatype_p.h"); const QString header = installHeaders + QLatin1String("/QtDeclarative/private/qdeclarativemetatype_p.h");
......
...@@ -47,7 +47,7 @@ class QtVersion; ...@@ -47,7 +47,7 @@ class QtVersion;
class QT4PROJECTMANAGER_EXPORT QmlDumpTool : public Utils::BuildableHelperLibrary class QT4PROJECTMANAGER_EXPORT QmlDumpTool : public Utils::BuildableHelperLibrary
{ {
public: public:
static bool canBuild(QtVersion *qtVersion); static bool canBuild(const QtVersion *qtVersion);
static QString toolForProject(ProjectExplorer::Project *project); static QString toolForProject(ProjectExplorer::Project *project);
static QString toolByInstallData(const QString &qtInstallData); static QString toolByInstallData(const QString &qtInstallData);
static QStringList locationsByInstallData(const QString &qtInstallData); static QStringList locationsByInstallData(const QString &qtInstallData);
......
...@@ -51,7 +51,7 @@ static inline QStringList validBinaryFilenames() ...@@ -51,7 +51,7 @@ static inline QStringList validBinaryFilenames()
<< QLatin1String("QMLObserver.app/Contents/MacOS/QMLObserver"); << QLatin1String("QMLObserver.app/Contents/MacOS/QMLObserver");
} }
bool QmlObserverTool::canBuild(QtVersion *qtVersion) bool QmlObserverTool::canBuild(const QtVersion *qtVersion)
{ {
return checkMinimumQtVersion(qtVersion->qtVersionString(), 4, 7, 1); return checkMinimumQtVersion(qtVersion->qtVersionString(), 4, 7, 1);
} }
......
...@@ -48,7 +48,7 @@ class QtVersion; ...@@ -48,7 +48,7 @@ class QtVersion;
class QT4PROJECTMANAGER_EXPORT QmlObserverTool : public Utils::BuildableHelperLibrary class QT4PROJECTMANAGER_EXPORT QmlObserverTool : public Utils::BuildableHelperLibrary
{ {
public: public:
static bool canBuild(QtVersion *qtVersion); static bool canBuild(const QtVersion *qtVersion);
static QString toolForProject(ProjectExplorer::Project *project); static QString toolForProject(ProjectExplorer::Project *project);
static QString toolByInstallData(const QString &qtInstallData); static QString toolByInstallData(const QString &qtInstallData);
static QStringList locationsByInstallData(const QString &qtInstallData); static QStringList locationsByInstallData(const QString &qtInstallData);
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include "qt4target.h" #include "qt4target.h"
#include "qtversionmanager.h" #include "qtversionmanager.h"
#include "qmldumptool.h"
#include "qmlobservertool.h"
#include <projectexplorer/debugginghelper.h> #include <projectexplorer/debugginghelper.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
...@@ -238,7 +240,9 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver ...@@ -238,7 +240,9 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
QIcon QtOptionsPageWidget::debuggerHelperIconForQtVersion(const QtVersion *version) QIcon QtOptionsPageWidget::debuggerHelperIconForQtVersion(const QtVersion *version)
{ {
if (version->hasDebuggingHelper() && version->hasQmlDump() && version->hasQmlObserver()) { if (version->hasDebuggingHelper()
&& (!QmlDumpTool::canBuild(version) || version->hasQmlDump())
&& (!QmlObserverTool::canBuild(version) || version->hasQmlObserver())) {
return m_debuggingHelperOkIcon; return m_debuggingHelperOkIcon;
} else if (!version->hasDebuggingHelper() && !version->hasQmlDump() && !version->hasQmlObserver()) { } else if (!version->hasDebuggingHelper() && !version->hasQmlDump() && !version->hasQmlObserver()) {
return m_debuggingHelperErrorIcon; return m_debuggingHelperErrorIcon;
...@@ -248,7 +252,9 @@ QIcon QtOptionsPageWidget::debuggerHelperIconForQtVersion(const QtVersion *versi ...@@ -248,7 +252,9 @@ QIcon QtOptionsPageWidget::debuggerHelperIconForQtVersion(const QtVersion *versi
QPixmap QtOptionsPageWidget::debuggerHelperPixmapForQtVersion(const QtVersion *version) QPixmap QtOptionsPageWidget::debuggerHelperPixmapForQtVersion(const QtVersion *version)
{ {
if (version->hasDebuggingHelper() && version->hasQmlDump() && version->hasQmlObserver()) { if (version->hasDebuggingHelper()
&& (!QmlDumpTool::canBuild(version) || version->hasQmlDump())
&& (!QmlObserverTool::canBuild(version) || version->hasQmlObserver())) {
return m_debuggingHelperOkPixmap; return m_debuggingHelperOkPixmap;
} else if (!version->hasDebuggingHelper() && !version->hasQmlDump() && !version->hasQmlObserver()) { } else if (!version->hasDebuggingHelper() && !version->hasQmlDump() && !version->hasQmlObserver()) {
return m_debuggingHelperErrorPixmap; return m_debuggingHelperErrorPixmap;
...@@ -311,7 +317,9 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(const QString &name, cons ...@@ -311,7 +317,9 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(const QString &name, cons
QTC_ASSERT(item, return) QTC_ASSERT(item, return)
item->setData(2, Qt::UserRole, output); item->setData(2, Qt::UserRole, output);
QSharedPointerQtVersion qtVersion = m_versions.at(index); QSharedPointerQtVersion qtVersion = m_versions.at(index);
const bool success = qtVersion->hasDebuggingHelper() && qtVersion->hasQmlDump() && qtVersion->hasQmlObserver(); const bool success = qtVersion->hasDebuggingHelper()
&& (!QmlDumpTool::canBuild(qtVersion.data()) || qtVersion->hasQmlDump())
&& (!QmlObserverTool::canBuild(qtVersion.data()) || qtVersion->hasQmlObserver());
item->setData(2, Qt::DecorationRole, debuggerHelperIconForQtVersion(qtVersion.data())); item->setData(2, Qt::DecorationRole, debuggerHelperIconForQtVersion(qtVersion.data()));
// Update bottom control if the selection is still the same // Update bottom control if the selection is still the same
...@@ -404,12 +412,16 @@ static inline QString msgHtmlHelperToolTip(const QString &gdbHelperPath, const Q ...@@ -404,12 +412,16 @@ static inline QString msgHtmlHelperToolTip(const QString &gdbHelperPath, const Q
QString notFound = QtOptionsPageWidget::tr("Binary not found"); QString notFound = QtOptionsPageWidget::tr("Binary not found");
//: Tooltip showing the debugging helper library file. //: Tooltip showing the debugging helper library file.
return QtOptionsPageWidget::tr("<html><body><table><tr><td>File:</td><td><pre>%1</pre></td></tr>" return QtOptionsPageWidget::tr("<html><body><table>"
"<tr><td colspan=\"2\"><b>GDB debugging helpers</b></td></tr>"
"<tr><td>File:</td><td><pre>%1</pre></td></tr>"
"<tr><td>Last&nbsp;modified:</td><td>%2</td></tr>" "<tr><td>Last&nbsp;modified:</td><td>%2</td></tr>"
"<tr><td>Size:</td><td>%3 Bytes</td></tr>" "<tr><td>Size:</td><td>%3 Bytes</td></tr>"
"<tr><td colspan=\"2\"><b>QML type dumper</b></td></tr>"
"<tr><td>File:</td><td><pre>%4</pre></td></tr>" "<tr><td>File:</td><td><pre>%4</pre></td></tr>"
"<tr><td>Last&nbsp;modified:</td><td>%5</td></tr>" "<tr><td>Last&nbsp;modified:</td><td>%5</td></tr>"
"<tr><td>Size:</td><td>%6 Bytes</td></tr>" "<tr><td>Size:</td><td>%6 Bytes</td></tr>"
"<tr><td colspan=\"2\"><b>QML observer</b></td></tr>"
"<tr><td>File:</td><td><pre>%7</pre></td></tr>" "<tr><td>File:</td><td><pre>%7</pre></td></tr>"
"<tr><td>Last&nbsp;modified:</td><td>%8</td></tr>" "<tr><td>Last&nbsp;modified:</td><td>%8</td></tr>"
"<tr><td>Size:</td><td>%9 Bytes</td></tr>" "<tr><td>Size:</td><td>%9 Bytes</td></tr>"
...@@ -432,12 +444,10 @@ void QtOptionsPageWidget::updateDebuggingHelperStateLabel(const QtVersion *versi ...@@ -432,12 +444,10 @@ void QtOptionsPageWidget::updateDebuggingHelperStateLabel(const QtVersion *versi
{ {
QString tooltip; QString tooltip;
if (version && version->isValid()) { if (version && version->isValid()) {
const bool hasHelpers = version->hasDebuggingHelper() && version->hasQmlDump() && version->hasQmlObserver();
m_ui->debuggingHelperStateLabel->setPixmap(debuggerHelperPixmapForQtVersion(version)); m_ui->debuggingHelperStateLabel->setPixmap(debuggerHelperPixmapForQtVersion(version));
if (hasHelpers) tooltip = msgHtmlHelperToolTip(version->debuggingHelperLibrary(),
tooltip = msgHtmlHelperToolTip(version->debuggingHelperLibrary(), version->qmlDumpTool(),
version->qmlDumpTool(), version->qmlObserverTool());
version->qmlObserverTool());
} else { } else {
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap()); m_ui->debuggingHelperStateLabel->setPixmap(QPixmap());
} }
......
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