forked from qt-creator/qt-creator
QmlRunControlFactory: Cleaner canRun code
Fixed a bug where the case config->qtVersion == 0 was mishandled. Change-Id: Ic11133bcfbe402e8f7a19b99b59161f8a913a2ab Reviewed-on: http://codereview.qt.nokia.com/1779 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
@@ -151,22 +151,24 @@ bool QmlProjectRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
||||
{
|
||||
QmlProjectRunConfiguration *config =
|
||||
qobject_cast<QmlProjectRunConfiguration*>(runConfiguration);
|
||||
if (!config)
|
||||
return false;
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE)
|
||||
return config != 0 && !config->viewerPath().isEmpty();
|
||||
else if (mode != Debugger::Constants::DEBUGMODE)
|
||||
return !config->viewerPath().isEmpty();
|
||||
if (mode != Debugger::Constants::DEBUGMODE)
|
||||
return false;
|
||||
|
||||
bool qmlDebugSupportInstalled =
|
||||
Debugger::DebuggerPlugin::isActiveDebugLanguage(Debugger::QmlLanguage);
|
||||
|
||||
if (config && qmlDebugSupportInstalled) {
|
||||
if (!(config->qtVersion() && config->qtVersion()->needsQmlDebuggingLibrary())
|
||||
|| !config->observerPath().isEmpty())
|
||||
return true;
|
||||
if (config->qtVersion() && QtSupport::QmlObserverTool::canBuild(config->qtVersion()))
|
||||
return true;
|
||||
}
|
||||
if (!Debugger::DebuggerPlugin::isActiveDebugLanguage(Debugger::QmlLanguage))
|
||||
return false;
|
||||
|
||||
if (!config->observerPath().isEmpty())
|
||||
return true;
|
||||
if (!config->qtVersion())
|
||||
return false;
|
||||
if (!config->qtVersion()->needsQmlDebuggingLibrary())
|
||||
return true;
|
||||
if (QtSupport::QmlObserverTool::canBuild(config->qtVersion()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user