forked from qt-creator/qt-creator
QmlProjectRunConfiguration: Derive from LocalApplicationRunConfiguration
Change-Id: I4a7c29f2f679e62bae6fa3d01983851207e532c8 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -58,8 +58,8 @@ LocalQmlProfilerRunner *LocalQmlProfilerRunner::createLocalRunner(
|
|||||||
Configuration conf;
|
Configuration conf;
|
||||||
if (rc1) {
|
if (rc1) {
|
||||||
// This is a "plain" .qmlproject.
|
// This is a "plain" .qmlproject.
|
||||||
conf.executable = rc1->observerPath();
|
conf.executable = rc1->executable();
|
||||||
conf.executableArguments = rc1->viewerArguments();
|
conf.executableArguments = rc1->commandLineArguments();
|
||||||
conf.workingDirectory = rc1->workingDirectory();
|
conf.workingDirectory = rc1->workingDirectory();
|
||||||
conf.environment = environment->environment();
|
conf.environment = environment->environment();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ bool QmlProfilerRunControl::startEngine()
|
|||||||
|
|
||||||
if (QmlProjectManager::QmlProjectRunConfiguration *rc =
|
if (QmlProjectManager::QmlProjectRunConfiguration *rc =
|
||||||
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration())) {
|
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration())) {
|
||||||
if (rc->observerPath().isEmpty()) {
|
if (rc->executable().isEmpty()) {
|
||||||
QmlProjectManager::QmlProjectPlugin::showQmlObserverToolWarning();
|
QmlProjectManager::QmlProjectPlugin::showQmlObserverToolWarning();
|
||||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle);
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle);
|
||||||
AnalyzerManager::stopTool();
|
AnalyzerManager::stopTool();
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ static AnalyzerStartParameters createQmlProfilerStartParameters(RunConfiguration
|
|||||||
if (environment)
|
if (environment)
|
||||||
sp.environment = environment->environment();
|
sp.environment = environment->environment();
|
||||||
sp.workingDirectory = rc1->workingDirectory();
|
sp.workingDirectory = rc1->workingDirectory();
|
||||||
sp.debuggee = rc1->observerPath();
|
sp.debuggee = rc1->executable();
|
||||||
sp.debuggeeArgs = rc1->viewerArguments();
|
sp.debuggeeArgs = rc1->commandLineArguments();
|
||||||
sp.displayName = rc1->displayName();
|
sp.displayName = rc1->displayName();
|
||||||
} else if (LocalApplicationRunConfiguration *rc2 =
|
} else if (LocalApplicationRunConfiguration *rc2 =
|
||||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace QmlProjectManager {
|
|||||||
const char M_CURRENT_FILE[] = "CurrentFile";
|
const char M_CURRENT_FILE[] = "CurrentFile";
|
||||||
|
|
||||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Id id) :
|
QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Id id) :
|
||||||
ProjectExplorer::RunConfiguration(parent, id),
|
ProjectExplorer::LocalApplicationRunConfiguration(parent, id),
|
||||||
m_scriptFile(QLatin1String(M_CURRENT_FILE)),
|
m_scriptFile(QLatin1String(M_CURRENT_FILE)),
|
||||||
m_isEnabled(false)
|
m_isEnabled(false)
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,7 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *
|
|||||||
|
|
||||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *parent,
|
QmlProjectRunConfiguration::QmlProjectRunConfiguration(ProjectExplorer::Target *parent,
|
||||||
QmlProjectRunConfiguration *source) :
|
QmlProjectRunConfiguration *source) :
|
||||||
ProjectExplorer::RunConfiguration(parent, source),
|
ProjectExplorer::LocalApplicationRunConfiguration(parent, source),
|
||||||
m_scriptFile(source->m_scriptFile),
|
m_scriptFile(source->m_scriptFile),
|
||||||
m_qmlViewerArgs(source->m_qmlViewerArgs),
|
m_qmlViewerArgs(source->m_qmlViewerArgs),
|
||||||
m_isEnabled(source->m_isEnabled)
|
m_isEnabled(source->m_isEnabled)
|
||||||
@@ -100,7 +100,7 @@ void QmlProjectRunConfiguration::ctor()
|
|||||||
addExtraAspect(new QmlProjectEnvironmentAspect(this));
|
addExtraAspect(new QmlProjectEnvironmentAspect(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlProjectRunConfiguration::viewerPath() const
|
QString QmlProjectRunConfiguration::executable() const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *version = qtVersion();
|
QtSupport::BaseQtVersion *version = qtVersion();
|
||||||
if (!version)
|
if (!version)
|
||||||
@@ -108,25 +108,18 @@ QString QmlProjectRunConfiguration::viewerPath() const
|
|||||||
|
|
||||||
if (id() == Constants::QML_SCENE_RC_ID)
|
if (id() == Constants::QML_SCENE_RC_ID)
|
||||||
return version->qmlsceneCommand();
|
return version->qmlsceneCommand();
|
||||||
else
|
if (!version->needsQmlDebuggingLibrary())
|
||||||
return version->qmlviewerCommand();
|
return version->qmlviewerCommand();
|
||||||
|
return version->qmlObserverTool();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlProjectRunConfiguration::observerPath() const
|
ProjectExplorer::LocalApplicationRunConfiguration::RunMode QmlProjectRunConfiguration::runMode() const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *version = qtVersion();
|
return Gui;
|
||||||
if (!version) {
|
|
||||||
return QString();
|
|
||||||
} else {
|
|
||||||
if (id() == Constants::QML_SCENE_RC_ID)
|
|
||||||
return version->qmlsceneCommand();
|
|
||||||
if (!version->needsQmlDebuggingLibrary())
|
|
||||||
return version->qmlviewerCommand();
|
|
||||||
return version->qmlObserverTool();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlProjectRunConfiguration::viewerArguments() const
|
QString QmlProjectRunConfiguration::commandLineArguments() const
|
||||||
{
|
{
|
||||||
// arguments in .user file
|
// arguments in .user file
|
||||||
QString args = m_qmlViewerArgs;
|
QString args = m_qmlViewerArgs;
|
||||||
@@ -146,6 +139,16 @@ QString QmlProjectRunConfiguration::viewerArguments() const
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QmlProjectRunConfiguration::dumperLibrary() const
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList QmlProjectRunConfiguration::dumperLibraryLocations() const
|
||||||
|
{
|
||||||
|
return QStringList();
|
||||||
|
}
|
||||||
|
|
||||||
QString QmlProjectRunConfiguration::workingDirectory() const
|
QString QmlProjectRunConfiguration::workingDirectory() const
|
||||||
{
|
{
|
||||||
QFileInfo projectFile(target()->project()->projectFilePath());
|
QFileInfo projectFile(target()->project()->projectFilePath());
|
||||||
@@ -303,8 +306,7 @@ void QmlProjectRunConfiguration::updateEnabled()
|
|||||||
qmlFileFound = !mainScript().isEmpty();
|
qmlFileFound = !mainScript().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool newValue = (QFileInfo(viewerPath()).exists()
|
bool newValue = QFileInfo(executable()).exists() && qmlFileFound;
|
||||||
|| QFileInfo(observerPath()).exists()) && qmlFileFound;
|
|
||||||
|
|
||||||
|
|
||||||
// Always emit change signal to force reevaluation of run/debug buttons
|
// Always emit change signal to force reevaluation of run/debug buttons
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "qmlprojectmanager_global.h"
|
#include "qmlprojectmanager_global.h"
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/localapplicationrunconfiguration.h>
|
||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ namespace Internal {
|
|||||||
class QmlProjectRunConfigurationWidget;
|
class QmlProjectRunConfigurationWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration
|
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class Internal::QmlProjectRunConfigurationFactory;
|
friend class Internal::QmlProjectRunConfigurationFactory;
|
||||||
@@ -62,9 +62,12 @@ class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplor
|
|||||||
public:
|
public:
|
||||||
QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
||||||
|
|
||||||
QString viewerPath() const;
|
QString executable() const;
|
||||||
QString observerPath() const;
|
RunMode runMode() const;
|
||||||
QString viewerArguments() const;
|
QString commandLineArguments() const;
|
||||||
|
QString dumperLibrary() const;
|
||||||
|
QStringList dumperLibraryLocations() const;
|
||||||
|
|
||||||
QString workingDirectory() const;
|
QString workingDirectory() const;
|
||||||
QtSupport::BaseQtVersion *qtVersion() const;
|
QtSupport::BaseQtVersion *qtVersion() const;
|
||||||
|
|
||||||
|
|||||||
@@ -62,11 +62,8 @@ QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfig
|
|||||||
m_applicationLauncher.setEnvironment(environment->environment());
|
m_applicationLauncher.setEnvironment(environment->environment());
|
||||||
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
|
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
|
||||||
|
|
||||||
if (mode == NormalRunMode)
|
m_executable = runConfiguration->executable();
|
||||||
m_executable = runConfiguration->viewerPath();
|
m_commandLineArguments = runConfiguration->commandLineArguments();
|
||||||
else
|
|
||||||
m_executable = runConfiguration->observerPath();
|
|
||||||
m_commandLineArguments = runConfiguration->viewerArguments();
|
|
||||||
m_mainQmlFile = runConfiguration->mainScript();
|
m_mainQmlFile = runConfiguration->mainScript();
|
||||||
|
|
||||||
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
||||||
@@ -154,11 +151,11 @@ bool QmlProjectRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
|||||||
if (!config)
|
if (!config)
|
||||||
return false;
|
return false;
|
||||||
if (mode == NormalRunMode)
|
if (mode == NormalRunMode)
|
||||||
return !config->viewerPath().isEmpty();
|
return !config->executable().isEmpty();
|
||||||
if (mode != DebugRunMode)
|
if (mode != DebugRunMode)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!config->observerPath().isEmpty())
|
if (!config->executable().isEmpty())
|
||||||
return true;
|
return true;
|
||||||
if (!config->qtVersion())
|
if (!config->qtVersion())
|
||||||
return false;
|
return false;
|
||||||
@@ -204,8 +201,8 @@ RunControl *QmlProjectRunControlFactory::createDebugRunControl(QmlProjectRunConf
|
|||||||
EnvironmentAspect *environment = runConfig->extraAspect<EnvironmentAspect>();
|
EnvironmentAspect *environment = runConfig->extraAspect<EnvironmentAspect>();
|
||||||
|
|
||||||
params.startMode = Debugger::StartInternal;
|
params.startMode = Debugger::StartInternal;
|
||||||
params.executable = runConfig->observerPath();
|
params.executable = runConfig->executable();
|
||||||
params.processArgs = runConfig->viewerArguments();
|
params.processArgs = runConfig->commandLineArguments();
|
||||||
params.workingDirectory = runConfig->workingDirectory();
|
params.workingDirectory = runConfig->workingDirectory();
|
||||||
if (environment)
|
if (environment)
|
||||||
params.environment = environment->environment();
|
params.environment = environment->environment();
|
||||||
|
|||||||
Reference in New Issue
Block a user