Commit 62676718 authored by Kai Koehne's avatar Kai Koehne

QmlProject: Disable debug action if qmlobserver cannot be built

QmlObserver right now requires 4.7.1 minimum. There's no gain in
telling the user that he needs qmlobserver to debug, if it can't be
build with 4.7.0 anyway.

Reviewed-by: Christiaan Janssen
parent 1e19803e
...@@ -114,26 +114,22 @@ Internal::QmlProjectTarget *QmlProjectRunConfiguration::qmlTarget() const ...@@ -114,26 +114,22 @@ Internal::QmlProjectTarget *QmlProjectRunConfiguration::qmlTarget() const
QString QmlProjectRunConfiguration::viewerPath() const QString QmlProjectRunConfiguration::viewerPath() const
{ {
if (m_qtVersionId == -1) Qt4ProjectManager::QtVersion *version = qtVersion();
if (!version) {
return QString(); return QString();
} else {
Qt4ProjectManager::QtVersionManager *versionManager = Qt4ProjectManager::QtVersionManager::instance(); return version->qmlviewerCommand();
Qt4ProjectManager::QtVersion *version = versionManager->version(m_qtVersionId); }
QTC_ASSERT(version, return QString());
return version->qmlviewerCommand();
} }
QString QmlProjectRunConfiguration::observerPath() const QString QmlProjectRunConfiguration::observerPath() const
{ {
if (m_qtVersionId == -1) Qt4ProjectManager::QtVersion *version = qtVersion();
if (!version) {
return QString(); return QString();
} else {
Qt4ProjectManager::QtVersionManager *versionManager = Qt4ProjectManager::QtVersionManager::instance(); return version->qmlObserverTool();
Qt4ProjectManager::QtVersion *version = versionManager->version(m_qtVersionId); }
QTC_ASSERT(version, return QString());
return version->qmlObserverTool();
} }
QStringList QmlProjectRunConfiguration::viewerArguments() const QStringList QmlProjectRunConfiguration::viewerArguments() const
...@@ -162,6 +158,18 @@ QString QmlProjectRunConfiguration::workingDirectory() const ...@@ -162,6 +158,18 @@ QString QmlProjectRunConfiguration::workingDirectory() const
return projectFile.absolutePath(); return projectFile.absolutePath();
} }
Qt4ProjectManager::QtVersion *QmlProjectRunConfiguration::qtVersion() const
{
if (m_qtVersionId == -1)
return 0;
Qt4ProjectManager::QtVersionManager *versionManager = Qt4ProjectManager::QtVersionManager::instance();
Qt4ProjectManager::QtVersion *version = versionManager->version(m_qtVersionId);
QTC_ASSERT(version, return 0);
return version;
}
static bool caseInsensitiveLessThan(const QString &s1, const QString &s2) static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
{ {
return s1.toLower() < s2.toLower(); return s1.toLower() < s2.toLower();
...@@ -381,10 +389,10 @@ void QmlProjectRunConfiguration::updateEnabled() ...@@ -381,10 +389,10 @@ void QmlProjectRunConfiguration::updateEnabled()
bool newValue = (QFileInfo(viewerPath()).exists() bool newValue = (QFileInfo(viewerPath()).exists()
|| QFileInfo(observerPath()).exists()) && qmlFileFound; || QFileInfo(observerPath()).exists()) && qmlFileFound;
if (m_isEnabled != newValue) {
m_isEnabled = newValue; // Always emit change signal to force reevaluation of run/debug buttons
emit isEnabledChanged(m_isEnabled); m_isEnabled = newValue;
} emit isEnabledChanged(m_isEnabled);
} }
void QmlProjectRunConfiguration::updateQtVersions() void QmlProjectRunConfiguration::updateQtVersions()
......
...@@ -74,6 +74,7 @@ public: ...@@ -74,6 +74,7 @@ public:
QString observerPath() const; QString observerPath() const;
QStringList viewerArguments() const; QStringList viewerArguments() const;
QString workingDirectory() const; QString workingDirectory() const;
Qt4ProjectManager::QtVersion *qtVersion() const;
// RunConfiguration // RunConfiguration
virtual QWidget *createConfigurationWidget(); virtual QWidget *createConfigurationWidget();
......
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
#include <debugger/debuggeruiswitcher.h> #include <debugger/debuggeruiswitcher.h>
#include <debugger/debuggerengine.h> #include <debugger/debuggerengine.h>
#include <qmljsinspector/qmljsinspectorconstants.h> #include <qmljsinspector/qmljsinspectorconstants.h>
#include <qt4projectmanager/qtversionmanager.h>
#include <qt4projectmanager/qmlobservertool.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h> #include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <QApplication> #include <QApplication>
...@@ -148,9 +150,18 @@ bool QmlRunControlFactory::canRun(RunConfiguration *runConfiguration, ...@@ -148,9 +150,18 @@ bool QmlRunControlFactory::canRun(RunConfiguration *runConfiguration,
} else { } else {
bool qmlDebugSupportInstalled = Debugger::DebuggerUISwitcher::instance()->supportedLanguages() bool qmlDebugSupportInstalled = Debugger::DebuggerUISwitcher::instance()->supportedLanguages()
& Debugger::QmlLanguage; & Debugger::QmlLanguage;
// don't check for qmlobserver already here because we can't update the run buttons
// if it has been built in the meantime if (config && qmlDebugSupportInstalled) {
return (config != 0) && qmlDebugSupportInstalled; if (!config->observerPath().isEmpty()) {
return true;
}
if (config->qtVersion() && Qt4ProjectManager::QmlObserverTool::canBuild(config->qtVersion())) {
return true;
} else {
return false;
}
}
} }
return false; return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment