ProjectExplorer: use enum instead of QString for run mode

Change-Id: Ia906944a489b09afdea59f74afbf759b4caebe37
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
hjk
2012-01-10 19:17:24 +01:00
committed by hjk
parent 2230f301ec
commit a6ff74c0d8
48 changed files with 198 additions and 177 deletions
+5 -5
View File
@@ -560,7 +560,7 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool)
return; return;
} }
pe->runProject(pro, tool->id().toString()); pe->runProject(pro, tool->runMode());
} }
bool AnalyzerManagerPrivate::isActionRunnable(QAction *action) const bool AnalyzerManagerPrivate::isActionRunnable(QAction *action) const
@@ -572,7 +572,7 @@ bool AnalyzerManagerPrivate::isActionRunnable(QAction *action) const
IAnalyzerTool *tool = m_toolFromAction.value(action); IAnalyzerTool *tool = m_toolFromAction.value(action);
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
return pe->canRun(pe->startupProject(), tool->id().toString()); return pe->canRun(pe->startupProject(), tool->runMode());
} }
void AnalyzerManagerPrivate::startTool() void AnalyzerManagerPrivate::startTool()
@@ -761,7 +761,7 @@ void AnalyzerManagerPrivate::updateRunActions()
else if (!m_currentTool) else if (!m_currentTool)
disabledReason = tr("No analyzer tool selected."); disabledReason = tr("No analyzer tool selected.");
else else
disabledReason = pe->cannotRunReason(project, m_currentTool->id().toString()); disabledReason = pe->cannotRunReason(project, m_currentTool->runMode());
m_startAction->setEnabled(startEnabled); m_startAction->setEnabled(startEnabled);
m_startAction->setToolTip(disabledReason); m_startAction->setToolTip(disabledReason);
@@ -908,10 +908,10 @@ void AnalyzerManager::handleToolFinished()
m_instance->d->handleToolFinished(); m_instance->d->handleToolFinished();
} }
IAnalyzerTool *AnalyzerManager::toolFromId(const Core::Id &id) IAnalyzerTool *AnalyzerManager::toolFromRunMode(RunMode runMode)
{ {
foreach (IAnalyzerTool *tool, m_instance->d->m_tools) foreach (IAnalyzerTool *tool, m_instance->d->m_tools)
if (id.name().startsWith(tool->id().name())) if (tool->runMode() == runMode)
return tool; return tool;
return 0; return 0;
} }
+2 -1
View File
@@ -38,6 +38,7 @@
#include "analyzerbase_global.h" #include "analyzerbase_global.h"
#include "analyzerconstants.h" #include "analyzerconstants.h"
#include <coreplugin/id.h> #include <coreplugin/id.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <QtCore/QObject> #include <QtCore/QObject>
@@ -72,7 +73,7 @@ public:
// Register a tool and initialize it. // Register a tool and initialize it.
static void addTool(IAnalyzerTool *tool, const StartModes &mode); static void addTool(IAnalyzerTool *tool, const StartModes &mode);
static IAnalyzerTool *toolFromId(const Core::Id &id); static IAnalyzerTool *toolFromRunMode(ProjectExplorer::RunMode runMode);
// Dockwidgets are registered to the main window. // Dockwidgets are registered to the main window.
static QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title, static QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title,
@@ -80,7 +80,7 @@ AnalyzerRunControl::Private::Private()
AnalyzerRunControl::AnalyzerRunControl(IAnalyzerTool *tool, AnalyzerRunControl::AnalyzerRunControl(IAnalyzerTool *tool,
const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
: RunControl(runConfiguration, tool->id().toString()), : RunControl(runConfiguration, tool->runMode()),
d(new Private) d(new Private)
{ {
d->m_engine = tool->createEngine(sp, runConfiguration); d->m_engine = tool->createEngine(sp, runConfiguration);
@@ -60,17 +60,17 @@ QString AnalyzerRunControlFactory::displayName() const
return tr("Analyzer"); return tr("Analyzer");
} }
bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{ {
IAnalyzerTool *tool = AnalyzerManager::toolFromId(Core::Id(mode)); IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
if (tool) if (tool)
return tool->canRun(runConfiguration, mode); return tool->canRun(runConfiguration, mode);
return false; return false;
} }
RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode) RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode)
{ {
IAnalyzerTool *tool = AnalyzerManager::toolFromId(Core::Id(mode)); IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
if (!tool) if (!tool)
return 0; return 0;
@@ -49,8 +49,9 @@ public:
// IRunControlFactory implementation // IRunControlFactory implementation
QString displayName() const; QString displayName() const;
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; bool canRun(RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, const QString &mode); ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode);
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(); ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
+5 -2
View File
@@ -40,6 +40,7 @@
#include "analyzerstartparameters.h" #include "analyzerstartparameters.h"
#include <coreplugin/id.h> #include <coreplugin/id.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <QtCore/QObject> #include <QtCore/QObject>
@@ -76,6 +77,8 @@ public:
/// Returns a unique ID for this tool. /// Returns a unique ID for this tool.
virtual Core::Id id() const = 0; virtual Core::Id id() const = 0;
/// Returns the run mode for this tool.
virtual ProjectExplorer::RunMode runMode() const = 0;
/// Returns a short user readable display name for this tool. /// Returns a short user readable display name for this tool.
virtual QString displayName() const = 0; virtual QString displayName() const = 0;
/// Returns a user readable description name for this tool. /// Returns a user readable description name for this tool.
@@ -124,12 +127,12 @@ public:
/// Returns true if the tool can be run /// Returns true if the tool can be run
virtual bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, virtual bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode) const = 0; ProjectExplorer::RunMode mode) const = 0;
/// Create the start parameters for the run control factory /// Create the start parameters for the run control factory
virtual AnalyzerStartParameters createStartParameters( virtual AnalyzerStartParameters createStartParameters(
ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode) const = 0; ProjectExplorer::RunMode mode) const = 0;
virtual void startTool(StartMode mode) = 0; virtual void startTool(StartMode mode) = 0;
-4
View File
@@ -52,10 +52,6 @@ const char G_MANUAL_REMOTE[] = "Debugger.Group.Manual.Remote";
const char G_AUTOMATIC_REMOTE[] = "Debugger.Group.Automatic.Remote"; const char G_AUTOMATIC_REMOTE[] = "Debugger.Group.Automatic.Remote";
const char G_START_QML[] = "Debugger.Group.Start.Qml"; const char G_START_QML[] = "Debugger.Group.Start.Qml";
// Project Explorer run mode (RUN/DEBUG)
const char DEBUGMODE[] = "Debugger.DebugMode";
const char DEBUGMODE2[] = "Debugger.DebugMode2"; // Breaks on main.
// Common actions (accessed by QML inspector) // Common actions (accessed by QML inspector)
const char INTERRUPT[] = "Debugger.Interrupt"; const char INTERRUPT[] = "Debugger.Interrupt";
const char CONTINUE[] = "Debugger.Continue"; const char CONTINUE[] = "Debugger.Continue";
+10 -12
View File
@@ -1427,21 +1427,21 @@ void DebuggerPluginPrivate::debugProject()
{ {
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (Project *pro = pe->startupProject()) if (Project *pro = pe->startupProject())
pe->runProject(pro, QLatin1String(Constants::DEBUGMODE)); pe->runProject(pro, DebugRunMode);
} }
void DebuggerPluginPrivate::debugProjectWithoutDeploy() void DebuggerPluginPrivate::debugProjectWithoutDeploy()
{ {
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (Project *pro = pe->startupProject()) if (Project *pro = pe->startupProject())
pe->runProject(pro, QLatin1String(Constants::DEBUGMODE), true); pe->runProject(pro, DebugRunMode, true);
} }
void DebuggerPluginPrivate::debugProjectBreakMain() void DebuggerPluginPrivate::debugProjectBreakMain()
{ {
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (Project *pro = pe->startupProject()) if (Project *pro = pe->startupProject())
pe->runProject(pro, QLatin1String(Constants::DEBUGMODE2)); pe->runProject(pro, DebugRunModeWithBreakOnMain);
} }
void DebuggerPluginPrivate::startExternalApplication() void DebuggerPluginPrivate::startExternalApplication()
@@ -2048,7 +2048,7 @@ void DebuggerPluginPrivate::displayDebugger(DebuggerEngine *engine, bool updateE
void DebuggerPluginPrivate::startDebugger(RunControl *rc) void DebuggerPluginPrivate::startDebugger(RunControl *rc)
{ {
QTC_ASSERT(rc, return); QTC_ASSERT(rc, return);
ProjectExplorerPlugin::instance()->startRunControl(rc, QLatin1String(Constants::DEBUGMODE)); ProjectExplorerPlugin::instance()->startRunControl(rc, DebugRunMode);
} }
@@ -2377,16 +2377,14 @@ void DebuggerPluginPrivate::updateDebugActions()
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
Project *project = pe->startupProject(); Project *project = pe->startupProject();
const QString debugMode = _(Constants::DEBUGMODE); const bool canRun = pe->canRun(project, DebugRunMode);
const bool canRun = pe->canRun(project, debugMode);
m_startAction->setEnabled(canRun); m_startAction->setEnabled(canRun);
m_startAction->setToolTip(canRun ? QString() : pe->cannotRunReason(project, debugMode)); m_startAction->setToolTip(canRun ? QString() : pe->cannotRunReason(project, DebugRunMode));
m_debugWithoutDeployAction->setEnabled(canRun); m_debugWithoutDeployAction->setEnabled(canRun);
// Step into/next: Start and break at 'main' unless a debugger is running. // Step into/next: Start and break at 'main' unless a debugger is running.
if (m_snapshotHandler->currentIndex() < 0) { if (m_snapshotHandler->currentIndex() < 0) {
const QString debugMode2 = _(Constants::DEBUGMODE2); const bool canRunAndBreakMain = pe->canRun(project, DebugRunModeWithBreakOnMain);
const bool canRunAndBreakMain = pe->canRun(project, debugMode2);
m_stepAction->setEnabled(canRunAndBreakMain); m_stepAction->setEnabled(canRunAndBreakMain);
m_nextAction->setEnabled(canRunAndBreakMain); m_nextAction->setEnabled(canRunAndBreakMain);
QString toolTip; QString toolTip;
@@ -2395,10 +2393,10 @@ void DebuggerPluginPrivate::updateDebugActions()
toolTip = tr("Start '%1' and break at function 'main()'") toolTip = tr("Start '%1' and break at function 'main()'")
.arg(project->displayName()); .arg(project->displayName());
} else { } else {
// Do not display long tooltip saying 'debugMode2 is not supported // Do not display long tooltip saying run mode is not supported
// for project' for projects to which 'break at main' is not applicable. // for project for projects to which 'break at main' is not applicable.
if (!canRun) if (!canRun)
toolTip = pe->cannotRunReason(project, debugMode2); toolTip = pe->cannotRunReason(project, DebugRunModeWithBreakOnMain);
} }
m_stepAction->setToolTip(toolTip); m_stepAction->setToolTip(toolTip);
m_nextAction->setToolTip(toolTip); m_nextAction->setToolTip(toolTip);
@@ -49,13 +49,14 @@ public:
// FIXME: What to do in case of a 0 runConfiguration? // FIXME: What to do in case of a 0 runConfiguration?
typedef ProjectExplorer::RunConfiguration RunConfiguration; typedef ProjectExplorer::RunConfiguration RunConfiguration;
typedef ProjectExplorer::RunControl RunControl; typedef ProjectExplorer::RunControl RunControl;
typedef ProjectExplorer::RunMode RunMode;
DebuggerRunControl *create(const DebuggerStartParameters &sp, DebuggerRunControl *create(const DebuggerStartParameters &sp,
RunConfiguration *runConfiguration = 0); RunConfiguration *runConfiguration = 0);
// ProjectExplorer::IRunControlFactory // ProjectExplorer::IRunControlFactory
// FIXME: Used by qmljsinspector.cpp:469 // FIXME: Used by qmljsinspector.cpp:469
RunControl *create(RunConfiguration *runConfiguration, const QString &mode); RunControl *create(RunConfiguration *runConfiguration, RunMode mode);
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; bool canRun(RunConfiguration *runConfiguration, RunMode mode) const;
static DebuggerEngine *createEngine(DebuggerEngineType et, static DebuggerEngine *createEngine(DebuggerEngineType et,
const DebuggerStartParameters &sp, const DebuggerStartParameters &sp,
+6 -8
View File
@@ -185,7 +185,7 @@ DebuggerRunControlPrivate::DebuggerRunControlPrivate(DebuggerRunControl *parent,
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration, DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
const DebuggerStartParameters &sp, const DebuggerStartParameters &sp,
const QPair<DebuggerEngineType, DebuggerEngineType> &masterSlaveEngineTypes) const QPair<DebuggerEngineType, DebuggerEngineType> &masterSlaveEngineTypes)
: RunControl(runConfiguration, QLatin1String(Constants::DEBUGMODE)), : RunControl(runConfiguration, ProjectExplorer::DebugRunMode),
d(new DebuggerRunControlPrivate(this, runConfiguration)) d(new DebuggerRunControlPrivate(this, runConfiguration))
{ {
connect(this, SIGNAL(finished()), SLOT(handleFinished())); connect(this, SIGNAL(finished()), SLOT(handleFinished()));
@@ -667,10 +667,9 @@ DebuggerRunControlFactory::DebuggerRunControlFactory(QObject *parent,
: IRunControlFactory(parent), m_enabledEngines(enabledEngines) : IRunControlFactory(parent), m_enabledEngines(enabledEngines)
{} {}
bool DebuggerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const bool DebuggerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{ {
return (mode == QLatin1String(Constants::DEBUGMODE) return (mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain)
|| mode == QLatin1String(Constants::DEBUGMODE2))
&& qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); && qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
} }
@@ -782,14 +781,13 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
} }
RunControl *DebuggerRunControlFactory::create RunControl *DebuggerRunControlFactory::create
(RunConfiguration *runConfiguration, const QString &mode) (RunConfiguration *runConfiguration, RunMode mode)
{ {
QTC_ASSERT(mode == QLatin1String(Constants::DEBUGMODE) QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0);
|| mode == QLatin1String(Constants::DEBUGMODE2), return 0);
DebuggerStartParameters sp = localStartParameters(runConfiguration); DebuggerStartParameters sp = localStartParameters(runConfiguration);
if (sp.startMode == NoStartMode) if (sp.startMode == NoStartMode)
return 0; return 0;
if (mode == QLatin1String(Constants::DEBUGMODE2)) if (mode == DebugRunModeWithBreakOnMain)
sp.breakOnMain = true; sp.breakOnMain = true;
return create(sp, runConfiguration); return create(sp, runConfiguration);
} }
+4 -4
View File
@@ -87,7 +87,7 @@ bool MaemoRunConfiguration::isEnabled() const
{ {
if (!RemoteLinuxRunConfiguration::isEnabled()) if (!RemoteLinuxRunConfiguration::isEnabled())
return false; return false;
if (!hasEnoughFreePorts(ProjectExplorer::Constants::RUNMODE)) { if (!hasEnoughFreePorts(NormalRunMode)) {
setDisabledReason(tr("Not enough free ports on the device.")); setDisabledReason(tr("Not enough free ports on the device."));
return false; return false;
} }
@@ -165,15 +165,15 @@ QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const
+ QFileInfo(localExecutableFilePath()).fileName(); + QFileInfo(localExecutableFilePath()).fileName();
} }
bool MaemoRunConfiguration::hasEnoughFreePorts(const QString &mode) const bool MaemoRunConfiguration::hasEnoughFreePorts(RunMode mode) const
{ {
const int freePortCount = freePorts().count(); const int freePortCount = freePorts().count();
const bool remoteMountsAllowed = maemoTarget()->allowsRemoteMounts(); const bool remoteMountsAllowed = maemoTarget()->allowsRemoteMounts();
const int mountDirCount = remoteMountsAllowed const int mountDirCount = remoteMountsAllowed
? remoteMounts()->validMountSpecificationCount() : 0; ? remoteMounts()->validMountSpecificationCount() : 0;
if (mode == Debugger::Constants::DEBUGMODE) if (mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain)
return freePortCount >= mountDirCount + portsUsedByDebuggers(); return freePortCount >= mountDirCount + portsUsedByDebuggers();
if (mode == ProjectExplorer::Constants::RUNMODE) if (mode == NormalRunMode)
return freePortCount >= mountDirCount; return freePortCount >= mountDirCount;
return false; return false;
} }
+1 -1
View File
@@ -55,7 +55,7 @@ public:
RemoteLinux::PortList freePorts() const; RemoteLinux::PortList freePorts() const;
Internal::MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; } Internal::MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; }
bool hasEnoughFreePorts(const QString &mode) const; bool hasEnoughFreePorts(ProjectExplorer::RunMode mode) const;
QString localDirToMountForRemoteGdb() const; QString localDirToMountForRemoteGdb() const;
QString remoteProjectSourcesMountPoint() const; QString remoteProjectSourcesMountPoint() const;
+4 -6
View File
@@ -153,8 +153,7 @@ MaemoRunControlFactory::~MaemoRunControlFactory()
{ {
} }
bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration, bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
const QString &mode) const
{ {
const MaemoRunConfiguration * const maemoRunConfig const MaemoRunConfiguration * const maemoRunConfig
= qobject_cast<MaemoRunConfiguration *>(runConfiguration); = qobject_cast<MaemoRunConfiguration *>(runConfiguration);
@@ -163,16 +162,15 @@ bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration,
return maemoRunConfig->hasEnoughFreePorts(mode); return maemoRunConfig->hasEnoughFreePorts(mode);
} }
RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig, RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig, RunMode mode)
const QString &mode)
{ {
Q_ASSERT(mode == ProjectExplorer::Constants::RUNMODE || mode == Debugger::Constants::DEBUGMODE); Q_ASSERT(mode == NormalRunMode || mode == DebugRunMode);
Q_ASSERT(canRun(runConfig, mode)); Q_ASSERT(canRun(runConfig, mode));
MaemoRunConfiguration *rc = qobject_cast<MaemoRunConfiguration *>(runConfig); MaemoRunConfiguration *rc = qobject_cast<MaemoRunConfiguration *>(runConfig);
Q_ASSERT(rc); Q_ASSERT(rc);
if (mode == ProjectExplorer::Constants::RUNMODE) if (mode == NormalRunMode)
return new MaemoRunControl(rc); return new MaemoRunControl(rc);
const DebuggerStartParameters params const DebuggerStartParameters params
+2 -2
View File
@@ -80,8 +80,8 @@ public:
QString displayName() const; QString displayName() const;
RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
RunControl *create(RunConfiguration *runConfiguration, const QString &mode); RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode);
}; };
} // namespace Internal } // namespace Internal
@@ -53,10 +53,9 @@ LocalApplicationRunControlFactory::~LocalApplicationRunControlFactory()
{ {
} }
bool LocalApplicationRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const bool LocalApplicationRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{ {
return (mode == QLatin1String(ProjectExplorer::Constants::RUNMODE)) return mode == NormalRunMode && qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
&& (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration) != 0);
} }
QString LocalApplicationRunControlFactory::displayName() const QString LocalApplicationRunControlFactory::displayName() const
@@ -64,7 +63,7 @@ QString LocalApplicationRunControlFactory::displayName() const
return tr("Run"); return tr("Run");
} }
RunControl *LocalApplicationRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) RunControl *LocalApplicationRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode)
{ {
QTC_ASSERT(canRun(runConfiguration, mode), return 0); QTC_ASSERT(canRun(runConfiguration, mode), return 0);
LocalApplicationRunConfiguration *localRunConfiguration = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); LocalApplicationRunConfiguration *localRunConfiguration = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
@@ -82,7 +81,7 @@ RunConfigWidget *LocalApplicationRunControlFactory::createConfigurationWidget(Ru
// ApplicationRunControl // ApplicationRunControl
LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, QString mode) LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, RunMode mode)
: RunControl(rc, mode) : RunControl(rc, mode)
{ {
Utils::Environment env = rc->environment(); Utils::Environment env = rc->environment();
@@ -35,6 +35,7 @@
#include "runconfiguration.h" #include "runconfiguration.h"
#include "applicationlauncher.h" #include "applicationlauncher.h"
#include "projectexplorerconstants.h"
namespace ProjectExplorer { namespace ProjectExplorer {
@@ -47,9 +48,9 @@ class LocalApplicationRunControlFactory : public IRunControlFactory
public: public:
LocalApplicationRunControlFactory (); LocalApplicationRunControlFactory ();
virtual ~LocalApplicationRunControlFactory(); virtual ~LocalApplicationRunControlFactory();
virtual bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; virtual bool canRun(RunConfiguration *runConfiguration, RunMode mode) const;
virtual QString displayName() const; virtual QString displayName() const;
virtual RunControl* create(RunConfiguration *runConfiguration, const QString &mode); virtual RunControl* create(RunConfiguration *runConfiguration, RunMode mode);
virtual RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); virtual RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
}; };
@@ -57,7 +58,7 @@ class LocalApplicationRunControl : public RunControl
{ {
Q_OBJECT Q_OBJECT
public: public:
LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration, QString mode); LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration, RunMode mode);
virtual ~LocalApplicationRunControl(); virtual ~LocalApplicationRunControl();
virtual void start(); virtual void start();
virtual StopResult stop(); virtual StopResult stop();
+19 -19
View File
@@ -230,7 +230,7 @@ struct ProjectExplorerPluginPrivate {
QString m_lastOpenDirectory; QString m_lastOpenDirectory;
RunConfiguration *m_delayedRunConfiguration; // TODO this is not right RunConfiguration *m_delayedRunConfiguration; // TODO this is not right
QString m_runMode; RunMode m_runMode;
QString m_projectFilterString; QString m_projectFilterString;
Internal::MiniProjectTargetSelector * m_targetSelector; Internal::MiniProjectTargetSelector * m_targetSelector;
Internal::ProjectExplorerSettings m_projectExplorerSettings; Internal::ProjectExplorerSettings m_projectExplorerSettings;
@@ -245,6 +245,7 @@ ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
m_currentProject(0), m_currentProject(0),
m_currentNode(0), m_currentNode(0),
m_delayedRunConfiguration(0), m_delayedRunConfiguration(0),
m_runMode(NoRunMode),
m_projectsMode(0), m_projectsMode(0),
m_toolChainManager(0) m_toolChainManager(0)
{ {
@@ -1548,7 +1549,7 @@ void ProjectExplorerPlugin::buildStateChanged(Project * pro)
updateActions(); updateActions();
} }
void ProjectExplorerPlugin::executeRunConfiguration(RunConfiguration *runConfiguration, const QString &runMode) void ProjectExplorerPlugin::executeRunConfiguration(RunConfiguration *runConfiguration, RunMode runMode)
{ {
if (IRunControlFactory *runControlFactory = findRunControlFactory(runConfiguration, runMode)) { if (IRunControlFactory *runControlFactory = findRunControlFactory(runConfiguration, runMode)) {
emit aboutToExecuteProject(runConfiguration->target()->project(), runMode); emit aboutToExecuteProject(runConfiguration->target()->project(), runMode);
@@ -1560,10 +1561,10 @@ void ProjectExplorerPlugin::executeRunConfiguration(RunConfiguration *runConfigu
} }
} }
void ProjectExplorerPlugin::startRunControl(RunControl *runControl, const QString &runMode) void ProjectExplorerPlugin::startRunControl(RunControl *runControl, RunMode runMode)
{ {
d->m_outputPane->createNewOutputWindow(runControl); d->m_outputPane->createNewOutputWindow(runControl);
if (runMode == QLatin1String(ProjectExplorer::Constants::RUNMODE) && d->m_projectExplorerSettings.showRunOutput) if (runMode == NormalRunMode && d->m_projectExplorerSettings.showRunOutput)
d->m_outputPane->popup(false); d->m_outputPane->popup(false);
d->m_outputPane->showTabFor(runControl); d->m_outputPane->showTabFor(runControl);
connect(runControl, SIGNAL(finished()), this, SLOT(runControlFinished())); connect(runControl, SIGNAL(finished()), this, SLOT(runControlFinished()));
@@ -1600,7 +1601,7 @@ void ProjectExplorerPlugin::buildQueueFinished(bool success)
d->m_buildManager->showTaskWindow(); d->m_buildManager->showTaskWindow();
} }
d->m_delayedRunConfiguration = 0; d->m_delayedRunConfiguration = 0;
d->m_runMode.clear(); d->m_runMode = NoRunMode;
} }
void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node *node) void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node *node)
@@ -1935,19 +1936,19 @@ void ProjectExplorerPlugin::cleanSession()
void ProjectExplorerPlugin::runProject() void ProjectExplorerPlugin::runProject()
{ {
runProject(startupProject(), QLatin1String(ProjectExplorer::Constants::RUNMODE)); runProject(startupProject(), NormalRunMode);
} }
void ProjectExplorerPlugin::runProjectWithoutDeploy() void ProjectExplorerPlugin::runProjectWithoutDeploy()
{ {
runProject(startupProject(), QLatin1String(ProjectExplorer::Constants::RUNMODE), true); runProject(startupProject(), NormalRunMode, true);
} }
void ProjectExplorerPlugin::runProjectContextMenu() void ProjectExplorerPlugin::runProjectContextMenu()
{ {
ProjectNode *projectNode = qobject_cast<ProjectNode*>(d->m_currentNode); ProjectNode *projectNode = qobject_cast<ProjectNode*>(d->m_currentNode);
if (projectNode == d->m_currentProject->rootProjectNode() || !projectNode) { if (projectNode == d->m_currentProject->rootProjectNode() || !projectNode) {
runProject(d->m_currentProject, QLatin1String(ProjectExplorer::Constants::RUNMODE)); runProject(d->m_currentProject, NormalRunMode);
} else { } else {
QAction *act = qobject_cast<QAction *>(sender()); QAction *act = qobject_cast<QAction *>(sender());
if (!act) if (!act)
@@ -1955,7 +1956,7 @@ void ProjectExplorerPlugin::runProjectContextMenu()
RunConfiguration *rc = act->data().value<RunConfiguration *>(); RunConfiguration *rc = act->data().value<RunConfiguration *>();
if (!rc) if (!rc)
return; return;
runRunConfiguration(rc, QLatin1String(ProjectExplorer::Constants::RUNMODE)); runRunConfiguration(rc, NormalRunMode);
} }
} }
@@ -2059,7 +2060,7 @@ bool ProjectExplorerPlugin::hasDeploySettings(Project *pro)
return false; return false;
} }
void ProjectExplorerPlugin::runProject(Project *pro, const QString &mode, const bool forceSkipDeploy) void ProjectExplorerPlugin::runProject(Project *pro, RunMode mode, const bool forceSkipDeploy)
{ {
if (!pro) if (!pro)
return; return;
@@ -2068,7 +2069,7 @@ void ProjectExplorerPlugin::runProject(Project *pro, const QString &mode, const
} }
void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguration *rc, void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguration *rc,
const QString &mode, RunMode runMode,
const bool forceSkipDeploy) const bool forceSkipDeploy)
{ {
if (!rc->isEnabled()) if (!rc->isEnabled())
@@ -2090,10 +2091,10 @@ void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguratio
if (queueCount > 0) { if (queueCount > 0) {
// delay running till after our queued steps were processed // delay running till after our queued steps were processed
d->m_runMode = mode; d->m_runMode = runMode;
d->m_delayedRunConfiguration = rc; d->m_delayedRunConfiguration = rc;
} else { } else {
executeRunConfiguration(rc, mode); executeRunConfiguration(rc, runMode);
} }
emit updateRunActions(); emit updateRunActions();
} }
@@ -2190,7 +2191,7 @@ void ProjectExplorerPlugin::activeRunConfigurationChanged()
} }
// NBS TODO implement more than one runner // NBS TODO implement more than one runner
IRunControlFactory *ProjectExplorerPlugin::findRunControlFactory(RunConfiguration *config, const QString &mode) IRunControlFactory *ProjectExplorerPlugin::findRunControlFactory(RunConfiguration *config, RunMode mode)
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
const QList<IRunControlFactory *> factories = pm->getObjects<IRunControlFactory>(); const QList<IRunControlFactory *> factories = pm->getObjects<IRunControlFactory>();
@@ -2254,7 +2255,7 @@ void ProjectExplorerPlugin::updateDeployActions()
emit updateRunActions(); emit updateRunActions();
} }
bool ProjectExplorerPlugin::canRun(Project *project, const QString &runMode) bool ProjectExplorerPlugin::canRun(Project *project, RunMode runMode)
{ {
if (!project || if (!project ||
!project->activeTarget() || !project->activeTarget() ||
@@ -2277,7 +2278,7 @@ bool ProjectExplorerPlugin::canRun(Project *project, const QString &runMode)
return (canRun && !building); return (canRun && !building);
} }
QString ProjectExplorerPlugin::cannotRunReason(Project *project, const QString &runMode) QString ProjectExplorerPlugin::cannotRunReason(Project *project, RunMode runMode)
{ {
if (!project) if (!project)
return tr("No active project"); return tr("No active project");
@@ -2317,10 +2318,9 @@ QString ProjectExplorerPlugin::cannotRunReason(Project *project, const QString &
void ProjectExplorerPlugin::slotUpdateRunActions() void ProjectExplorerPlugin::slotUpdateRunActions()
{ {
Project *project = startupProject(); Project *project = startupProject();
const QString runMode = QLatin1String(ProjectExplorer::Constants::RUNMODE); const bool state = canRun(project, NormalRunMode);
const bool state = canRun(project, runMode);
d->m_runAction->setEnabled(state); d->m_runAction->setEnabled(state);
d->m_runAction->setToolTip(cannotRunReason(project, runMode)); d->m_runAction->setToolTip(cannotRunReason(project, NormalRunMode));
d->m_runWithoutDeployAction->setEnabled(state); d->m_runWithoutDeployAction->setEnabled(state);
} }
@@ -34,6 +34,7 @@
#define PROJECTEXPLORER_H #define PROJECTEXPLORER_H
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include "projectexplorerconstants.h"
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
@@ -105,7 +106,7 @@ public:
void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes); void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
Internal::ProjectExplorerSettings projectExplorerSettings() const; Internal::ProjectExplorerSettings projectExplorerSettings() const;
void startRunControl(RunControl *runControl, const QString &mode); void startRunControl(RunControl *runControl, RunMode runMode);
// internal public for FlatModel // internal public for FlatModel
void renameFile(Node *node, const QString &to); void renameFile(Node *node, const QString &to);
@@ -113,10 +114,10 @@ public:
bool coreAboutToClose(); bool coreAboutToClose();
QList<QPair<QString, QString> > recentProjects(); QList<QPair<QString, QString> > recentProjects();
bool canRun(Project *pro, const QString &runMode); bool canRun(Project *pro, RunMode runMode);
QString cannotRunReason(Project *project, const QString &runMode); QString cannotRunReason(Project *project, RunMode runMode);
void runProject(Project *pro, const QString &mode, const bool forceSkipDeploy = false); void runProject(Project *pro, RunMode, const bool forceSkipDeploy = false);
void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, const QString &mode, void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, RunMode runMode,
const bool forceSkipDeploy = false); const bool forceSkipDeploy = false);
void addExistingFiles(ProjectExplorer::ProjectNode *projectNode, const QStringList &filePaths); void addExistingFiles(ProjectExplorer::ProjectNode *projectNode, const QStringList &filePaths);
@@ -140,7 +141,7 @@ signals:
void currentProjectChanged(ProjectExplorer::Project *project); void currentProjectChanged(ProjectExplorer::Project *project);
void currentNodeChanged(ProjectExplorer::Node *node, ProjectExplorer::Project *project); void currentNodeChanged(ProjectExplorer::Node *node, ProjectExplorer::Project *project);
void aboutToExecuteProject(ProjectExplorer::Project *project, const QString &runMode); void aboutToExecuteProject(ProjectExplorer::Project *project, RunMode runMode);
void recentProjectsChanged(); void recentProjectsChanged();
void settingsChanged(); void settingsChanged();
@@ -262,7 +263,7 @@ private:
int queue(QList<Project *>, QStringList stepIds); int queue(QList<Project *>, QStringList stepIds);
void updateContextMenuActions(); void updateContextMenuActions();
bool parseArguments(const QStringList &arguments, QString *error); bool parseArguments(const QStringList &arguments, QString *error);
void executeRunConfiguration(RunConfiguration *, const QString &mode); void executeRunConfiguration(RunConfiguration *, RunMode mode);
bool hasBuildSettings(Project *pro); bool hasBuildSettings(Project *pro);
QPair<bool, QString> buildSettingsEnabledForSession(); QPair<bool, QString> buildSettingsEnabledForSession();
QPair<bool, QString> buildSettingsEnabled(Project *pro); QPair<bool, QString> buildSettingsEnabled(Project *pro);
@@ -271,7 +272,7 @@ private:
void setCurrent(Project *project, QString filePath, Node *node); void setCurrent(Project *project, QString filePath, Node *node);
QStringList allFilesWithDependencies(Project *pro); QStringList allFilesWithDependencies(Project *pro);
IRunControlFactory *findRunControlFactory(RunConfiguration *config, const QString &mode); IRunControlFactory *findRunControlFactory(RunConfiguration *config, RunMode mode);
void addToRecentProjects(const QString &fileName, const QString &displayName); void addToRecentProjects(const QString &fileName, const QString &displayName);
@@ -88,8 +88,6 @@ const char SHOW_TASK_IN_EDITOR[] = "ProjectExplorer.ShowTaskInEditor";
const char VCS_ANNOTATE_TASK[] = "ProjectExplorer.VcsAnnotateTask"; const char VCS_ANNOTATE_TASK[] = "ProjectExplorer.VcsAnnotateTask";
const char SHOW_TASK_OUTPUT[] = "ProjectExplorer.ShowTaskOutput"; const char SHOW_TASK_OUTPUT[] = "ProjectExplorer.ShowTaskOutput";
// Run modes
const char RUNMODE[] = "ProjectExplorer.RunMode";
const char SELECTTARGET[] = "ProjectExplorer.SelectTarget"; const char SELECTTARGET[] = "ProjectExplorer.SelectTarget";
const char SELECTTARGETQUICK[] = "ProjectExplorer.SelectTargetQuick"; const char SELECTTARGETQUICK[] = "ProjectExplorer.SelectTargetQuick";
@@ -224,6 +222,18 @@ const int QML_DEFAULT_DEBUG_SERVER_PORT = 3768;
const char DEFAULT_WORKING_DIR[] = "%{buildDir}"; const char DEFAULT_WORKING_DIR[] = "%{buildDir}";
} // namespace Constants } // namespace Constants
// Run modes
enum RunMode {
NoRunMode,
NormalRunMode,
DebugRunMode,
DebugRunModeWithBreakOnMain,
QmlProfilerRunMode,
CallgrindRunMode,
MemcheckRunMode
};
} // namespace ProjectExplorer } // namespace ProjectExplorer
#endif // PROJECTEXPLORERCONSTANTS_H #endif // PROJECTEXPLORERCONSTANTS_H
@@ -504,7 +504,7 @@ IRunConfigurationAspect *IRunControlFactory::createRunConfigurationAspect()
TODO the icon differs currently only per "mode", so this is more flexible then it needs to be. TODO the icon differs currently only per "mode", so this is more flexible then it needs to be.
*/ */
RunControl::RunControl(RunConfiguration *runConfiguration, QString mode) RunControl::RunControl(RunConfiguration *runConfiguration, RunMode mode)
: m_runMode(mode), m_runConfiguration(runConfiguration), m_outputFormatter(0) : m_runMode(mode), m_runConfiguration(runConfiguration), m_outputFormatter(0)
{ {
if (runConfiguration) { if (runConfiguration) {
@@ -526,7 +526,7 @@ Utils::OutputFormatter *RunControl::outputFormatter()
return m_outputFormatter; return m_outputFormatter;
} }
QString RunControl::runMode() const RunMode RunControl::runMode() const
{ {
return m_runMode; return m_runMode;
} }
@@ -35,6 +35,7 @@
#include "projectconfiguration.h" #include "projectconfiguration.h"
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include "projectexplorerconstants.h"
#include <utils/outputformat.h> #include <utils/outputformat.h>
@@ -190,8 +191,8 @@ public:
explicit IRunControlFactory(QObject *parent = 0); explicit IRunControlFactory(QObject *parent = 0);
virtual ~IRunControlFactory(); virtual ~IRunControlFactory();
virtual bool canRun(RunConfiguration *runConfiguration, const QString &mode) const = 0; virtual bool canRun(RunConfiguration *runConfiguration, RunMode mode) const = 0;
virtual RunControl* create(RunConfiguration *runConfiguration, const QString &mode) = 0; virtual RunControl *create(RunConfiguration *runConfiguration, RunMode mode) = 0;
virtual QString displayName() const = 0; virtual QString displayName() const = 0;
@@ -223,7 +224,7 @@ public:
AsynchronousStop // Stop sequence has been started AsynchronousStop // Stop sequence has been started
}; };
explicit RunControl(RunConfiguration *runConfiguration, QString mode); RunControl(RunConfiguration *runConfiguration, RunMode mode);
virtual ~RunControl(); virtual ~RunControl();
virtual void start() = 0; virtual void start() = 0;
@@ -240,7 +241,7 @@ public:
bool sameRunConfiguration(const RunControl *other) const; bool sameRunConfiguration(const RunControl *other) const;
Utils::OutputFormatter *outputFormatter(); Utils::OutputFormatter *outputFormatter();
QString runMode() const; RunMode runMode() const;
public slots: public slots:
void bringApplicationToForeground(qint64 pid); void bringApplicationToForeground(qint64 pid);
@@ -264,7 +265,7 @@ protected:
private: private:
QString m_displayName; QString m_displayName;
QString m_runMode; RunMode m_runMode;
const QWeakPointer<RunConfiguration> m_runConfiguration; const QWeakPointer<RunConfiguration> m_runConfiguration;
Utils::OutputFormatter *m_outputFormatter; Utils::OutputFormatter *m_outputFormatter;
@@ -49,7 +49,7 @@ CodaQmlProfilerRunner::CodaQmlProfilerRunner(S60DeviceRunConfiguration *configur
QObject *parent) : QObject *parent) :
AbstractQmlProfilerRunner(parent), AbstractQmlProfilerRunner(parent),
m_configuration(configuration), m_configuration(configuration),
m_runControl(new CodaRunControl(configuration, Analyzer::Constants::MODE_ANALYZE)) m_runControl(new CodaRunControl(configuration, QmlProfilerRunMode))
{ {
connect(m_runControl, SIGNAL(finished()), this, SIGNAL(stopped())); connect(m_runControl, SIGNAL(finished()), this, SIGNAL(stopped()));
connect(m_runControl, connect(m_runControl,
+10 -7
View File
@@ -199,6 +199,11 @@ Core::Id QmlProfilerTool::id() const
return "QmlProfiler"; return "QmlProfiler";
} }
RunMode QmlProfilerTool::runMode() const
{
return QmlProfilerRunMode;
}
QString QmlProfilerTool::displayName() const QString QmlProfilerTool::displayName() const
{ {
return tr("QML Profiler"); return tr("QML Profiler");
@@ -365,19 +370,17 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
return engine; return engine;
} }
bool QmlProfilerTool::canRun(RunConfiguration *runConfiguration, const QString &mode) const bool QmlProfilerTool::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{ {
Q_UNUSED(mode);
if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration) if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)
|| qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration) || qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration)
|| qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration) || qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)
|| qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration)) || qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration))
return true; return mode == runMode();
return false; return false;
} }
AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration *runConfiguration, const QString &mode) const AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration *runConfiguration, RunMode mode) const
{ {
Q_UNUSED(mode); Q_UNUSED(mode);
@@ -693,7 +696,7 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0); AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id().toString()); ProjectExplorerPlugin::instance()->startRunControl(rc, tool->runMode());
} }
void QmlProfilerTool::tryToConnect() void QmlProfilerTool::tryToConnect()
@@ -786,7 +789,7 @@ void QmlProfilerTool::startTool(StartMode mode)
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
// ### not sure if we're supposed to check if the RunConFiguration isEnabled // ### not sure if we're supposed to check if the RunConFiguration isEnabled
Project *pro = pe->startupProject(); Project *pro = pe->startupProject();
pe->runProject(pro, id().toString()); pe->runProject(pro, runMode());
} else if (mode == StartRemote) { } else if (mode == StartRemote) {
startRemoteTool(this, mode); startRemoteTool(this, mode);
} }
+3 -2
View File
@@ -52,6 +52,7 @@ public:
~QmlProfilerTool(); ~QmlProfilerTool();
Core::Id id() const; Core::Id id() const;
ProjectExplorer::RunMode runMode() const;
QString displayName() const; QString displayName() const;
QString description() const; QString description() const;
ToolMode toolMode() const; ToolMode toolMode() const;
@@ -62,11 +63,11 @@ public:
ProjectExplorer::RunConfiguration *runConfiguration = 0); ProjectExplorer::RunConfiguration *runConfiguration = 0);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode) const; ProjectExplorer::RunMode mode) const;
Analyzer::AnalyzerStartParameters createStartParameters( Analyzer::AnalyzerStartParameters createStartParameters(
ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode) const; ProjectExplorer::RunMode mode) const;
QWidget *createWidgets(); QWidget *createWidgets();
void startTool(Analyzer::StartMode mode); void startTool(Analyzer::StartMode mode);
@@ -54,7 +54,7 @@ RemoteLinuxQmlProfilerRunner::RemoteLinuxQmlProfilerRunner(
= PluginManager::instance()->getObjects<IRunControlFactory>(); = PluginManager::instance()->getObjects<IRunControlFactory>();
foreach (IRunControlFactory *factory, runControlFactories) { foreach (IRunControlFactory *factory, runControlFactories) {
if (factory->canRun(runConfiguration, ProjectExplorer::Constants::RUNMODE)) { if (factory->canRun(runConfiguration, NormalRunMode)) {
runControlFactory = factory; runControlFactory = factory;
break; break;
} }
@@ -63,8 +63,7 @@ RemoteLinuxQmlProfilerRunner::RemoteLinuxQmlProfilerRunner(
QTC_ASSERT(runControlFactory, return); QTC_ASSERT(runControlFactory, return);
// create run control // create run control
RunControl *runControl = runControlFactory->create(runConfiguration, RunControl *runControl = runControlFactory->create(runConfiguration, NormalRunMode);
ProjectExplorer::Constants::RUNMODE);
m_runControl = qobject_cast<AbstractRemoteLinuxRunControl*>(runControl); m_runControl = qobject_cast<AbstractRemoteLinuxRunControl*>(runControl);
QTC_ASSERT(m_runControl, return); QTC_ASSERT(m_runControl, return);
@@ -54,13 +54,13 @@ namespace QmlProjectManager {
namespace Internal { namespace Internal {
QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration, QString mode) QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration, RunMode mode)
: RunControl(runConfiguration, mode) : RunControl(runConfiguration, mode)
{ {
m_applicationLauncher.setEnvironment(runConfiguration->environment()); m_applicationLauncher.setEnvironment(runConfiguration->environment());
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory()); m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
if (mode == ProjectExplorer::Constants::RUNMODE) { if (mode == NormalRunMode) {
m_executable = runConfiguration->viewerPath(); m_executable = runConfiguration->viewerPath();
} else { } else {
m_executable = runConfiguration->observerPath(); m_executable = runConfiguration->observerPath();
@@ -141,15 +141,15 @@ QmlProjectRunControlFactory::~QmlProjectRunControlFactory()
} }
bool QmlProjectRunControlFactory::canRun(RunConfiguration *runConfiguration, bool QmlProjectRunControlFactory::canRun(RunConfiguration *runConfiguration,
const QString &mode) const RunMode mode) const
{ {
QmlProjectRunConfiguration *config = QmlProjectRunConfiguration *config =
qobject_cast<QmlProjectRunConfiguration*>(runConfiguration); qobject_cast<QmlProjectRunConfiguration*>(runConfiguration);
if (!config) if (!config)
return false; return false;
if (mode == ProjectExplorer::Constants::RUNMODE) if (mode == NormalRunMode)
return !config->viewerPath().isEmpty(); return !config->viewerPath().isEmpty();
if (mode != Debugger::Constants::DEBUGMODE) if (mode != DebugRunMode)
return false; return false;
if (!Debugger::DebuggerPlugin::isActiveDebugLanguage(Debugger::QmlLanguage)) if (!Debugger::DebuggerPlugin::isActiveDebugLanguage(Debugger::QmlLanguage))
@@ -167,7 +167,7 @@ bool QmlProjectRunControlFactory::canRun(RunConfiguration *runConfiguration,
} }
RunControl *QmlProjectRunControlFactory::create(RunConfiguration *runConfiguration, RunControl *QmlProjectRunControlFactory::create(RunConfiguration *runConfiguration,
const QString &mode) RunMode mode)
{ {
QTC_ASSERT(canRun(runConfiguration, mode), return 0); QTC_ASSERT(canRun(runConfiguration, mode), return 0);
QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration *>(runConfiguration); QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration *>(runConfiguration);
@@ -184,9 +184,9 @@ RunControl *QmlProjectRunControlFactory::create(RunConfiguration *runConfigurati
} }
RunControl *runControl = 0; RunControl *runControl = 0;
if (mode == ProjectExplorer::Constants::RUNMODE) if (mode == NormalRunMode)
runControl = new QmlProjectRunControl(config, mode); runControl = new QmlProjectRunControl(config, mode);
else if (mode == Debugger::Constants::DEBUGMODE) else if (mode == DebugRunMode)
runControl = createDebugRunControl(config); runControl = createDebugRunControl(config);
return runControl; return runControl;
} }
@@ -46,7 +46,8 @@ class QmlProjectRunControl : public ProjectExplorer::RunControl
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration, QString mode); QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode);
virtual ~QmlProjectRunControl (); virtual ~QmlProjectRunControl ();
// RunControl // RunControl
@@ -77,8 +78,8 @@ public:
virtual ~QmlProjectRunControlFactory(); virtual ~QmlProjectRunControlFactory();
// IRunControlFactory // IRunControlFactory
virtual bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const; virtual bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
virtual ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode); virtual ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode);
virtual QString displayName() const; virtual QString displayName() const;
virtual ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration virtual ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration
*runConfiguration); *runConfiguration);
@@ -65,7 +65,7 @@ using namespace Coda;
enum { debug = 0 }; enum { debug = 0 };
CodaRunControl::CodaRunControl(RunConfiguration *runConfiguration, const QString &mode) : CodaRunControl::CodaRunControl(RunConfiguration *runConfiguration, RunMode mode) :
S60RunControlBase(runConfiguration, mode), S60RunControlBase(runConfiguration, mode),
m_port(0), m_port(0),
m_state(StateUninit), m_state(StateUninit),
@@ -57,7 +57,8 @@ class QT4PROJECTMANAGER_EXPORT CodaRunControl : public S60RunControlBase
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CodaRunControl(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode); CodaRunControl(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode);
virtual ~CodaRunControl(); virtual ~CodaRunControl();
virtual bool isRunning() const; virtual bool isRunning() const;
@@ -160,7 +160,7 @@ void S60DeviceDebugRunControl::remoteSetupRequested()
{ {
// This is called from Engine->setupInferior(), ie InferiorSetupRequested state // This is called from Engine->setupInferior(), ie InferiorSetupRequested state
QTC_ASSERT(runConfiguration()->useQmlDebugger() && !runConfiguration()->useCppDebugger(), return); QTC_ASSERT(runConfiguration()->useQmlDebugger() && !runConfiguration()->useCppDebugger(), return);
m_codaRunControl = new CodaRunControl(runConfiguration(), Debugger::Constants::DEBUGMODE); m_codaRunControl = new CodaRunControl(runConfiguration(), DebugRunMode);
connect(m_codaRunControl, SIGNAL(connected()), this, SLOT(codaConnected())); connect(m_codaRunControl, SIGNAL(connected()), this, SLOT(codaConnected()));
connect(m_codaRunControl, SIGNAL(finished()), this, SLOT(codaFinished())); connect(m_codaRunControl, SIGNAL(finished()), this, SLOT(codaFinished()));
connect(m_codaRunControl, SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)), this, SLOT(handleMessageFromCoda(ProjectExplorer::RunControl*,QString,Utils::OutputFormat))); connect(m_codaRunControl, SIGNAL(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)), this, SLOT(handleMessageFromCoda(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)));
@@ -218,16 +218,15 @@ S60DeviceDebugRunControlFactory::S60DeviceDebugRunControlFactory(QObject *parent
{ {
} }
bool S60DeviceDebugRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const bool S60DeviceDebugRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{ {
return mode == QLatin1String(Debugger::Constants::DEBUGMODE) return mode == DebugRunMode && qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
&& qobject_cast<S60DeviceRunConfiguration *>(runConfiguration) != 0;
} }
ProjectExplorer::RunControl* S60DeviceDebugRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) ProjectExplorer::RunControl* S60DeviceDebugRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode)
{ {
S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration); S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
QTC_ASSERT(rc && mode == QLatin1String(Debugger::Constants::DEBUGMODE), return 0); QTC_ASSERT(rc && mode == DebugRunMode, return 0);
const Debugger::DebuggerStartParameters startParameters = s60DebuggerStartParams(rc); const Debugger::DebuggerStartParameters startParameters = s60DebuggerStartParams(rc);
const Debugger::ConfigurationCheck check = Debugger::checkDebugConfiguration(startParameters); const Debugger::ConfigurationCheck check = Debugger::checkDebugConfiguration(startParameters);
if (!check) { if (!check) {
@@ -74,9 +74,9 @@ class S60DeviceDebugRunControlFactory : public ProjectExplorer::IRunControlFacto
{ {
public: public:
explicit S60DeviceDebugRunControlFactory(QObject *parent = 0); explicit S60DeviceDebugRunControlFactory(QObject *parent = 0);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const; bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode); ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode);
QString displayName() const; QString displayName() const;
ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration * /*runConfiguration */); ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration * /*runConfiguration */);
}; };
@@ -345,7 +345,7 @@ QString S60EmulatorRunConfigurationFactory::displayNameForId(const QString &id)
// ======== S60EmulatorRunControl // ======== S60EmulatorRunControl
S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runConfiguration, QString mode) S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runConfiguration, RunMode mode)
: RunControl(runConfiguration, mode) : RunControl(runConfiguration, mode)
{ {
// FIXME: This should be configurable! // FIXME: This should be configurable!
@@ -141,7 +141,8 @@ class S60EmulatorRunControl : public ProjectExplorer::RunControl
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit S60EmulatorRunControl(S60EmulatorRunConfiguration *runConfiguration, QString mode); S60EmulatorRunControl(S60EmulatorRunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode);
~S60EmulatorRunControl() {} ~S60EmulatorRunControl() {}
void start(); void start();
virtual StopResult stop(); virtual StopResult stop();
@@ -74,17 +74,17 @@ template <class RunControl, class RunConfiguration>
class RunControlFactory : public ProjectExplorer::IRunControlFactory class RunControlFactory : public ProjectExplorer::IRunControlFactory
{ {
public: public:
explicit RunControlFactory(const QString &mode, RunControlFactory(ProjectExplorer::RunMode mode, const QString &name, QObject *parent = 0) :
const QString &name,
QObject *parent = 0) :
IRunControlFactory(parent), m_mode(mode), m_name(name) {} IRunControlFactory(parent), m_mode(mode), m_name(name) {}
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const { bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const
return (mode == m_mode) {
&& (qobject_cast<RunConfiguration *>(runConfiguration) != 0); return mode == m_mode && qobject_cast<RunConfiguration *>(runConfiguration);
} }
ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) { ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode)
{
RunConfiguration *rc = qobject_cast<RunConfiguration *>(runConfiguration); RunConfiguration *rc = qobject_cast<RunConfiguration *>(runConfiguration);
QTC_ASSERT(rc && mode == m_mode, return 0); QTC_ASSERT(rc && mode == m_mode, return 0);
return new RunControl(rc, mode); return new RunControl(rc, mode);
@@ -99,7 +99,7 @@ public:
} }
private: private:
const QString m_mode; const ProjectExplorer::RunMode m_mode;
const QString m_name; const QString m_name;
}; };
@@ -117,10 +117,9 @@ S60Manager::S60Manager(QObject *parent) : QObject(parent)
addAutoReleasedObject(new S60EmulatorRunConfigurationFactory); addAutoReleasedObject(new S60EmulatorRunConfigurationFactory);
addAutoReleasedObject(new RunControlFactory<S60EmulatorRunControl, S60EmulatorRunConfiguration> addAutoReleasedObject(new RunControlFactory<S60EmulatorRunControl, S60EmulatorRunConfiguration>
(QLatin1String(ProjectExplorer::Constants::RUNMODE), (ProjectExplorer::NormalRunMode, tr("Run in Emulator"), parent));
tr("Run in Emulator"), parent));
addAutoReleasedObject(new S60DeviceRunConfigurationFactory); addAutoReleasedObject(new S60DeviceRunConfigurationFactory);
addAutoReleasedObject(new S60RunControlFactory(QLatin1String(ProjectExplorer::Constants::RUNMODE), addAutoReleasedObject(new S60RunControlFactory(ProjectExplorer::NormalRunMode,
tr("Run on Device"), parent)); tr("Run on Device"), parent));
addAutoReleasedObject(new S60CreatePackageStepFactory); addAutoReleasedObject(new S60CreatePackageStepFactory);
addAutoReleasedObject(new S60DeployStepFactory); addAutoReleasedObject(new S60DeployStepFactory);
@@ -73,7 +73,8 @@ QString S60RunControlBase::msgListFile(const QString &file)
return rc; return rc;
} }
S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration, const QString &mode) : S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration,
RunMode mode) :
RunControl(runConfiguration, mode), RunControl(runConfiguration, mode),
m_launchProgress(0) m_launchProgress(0)
{ {
@@ -91,9 +92,7 @@ S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration, const Q
m_targetName = s60runConfig->targetName(); m_targetName = s60runConfig->targetName();
m_commandLineArguments = s60runConfig->commandLineArguments(); m_commandLineArguments = s60runConfig->commandLineArguments();
QString qmlArgs = s60runConfig->qmlCommandLineArguments(); QString qmlArgs = s60runConfig->qmlCommandLineArguments();
if (((mode == Debugger::Constants::DEBUGMODE) if ((mode == DebugRunMode || mode == QmlProfilerRunMode) && !qmlArgs.isEmpty()) {
|| (mode == Analyzer::Constants::MODE_ANALYZE))
&& !qmlArgs.isEmpty()) {
m_commandLineArguments.prepend(' '); m_commandLineArguments.prepend(' ');
m_commandLineArguments.prepend(qmlArgs); m_commandLineArguments.prepend(qmlArgs);
} }
@@ -45,7 +45,8 @@ class QT4PROJECTMANAGER_EXPORT S60RunControlBase : public ProjectExplorer::RunCo
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit S60RunControlBase(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode); S60RunControlBase(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode);
~S60RunControlBase(); ~S60RunControlBase();
virtual void start(); virtual void start();
@@ -43,14 +43,12 @@ using namespace ProjectExplorer;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
S60RunControlFactory::S60RunControlFactory(const QString &mode, S60RunControlFactory::S60RunControlFactory(RunMode mode, const QString &name, QObject *parent) :
const QString &name,
QObject *parent) :
IRunControlFactory(parent), m_mode(mode), m_name(name) IRunControlFactory(parent), m_mode(mode), m_name(name)
{ {
} }
bool S60RunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const bool S60RunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{ {
if (mode != m_mode) if (mode != m_mode)
return false; return false;
@@ -61,7 +59,7 @@ bool S60RunControlFactory::canRun(RunConfiguration *runConfiguration, const QStr
return activeDeployConf != 0; return activeDeployConf != 0;
} }
RunControl* S60RunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode) RunControl* S60RunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode)
{ {
S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration); S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
@@ -41,20 +41,22 @@ namespace Internal {
class S60RunControlFactory : public ProjectExplorer::IRunControlFactory class S60RunControlFactory : public ProjectExplorer::IRunControlFactory
{ {
public: public:
explicit S60RunControlFactory(const QString &mode, explicit S60RunControlFactory(ProjectExplorer::RunMode mode,
const QString &name, const QString &name,
QObject *parent = 0); QObject *parent = 0);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const; bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode) const;
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode); ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode);
QString displayName() const; QString displayName() const;
ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration *runConfiguration); ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration *runConfiguration);
private: private:
const QString m_mode; const ProjectExplorer::RunMode m_mode;
const QString m_name; const QString m_name;
}; };
@@ -47,7 +47,7 @@ namespace RemoteLinux {
using ProjectExplorer::RunConfiguration; using ProjectExplorer::RunConfiguration;
AbstractRemoteLinuxRunControl::AbstractRemoteLinuxRunControl(RunConfiguration *rc) AbstractRemoteLinuxRunControl::AbstractRemoteLinuxRunControl(RunConfiguration *rc)
: RunControl(rc, ProjectExplorer::Constants::RUNMODE) : RunControl(rc, ProjectExplorer::NormalRunMode)
, m_running(false) , m_running(false)
{ {
} }
@@ -57,11 +57,9 @@ RemoteLinuxRunControlFactory::~RemoteLinuxRunControlFactory()
{ {
} }
bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
const QString &mode) const
{ {
if (mode != QLatin1String(ProjectExplorer::Constants::RUNMODE) if (mode != NormalRunMode && mode != DebugRunMode)
&& mode != QLatin1String(Debugger::Constants::DEBUGMODE))
return false; return false;
if (!runConfiguration->isEnabled() if (!runConfiguration->isEnabled()
@@ -71,19 +69,18 @@ bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration,
const RemoteLinuxRunConfiguration * const remoteRunConfig const RemoteLinuxRunConfiguration * const remoteRunConfig
= qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration); = qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration);
if (mode == QLatin1String(Debugger::Constants::DEBUGMODE)) if (mode == DebugRunMode)
return remoteRunConfig->portsUsedByDebuggers() <= remoteRunConfig->freePorts().count(); return remoteRunConfig->portsUsedByDebuggers() <= remoteRunConfig->freePorts().count();
return true; return true;
} }
RunControl* RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, RunMode mode)
const QString &mode)
{ {
Q_ASSERT(canRun(runConfig, mode)); Q_ASSERT(canRun(runConfig, mode));
RemoteLinuxRunConfiguration *rc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig); RemoteLinuxRunConfiguration *rc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig);
Q_ASSERT(rc); Q_ASSERT(rc);
if (mode == ProjectExplorer::Constants::RUNMODE) if (mode == ProjectExplorer::NormalRunMode)
return new RemoteLinuxRunControl(rc); return new RemoteLinuxRunControl(rc);
const DebuggerStartParameters params const DebuggerStartParameters params
@@ -46,9 +46,10 @@ public:
QString displayName() const; QString displayName() const;
ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration *runConfiguration); ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration *runConfiguration);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const; bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode) const;
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode); ProjectExplorer::RunMode mode);
}; };
} // namespace Internal } // namespace Internal
+5
View File
@@ -518,6 +518,11 @@ Core::Id CallgrindTool::id() const
return "Callgrind"; return "Callgrind";
} }
ProjectExplorer::RunMode CallgrindTool::runMode() const
{
return ProjectExplorer::CallgrindRunMode;
}
QString CallgrindTool::displayName() const QString CallgrindTool::displayName() const
{ {
return tr("Valgrind Function Profiler"); return tr("Valgrind Function Profiler");
+1
View File
@@ -49,6 +49,7 @@ public:
~CallgrindTool(); ~CallgrindTool();
Core::Id id() const; Core::Id id() const;
ProjectExplorer::RunMode runMode() const;
QString displayName() const; QString displayName() const;
QString description() const; QString description() const;
ToolMode toolMode() const; ToolMode toolMode() const;
+5
View File
@@ -290,6 +290,11 @@ Core::Id MemcheckTool::id() const
return "Memcheck"; return "Memcheck";
} }
ProjectExplorer::RunMode MemcheckTool::runMode() const
{
return ProjectExplorer::MemcheckRunMode;
}
QString MemcheckTool::displayName() const QString MemcheckTool::displayName() const
{ {
return tr("Valgrind Memory Analyzer"); return tr("Valgrind Memory Analyzer");
+1
View File
@@ -94,6 +94,7 @@ public:
MemcheckTool(QObject *parent); MemcheckTool(QObject *parent);
Core::Id id() const; Core::Id id() const;
ProjectExplorer::RunMode runMode() const;
QString displayName() const; QString displayName() const;
QString description() const; QString description() const;
+1 -1
View File
@@ -84,7 +84,7 @@ static void startRemoteTool(IAnalyzerTool *tool)
//m_currentRunControl = rc; //m_currentRunControl = rc;
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id().toString()); ProjectExplorerPlugin::instance()->startRunControl(rc, tool->runMode());
} }
void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode) void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode)
+3 -4
View File
@@ -49,14 +49,13 @@ ValgrindTool::ValgrindTool(QObject *parent) :
{ {
} }
bool ValgrindTool::canRun(ProjectExplorer::RunConfiguration *, const QString &) const bool ValgrindTool::canRun(RunConfiguration *, RunMode mode) const
{ {
return true; return mode == runMode();
} }
Analyzer::AnalyzerStartParameters ValgrindTool::createStartParameters( Analyzer::AnalyzerStartParameters ValgrindTool::createStartParameters(
ProjectExplorer::RunConfiguration *runConfiguration, RunConfiguration *runConfiguration, RunMode mode) const
const QString &mode) const
{ {
Q_UNUSED(mode); Q_UNUSED(mode);
+2 -2
View File
@@ -45,11 +45,11 @@ public:
explicit ValgrindTool(QObject *parent); explicit ValgrindTool(QObject *parent);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode) const; ProjectExplorer::RunMode mode) const;
Analyzer::AnalyzerStartParameters createStartParameters( Analyzer::AnalyzerStartParameters createStartParameters(
ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode) const; ProjectExplorer::RunMode mode) const;
}; };
} // namespace Internal } // namespace Internal