aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2014-03-26 11:23:04 +0100
committerKai Koehne <kai.koehne@digia.com>2014-03-31 17:16:50 +0200
commit7ca474b2c81883c6a5ca8e8044ee4a45690f7152 (patch)
tree3ba1a98aa688020068cd8d4bfa94b525d2352f45
parent76afffe43a14f1cde3742f901f21459835380437 (diff)
Update debugger language aspect in run settings when qmake step changes
When QML language debugging hasn't been set to a fixed state yet by the user try to find a qmake step to decide whether to enable QML debugging by default or not. This is a hack, breaking the separation between qt build steps and debugger run settings. However, adding a generic project infrastructure for this specific use case is probably overkill... Task-number: QTCREATORBUG-11474 Change-Id: Ib65c8474b9b7ec187769c209531ff56bc8293cde Reviewed-by: Aurindam Jana <aurindam.jana@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
-rw-r--r--src/plugins/debugger/debuggerrunconfigurationaspect.cpp38
-rw-r--r--src/plugins/qmakeprojectmanager/qmakestep.h3
2 files changed, 37 insertions, 4 deletions
diff --git a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp
index b2be33ad5e..e00f459a37 100644
--- a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp
+++ b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp
@@ -39,6 +39,9 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/target.h>
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/buildstep.h>
+#include <projectexplorer/buildsteplist.h>
#include <QCheckBox>
#include <QSpinBox>
@@ -53,6 +56,8 @@ static const char USE_QML_DEBUGGER_AUTO_KEY[] = "RunConfiguration.UseQmlDebugger
static const char QML_DEBUG_SERVER_PORT_KEY[] = "RunConfiguration.QmlDebugServerPort";
static const char USE_MULTIPROCESS_KEY[] = "RunConfiguration.UseMultiProcess";
+using namespace ProjectExplorer;
+
namespace Debugger {
namespace Internal {
@@ -70,13 +75,15 @@ public:
explicit DebuggerRunConfigWidget(DebuggerRunConfigurationAspect *aspect);
QString displayName() const { return tr("Debugger Settings"); }
+ void showEvent(QShowEvent *event);
+ void update();
+
private slots:
void useCppDebuggerClicked(bool on);
void useQmlDebuggerToggled(bool on);
void useQmlDebuggerClicked(bool on);
void qmlDebugServerPortChanged(int port);
void useMultiProcessToggled(bool on);
- void update();
public:
DebuggerRunConfigurationAspect *m_aspect; // not owned
@@ -139,10 +146,19 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(DebuggerRunConfigurationAspect
layout->addLayout(qmlLayout);
layout->addWidget(m_useMultiProcess);
setLayout(layout);
+}
- connect(aspect->runConfiguration()->target()->project(), SIGNAL(projectLanguagesUpdated()),
- this, SLOT(update()));
- update();
+void DebuggerRunConfigWidget::showEvent(QShowEvent *event)
+{
+ // Update the UI on every show() because the state of
+ // QML debugger language is hard to track.
+ //
+ // !event->spontaneous makes sure we ignore e.g. global windows events,
+ // when Qt Creator itself is minimized/maximized.
+ if (!event->spontaneous())
+ update();
+
+ RunConfigWidget::showEvent(event);
}
void DebuggerRunConfigWidget::update()
@@ -233,6 +249,20 @@ bool DebuggerRunConfigurationAspect::useCppDebugger() const
bool DebuggerRunConfigurationAspect::useQmlDebugger() const
{
if (m_useQmlDebugger == DebuggerRunConfigurationAspect::AutoEnabledLanguage) {
+ //
+ // Try to find a build step (qmake) to check whether qml debugging is enabled there
+ // (Using the Qt metatype system to avoid a hard qt4projectmanager dependency)
+ //
+ if (BuildConfiguration *bc = runConfiguration()->target()->activeBuildConfiguration()) {
+ if (BuildStepList *bsl = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)) {
+ foreach (BuildStep *step, bsl->steps()) {
+ QVariant linkProperty = step->property("linkQmlDebuggingLibrary");
+ if (linkProperty.isValid() && linkProperty.canConvert(QVariant::Bool))
+ return linkProperty.toBool();
+ }
+ }
+ }
+
const Core::Context languages = runConfiguration()->target()->project()->projectLanguages();
return languages.contains(ProjectExplorer::Constants::LANG_QMLJS)
&& !languages.contains(ProjectExplorer::Constants::LANG_CXX);
diff --git a/src/plugins/qmakeprojectmanager/qmakestep.h b/src/plugins/qmakeprojectmanager/qmakestep.h
index e68305d178..f0e5dd1ca9 100644
--- a/src/plugins/qmakeprojectmanager/qmakestep.h
+++ b/src/plugins/qmakeprojectmanager/qmakestep.h
@@ -82,6 +82,9 @@ class QMAKEPROJECTMANAGER_EXPORT QMakeStep : public ProjectExplorer::AbstractPro
DebugLink
};
+ // used in DebuggerRunConfigurationAspect
+ Q_PROPERTY(bool linkQmlDebuggingLibrary READ linkQmlDebuggingLibrary WRITE setLinkQmlDebuggingLibrary NOTIFY linkQmlDebuggingLibraryChanged)
+
public:
explicit QMakeStep(ProjectExplorer::BuildStepList *parent);
virtual ~QMakeStep();