From bc5c462df6790a11529a24f4644fd01b50acdd35 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Mar 2011 16:37:38 +0100 Subject: [PATCH] Debugging helpers: Build Gdb helper on Mac only. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Kai Köhne --- .../qt4projectmanager/debugginghelper.ui | 82 ++++++++++--------- .../debugginghelperbuildtask.cpp | 52 ++++++------ .../debugginghelperbuildtask.h | 4 +- .../qt4projectmanager/qtoptionspage.cpp | 32 ++++---- 4 files changed, 91 insertions(+), 79 deletions(-) diff --git a/src/plugins/qt4projectmanager/debugginghelper.ui b/src/plugins/qt4projectmanager/debugginghelper.ui index 5239efba832..d890e3e0a6b 100644 --- a/src/plugins/qt4projectmanager/debugginghelper.ui +++ b/src/plugins/qt4projectmanager/debugginghelper.ui @@ -2,42 +2,20 @@ Qt4ProjectManager::Internal::DebuggingHelper + + + 0 + 0 + 321 + 150 + + 0 - - - - Helps showing content of Qt types. Only used in older versions of gdb. - - - Gdb Helper: - - - - - - - TextLabel - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -98,13 +76,6 @@ - - - - Build - - - @@ -153,6 +124,43 @@ + + + + Helps showing content of Qt types. Only used in older versions of gdb. + + + Gdb Helper: + + + + + + + TextLabel + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Build + + + diff --git a/src/plugins/qt4projectmanager/debugginghelperbuildtask.cpp b/src/plugins/qt4projectmanager/debugginghelperbuildtask.cpp index cd07bd4ae3a..40c6f6e0c33 100644 --- a/src/plugins/qt4projectmanager/debugginghelperbuildtask.cpp +++ b/src/plugins/qt4projectmanager/debugginghelperbuildtask.cpp @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include @@ -47,7 +49,8 @@ using namespace Qt4ProjectManager::Internal; using ProjectExplorer::DebuggingHelperLibrary; -DebuggingHelperBuildTask::DebuggingHelperBuildTask(const QtVersion *version, Tools tools) +DebuggingHelperBuildTask::DebuggingHelperBuildTask(const QtVersion *version, Tools tools) : + m_tools(tools & availableTools(version)) { if (!version || !version->isValid()) return; @@ -90,37 +93,34 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const QtVersion *version, Too m_qmakeCommand = version->qmakeCommand(); m_makeCommand = tc->makeCommand(); m_mkspec = version->mkspec(); - - m_tools = tools; - - // Check the build requirements of the tools - - if (m_tools & QmlDump) { - if (!QmlDumpTool::canBuild(version)) { - m_tools ^= QmlDump; - } - } - - if (m_tools & QmlObserver) { - if (!QmlObserverTool::canBuild(version)) { - m_tools ^= QmlObserver; - } else { - m_tools |= QmlDebugging; - } - } - - if (m_tools & QmlDebugging) { - if (!QmlDebuggingLibrary::canBuild(version)) { - m_tools ^= QmlDebugging; - m_tools &= ~QmlObserver; // remove observer if set - } - } } DebuggingHelperBuildTask::~DebuggingHelperBuildTask() { } +DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const QtVersion *version) +{ + QTC_ASSERT(version, return 0; ) + // Check the build requirements of the tools + DebuggingHelperBuildTask::Tools tools = 0; + // Gdb helpers are needed on Mac/gdb only. + foreach (const ProjectExplorer::Abi &abi, version->qtAbis()) { + if (abi.os() == ProjectExplorer::Abi::MacOS) { + tools |= DebuggingHelperBuildTask::GdbDebugging; + break; + } + } + if (QmlDumpTool::canBuild(version)) + tools |= QmlDump; + if (QmlDebuggingLibrary::canBuild(version)) { + tools |= QmlDebugging; + if (QmlObserverTool::canBuild(version)) + tools |= QmlObserver; // requires QML debugging. + } + return tools; +} + void DebuggingHelperBuildTask::run(QFutureInterface &future) { future.setProgressRange(0, 5); diff --git a/src/plugins/qt4projectmanager/debugginghelperbuildtask.h b/src/plugins/qt4projectmanager/debugginghelperbuildtask.h index 45094b0c364..20d24fe3e29 100644 --- a/src/plugins/qt4projectmanager/debugginghelperbuildtask.h +++ b/src/plugins/qt4projectmanager/debugginghelperbuildtask.h @@ -62,13 +62,15 @@ public: void run(QFutureInterface &future); + static Tools availableTools(const QtVersion *version); + signals: void finished(int qtVersionId, DebuggingHelperBuildTask::Tools tools, const QString &output); private: bool buildDebuggingHelper(QFutureInterface &future, QString *output); - Tools m_tools; + const Tools m_tools; int m_qtId; QString m_qtInstallData; diff --git a/src/plugins/qt4projectmanager/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp index 6ad45d75f3f..8ecb72d3c45 100644 --- a/src/plugins/qt4projectmanager/qtoptionspage.cpp +++ b/src/plugins/qt4projectmanager/qtoptionspage.cpp @@ -39,10 +39,6 @@ #include "qt4projectmanagerconstants.h" #include "qt4target.h" #include "qtversionmanager.h" -#include "qmldumptool.h" -#include "qmlobservertool.h" -#include "qmldebugginglibrary.h" -#include "debugginghelperbuildtask.h" #include #include @@ -439,20 +435,22 @@ void QtOptionsPageWidget::removeQtDir() void QtOptionsPageWidget::updateDebuggingHelperUi() { - QtVersion *version = currentVersion(); + const QtVersion *version = currentVersion(); const QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); if (!version || !version->supportsBinaryDebuggingHelper()) { m_ui->debuggingHelperWidget->setVisible(false); } else { - bool canBuildQmlDumper = QmlDumpTool::canBuild(version); - bool canBuildQmlDebuggingLib = QmlDebuggingLibrary::canBuild(version); - bool canBuildQmlObserver = QmlObserverTool::canBuild(version); + const DebuggingHelperBuildTask::Tools availableTools = DebuggingHelperBuildTask::availableTools(version); + const bool canBuildGdbHelper = availableTools & DebuggingHelperBuildTask::GdbDebugging; + const bool canBuildQmlDumper = availableTools & DebuggingHelperBuildTask::QmlDump; + const bool canBuildQmlDebuggingLib = availableTools & DebuggingHelperBuildTask::QmlDebugging; + const bool canBuildQmlObserver = availableTools & DebuggingHelperBuildTask::QmlObserver; - bool hasGdbHelper = !version->gdbDebuggingHelperLibrary().isEmpty(); - bool hasQmlDumper = version->hasQmlDump(); - bool hasQmlDebuggingLib = version->hasQmlDebuggingLibrary(); - bool hasQmlObserver = !version->qmlObserverTool().isEmpty(); + const bool hasGdbHelper = !version->gdbDebuggingHelperLibrary().isEmpty(); + const bool hasQmlDumper = version->hasQmlDump(); + const bool hasQmlDebuggingLib = version->hasQmlDebuggingLibrary(); + const bool hasQmlObserver = !version->qmlObserverTool().isEmpty(); bool isBuildingGdbHelper = false; bool isBuildingQmlDumper = false; @@ -495,11 +493,15 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() gdbHelperText = QDir::toNativeSeparators(version->gdbDebuggingHelperLibrary()); gdbHelperTextFlags = Qt::TextSelectableByMouse; } else { - gdbHelperText = tr("Not yet built."); + if (canBuildGdbHelper) { + gdbHelperText = tr("Not yet built."); + } else { + gdbHelperText = tr("Not needed."); + } } m_debuggingHelperUi->gdbHelperStatus->setText(gdbHelperText); m_debuggingHelperUi->gdbHelperStatus->setTextInteractionFlags(gdbHelperTextFlags); - m_debuggingHelperUi->gdbHelperBuildButton->setEnabled(!isBuildingGdbHelper); + m_debuggingHelperUi->gdbHelperBuildButton->setEnabled(canBuildGdbHelper && !isBuildingGdbHelper); QString qmlDumpStatusText; Qt::TextInteractionFlags qmlDumpStatusTextFlags = Qt::NoTextInteraction; @@ -535,7 +537,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() if (qmlDebuggingLibStatusText != debugPath) { if (!qmlDebuggingLibStatusText.isEmpty() && !debugPath.isEmpty()) { - qmlDebuggingLibStatusText += QLatin1String("\n"); + qmlDebuggingLibStatusText += QLatin1Char('\n'); } qmlDebuggingLibStatusText += debugPath; }