Commit fc0da55e authored by Aurindam Jana's avatar Aurindam Jana Committed by hjk

QmlProjectRunConfiguration: Derive from LocalApplicationRunConfiguration

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