Commit 6c18d557 authored by Kai Koehne's avatar Kai Koehne

DebuggingHelper: Only show build log on error

This fixes the case that the user only compiles one debugging helper, and
the debug output was displayed although the compilation went fine.

Task-number: QTCREATORBUG-3711
Reviewed-by: ckamm
parent 2a7f8c1f
......@@ -45,6 +45,9 @@ using ProjectExplorer::DebuggingHelperLibrary;
DebuggingHelperBuildTask::DebuggingHelperBuildTask(QtVersion *version, Tools tools)
{
// allow type to be used in queued connections.
qRegisterMetaType<DebuggingHelperBuildTask::Tools>("DebuggingHelperBuildTask::Tools");
//
// Extract all information we need from version, such that we don't depend on the existence
// of the version pointer while compiling
......@@ -122,10 +125,10 @@ void DebuggingHelperBuildTask::run(QFutureInterface<void> &future)
success = buildDebuggingHelper(future, &output);
if (success) {
emit finished(m_qtId, output);
emit finished(m_qtId, m_tools, output);
} else {
qWarning("%s", qPrintable(m_errorMessage));
emit finished(m_qtId, m_errorMessage);
emit finished(m_qtId, m_tools, m_errorMessage);
}
deleteLater();
......
......@@ -59,7 +59,7 @@ public:
void run(QFutureInterface<void> &future);
signals:
void finished(int qtVersionId, const QString &output);
void finished(int qtVersionId, DebuggingHelperBuildTask::Tools tools, const QString &output);
private:
bool buildDebuggingHelper(QFutureInterface<void> &future, QString *output);
......
......@@ -73,7 +73,8 @@ public:
{
qmlDumpBuilds()->insert(m_version.uniqueId(), this);
connect(m_buildTask, SIGNAL(finished(int,QString)), this, SLOT(finish(int,QString)),
connect(m_buildTask, SIGNAL(finished(int,DebuggingHelperBuildTask::Tools,QString)),
this, SLOT(finish(int,DebuggingHelperBuildTask::Tools,QString)),
Qt::QueuedConnection);
}
......@@ -93,10 +94,11 @@ public:
}
private slots:
void finish(int qtId, const QString &output)
void finish(int qtId, DebuggingHelperBuildTask::Tools tools, const QString &output)
{
QtVersion *version = QtVersionManager::instance()->version(qtId);
QTC_ASSERT(tools == DebuggingHelperBuildTask::QmlDump, return);
QString errorMessage;
if (!version) {
m_failed = true;
......
......@@ -287,7 +287,7 @@ static inline int findVersionById(const QList<QSharedPointerQtVersion> &l, int i
}
// Update with results of terminated helper build
void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, const QString &output)
void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, DebuggingHelperBuildTask::Tools tools, const QString &output)
{
const int index = findVersionById(m_versions, qtVersionId);
if (index == -1)
......@@ -302,9 +302,14 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, const QS
item->setData(0, BuildLogRole, output);
QSharedPointerQtVersion qtVersion = m_versions.at(index);
const bool success = qtVersion->hasDebuggingHelper()
&& (!QmlDumpTool::canBuild(qtVersion.data()) || qtVersion->hasQmlDump())
&& (!QmlObserverTool::canBuild(qtVersion.data()) || qtVersion->hasQmlObserver());
bool success = true;
if (tools & DebuggingHelperBuildTask::GdbDebugging)
success &= qtVersion->hasDebuggingHelper();
if (tools & DebuggingHelperBuildTask::QmlDump)
success &= qtVersion->hasQmlDump();
if (tools & DebuggingHelperBuildTask::QmlObserver)
success &= qtVersion->hasQmlObserver();
// Update bottom control if the selection is still the same
if (index == currentIndex()) {
......@@ -333,7 +338,8 @@ void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools t
// Run a debugging helper build task in the background.
DebuggingHelperBuildTask *buildTask = new DebuggingHelperBuildTask(version, tools);
connect(buildTask, SIGNAL(finished(int,QString)), this, SLOT(debuggingHelperBuildFinished(int,QString)),
connect(buildTask, SIGNAL(finished(int,DebuggingHelperBuildTask::Tools,QString)),
this, SLOT(debuggingHelperBuildFinished(int,DebuggingHelperBuildTask::Tools,QString)),
Qt::QueuedConnection);
QFuture<void> task = QtConcurrent::run(&DebuggingHelperBuildTask::run, buildTask);
const QString taskName = tr("Building helpers");
......
......@@ -114,7 +114,7 @@ private slots:
void buildQmlDump();
void buildQmlObserver();
void slotShowDebuggingBuildLog();
void debuggingHelperBuildFinished(int qtVersionId, const QString &output);
void debuggingHelperBuildFinished(int qtVersionId, DebuggingHelperBuildTask::Tools tools, const QString &output);
private:
void showDebuggingBuildLog(const QTreeWidgetItem *currentItem);
......
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