Removing support for DebuggingHelpers

This patch removes infrastructure and ui for DebuggingHelpers
and specifically qmldumptool.

The qmldumptool was the last relevant DebuggingHelper and is only required
for Qt < 4.8.

Change-Id: I3767be0858e5eba16a33a3ab8436e95fc06a9e99
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2016-01-22 16:14:07 +01:00
parent edb55e1f66
commit e3a3792fd6
14 changed files with 11 additions and 787 deletions

View File

@@ -38,7 +38,6 @@
#include <projectexplorer/kit.h> #include <projectexplorer/kit.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qtsupport/debugginghelperbuildtask.h>
#include <qtsupport/qtversionmanager.h> #include <qtsupport/qtversionmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>

View File

@@ -42,7 +42,6 @@
#include <coreplugin/coreicons.h> #include <coreplugin/coreicons.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <qtsupport/debugginghelperbuildtask.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtversionmanager.h> #include <qtsupport/qtversionmanager.h>
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>

View File

@@ -116,9 +116,7 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
} }
if (projectInfo.tryQmlDump) { if (projectInfo.tryQmlDump) {
ToolChain *toolChain = ToolChainKitInformation::toolChain(activeKit); QtSupport::QmlDumpTool::pathAndEnvironment(qtVersion,
QtSupport::QmlDumpTool::pathAndEnvironment(project, qtVersion,
toolChain,
preferDebugDump, &projectInfo.qmlDumpPath, preferDebugDump, &projectInfo.qmlDumpPath,
&projectInfo.qmlDumpEnvironment); &projectInfo.qmlDumpEnvironment);
projectInfo.qmlDumpHasRelocatableFlag = qtVersion->hasQmlDumpWithRelocatableFlag(); projectInfo.qmlDumpHasRelocatableFlag = qtVersion->hasQmlDumpWithRelocatableFlag();

View File

@@ -37,7 +37,6 @@
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/headerpath.h> #include <projectexplorer/headerpath.h>
#include <qtsupport/debugginghelperbuildtask.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>

View File

@@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QtSupport::Internal::DebuggingHelper</class>
<widget class="QWidget" name="QtSupport::Internal::DebuggingHelper">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>330</width>
<height>85</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QPushButton" name="qmlDumpBuildButton">
<property name="text">
<string>Build</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="qmlDumpLabel">
<property name="toolTip">
<string>Used to extract QML type information from library-based plugins.</string>
</property>
<property name="text">
<string>QML Dump:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="qmlDumpStatus">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="toolChainLabel">
<property name="text">
<string>Compiler:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="toolChainComboBox">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="showLogButton">
<property name="toolTip">
<string>Show compiler output of last build.</string>
</property>
<property name="text">
<string>Show Log</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="rebuildButton">
<property name="text">
<string>Build All</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,196 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "debugginghelperbuildtask.h"
#include "qmldumptool.h"
#include "baseqtversion.h"
#include "qtversionmanager.h"
#include <projectexplorer/toolchain.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
using namespace QtSupport;
using namespace QtSupport::Internal;
using namespace QtSupport::Internal;
using namespace ProjectExplorer;
DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
const ToolChain *toolChain,
Tools tools) :
m_tools(tools & availableTools(version)),
m_invalidQt(false),
m_showErrors(true)
{
if (!version || !version->isValid() || !toolChain) {
m_invalidQt = true;
return;
}
// allow type to be used in queued connections.
qRegisterMetaType<DebuggingHelperBuildTask::Tools>("DebuggingHelperBuildTask::Tools");
// Print result in application ouptut
connect(this, SIGNAL(logOutput(QString,Core::MessageManager::PrintToOutputPaneFlags)),
Core::MessageManager::instance(), SLOT(write(QString,Core::MessageManager::PrintToOutputPaneFlags)),
Qt::QueuedConnection);
//
// Extract all information we need from version, such that we don't depend on the existence
// of the version pointer while compiling
//
m_qtId = version->uniqueId();
m_qtInstallData = version->qmakeProperty("QT_INSTALL_DATA");
if (m_qtInstallData.isEmpty()) {
const QString error
= QCoreApplication::translate(
"QtVersion",
"Cannot determine the installation path for Qt version \"%1\"."
).arg(version->displayName());
log(QString(), error);
m_invalidQt = true;
return;
}
m_environment = Utils::Environment::systemEnvironment();
#if 0 // FIXME: Reenable this!
version->addToEnvironment(m_environment);
#endif
toolChain->addToEnvironment(m_environment);
log(QCoreApplication::translate("QtVersion", "Building helper(s) with toolchain \"%1\"...\n"
).arg(toolChain->displayName()), QString());
if (toolChain->targetAbi().os() == Abi::LinuxOS
&& Abi::hostAbi().os() == Abi::WindowsOS)
m_target = QLatin1String("-unix");
m_makeArguments << QLatin1String("all")
<< QLatin1String("-k");
m_qmakeCommand = version->qmakeCommand();
m_qmakeArguments = QStringList() << QLatin1String("-nocache");
if (toolChain->targetAbi().os() == Abi::MacOS
&& toolChain->targetAbi().architecture() == Abi::X86Architecture) {
// explicitly set 32 or 64 bit in case Qt is compiled with both
if (toolChain->targetAbi().wordWidth() == 32)
m_qmakeArguments << QLatin1String("CONFIG+=x86");
else if (toolChain->targetAbi().wordWidth() == 64)
m_qmakeArguments << QLatin1String("CONFIG+=x86_64");
}
m_makeCommand = toolChain->makeCommand(m_environment);
m_mkspec = version->mkspec();
// Make sure QtVersion cache is invalidated
connect(this, SIGNAL(updateQtVersions(Utils::FileName)),
QtVersionManager::instance(), SLOT(updateDumpFor(Utils::FileName)),
Qt::QueuedConnection);
}
DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const BaseQtVersion *version)
{
QTC_ASSERT(version, return 0);
// Check the build requirements of the tools
DebuggingHelperBuildTask::Tools tools = 0;
if (QmlDumpTool::canBuild(version))
tools |= QmlDump;
return tools;
}
void DebuggingHelperBuildTask::showOutputOnError(bool show)
{
m_showErrors = show;
}
void DebuggingHelperBuildTask::run(QFutureInterface<void> &future)
{
future.setProgressRange(0, 3);
future.setProgressValue(1);
if (m_invalidQt || !buildDebuggingHelper(future)) {
const QString error
= QCoreApplication::translate(
"QtVersion",
"Build failed.");
log(QString(), error);
} else {
const QString result
= QCoreApplication::translate(
"QtVersion",
"Build succeeded.");
log(result, QString());
}
emit finished(m_qtId, m_log, m_tools);
emit updateQtVersions(m_qmakeCommand);
deleteLater();
}
bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &future)
{
Utils::BuildableHelperLibrary::BuildHelperArguments arguments;
arguments.makeCommand = m_makeCommand;
arguments.makeArguments = m_makeArguments;
arguments.qmakeCommand = m_qmakeCommand;
arguments.qmakeArguments = m_qmakeArguments;
arguments.targetMode = m_target;
arguments.mkspec = m_mkspec;
arguments.environment = m_environment;
future.setProgressValue(2);
if (m_tools & QmlDump) {
QString output, error;
bool success = true;
arguments.directory = QmlDumpTool::copy(m_qtInstallData, &error);
if (arguments.directory.isEmpty()
|| !QmlDumpTool::build(arguments, &output, &error))
success = false;
log(output, error);
if (!success)
return false;
}
future.setProgressValue(3);
return true;
}
void DebuggingHelperBuildTask::log(const QString &output, const QString &error)
{
if (output.isEmpty() && error.isEmpty())
return;
QString logEntry;
if (!output.isEmpty())
logEntry.append(output);
if (!error.isEmpty())
logEntry.append(error);
m_log.append(logEntry);
Core::MessageManager::PrintToOutputPaneFlags flag = Core::MessageManager::Silent;
if (m_showErrors && !error.isEmpty())
flag = Core::MessageManager::NoModeSwitch;
emit logOutput(logEntry, flag);
}

View File

@@ -1,95 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#ifndef DEBUGGINGHELPERBUILDTASK_H
#define DEBUGGINGHELPERBUILDTASK_H
#include "qtsupport_global.h"
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <coreplugin/messagemanager.h>
#include <QObject>
#include <QFutureInterface>
#include <QMetaType>
namespace ProjectExplorer { class ToolChain; }
namespace QtSupport {
class BaseQtVersion;
class QTSUPPORT_EXPORT DebuggingHelperBuildTask : public QObject
{
Q_OBJECT
public:
enum DebuggingHelper {
QmlDump = 0x02,
AllTools = QmlDump
};
Q_DECLARE_FLAGS(Tools, DebuggingHelper)
explicit DebuggingHelperBuildTask(const BaseQtVersion *version,
const ProjectExplorer::ToolChain *toolChain,
Tools tools = AllTools);
void showOutputOnError(bool show);
void run(QFutureInterface<void> &future);
static Tools availableTools(const BaseQtVersion *version);
signals:
void finished(int qtVersionId, const QString &output, DebuggingHelperBuildTask::Tools tools);
// used internally
void logOutput(const QString &output, Core::MessageManager::PrintToOutputPaneFlags flags);
void updateQtVersions(const Utils::FileName &qmakeCommand);
private:
bool buildDebuggingHelper(QFutureInterface<void> &future);
void log(const QString &output, const QString &error);
const Tools m_tools;
int m_qtId;
QString m_qtInstallData;
QString m_target;
Utils::FileName m_qmakeCommand;
QStringList m_qmakeArguments;
QString m_makeCommand;
QStringList m_makeArguments;
Utils::FileName m_mkspec;
Utils::Environment m_environment;
QString m_log;
bool m_invalidQt;
bool m_showErrors;
};
} // namespace QtSupport
Q_DECLARE_METATYPE(QtSupport::DebuggingHelperBuildTask::Tools)
#endif // DEBUGGINGHELPERBUILDTASK_H

View File

@@ -26,7 +26,6 @@
#include "qmldumptool.h" #include "qmldumptool.h"
#include "qtsupportconstants.h" #include "qtsupportconstants.h"
#include "qtversionmanager.h" #include "qtversionmanager.h"
#include "debugginghelperbuildtask.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
@@ -43,118 +42,6 @@
#include <QHash> #include <QHash>
#include <QStandardPaths> #include <QStandardPaths>
namespace {
using namespace QtSupport;
using namespace ProjectExplorer;
class QmlDumpBuildTask;
typedef QHash<int, QmlDumpBuildTask *> QmlDumpByVersion;
Q_GLOBAL_STATIC(QmlDumpByVersion, qmlDumpBuilds)
// A task suitable to be run by QtConcurrent to build qmldump.
class QmlDumpBuildTask : public QObject
{
Q_OBJECT
public:
explicit QmlDumpBuildTask(BaseQtVersion *version, ToolChain *toolChain)
: m_buildTask(new DebuggingHelperBuildTask(version, toolChain,
DebuggingHelperBuildTask::QmlDump))
, m_failed(false)
{
qmlDumpBuilds()->insert(version->uniqueId(), this);
// Don't open General Messages pane with errors
m_buildTask->showOutputOnError(false);
connect(m_buildTask, SIGNAL(finished(int,QString,DebuggingHelperBuildTask::Tools)),
this, SLOT(finish(int,QString,DebuggingHelperBuildTask::Tools)),
Qt::QueuedConnection);
}
void run(QFutureInterface<void> &future)
{
m_buildTask->run(future);
}
void updateProjectWhenDone(QPointer<Project> project, bool preferDebug)
{
foreach (const ProjectToUpdate &update, m_projectsToUpdate) {
if (update.project == project)
return;
}
ProjectToUpdate update;
update.project = project;
update.preferDebug = preferDebug;
m_projectsToUpdate += update;
}
bool hasFailed() const
{
return m_failed;
}
private slots:
void finish(int qtId, const QString &output, DebuggingHelperBuildTask::Tools tools)
{
BaseQtVersion *version = QtVersionManager::version(qtId);
QTC_ASSERT(tools == DebuggingHelperBuildTask::QmlDump, return);
QString errorMessage;
if (!version) {
m_failed = true;
errorMessage = QString::fromLatin1("Qt version became invalid");
} else {
if (!version->hasQmlDump()) {
m_failed = true;
errorMessage = QString::fromLatin1("Could not build QML plugin dumping helper for %1\n"
"Output:\n%2").
arg(version->displayName(), output);
}
}
if (m_failed) {
qWarning("%s", qPrintable(errorMessage));
return;
}
// update qmldump path for all the project
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
if (!modelManager)
return;
foreach (const ProjectToUpdate &update, m_projectsToUpdate) {
if (!update.project)
continue;
QmlJS::ModelManagerInterface::ProjectInfo projectInfo = modelManager->projectInfo(update.project);
projectInfo.qmlDumpPath = version->qmlDumpTool(update.preferDebug);
if (projectInfo.qmlDumpPath.isEmpty())
projectInfo.qmlDumpPath = version->qmlDumpTool(!update.preferDebug);
projectInfo.qmlDumpEnvironment = version->qmlToolsEnvironment();
projectInfo.qmlDumpHasRelocatableFlag = version->hasQmlDumpWithRelocatableFlag();
modelManager->updateProjectInfo(projectInfo, update.project);
}
// clean up
qmlDumpBuilds()->remove(qtId);
deleteLater();
}
private:
class ProjectToUpdate {
public:
QPointer<Project> project;
bool preferDebug;
};
QList<ProjectToUpdate> m_projectsToUpdate;
DebuggingHelperBuildTask *m_buildTask; // deletes itself after run()
bool m_failed;
};
} // end of anonymous namespace
namespace QtSupport { namespace QtSupport {
static inline QStringList validBinaryFilenames(bool debugBuild) static inline QStringList validBinaryFilenames(bool debugBuild)
@@ -311,25 +198,13 @@ QStringList QmlDumpTool::installDirectories(const QString &qtInstallData)
return directories; return directories;
} }
void QmlDumpTool::pathAndEnvironment(Project *project, BaseQtVersion *version, void QmlDumpTool::pathAndEnvironment(BaseQtVersion *version,
ToolChain *toolChain,
bool preferDebug, QString *dumperPath, Utils::Environment *env) bool preferDebug, QString *dumperPath, Utils::Environment *env)
{ {
QString path; if (version && !version->hasQmlDump())
if (version && !version->hasQmlDump() && QmlDumpTool::canBuild(version)) {
QmlDumpBuildTask *qmlDumpBuildTask = qmlDumpBuilds()->value(version->uniqueId());
if (qmlDumpBuildTask) {
if (!qmlDumpBuildTask->hasFailed())
qmlDumpBuildTask->updateProjectWhenDone(project, preferDebug);
} else {
QmlDumpBuildTask *buildTask = new QmlDumpBuildTask(version, toolChain);
buildTask->updateProjectWhenDone(project, preferDebug);
QFuture<void> task = QtConcurrent::run(&QmlDumpBuildTask::run, buildTask);
const QString taskName = QmlDumpBuildTask::tr("Building QML Helpers");
Core::ProgressManager::addTask(task, taskName, "QmakeProjectManager::BuildHelpers");
}
return; return;
}
QString path;
path = toolForVersion(version, preferDebug); path = toolForVersion(version, preferDebug);
if (path.isEmpty()) if (path.isEmpty())
@@ -354,4 +229,3 @@ void QmlDumpTool::pathAndEnvironment(Project *project, BaseQtVersion *version,
} // namespace QtSupport } // namespace QtSupport
#include "qmldumptool.moc"

View File

@@ -57,8 +57,7 @@ public:
// Copy the source files to a target location and return the chosen target location. // Copy the source files to a target location and return the chosen target location.
static QString copy(const QString &qtInstallData, QString *errorMessage); static QString copy(const QString &qtInstallData, QString *errorMessage);
static void pathAndEnvironment(ProjectExplorer::Project *project, BaseQtVersion *version, static void pathAndEnvironment(BaseQtVersion *version,
ProjectExplorer::ToolChain *toolChain,
bool preferDebug, QString *path, Utils::Environment *env); bool preferDebug, QString *path, Utils::Environment *env);
private: private:

View File

@@ -28,11 +28,9 @@
#include "ui_showbuildlog.h" #include "ui_showbuildlog.h"
#include "ui_qtversionmanager.h" #include "ui_qtversionmanager.h"
#include "ui_qtversioninfo.h" #include "ui_qtversioninfo.h"
#include "ui_debugginghelper.h"
#include "qtsupportconstants.h" #include "qtsupportconstants.h"
#include "qtversionmanager.h" #include "qtversionmanager.h"
#include "qtversionfactory.h" #include "qtversionfactory.h"
#include "qmldumptool.h"
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
@@ -41,6 +39,7 @@
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h> #include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <utils/buildablehelperlibrary.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -140,22 +139,11 @@ public:
m_toolChainId = id; m_toolChainId = id;
} }
DebuggingHelperBuildTask::Tools buildFlags() const
{
return m_buildFlags;
}
void setBuildFlags(DebuggingHelperBuildTask::Tools flags)
{
m_buildFlags = flags;
}
private: private:
BaseQtVersion *m_version = 0; BaseQtVersion *m_version = 0;
QIcon m_icon; QIcon m_icon;
QString m_buildLog; QString m_buildLog;
QByteArray m_toolChainId; QByteArray m_toolChainId;
DebuggingHelperBuildTask::Tools m_buildFlags;
}; };
/// ///
@@ -200,7 +188,6 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent)
, m_specifyNameString(tr("<specify a name>")) , m_specifyNameString(tr("<specify a name>"))
, m_ui(new Internal::Ui::QtVersionManager()) , m_ui(new Internal::Ui::QtVersionManager())
, m_versionUi(new Internal::Ui::QtVersionInfo()) , m_versionUi(new Internal::Ui::QtVersionInfo())
, m_debuggingHelperUi(new Internal::Ui::DebuggingHelper())
, m_infoBrowser(new QTextBrowser) , m_infoBrowser(new QTextBrowser)
, m_invalidVersionIcon(Core::Icons::ERROR.icon()) , m_invalidVersionIcon(Core::Icons::ERROR.icon())
, m_warningVersionIcon(Core::Icons::WARNING.icon()) , m_warningVersionIcon(Core::Icons::WARNING.icon())
@@ -212,9 +199,6 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent)
m_versionUi->setupUi(versionInfoWidget); m_versionUi->setupUi(versionInfoWidget);
m_versionUi->editPathPushButton->setText(PathChooser::browseButtonLabel()); m_versionUi->editPathPushButton->setText(PathChooser::browseButtonLabel());
QWidget *debuggingHelperDetailsWidget = new QWidget();
m_debuggingHelperUi->setupUi(debuggingHelperDetailsWidget);
m_ui->setupUi(this); m_ui->setupUi(this);
m_infoBrowser->setOpenLinks(false); m_infoBrowser->setOpenLinks(false);
@@ -228,10 +212,6 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent)
m_ui->versionInfoWidget->setWidget(versionInfoWidget); m_ui->versionInfoWidget->setWidget(versionInfoWidget);
m_ui->versionInfoWidget->setState(DetailsWidget::NoSummary); m_ui->versionInfoWidget->setState(DetailsWidget::NoSummary);
m_ui->debuggingHelperWidget->setWidget(debuggingHelperDetailsWidget);
connect(m_ui->debuggingHelperWidget, &DetailsWidget::expanded,
this, &QtOptionsPageWidget::setInfoWidgetVisibility);
auto rootItem = new QtVersionItem(QLatin1String("root")); auto rootItem = new QtVersionItem(QLatin1String("root"));
m_autoItem = new QtVersionItem(tr("Auto-detected")); m_autoItem = new QtVersionItem(tr("Auto-detected"));
rootItem->appendChild(m_autoItem); rootItem->appendChild(m_autoItem);
@@ -277,16 +257,6 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent)
connect(m_ui->qtdirList->selectionModel(), &QItemSelectionModel::currentChanged, connect(m_ui->qtdirList->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QtOptionsPageWidget::versionChanged); this, &QtOptionsPageWidget::versionChanged);
connect(m_debuggingHelperUi->rebuildButton, &QAbstractButton::clicked,
this, [this]() { buildDebuggingHelper(); });
connect(m_debuggingHelperUi->qmlDumpBuildButton, &QAbstractButton::clicked,
this, &QtOptionsPageWidget::buildQmlDump);
connect(m_debuggingHelperUi->showLogButton, &QAbstractButton::clicked,
this, &QtOptionsPageWidget::slotShowDebuggingBuildLog);
connect(m_debuggingHelperUi->toolChainComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &QtOptionsPageWidget::selectedToolChainChanged);
connect(m_ui->cleanUpButton, &QAbstractButton::clicked, connect(m_ui->cleanUpButton, &QAbstractButton::clicked,
this, &QtOptionsPageWidget::cleanUpQtVersions); this, &QtOptionsPageWidget::cleanUpQtVersions);
userChangedCurrentVersion(); userChangedCurrentVersion();
@@ -326,41 +296,6 @@ QtVersionItem *QtOptionsPageWidget::currentItem() const
return item; return item;
} }
// Update with results of terminated helper build
void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, const QString &output, DebuggingHelperBuildTask::Tools tools)
{
auto findItem = [qtVersionId](Utils::TreeItem *parent) {
foreach (Utils::TreeItem *child, parent->children()) {
auto item = static_cast<QtVersionItem *>(child);
if (item->version()->uniqueId() == qtVersionId)
return item;
}
return (QtVersionItem *)nullptr;
};
QtVersionItem *item = findItem(m_manualItem);
if (!item)
item = findItem(m_autoItem);
if (!item)
return;
DebuggingHelperBuildTask::Tools buildFlags = item->buildFlags();
buildFlags &= ~tools;
item->setBuildFlags(buildFlags);
item->setBuildLog(output);
bool success = true;
if (tools & DebuggingHelperBuildTask::QmlDump)
success &= item->version()->hasQmlDump();
if (!success)
showDebuggingBuildLog(item);
updateDebuggingHelperUi();
}
void QtOptionsPageWidget::cleanUpQtVersions() void QtOptionsPageWidget::cleanUpQtVersions()
{ {
QVector<QtVersionItem *> toRemove; QVector<QtVersionItem *> toRemove;
@@ -401,7 +336,6 @@ void QtOptionsPageWidget::toolChainsUpdated()
foreach (Utils::TreeItem *child, parent->children()) { foreach (Utils::TreeItem *child, parent->children()) {
if (child == currentItem()) { if (child == currentItem()) {
updateDescriptionLabel(); updateDescriptionLabel();
updateDebuggingHelperUi();
} else { } else {
updateVersionItem(static_cast<QtVersionItem *>(child)); updateVersionItem(static_cast<QtVersionItem *>(child));
} }
@@ -412,16 +346,6 @@ void QtOptionsPageWidget::toolChainsUpdated()
update(m_manualItem); update(m_manualItem);
} }
void QtOptionsPageWidget::selectedToolChainChanged(int comboIndex)
{
QtVersionItem *item = currentItem();
if (!item)
return;
QByteArray toolChainId = m_debuggingHelperUi->toolChainComboBox->itemData(comboIndex).toByteArray();
item->setToolChainId(toolChainId);
}
void QtOptionsPageWidget::qtVersionsDumpUpdated(const FileName &qmakeCommand) void QtOptionsPageWidget::qtVersionsDumpUpdated(const FileName &qmakeCommand)
{ {
auto recheck = [qmakeCommand](Utils::TreeItem *parent) { auto recheck = [qmakeCommand](Utils::TreeItem *parent) {
@@ -439,16 +363,13 @@ void QtOptionsPageWidget::qtVersionsDumpUpdated(const FileName &qmakeCommand)
&& currentVersion()->qmakeCommand() == qmakeCommand) { && currentVersion()->qmakeCommand() == qmakeCommand) {
updateWidgets(); updateWidgets();
updateDescriptionLabel(); updateDescriptionLabel();
updateDebuggingHelperUi();
} }
} }
void QtOptionsPageWidget::setInfoWidgetVisibility() void QtOptionsPageWidget::setInfoWidgetVisibility()
{ {
m_ui->versionInfoWidget->setVisible((m_ui->infoWidget->state() == DetailsWidget::Collapsed) m_ui->versionInfoWidget->setVisible(m_ui->infoWidget->state() == DetailsWidget::Collapsed);
&& (m_ui->debuggingHelperWidget->state() == DetailsWidget::Collapsed)); m_ui->infoWidget->setVisible(true);
m_ui->infoWidget->setVisible(m_ui->debuggingHelperWidget->state() == DetailsWidget::Collapsed);
m_ui->debuggingHelperWidget->setVisible(m_ui->infoWidget->state() == DetailsWidget::Collapsed);
} }
void QtOptionsPageWidget::infoAnchorClicked(const QUrl &url) void QtOptionsPageWidget::infoAnchorClicked(const QUrl &url)
@@ -568,48 +489,6 @@ void QtOptionsPageWidget::updateVersionItem(QtVersionItem *item)
item->setIcon(info.icon); item->setIcon(info.icon);
} }
void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools tools)
{
QtVersionItem *item = currentItem();
if (!item)
return;
if (!item->version())
return;
// remove tools that cannot be build
tools &= DebuggingHelperBuildTask::availableTools(currentVersion());
DebuggingHelperBuildTask::Tools buildFlags = item->buildFlags();
buildFlags |= tools;
item->setBuildFlags(buildFlags);
updateDebuggingHelperUi();
// Run a debugging helper build task in the background.
QByteArray toolChainId = m_debuggingHelperUi->toolChainComboBox->itemData(
m_debuggingHelperUi->toolChainComboBox->currentIndex()).toByteArray();
ToolChain *toolChain = ToolChainManager::findToolChain(toolChainId);
if (!toolChain)
return;
DebuggingHelperBuildTask *buildTask = new DebuggingHelperBuildTask(item->version(), toolChain, tools);
// Don't open General Messages pane with errors
buildTask->showOutputOnError(false);
connect(buildTask, SIGNAL(finished(int,QString,DebuggingHelperBuildTask::Tools)),
this, SLOT(debuggingHelperBuildFinished(int,QString,DebuggingHelperBuildTask::Tools)),
Qt::QueuedConnection);
QFuture<void> task = QtConcurrent::run(&DebuggingHelperBuildTask::run, buildTask);
const QString taskName = tr("Building Helpers");
Core::ProgressManager::addTask(task, taskName, "QmakeProjectManager::BuildHelpers");
}
void QtOptionsPageWidget::buildQmlDump()
{
buildDebuggingHelper(DebuggingHelperBuildTask::QmlDump);
}
// Non-modal dialog // Non-modal dialog
class BuildLogDialog : public QDialog { class BuildLogDialog : public QDialog {
public: public:
@@ -633,12 +512,6 @@ void BuildLogDialog::setText(const QString &text)
m_ui.log->ensureCursorVisible(); m_ui.log->ensureCursorVisible();
} }
void QtOptionsPageWidget::slotShowDebuggingBuildLog()
{
if (const QtVersionItem *item = currentItem())
showDebuggingBuildLog(item);
}
void QtOptionsPageWidget::showDebuggingBuildLog(const QtVersionItem *item) void QtOptionsPageWidget::showDebuggingBuildLog(const QtVersionItem *item)
{ {
BaseQtVersion *version = item->version(); BaseQtVersion *version = item->version();
@@ -709,7 +582,6 @@ QtOptionsPageWidget::~QtOptionsPageWidget()
{ {
delete m_ui; delete m_ui;
delete m_versionUi; delete m_versionUi;
delete m_debuggingHelperUi;
delete m_configurationWidget; delete m_configurationWidget;
} }
@@ -826,98 +698,6 @@ void QtOptionsPageWidget::editPath()
delete current; delete current;
} }
void QtOptionsPageWidget::updateDebuggingHelperUi()
{
BaseQtVersion *version = currentVersion();
const QtVersionItem *item = currentItem();
QList<ToolChain*> toolchains = toolChains(currentVersion());
if (!version || !version->isValid() || toolchains.isEmpty()) {
m_ui->debuggingHelperWidget->setVisible(false);
} else {
const DebuggingHelperBuildTask::Tools availableTools = DebuggingHelperBuildTask::availableTools(version);
const bool canBuildQmlDumper = availableTools & DebuggingHelperBuildTask::QmlDump;
const bool hasQmlDumper = version->hasQmlDump();
const bool needsQmlDumper = version->needsQmlDump();
bool isBuildingQmlDumper = false;
if (item) {
DebuggingHelperBuildTask::Tools buildingTools = item->buildFlags();
isBuildingQmlDumper = buildingTools & DebuggingHelperBuildTask::QmlDump;
}
// get names of tools from labels
QStringList helperNames;
const QChar colon = QLatin1Char(':');
if (hasQmlDumper)
helperNames << m_debuggingHelperUi->qmlDumpLabel->text().remove(colon);
QString status;
if (helperNames.isEmpty()) {
status = tr("Helpers: None available");
} else {
//: %1 is list of tool names.
status = tr("Helpers: %1.").arg(helperNames.join(QLatin1String(", ")));
}
m_ui->debuggingHelperWidget->setSummaryText(status);
QString qmlDumpStatusText, qmlDumpStatusToolTip;
Qt::TextInteractionFlags qmlDumpStatusTextFlags = Qt::NoTextInteraction;
if (hasQmlDumper) {
qmlDumpStatusText = QDir::toNativeSeparators(version->qmlDumpTool(false));
const QString debugQmlDumpPath = QDir::toNativeSeparators(version->qmlDumpTool(true));
if (qmlDumpStatusText != debugQmlDumpPath) {
if (!qmlDumpStatusText.isEmpty()
&& !debugQmlDumpPath.isEmpty())
qmlDumpStatusText += QLatin1String("\n");
qmlDumpStatusText += debugQmlDumpPath;
}
qmlDumpStatusTextFlags = Qt::TextSelectableByMouse;
} else {
if (!needsQmlDumper) {
qmlDumpStatusText = tr("<i>Not needed.</i>");
} else if (canBuildQmlDumper) {
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);
QList<ToolChain*> toolchains = toolChains(currentVersion());
QByteArray selectedToolChainId = item->toolChainId();
m_debuggingHelperUi->toolChainComboBox->clear();
for (int i = 0; i < toolchains.size(); ++i) {
if (!toolchains.at(i)->isValid())
continue;
if (i >= m_debuggingHelperUi->toolChainComboBox->count()) {
m_debuggingHelperUi->toolChainComboBox->insertItem(i, toolchains.at(i)->displayName(),
toolchains.at(i)->id());
}
if (toolchains.at(i)->id() == selectedToolChainId)
m_debuggingHelperUi->toolChainComboBox->setCurrentIndex(i);
}
const bool hasLog = item && !item->buildLog().isEmpty();
m_debuggingHelperUi->showLogButton->setEnabled(hasLog);
const bool canBuild = canBuildQmlDumper;
const bool isBuilding = isBuildingQmlDumper;
m_debuggingHelperUi->rebuildButton->setEnabled(canBuild && !isBuilding);
m_debuggingHelperUi->toolChainComboBox->setEnabled(canBuild && !isBuilding);
setInfoWidgetVisibility();
}
}
// To be called if a Qt version was removed or added // To be called if a Qt version was removed or added
void QtOptionsPageWidget::updateCleanUpButton() void QtOptionsPageWidget::updateCleanUpButton()
{ {
@@ -937,13 +717,11 @@ void QtOptionsPageWidget::userChangedCurrentVersion()
{ {
updateWidgets(); updateWidgets();
updateDescriptionLabel(); updateDescriptionLabel();
updateDebuggingHelperUi();
} }
void QtOptionsPageWidget::qtVersionChanged() void QtOptionsPageWidget::qtVersionChanged()
{ {
updateDescriptionLabel(); updateDescriptionLabel();
updateDebuggingHelperUi();
} }
void QtOptionsPageWidget::updateDescriptionLabel() void QtOptionsPageWidget::updateDescriptionLabel()
@@ -969,7 +747,6 @@ void QtOptionsPageWidget::updateDescriptionLabel()
m_infoBrowser->clear(); m_infoBrowser->clear();
m_ui->versionInfoWidget->setVisible(false); m_ui->versionInfoWidget->setVisible(false);
m_ui->infoWidget->setVisible(false); m_ui->infoWidget->setVisible(false);
m_ui->debuggingHelperWidget->setVisible(false);
} }
} }

View File

@@ -26,8 +26,8 @@
#ifndef QTOPTIONSPAGE_H #ifndef QTOPTIONSPAGE_H
#define QTOPTIONSPAGE_H #define QTOPTIONSPAGE_H
#include "debugginghelperbuildtask.h"
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <utils/fileutils.h>
#include <QIcon> #include <QIcon>
#include <QPointer> #include <QPointer>
@@ -56,7 +56,6 @@ class QtVersionItem;
namespace Ui { namespace Ui {
class QtVersionManager; class QtVersionManager;
class QtVersionInfo; class QtVersionInfo;
class DebuggingHelper;
} }
class QtOptionsPageWidget : public QWidget class QtOptionsPageWidget : public QWidget
@@ -73,7 +72,6 @@ private:
void updateDescriptionLabel(); void updateDescriptionLabel();
void userChangedCurrentVersion(); void userChangedCurrentVersion();
void updateWidgets(); void updateWidgets();
void updateDebuggingHelperUi();
BaseQtVersion *currentVersion() const; BaseQtVersion *currentVersion() const;
QtVersionItem *currentItem() const; QtVersionItem *currentItem() const;
void showDebuggingBuildLog(const QtVersionItem *item); void showDebuggingBuildLog(const QtVersionItem *item);
@@ -82,7 +80,6 @@ private:
Internal::Ui::QtVersionManager *m_ui; Internal::Ui::QtVersionManager *m_ui;
Internal::Ui::QtVersionInfo *m_versionUi; Internal::Ui::QtVersionInfo *m_versionUi;
Internal::Ui::DebuggingHelper *m_debuggingHelperUi;
QTextBrowser *m_infoBrowser; QTextBrowser *m_infoBrowser;
int m_defaultVersion; int m_defaultVersion;
QIcon m_invalidVersionIcon; QIcon m_invalidVersionIcon;
@@ -99,15 +96,9 @@ private slots:
void editPath(); void editPath();
void updateCleanUpButton(); void updateCleanUpButton();
void updateCurrentQtName(); void updateCurrentQtName();
void buildDebuggingHelper(DebuggingHelperBuildTask::Tools tools
= DebuggingHelperBuildTask::AllTools);
void buildQmlDump();
void slotShowDebuggingBuildLog();
void debuggingHelperBuildFinished(int qtVersionId, const QString &output,
DebuggingHelperBuildTask::Tools tools);
void cleanUpQtVersions(); void cleanUpQtVersions();
void toolChainsUpdated(); void toolChainsUpdated();
void selectedToolChainChanged(int index);
void qtVersionsDumpUpdated(const Utils::FileName &qmakeCommand); void qtVersionsDumpUpdated(const Utils::FileName &qmakeCommand);
void setInfoWidgetVisibility(); void setInfoWidgetVisibility();

View File

@@ -24,7 +24,6 @@ HEADERS += \
qtoptionspage.h \ qtoptionspage.h \
customexecutablerunconfiguration.h \ customexecutablerunconfiguration.h \
customexecutableconfigurationwidget.h \ customexecutableconfigurationwidget.h \
debugginghelperbuildtask.h \
qtsupportconstants.h \ qtsupportconstants.h \
profilereader.h \ profilereader.h \
qtparser.h \ qtparser.h \
@@ -53,7 +52,6 @@ SOURCES += \
qtoptionspage.cpp \ qtoptionspage.cpp \
customexecutablerunconfiguration.cpp \ customexecutablerunconfiguration.cpp \
customexecutableconfigurationwidget.cpp \ customexecutableconfigurationwidget.cpp \
debugginghelperbuildtask.cpp \
profilereader.cpp \ profilereader.cpp \
qtparser.cpp \ qtparser.cpp \
exampleslistmodel.cpp \ exampleslistmodel.cpp \
@@ -68,7 +66,6 @@ FORMS += \
codegensettingspagewidget.ui \ codegensettingspagewidget.ui \
showbuildlog.ui \ showbuildlog.ui \
qtversioninfo.ui \ qtversioninfo.ui \
debugginghelper.ui \
qtversionmanager.ui \ qtversionmanager.ui \
RESOURCES += \ RESOURCES += \

View File

@@ -69,9 +69,6 @@ QtcPlugin {
"customexecutableconfigurationwidget.h", "customexecutableconfigurationwidget.h",
"customexecutablerunconfiguration.cpp", "customexecutablerunconfiguration.cpp",
"customexecutablerunconfiguration.h", "customexecutablerunconfiguration.h",
"debugginghelper.ui",
"debugginghelperbuildtask.cpp",
"debugginghelperbuildtask.h",
"exampleslistmodel.cpp", "exampleslistmodel.cpp",
"exampleslistmodel.h", "exampleslistmodel.h",
"profilereader.cpp", "profilereader.cpp",

View File

@@ -26,9 +26,6 @@
<item> <item>
<widget class="Utils::DetailsWidget" name="infoWidget" native="true"/> <widget class="Utils::DetailsWidget" name="infoWidget" native="true"/>
</item> </item>
<item>
<widget class="Utils::DetailsWidget" name="debuggingHelperWidget" native="true"/>
</item>
</layout> </layout>
</item> </item>
<item> <item>