From 308b462973bf90802d28bc946176f526f5bd302a Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt <lasse.holmstedt@nokia.com> Date: Thu, 29 Jul 2010 16:58:12 +0200 Subject: [PATCH] QML Inspector: Disable debug actions when qml inspector is disabled Reviewed-by: Thomas Hartmann --- src/plugins/debugger/debuggeruiswitcher.cpp | 5 +++++ src/plugins/debugger/debuggeruiswitcher.h | 2 ++ src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp | 9 ++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/debuggeruiswitcher.cpp b/src/plugins/debugger/debuggeruiswitcher.cpp index a7db1101a7a..2c9b2237e26 100644 --- a/src/plugins/debugger/debuggeruiswitcher.cpp +++ b/src/plugins/debugger/debuggeruiswitcher.cpp @@ -153,6 +153,11 @@ DebuggerUISwitcher::~DebuggerUISwitcher() delete d; } +QStringList DebuggerUISwitcher::supportedLanguages() const +{ + return d->m_languages; +} + void DebuggerUISwitcher::addMenuAction(Core::Command *command, const QString &langName, const QString &group) { diff --git a/src/plugins/debugger/debuggeruiswitcher.h b/src/plugins/debugger/debuggeruiswitcher.h index 52a4e1cb3a5..522d5fd61ab 100644 --- a/src/plugins/debugger/debuggeruiswitcher.h +++ b/src/plugins/debugger/debuggeruiswitcher.h @@ -77,6 +77,8 @@ public: void addMenuAction(Core::Command *command, const QString &langName, const QString &group = QString()); + QStringList supportedLanguages() const; + // Changes the active language UI to the one specified by langName. // Does nothing if automatic switching is toggled off from settings. void setActiveLanguage(const QString &langName); diff --git a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp index de6e9bba300..3307df5b4c8 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp @@ -37,7 +37,6 @@ #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/applicationlauncher.h> #include <utils/qtcassert.h> -#include <debugger/debuggerconstants.h> #include <debugger/debuggerconstants.h> #include <debugger/debuggeruiswitcher.h> @@ -147,8 +146,12 @@ QmlRunControlFactory::~QmlRunControlFactory() bool QmlRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const { - Q_UNUSED(mode); - return (qobject_cast<QmlProjectRunConfiguration*>(runConfiguration) != 0); + QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration*>(runConfiguration); + if (mode == ProjectExplorer::Constants::RUNMODE) { + return config != 0; + } else { + return (config != 0) && Debugger::DebuggerUISwitcher::instance()->supportedLanguages().contains(Qml::Constants::LANG_QML); + } } RunControl *QmlRunControlFactory::create(RunConfiguration *runConfiguration, -- GitLab