QmlJSDebug: Move qmljsdebug into a static library

Reviewed-by: dt
This commit is contained in:
Kai Koehne
2011-01-12 16:24:00 +01:00
parent 45187a15a7
commit 3fef120d59
30 changed files with 750 additions and 176 deletions

View File

@@ -43,7 +43,7 @@
# define QMLJSDEBUGGER_EXPORT
# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT
# else
# define QMLJSDEBUGGER_EXPORT Q_DECL_IMPORT
# define QMLJSDEBUGGER_EXPORT
# define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT
#endif

View File

@@ -1,67 +1,6 @@
# This file is part of Qt Creator
# It enables debugging of Qt Quick applications
QT += declarative script
QT += declarative
INCLUDEPATH += $$PWD/include
DEPENDPATH += $$PWD $$PWD/include editor $$PWD/qt-private
contains(CONFIG, dll) {
DEFINES += BUILD_QMLJSDEBUGGER_LIB
} else {
DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB
}
!contains(DEFINES, NO_JSDEBUGGER) {
HEADERS += \
include/jsdebuggeragent.h \
include/qmljsdebugger_global.h
SOURCES += \
jsdebuggeragent.cpp
}
!contains(DEFINES, NO_QMLOBSERVER) {
HEADERS += \
include/qdeclarativeviewobserver.h \
include/qdeclarativeobserverservice.h \
include/qmlobserverconstants.h \
editor/abstractliveedittool.h \
editor/liveselectiontool.h \
editor/livelayeritem.h \
editor/livesingleselectionmanipulator.h \
editor/liverubberbandselectionmanipulator.h \
editor/liveselectionrectangle.h \
editor/liveselectionindicator.h \
editor/boundingrecthighlighter.h \
editor/subcomponenteditortool.h \
editor/subcomponentmasklayeritem.h \
editor/zoomtool.h \
editor/colorpickertool.h \
editor/qmltoolbar.h \
editor/toolbarcolorbox.h \
qdeclarativeviewobserver_p.h
SOURCES += \
qdeclarativeviewobserver.cpp \
qdeclarativeobserverservice.cpp \
editor/abstractliveedittool.cpp \
editor/liveselectiontool.cpp \
editor/livelayeritem.cpp \
editor/livesingleselectionmanipulator.cpp \
editor/liverubberbandselectionmanipulator.cpp \
editor/liveselectionrectangle.cpp \
editor/liveselectionindicator.cpp \
editor/boundingrecthighlighter.cpp \
editor/subcomponenteditortool.cpp \
editor/subcomponentmasklayeritem.cpp \
editor/zoomtool.cpp \
editor/colorpickertool.cpp \
editor/qmltoolbar.cpp \
editor/toolbarcolorbox.cpp
RESOURCES += editor/editor.qrc
}
OTHER_FILES += qmljsdebugger.pri
LIBS += -L$$PWD -lQmlJSDebugger

View File

@@ -2,10 +2,67 @@
# It enables debugging of Qt Quick applications
TEMPLATE = lib
CONFIG+=dll
TARGET = QmlJSDebugger
CONFIG += staticlib
QT += declarative script
INCLUDEPATH += $$PWD/include
DEPENDPATH += $$PWD $$PWD/include editor $$PWD/qt-private
DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB
unix:QMAKE_CXXFLAGS_DEBUG += -O3
include(../../../../src/qtcreatorlibrary.pri)
include(qmljsdebugger-lib.pri)
DESTDIR = $$PWD
TARGET=qmljsdebugger
CONFIG(debug, debug|release) {
windows:TARGET=qmljsdebuggerd
}
# JS Debugging
HEADERS += \
include/jsdebuggeragent.h \
include/qmljsdebugger_global.h
SOURCES += \
jsdebuggeragent.cpp
HEADERS += \
include/qdeclarativeviewobserver.h \
include/qdeclarativeobserverservice.h \
include/qmlobserverconstants.h \
editor/abstractliveedittool.h \
editor/liveselectiontool.h \
editor/livelayeritem.h \
editor/livesingleselectionmanipulator.h \
editor/liverubberbandselectionmanipulator.h \
editor/liveselectionrectangle.h \
editor/liveselectionindicator.h \
editor/boundingrecthighlighter.h \
editor/subcomponenteditortool.h \
editor/subcomponentmasklayeritem.h \
editor/zoomtool.h \
editor/colorpickertool.h \
editor/qmltoolbar.h \
editor/toolbarcolorbox.h \
qdeclarativeviewobserver_p.h
SOURCES += \
qdeclarativeviewobserver.cpp \
qdeclarativeobserverservice.cpp \
editor/abstractliveedittool.cpp \
editor/liveselectiontool.cpp \
editor/livelayeritem.cpp \
editor/livesingleselectionmanipulator.cpp \
editor/liverubberbandselectionmanipulator.cpp \
editor/liveselectionrectangle.cpp \
editor/liveselectionindicator.cpp \
editor/boundingrecthighlighter.cpp \
editor/subcomponenteditortool.cpp \
editor/subcomponentmasklayeritem.cpp \
editor/zoomtool.cpp \
editor/colorpickertool.cpp \
editor/qmltoolbar.cpp \
editor/toolbarcolorbox.cpp
RESOURCES += editor/editor.qrc
OTHER_FILES += qmljsdebugger.pri

View File

@@ -2,20 +2,17 @@ TEMPLATE = app
CONFIG += qt uic
### FIXME: only debug plugins are now supported.
CONFIG -= release
CONFIG += debug
include(qml.pri)
SOURCES += main.cpp
exists($$PWD/qmljsdebugger/qmljsdebugger-lib.pri) {
# for building helpers within QT_INSTALL_DATA, we deploy the lib inside the observer directory.
include($$PWD/qmljsdebugger/qmljsdebugger-lib.pri)
} else {
include($$PWD/../qmljsdebugger/qmljsdebugger-lib.pri)
# INCLUDEPATH and library path has to be extended by qmake call
DEBUGLIB=qmljsdebugger
CONFIG(debug, debug|release) {
windows:DEBUGLIB = qmljsdebuggerd
}
LIBS+=-l$$DEBUGLIB
#INCLUDEPATH += ../../include/QtDeclarative
#INCLUDEPATH += ../../src/declarative/util

View File

@@ -10,49 +10,9 @@ SOURCES += $$PWD/qmlapplicationviewer.cpp
HEADERS += $$PWD/qmlapplicationviewer.h
INCLUDEPATH += $$PWD
defineTest(minQtVersion) {
maj = $$1
min = $$2
patch = $$3
isEqual(QT_MAJOR_VERSION, $$maj) {
isEqual(QT_MINOR_VERSION, $$min) {
isEqual(QT_PATCH_VERSION, $$patch) {
return(true)
}
greaterThan(QT_PATCH_VERSION, $$patch) {
return(true)
}
}
greaterThan(QT_MINOR_VERSION, $$min) {
return(true)
}
}
return(false)
}
contains(DEFINES, QMLJSDEBUGGER) {
CONFIG(debug, debug|release) {
!minQtVersion(4, 7, 1) {
warning()
warning("Disabling QML debugging:")
warning()
warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.")
warning("This library requires Qt 4.7.1 or newer.")
warning()
DEFINES -= QMLJSDEBUGGER
} else:isEmpty(QMLJSDEBUGGER_PATH) {
warning()
warning("Disabling QML debugging:")
warning()
warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.")
warning("Please specify its location on the qmake command line, eg")
warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger")
warning()
DEFINES -= QMLJSDEBUGGER
} else {
include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
}
} else {
DEFINES -= QMLJSDEBUGGER
}
# Include JS debugger library if QMLJSDEBUGGER_PATH is set
!isEmpty(QMLJSDEBUGGER_PATH) {
include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
} else {
DEFINES -= QMLJSDEBUGGER
}

View File

@@ -255,7 +255,8 @@ bool BuildableHelperLibrary::buildHelper(const QString &helperName, const QStrin
const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
QString *output, QString *errorMessage)
const QStringList &qmakeArguments, QString *output,
QString *errorMessage)
{
const QChar newline = QLatin1Char('\n');
// Setup process
@@ -284,13 +285,14 @@ bool BuildableHelperLibrary::buildHelper(const QString &helperName, const QStrin
output->append(newline);
output->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", "Running %1 ...\n").arg(qmakeCommand));
QStringList qMakeArgs;
QStringList qmakeArgs;
if (!targetMode.isEmpty())
qMakeArgs << targetMode;
qmakeArgs << targetMode;
if (!mkspec.isEmpty())
qMakeArgs << QLatin1String("-spec") << mkspec;
qMakeArgs << proFilename;
if (!runBuildProcess(proc, qmakeCommand, qMakeArgs, 30000, false, output, errorMessage))
qmakeArgs << QLatin1String("-spec") << mkspec;
qmakeArgs << proFilename;
qmakeArgs << qmakeArguments;
if (!runBuildProcess(proc, qmakeCommand, qmakeArgs, 30000, false, output, errorMessage))
return false;
output->append(newline);
if (makeFullPath.isEmpty()) {

View File

@@ -70,7 +70,8 @@ public:
const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
QString *output, QString *errorMessage);
const QStringList &qmakeArguments, QString *output,
QString *errorMessage);
static bool getHelperFileInfoFor(const QStringList &validBinaryFilenames,
const QString &directory, QFileInfo* info);

View File

@@ -58,6 +58,8 @@ DebuggerLanguageChooser::DebuggerLanguageChooser(QWidget *parent) :
m_debugServerPortLabel->setBuddy(m_debugServerPort);
m_qmlDebuggerInfoLabel = new QLabel(tr("<a href=\"qthelp://com.nokia.qtcreator/doc/creator-qml-debugging.html\">What are the prerequisites?</a>"));
connect(m_useQmlDebugger, SIGNAL(toggled(bool)), m_debugServerPort, SLOT(setEnabled(bool)));
connect(m_useQmlDebugger, SIGNAL(toggled(bool)), m_debugServerPortLabel, SLOT(setEnabled(bool)));
connect(m_debugServerPort, SIGNAL(valueChanged(int)), this, SLOT(onDebugServerPortChanged(int)));
@@ -67,6 +69,7 @@ DebuggerLanguageChooser::DebuggerLanguageChooser(QWidget *parent) :
qmlLayout->addWidget(m_useQmlDebugger);
qmlLayout->addWidget(m_debugServerPortLabel);
qmlLayout->addWidget(m_debugServerPort);
qmlLayout->addWidget(m_qmlDebuggerInfoLabel);
qmlLayout->addStretch();
QVBoxLayout *layout = new QVBoxLayout;

View File

@@ -73,6 +73,7 @@ private:
QCheckBox *m_useQmlDebugger;
QSpinBox *m_debugServerPort;
QLabel *m_debugServerPortLabel;
QLabel *m_qmlDebuggerInfoLabel;
};
} // namespace Utils

View File

@@ -125,9 +125,10 @@ QString DebuggingHelperLibrary::copy(const QString &qtInstallData,
bool DebuggingHelperLibrary::build(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
QString *output, QString *errorMessage)
const QStringList &qmakeArguments, QString *output,
QString *errorMessage)
{
return buildHelper(QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
"GDB helper"), QLatin1String("gdbmacros.pro"), directory,
makeCommand, qmakeCommand, mkspec, env, targetMode, output, errorMessage);
makeCommand, qmakeCommand, mkspec, env, targetMode, qmakeArguments, output, errorMessage);
}

View File

@@ -54,7 +54,7 @@ public:
static bool build(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
QString *output, QString *errorMessage);
const QStringList &qmakeArguments, QString *output, QString *errorMessage);
// Copy the source files to a target location and return the chosen target location.
static QString copy(const QString &qtInstallData, QString *errorMessage);

View File

@@ -68,7 +68,7 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="qmlObserverLabel">
<property name="toolTip">
<string>A modified version of qmlviewer with support for QML/JS debugging.</string>
@@ -78,14 +78,14 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QLabel" name="qmlObserverStatus">
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="3" column="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -112,13 +112,47 @@
</property>
</widget>
</item>
<item row="2" column="4">
<item row="3" column="4">
<widget class="QPushButton" name="qmlObserverBuildButton">
<property name="text">
<string>Build</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="qmlDebuggingLibLabel">
<property name="text">
<string>Qml Debugging Library:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="qmlDebuggingLibStatus">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_5">
<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 row="2" column="4">
<widget class="QPushButton" name="qmlDebuggingLibBuildButton">
<property name="text">
<string>Build</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@@ -34,6 +34,7 @@
#include "debugginghelperbuildtask.h"
#include "qmldumptool.h"
#include "qmlobservertool.h"
#include "qmldebugginglibrary.h"
#include <projectexplorer/debugginghelper.h>
#include <QtCore/QCoreApplication>
@@ -97,14 +98,25 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(QtVersion *version, Tools too
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
}
}
}
@@ -143,7 +155,7 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu
return false;
if (!DebuggingHelperLibrary::build(gdbHelperDirectory, m_makeCommand,
m_qmakeCommand, m_mkspec, m_environment,
m_target, output, &m_errorMessage))
m_target, QStringList(), output, &m_errorMessage))
return false;
}
future.setProgressValue(2);
@@ -153,20 +165,37 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu
if (qmlDumpToolDirectory.isEmpty())
return false;
if (!QmlDumpTool::build(qmlDumpToolDirectory, m_makeCommand, m_qmakeCommand, m_mkspec,
m_environment, m_target, output, &m_errorMessage))
m_environment, m_target, QStringList(), output, &m_errorMessage))
return false;
}
future.setProgressValue(3);
QString qmlDebuggingDirectory;
if (m_tools & QmlDebugging) {
qmlDebuggingDirectory = QmlDebuggingLibrary::copy(m_qtInstallData, &m_errorMessage);
if (qmlDebuggingDirectory.isEmpty())
return false;
if (!QmlDebuggingLibrary::build(qmlDebuggingDirectory, m_makeCommand,
m_qmakeCommand, m_mkspec, m_environment,
m_target, QStringList(), output, &m_errorMessage))
return false;
}
future.setProgressValue(4);
if (m_tools & QmlObserver) {
const QString qmlObserverDirectory = QmlObserverTool::copy(m_qtInstallData,
&m_errorMessage);
if (qmlObserverDirectory.isEmpty())
return false;
QStringList qmakeArgs;
qmakeArgs << QLatin1String("INCLUDEPATH+=") + qmlDebuggingDirectory + "/include";
qmakeArgs << QLatin1String("LIBS+=-L") + qmlDebuggingDirectory;
if (!QmlObserverTool::build(qmlObserverDirectory, m_makeCommand, m_qmakeCommand, m_mkspec,
m_environment, m_target, output, &m_errorMessage))
m_environment, m_target, qmakeArgs, output, &m_errorMessage))
return false;
}
future.setProgressValue(4);
future.setProgressValue(5);
return true;
}

View File

@@ -47,9 +47,10 @@ class DebuggingHelperBuildTask : public QObject {
public:
enum DebuggingHelper {
GdbDebugging = 0x01,
QmlObserver = 0x02,
QmlDump = 0x04,
AllTools = GdbDebugging | QmlObserver | QmlDump
QmlDebugging = 0x02,
QmlObserver = 0x04,
QmlDump = 0x08,
AllTools = GdbDebugging | QmlDebugging | QmlObserver | QmlDump
};
Q_DECLARE_FLAGS(Tools, DebuggingHelper)

View File

@@ -42,15 +42,19 @@
#include "qt4projectmanager.h"
#include "qt4target.h"
#include "qtversionmanager.h"
#include "debugginghelperbuildtask.h"
#include <projectexplorer/buildsteplist.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <qtconcurrent/runextensions.h>
#include <QtCore/QtConcurrentRun>
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
@@ -61,18 +65,21 @@ const char * const QMAKE_BS_ID("QtProjectManager.QMakeBuildStep");
const char * const QMAKE_ARGUMENTS_KEY("QtProjectManager.QMakeBuildStep.QMakeArguments");
const char * const QMAKE_FORCED_KEY("QtProjectManager.QMakeBuildStep.QMakeForced");
const char * const QMAKE_QMLDEBUGLIB_KEY("QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary");
}
QMakeStep::QMakeStep(BuildStepList *bsl) :
AbstractProcessStep(bsl, QLatin1String(QMAKE_BS_ID)),
m_forced(false)
m_forced(false),
m_linkQmlDebuggingLibrary(false)
{
ctor();
}
QMakeStep::QMakeStep(BuildStepList *bsl, const QString &id) :
AbstractProcessStep(bsl, id),
m_forced(false)
m_forced(false),
m_linkQmlDebuggingLibrary(false)
{
ctor();
}
@@ -80,7 +87,8 @@ QMakeStep::QMakeStep(BuildStepList *bsl, const QString &id) :
QMakeStep::QMakeStep(BuildStepList *bsl, QMakeStep *bs) :
AbstractProcessStep(bsl, bs),
m_forced(bs->m_forced),
m_userArgs(bs->m_userArgs)
m_userArgs(bs->m_userArgs),
m_linkQmlDebuggingLibrary(bs->m_linkQmlDebuggingLibrary)
{
ctor();
}
@@ -166,9 +174,15 @@ QStringList QMakeStep::moreArguments()
<< QLatin1String("RCC_DIR=rcc");
}
// Do not turn debugger path into native path separators: Qmake does not like that!
arguments << QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH) + QLatin1Char('=') +
Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger");
if (m_linkQmlDebuggingLibrary
&& !bc->qtVersion()->qmlDebuggingHelperLibrary(true).isEmpty()) {
// Do not turn debugger path into native path separators: Qmake does not like that!
const QString debuggingHelperPath
= QFileInfo(bc->qtVersion()->qmlDebuggingHelperLibrary(true)).dir().path();
arguments << QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)
+ QLatin1Char('=') + debuggingHelperPath;
}
return arguments;
}
@@ -313,6 +327,57 @@ void QMakeStep::setUserArguments(const QString &arguments)
qt4BuildConfiguration()->emitProFileEvaluteNeeded();
}
bool QMakeStep::isQmlDebuggingLibrarySupported(QString *reason) const
{
if (qt4BuildConfiguration()->qtVersion()->hasQmlDebuggingLibrary())
return true;
int major, minor, patch;
if (!qt4BuildConfiguration()->qtVersion()->versionNumbers(&major, &minor, &patch)) {
if (reason)
*reason = tr("Invalid Qt version.");
return false;
}
// only support 4.7.1 onwards
bool compatibleQt = false;
if (major == 4) {
if (minor == 7) {
if (patch >= 1)
compatibleQt = true;
} else if (minor > 7)
compatibleQt = true;
}
if (!compatibleQt) {
if (reason)
*reason = tr("Requires Qt 4.7.1 or newer.");
return false;
}
if (reason)
*reason = tr("Library not available. <a href='compile'>Compile...</a>.");
return false;
}
bool QMakeStep::linkQmlDebuggingLibrary() const
{
return m_linkQmlDebuggingLibrary;
}
void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
{
if (m_linkQmlDebuggingLibrary == enable)
return;
m_linkQmlDebuggingLibrary = enable;
emit linkQmlDebuggingLibraryChanged();
qt4BuildConfiguration()->emitQMakeBuildConfigurationChanged();
qt4BuildConfiguration()->emitProFileEvaluteNeeded();
}
QStringList QMakeStep::parserArguments()
{
QStringList result;
@@ -342,6 +407,7 @@ QVariantMap QMakeStep::toMap() const
{
QVariantMap map(AbstractProcessStep::toMap());
map.insert(QLatin1String(QMAKE_ARGUMENTS_KEY), m_userArgs);
map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary);
map.insert(QLatin1String(QMAKE_FORCED_KEY), m_forced);
return map;
}
@@ -350,6 +416,7 @@ bool QMakeStep::fromMap(const QVariantMap &map)
{
m_userArgs = map.value(QLatin1String(QMAKE_ARGUMENTS_KEY)).toString();
m_forced = map.value(QLatin1String(QMAKE_FORCED_KEY), false).toBool();
m_linkQmlDebuggingLibrary = map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool();
return BuildStep::fromMap(map);
}
@@ -365,8 +432,14 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
this, SLOT(qmakeArgumentsLineEdited()));
connect(m_ui.buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(buildConfigurationSelected()));
connect(m_ui.qmlDebuggingLibraryCheckBox, SIGNAL(toggled(bool)),
this, SLOT(linkQmlDebuggingLibraryChecked(bool)));
connect(m_ui.qmlDebuggingWarningText, SIGNAL(linkActivated(QString)),
this, SLOT(buildQmlDebuggingHelper()));
connect(step, SIGNAL(userArgumentsChanged()),
this, SLOT(userArgumentsChanged()));
connect(step, SIGNAL(linkQmlDebuggingLibraryChanged()),
this, SLOT(linkQmlDebuggingLibraryChanged()));
connect(step->qt4BuildConfiguration(), SIGNAL(qtVersionChanged()),
this, SLOT(qtVersionChanged()));
connect(step->qt4BuildConfiguration(), SIGNAL(qmakeBuildConfigurationChanged()),
@@ -376,11 +449,14 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
void QMakeStepConfigWidget::init()
{
m_ui.qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments());
m_ui.qmlDebuggingLibraryCheckBox->setEnabled(m_step->isQmlDebuggingLibrarySupported());
m_ui.qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
qmakeBuildConfigChanged();
updateSummaryLabel();
updateEffectiveQMakeCall();
updateQmlDebuggingWarningsLabel();
}
QString QMakeStepConfigWidget::summaryText() const
@@ -423,6 +499,18 @@ void QMakeStepConfigWidget::userArgumentsChanged()
updateEffectiveQMakeCall();
}
void QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged()
{
if (m_ignoreChange)
return;
m_ui.qmlDebuggingLibraryCheckBox->setEnabled(m_step->isQmlDebuggingLibrarySupported());
m_ui.qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
updateSummaryLabel();
updateEffectiveQMakeCall();
updateQmlDebuggingWarningsLabel();
}
void QMakeStepConfigWidget::qmakeArgumentsLineEdited()
{
m_ignoreChange = true;
@@ -459,6 +547,46 @@ void QMakeStepConfigWidget::buildConfigurationSelected()
updateEffectiveQMakeCall();
}
void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked)
{
if (m_ignoreChange)
return;
m_ignoreChange = true;
m_step->setLinkQmlDebuggingLibrary(checked);
m_ignoreChange = false;
updateSummaryLabel();
updateEffectiveQMakeCall();
updateQmlDebuggingWarningsLabel();
}
void QMakeStepConfigWidget::buildQmlDebuggingHelper()
{
QtVersion *version = m_step->qt4BuildConfiguration()->qtVersion();
DebuggingHelperBuildTask *buildTask = new DebuggingHelperBuildTask(version,
DebuggingHelperBuildTask::QmlDebugging);
connect(buildTask, SIGNAL(finished(int,DebuggingHelperBuildTask::Tools,QString)),
this, SLOT(debuggingHelperBuildFinished()),
Qt::QueuedConnection);
QFuture<void> task = QtConcurrent::run(&DebuggingHelperBuildTask::run, buildTask);
const QString taskName = tr("Building helpers");
Core::ICore::instance()->progressManager()->addTask(task, taskName,
QLatin1String("Qt4ProjectManager::BuildHelpers"));
}
void QMakeStepConfigWidget::debuggingHelperBuildFinished()
{
m_step->qt4BuildConfiguration()->qtVersion()->invalidateCache();
m_ui.qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
m_ui.qmlDebuggingLibraryCheckBox->setEnabled(m_step->isQmlDebuggingLibrarySupported());
updateSummaryLabel();
updateEffectiveQMakeCall();
updateQmlDebuggingWarningsLabel();
}
void QMakeStepConfigWidget::updateSummaryLabel()
{
Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();
@@ -478,6 +606,23 @@ void QMakeStepConfigWidget::updateSummaryLabel()
}
void QMakeStepConfigWidget::updateQmlDebuggingWarningsLabel()
{
QString reason;
m_ui.qmlDebuggingWarningText->clear();
if (!m_step->isQmlDebuggingLibrarySupported(&reason)) {
m_ui.qmlDebuggingWarningText->setText(reason);
}
if (m_step->linkQmlDebuggingLibrary()) {
if (m_step->isQmlDebuggingLibrarySupported()) {
m_ui.qmlDebuggingWarningText->setText("Might make your application vulnerable. Only use in a safe environment!");
}
}
m_ui.qmlDebuggingWarningIcon->setVisible(!m_ui.qmlDebuggingWarningText->text().isEmpty());
}
void QMakeStepConfigWidget::updateEffectiveQMakeCall()
{
Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();

View File

@@ -95,11 +95,15 @@ public:
QStringList parserArguments();
QString userArguments();
void setUserArguments(const QString &arguments);
bool linkQmlDebuggingLibrary() const;
void setLinkQmlDebuggingLibrary(bool enable);
bool isQmlDebuggingLibrarySupported(QString *reason = 0) const;
QVariantMap toMap() const;
signals:
void userArgumentsChanged();
void linkQmlDebuggingLibraryChanged();
protected:
QMakeStep(ProjectExplorer::BuildStepList *parent, QMakeStep *source);
@@ -117,6 +121,7 @@ private:
bool m_forced;
bool m_needToRunQMake; // set in init(), read in run()
QString m_userArgs;
bool m_linkQmlDebuggingLibrary;
bool m_scriptTemplate;
QList<ProjectExplorer::Task> m_tasks;
};
@@ -135,12 +140,20 @@ private slots:
void qtVersionChanged();
void qmakeBuildConfigChanged();
void userArgumentsChanged();
void linkQmlDebuggingLibraryChanged();
// slots for dealing with user changes in our UI
void qmakeArgumentsLineEdited();
void buildConfigurationSelected();
void linkQmlDebuggingLibraryChecked(bool checked);
// other
void buildQmlDebuggingHelper();
void debuggingHelperBuildFinished();
private:
void updateSummaryLabel();
void updateQmlDebuggingWarningsLabel();
void updateEffectiveQMakeCall();
Ui::QMakeStep m_ui;
QMakeStep *m_step;

View File

@@ -6,14 +6,11 @@
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>172</height>
<width>440</width>
<height>190</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
@@ -57,6 +54,56 @@
<widget class="QLineEdit" name="qmakeAdditonalArgumentsLineEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Link QML debugging library:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="qmlDebuggingLibraryCheckBox">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="qmlDebuggingWarningIcon">
<property name="pixmap">
<pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="qmlDebuggingWarningText">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Effective qmake call:</string>
@@ -66,7 +113,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QPlainTextEdit" name="qmakeArgumentsEdit">
<property name="enabled">
<bool>true</bool>
@@ -84,6 +131,8 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../projectexplorer/projectexplorer.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,156 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** No Commercial Usage
**
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#include "qmldebugginglibrary.h"
#include "qt4project.h"
#include "qt4projectmanagerconstants.h"
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <projectexplorer/project.h>
#include <QDesktopServices>
#include <QCoreApplication>
#include <QDir>
#include <QDebug>
namespace Qt4ProjectManager {
QString QmlDebuggingLibrary::libraryByInstallData(const QString &qtInstallData, bool debugBuild)
{
if (!Core::ICore::instance())
return QString();
const QString mainFilename = Core::ICore::instance()->resourcePath()
+ QLatin1String("/qml/qmljsdebugger/qmljsdebugger.pro");
const QStringList directories = installDirectories(qtInstallData);
QStringList binFilenames;
if (debugBuild) {
binFilenames << QLatin1String("qmljsdebuggerd.lib");
binFilenames << QLatin1String("libqmljsdebuggerd.a"); // mingw
} else {
binFilenames << QLatin1String("qmljsdebugger.lib");
}
binFilenames << QLatin1String("libqmljsdebugger.a");
return byInstallDataHelper(mainFilename, directories, binFilenames);
}
bool QmlDebuggingLibrary::canBuild(const QtVersion *qtVersion)
{
return checkMinimumQtVersion(qtVersion->qtVersionString(), 4, 7, 1);
}
bool QmlDebuggingLibrary::build(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
const QStringList &qmakeArguments, QString *output, QString *errorMessage)
{
return buildHelper(QCoreApplication::translate("Qt4ProjectManager::QmlDebuggingLibrary", "Qml Debugging"),
QLatin1String("qmljsdebugger.pro"),
directory, makeCommand, qmakeCommand, mkspec, env, targetMode,
qmakeArguments, output, errorMessage);
}
static inline bool mkpath(const QString &targetDirectory, QString *errorMessage)
{
if (!QDir().mkpath(targetDirectory)) {
*errorMessage = QCoreApplication::translate("Qt4ProjectManager::QmlDebuggingLibrary", "The target directory %1 could not be created.").arg(targetDirectory);
return false;
}
return true;
}
QString QmlDebuggingLibrary::copy(const QString &qtInstallData, QString *errorMessage)
{
const QStringList directories = QmlDebuggingLibrary::installDirectories(qtInstallData);
QString sourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger/");
QStringList qmljsDebuggerFiles = recursiveFileList(QDir(sourcePath));
// Try to find a writeable directory.
foreach (const QString &directory, directories) {
if (!mkpath(directory, errorMessage)) {
continue;
} else {
errorMessage->clear();
}
if (copyFiles(sourcePath, qmljsDebuggerFiles,
directory, errorMessage))
{
errorMessage->clear();
return directory;
}
}
*errorMessage = QCoreApplication::translate("Qt4ProjectManager::QmlDebuggingLibrary",
"Qml Debugging library could not be built in any of the directories:\n- %1\n\nReason: %2")
.arg(directories.join(QLatin1String("\n- ")), *errorMessage);
return QString();
}
QStringList QmlDebuggingLibrary::recursiveFileList(const QDir &dir, const QString &prefix)
{
QStringList files;
QString _prefix = prefix;
if (!_prefix.isEmpty() && !_prefix.endsWith('/')) {
_prefix = _prefix + '/';
}
foreach (const QString &fileName, dir.entryList(QDir::Files)) {
files << _prefix + fileName;
}
foreach (const QString &subDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
files += recursiveFileList(QDir(dir.absoluteFilePath(subDir)), _prefix + subDir);
}
return files;
}
QStringList QmlDebuggingLibrary::installDirectories(const QString &qtInstallData)
{
const QChar slash = QLatin1Char('/');
const uint hash = qHash(qtInstallData);
QStringList directories;
directories
<< (qtInstallData + QLatin1String("/qtc-qmldbg/"))
<< QDir::cleanPath((QCoreApplication::applicationDirPath() + QLatin1String("/../qtc-qmldbg/") + QString::number(hash))) + slash
<< (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/qtc-qmldbg/") + QString::number(hash)) + slash;
return directories;
}
} // namespace

View File

@@ -0,0 +1,74 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** No Commercial Usage
**
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef QMLDEBUGGINGLIBRARY_H
#define QMLDEBUGGINGLIBRARY_H
#include <utils/buildablehelperlibrary.h>
#include "qt4projectmanager_global.h"
QT_FORWARD_DECLARE_CLASS(QDir)
namespace Utils {
class Environment;
}
namespace ProjectExplorer {
class Project;
}
namespace Qt4ProjectManager {
class QtVersion;
class QmlDebuggingLibrary : public Utils::BuildableHelperLibrary
{
public:
static QString libraryByInstallData(const QString &qtInstallData, bool debugBuild);
static bool canBuild(const QtVersion *qtVersion);
static bool build(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
const QStringList &qmakeArguments, QString *output, QString *errorMessage);
static QString copy(const QString &qtInstallData, QString *errorMessage);
private:
static QStringList recursiveFileList(const QDir &dir, const QString &prefix = QString());
static QStringList installDirectories(const QString &qtInstallData);
};
} // namespace
#endif // QMLDEBUGGINGLIBRARY_H

View File

@@ -256,11 +256,11 @@ QStringList QmlDumpTool::locationsByInstallData(const QString &qtInstallData, bo
bool QmlDumpTool::build(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
QString *output, QString *errorMessage)
const QStringList &qmakeArguments, QString *output, QString *errorMessage)
{
return buildHelper(QCoreApplication::translate("Qt4ProjectManager::QmlDumpTool", "qmldump"), QLatin1String("qmldump.pro"),
directory, makeCommand, qmakeCommand, mkspec, env, targetMode,
output, errorMessage);
qmakeArguments, output, errorMessage);
}
QString QmlDumpTool::copy(const QString &qtInstallData, QString *errorMessage)

View File

@@ -60,7 +60,7 @@ public:
static bool build(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
QString *output, QString *errorMessage);
const QStringList &qmakeArguments, QString *output, QString *errorMessage);
// Copy the source files to a target location and return the chosen target location.
static QString copy(const QString &qtInstallData, QString *errorMessage);

View File

@@ -107,12 +107,13 @@ QStringList QmlObserverTool::locationsByInstallData(const QString &qtInstallData
bool QmlObserverTool::build(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
QString *output, QString *errorMessage)
const QStringList &qmakeArguments, QString *output,
QString *errorMessage)
{
return buildHelper(QCoreApplication::translate("Qt4ProjectManager::QmlObserverTool", "QMLObserver"),
QLatin1String("qmlobserver.pro"),
directory, makeCommand, qmakeCommand, mkspec, env, targetMode,
output, errorMessage);
qmakeArguments, output, errorMessage);
}
static inline bool mkpath(const QString &targetDirectory, QString *errorMessage)
@@ -129,10 +130,8 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag
const QStringList directories = QmlObserverTool::installDirectories(qtInstallData);
QString sourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmlobserver/");
QString libSourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger/");
QStringList observerFiles = recursiveFileList(QDir(sourcePath));
QStringList qmljsDebuggerFiles = recursiveFileList(QDir(libSourcePath));
// Try to find a writeable directory.
foreach(const QString &directory, directories) {
@@ -142,10 +141,7 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag
errorMessage->clear();
}
if (copyFiles(sourcePath, observerFiles, directory, errorMessage)
&& copyFiles(libSourcePath, qmljsDebuggerFiles,
directory + QLatin1String("/qmljsdebugger/"), errorMessage))
{
if (copyFiles(sourcePath, observerFiles, directory, errorMessage)) {
errorMessage->clear();
return directory;
}

View File

@@ -63,7 +63,7 @@ public:
static bool build(const QString &directory, const QString &makeCommand,
const QString &qmakeCommand, const QString &mkspec,
const Utils::Environment &env, const QString &targetMode,
QString *output, QString *errorMessage);
const QStringList &qmakeArguments, QString *output, QString *errorMessage);
// Copy the source files to a target location and return the chosen target location.
static QString copy(const QString &qtInstallData, QString *errorMessage);

View File

@@ -42,6 +42,7 @@
#include "qt4projectmanagerconstants.h"
#include "qtoutputformatter.h"
#include "qt4desktoptarget.h"
#include "qmakestep.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>

View File

@@ -563,7 +563,7 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
void Qt4BuildConfiguration::removeQMLInspectorFromArguments(QString *args)
{
for (Utils::QtcProcess::ArgIterator ait(args); ait.next(); )
if (ait.value().startsWith(QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)))
if (ait.value().contains(QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)))
ait.deleteArg();
}

View File

@@ -68,6 +68,7 @@ HEADERS += \
qt4projectmanager_global.h \
qmldumptool.h \
qmlobservertool.h \
qmldebugginglibrary.h \
profilecompletion.h \
profilekeywords.h \
debugginghelperbuildtask.h
@@ -132,6 +133,7 @@ SOURCES += qt4projectmanagerplugin.cpp \
findqt4profiles.cpp \
qmldumptool.cpp \
qmlobservertool.cpp \
qmldebugginglibrary.cpp \
profilecompletion.cpp \
profilekeywords.cpp \
debugginghelperbuildtask.cpp

View File

@@ -41,6 +41,7 @@
#include "qtversionmanager.h"
#include "qmldumptool.h"
#include "qmlobservertool.h"
#include "qmldebugginglibrary.h"
#include "debugginghelperbuildtask.h"
#include <projectexplorer/debugginghelper.h>
@@ -232,6 +233,8 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
this, SLOT(buildGdbHelper()));
connect(m_debuggingHelperUi->qmlDumpBuildButton, SIGNAL(clicked()),
this, SLOT(buildQmlDump()));
connect(m_debuggingHelperUi->qmlDebuggingLibBuildButton, SIGNAL(clicked()),
this, SLOT(buildQmlDebuggingLibrary()));
connect(m_debuggingHelperUi->qmlObserverBuildButton, SIGNAL(clicked()),
this, SLOT(buildQmlObserver()));
@@ -309,6 +312,8 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, Debuggin
bool success = true;
if (tools & DebuggingHelperBuildTask::GdbDebugging)
success &= qtVersion->hasDebuggingHelper();
if (tools & DebuggingHelperBuildTask::QmlDebugging)
success &= qtVersion->hasQmlDebuggingLibrary();
if (tools & DebuggingHelperBuildTask::QmlDump)
success &= qtVersion->hasQmlDump();
if (tools & DebuggingHelperBuildTask::QmlObserver)
@@ -363,9 +368,17 @@ void QtOptionsPageWidget::buildQmlDump()
buildDebuggingHelper(DebuggingHelperBuildTask::QmlDump);
}
void QtOptionsPageWidget::buildQmlDebuggingLibrary()
{
buildDebuggingHelper(DebuggingHelperBuildTask::QmlDebugging);
}
void QtOptionsPageWidget::buildQmlObserver()
{
buildDebuggingHelper(DebuggingHelperBuildTask::QmlObserver);
DebuggingHelperBuildTask::Tools qmlDbgTools =
DebuggingHelperBuildTask::QmlObserver
| DebuggingHelperBuildTask::QmlDebugging;
buildDebuggingHelper(qmlDbgTools);
}
// Non-modal dialog
@@ -445,9 +458,13 @@ void QtOptionsPageWidget::removeQtDir()
}
// Format html table tooltip about helpers
static inline QString msgHtmlHelperToolTip(const QString &gdbHelperPath, const QString &qmlDumpPath, const QString &qmlObserverPath)
static inline QString msgHtmlHelperToolTip(const QString &gdbHelperPath,
const QString &qmlJsDebugLibPath,
const QString &qmlDumpPath,
const QString &qmlObserverPath)
{
QFileInfo gdbHelperFI(gdbHelperPath);
QFileInfo qmlJsDebugLibFi(qmlJsDebugLibPath);
QFileInfo qmlDumpFI(qmlDumpPath);
QFileInfo qmlObserverFI(qmlObserverPath);
@@ -459,19 +476,26 @@ static inline QString msgHtmlHelperToolTip(const QString &gdbHelperPath, const Q
"<tr><td>File:</td><td><pre>%1</pre></td></tr>"
"<tr><td>Last&nbsp;modified:</td><td>%2</td></tr>"
"<tr><td>Size:</td><td>%3 Bytes</td></tr>"
"<tr><td colspan=\"2\"><b>QML type dumper</b></td></tr>"
"<tr><td colspan=\"2\"><b>QML debugging library</b></td></tr>"
"<tr><td>File:</td><td><pre>%4</pre></td></tr>"
"<tr><td>Last&nbsp;modified:</td><td>%5</td></tr>"
"<tr><td>Size:</td><td>%6 Bytes</td></tr>"
"<tr><td colspan=\"2\"><b>QML observer</b></td></tr>"
"<tr><td colspan=\"2\"><b>QML type dumper</b></td></tr>"
"<tr><td>File:</td><td><pre>%7</pre></td></tr>"
"<tr><td>Last&nbsp;modified:</td><td>%8</td></tr>"
"<tr><td>Size:</td><td>%9 Bytes</td></tr>"
"<tr><td colspan=\"2\"><b>QML observer</b></td></tr>"
"<tr><td>File:</td><td><pre>%10</pre></td></tr>"
"<tr><td>Last&nbsp;modified:</td><td>%11</td></tr>"
"<tr><td>Size:</td><td>%12 Bytes</td></tr>"
"</table></body></html>"
).
arg(gdbHelperPath.isEmpty() ? notFound : QDir::toNativeSeparators(gdbHelperFI.absoluteFilePath())).
arg(gdbHelperFI.lastModified().toString(Qt::SystemLocaleLongDate)).
arg(gdbHelperFI.size()).
arg(qmlJsDebugLibPath.isEmpty() ? notFound : QDir::toNativeSeparators(qmlJsDebugLibFi.absoluteFilePath())).
arg(qmlJsDebugLibFi.lastModified().toString(Qt::SystemLocaleLongDate)).
arg(qmlJsDebugLibFi.size()).
arg(qmlDumpPath.isEmpty() ? notFound : QDir::toNativeSeparators(qmlDumpFI.absoluteFilePath())).
arg(qmlDumpFI.lastModified().toString(Qt::SystemLocaleLongDate)).
arg(qmlDumpFI.size()).
@@ -489,14 +513,17 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
m_ui->debuggingHelperWidget->setVisible(false);
} else {
bool canBuildQmlDumper = QmlDumpTool::canBuild(version);
bool canBuildQmlDebuggingLib = QmlDebuggingLibrary::canBuild(version);
bool canBuildQmlObserver = QmlObserverTool::canBuild(version);
bool hasGdbHelper = !version->debuggingHelperLibrary().isEmpty();
bool hasQmlDumper = version->hasQmlDump();
bool hasQmlDebuggingLib = version->hasQmlDebuggingLibrary();
bool hasQmlObserver = !version->qmlObserverTool().isEmpty();
bool isBuildingGdbHelper = false;
bool isBuildingQmlDumper = false;
bool isBuildingQmlDebuggingLib = false;
bool isBuildingQmlObserver = false;
if (currentItem) {
@@ -504,6 +531,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
= currentItem->data(0, BuildRunningRole).value<DebuggingHelperBuildTask::Tools>();
isBuildingGdbHelper = buildingTools & DebuggingHelperBuildTask::GdbDebugging;
isBuildingQmlDumper = buildingTools & DebuggingHelperBuildTask::QmlDump;
isBuildingQmlDebuggingLib = buildingTools & DebuggingHelperBuildTask::QmlDebugging;
isBuildingQmlObserver = buildingTools & DebuggingHelperBuildTask::QmlObserver;
}
@@ -513,6 +541,8 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
helperNames << m_debuggingHelperUi->gdbHelperLabel->text().remove(':');
if (hasQmlDumper)
helperNames << m_debuggingHelperUi->qmlDumpLabel->text().remove(':');
if (hasQmlDebuggingLib)
helperNames << m_debuggingHelperUi->qmlDebuggingLibLabel->text().remove(':');
if (hasQmlObserver)
helperNames << m_debuggingHelperUi->qmlObserverLabel->text().remove(':');
@@ -526,7 +556,6 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
m_ui->debuggingHelperWidget->setSummaryText(status);
// Set detailed labels
QString gdbHelperText;
Qt::TextInteractionFlags gdbHelperTextFlags = Qt::NoTextInteraction;
if (hasGdbHelper) {
@@ -545,7 +574,8 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
qmlDumpStatusText = QDir::toNativeSeparators(version->qmlDumpTool(false));
const QString debugQmlDumpPath = QDir::toNativeSeparators(version->qmlDumpTool(true));
if (qmlDumpStatusText != debugQmlDumpPath) {
if (!qmlDumpStatusText.isEmpty())
if (!qmlDumpStatusText.isEmpty()
&& !debugQmlDumpPath.isEmpty())
qmlDumpStatusText += QLatin1String("\n");
qmlDumpStatusText += debugQmlDumpPath;
}
@@ -561,6 +591,35 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
m_debuggingHelperUi->qmlDumpStatus->setTextInteractionFlags(qmlDumpStatusTextFlags);
m_debuggingHelperUi->qmlDumpBuildButton->setEnabled(canBuildQmlDumper & !isBuildingQmlDumper);
QString qmlDebuggingLibStatusText;
Qt::TextInteractionFlags qmlDebuggingLibStatusTextFlags = Qt::NoTextInteraction;
if (hasQmlDebuggingLib) {
qmlDebuggingLibStatusText = QDir::toNativeSeparators(
version->qmlDebuggingHelperLibrary(false));
const QString debugPath = QDir::toNativeSeparators(
version->qmlDebuggingHelperLibrary(true));
if (qmlDebuggingLibStatusText != debugPath) {
if (!qmlDebuggingLibStatusText.isEmpty()
&& !debugPath.isEmpty()) {
qmlDebuggingLibStatusText += QLatin1String("\n");
}
qmlDebuggingLibStatusText += debugPath;
}
qmlDebuggingLibStatusTextFlags = Qt::TextSelectableByMouse;
} else {
if (canBuildQmlDebuggingLib) {
qmlDebuggingLibStatusText = tr("<i>Not yet built.</i>");
} else {
qmlDebuggingLibStatusText = tr("<i>Cannot be compiled.</i>");
}
}
m_debuggingHelperUi->qmlDebuggingLibStatus->setText(qmlDebuggingLibStatusText);
m_debuggingHelperUi->qmlDebuggingLibStatus->setTextInteractionFlags(qmlDebuggingLibStatusTextFlags);
m_debuggingHelperUi->qmlDebuggingLibBuildButton->setEnabled(canBuildQmlDebuggingLib
&& !isBuildingQmlDebuggingLib);
QString qmlObserverStatusText;
Qt::TextInteractionFlags qmlObserverStatusTextFlags = Qt::NoTextInteraction;
if (hasQmlObserver) {
@@ -583,6 +642,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
m_debuggingHelperUi->rebuildButton->setEnabled(!isBuildingGdbHelper
&& !isBuildingQmlDumper
&& !isBuildingQmlDebuggingLib
&& !isBuildingQmlObserver);
m_ui->debuggingHelperWidget->setVisible(true);

View File

@@ -112,6 +112,7 @@ private slots:
= DebuggingHelperBuildTask::AllTools);
void buildGdbHelper();
void buildQmlDump();
void buildQmlDebuggingLibrary();
void buildQmlObserver();
void slotShowDebuggingBuildLog();
void debuggingHelperBuildFinished(int qtVersionId, DebuggingHelperBuildTask::Tools tools, const QString &output);

View File

@@ -46,6 +46,8 @@
#include "qmlobservertool.h"
#include "qmldumptool.h"
#include "qmldebugginglibrary.h"
#include <projectexplorer/debugginghelper.h>
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/projectexplorer.h>
@@ -547,6 +549,7 @@ QtVersion::QtVersion(const QString &name, const QString &qmakeCommand, int id,
m_autodetectionSource(autodetectionSource),
m_hasDebuggingHelper(false),
m_hasQmlDump(false),
m_hasQmlDebuggingLibrary(false),
m_hasQmlObserver(false),
m_toolChainUpToDate(false),
m_versionInfoUpToDate(false),
@@ -572,6 +575,7 @@ QtVersion::QtVersion(const QString &name, const QString &qmakeCommand,
m_autodetectionSource(autodetectionSource),
m_hasDebuggingHelper(false),
m_hasQmlDump(false),
m_hasQmlDebuggingLibrary(false),
m_hasQmlObserver(false),
m_toolChainUpToDate(false),
m_versionInfoUpToDate(false),
@@ -593,6 +597,7 @@ QtVersion::QtVersion(const QString &qmakeCommand, bool isAutodetected, const QSt
m_autodetectionSource(autodetectionSource),
m_hasDebuggingHelper(false),
m_hasQmlDump(false),
m_hasQmlDebuggingLibrary(false),
m_hasQmlObserver(false),
m_toolChainUpToDate(false),
m_versionInfoUpToDate(false),
@@ -614,6 +619,7 @@ QtVersion::QtVersion()
m_isAutodetected(false),
m_hasDebuggingHelper(false),
m_hasQmlDump(false),
m_hasQmlDebuggingLibrary(false),
m_hasQmlObserver(false),
m_toolChainUpToDate(false),
m_versionInfoUpToDate(false),
@@ -791,6 +797,28 @@ QString QtVersion::qtVersionString() const
return m_qtVersionString;
}
bool QtVersion::versionNumbers(int *majorNumber, int *minorNumber, int *patchNumber) const
{
const QString versionString = qtVersionString();
if (versionString.isEmpty())
return false;
// check format
static QRegExp qtVersionRegex(QLatin1String("^\\d+\\.\\d+\\.\\d+$"));
if (!qtVersionRegex.exactMatch(versionString))
return false;
QStringList parts = versionString.split(QLatin1Char('.'));
if (majorNumber)
*majorNumber = parts.at(0).toInt();
if (minorNumber)
*minorNumber = parts.at(1).toInt();
if (patchNumber)
*patchNumber = parts.at(2).toInt();
return true;
}
QHash<QString,QString> QtVersion::versionInfo() const
{
updateVersionInfo();
@@ -1148,6 +1176,7 @@ void QtVersion::updateVersionInfo() const
m_hasDocumentation = false;
m_hasDebuggingHelper = false;
m_hasQmlDump = false;
m_hasQmlDebuggingLibrary = false;
m_hasQmlObserver = false;
if (!queryQMakeVariables(qmakeCommand(), &m_versionInfo))
@@ -1160,6 +1189,9 @@ void QtVersion::updateVersionInfo() const
if (!qtInstallData.isEmpty()) {
m_hasDebuggingHelper = !DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(qtInstallData).isEmpty();
m_hasQmlDump = !QmlDumpTool::toolByInstallData(qtInstallData, false).isEmpty() || !QmlDumpTool::toolByInstallData(qtInstallData, true).isEmpty();
m_hasQmlDebuggingLibrary
= !QmlDebuggingLibrary::libraryByInstallData(qtInstallData, false).isEmpty()
|| !QmlDebuggingLibrary::libraryByInstallData(qtInstallData, true).isEmpty();
m_hasQmlObserver = !QmlObserverTool::toolByInstallData(qtInstallData).isEmpty();
}
}
@@ -1648,7 +1680,7 @@ QString QtVersion::invalidReason() const
return QCoreApplication::translate("QtVersion", "Qt version is not properly installed, please run make install");
if (!m_versionInfo.contains("QT_INSTALL_BINS"))
return QCoreApplication::translate("QtVersion",
"Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?");
"Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?");
if (m_toolChainUpToDate && m_mkspecFullPath.isEmpty())
return QCoreApplication::translate("QtVersion", "The default mkspec symlink is broken.");
return QString();
@@ -1699,12 +1731,19 @@ bool QtVersion::hasDebuggingHelper() const
return m_hasDebuggingHelper;
}
bool QtVersion::hasQmlDump() const
{
updateVersionInfo();
return m_hasQmlDump;
}
bool QtVersion::hasQmlDebuggingLibrary() const
{
updateVersionInfo();
return m_hasQmlDebuggingLibrary;
}
bool QtVersion::hasQmlObserver() const
{
updateVersionInfo();
@@ -1740,6 +1779,14 @@ QString QtVersion::qmlDumpTool(bool debugVersion) const
return QmlDumpTool::toolByInstallData(qtInstallData, debugVersion);
}
QString QtVersion::qmlDebuggingHelperLibrary(bool debugVersion) const
{
QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");
if (qtInstallData.isEmpty())
return QString();
return QmlDebuggingLibrary::libraryByInstallData(qtInstallData, debugVersion);
}
QString QtVersion::qmlObserverTool() const
{
QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");

View File

@@ -109,6 +109,8 @@ public:
void setQMakeCommand(const QString &path);
QString qtVersionString() const;
bool versionNumbers(int *majorNumber, int *minorNumber, int *patchNumber) const;
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
QHash<QString,QString> versionInfo() const;
@@ -129,12 +131,14 @@ public:
bool hasDebuggingHelper() const;
QString debuggingHelperLibrary() const;
QString qmlDebuggingHelperLibrary(bool debugVersion) const;
QString qmlDumpTool(bool debugVersion) const;
QString qmlObserverTool() const;
QStringList debuggingHelperLibraryLocations() const;
bool supportsBinaryDebuggingHelper() const;
bool hasQmlDump() const;
bool hasQmlDebuggingLibrary() const;
bool hasQmlObserver() const;
Utils::Environment qmlToolsEnvironment() const;
@@ -196,6 +200,7 @@ private:
QString m_autodetectionSource;
mutable bool m_hasDebuggingHelper; // controlled by m_versionInfoUpToDate
mutable bool m_hasQmlDump; // controlled by m_versionInfoUpToDate
mutable bool m_hasQmlDebuggingLibrary; // controlled by m_versionInfoUpdate
mutable bool m_hasQmlObserver; // controlled by m_versionInfoUpToDate
QString m_mwcDirectory;