Commit a6ff74c0 authored by hjk's avatar hjk Committed by hjk

ProjectExplorer: use enum instead of QString for run mode

Change-Id: Ia906944a489b09afdea59f74afbf759b4caebe37
Reviewed-by: default avatarAurindam Jana <aurindam.jana@nokia.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 2230f301
......@@ -560,7 +560,7 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool)
return;
}
pe->runProject(pro, tool->id().toString());
pe->runProject(pro, tool->runMode());
}
bool AnalyzerManagerPrivate::isActionRunnable(QAction *action) const
......@@ -572,7 +572,7 @@ bool AnalyzerManagerPrivate::isActionRunnable(QAction *action) const
IAnalyzerTool *tool = m_toolFromAction.value(action);
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
return pe->canRun(pe->startupProject(), tool->id().toString());
return pe->canRun(pe->startupProject(), tool->runMode());
}
void AnalyzerManagerPrivate::startTool()
......@@ -761,7 +761,7 @@ void AnalyzerManagerPrivate::updateRunActions()
else if (!m_currentTool)
disabledReason = tr("No analyzer tool selected.");
else
disabledReason = pe->cannotRunReason(project, m_currentTool->id().toString());
disabledReason = pe->cannotRunReason(project, m_currentTool->runMode());
m_startAction->setEnabled(startEnabled);
m_startAction->setToolTip(disabledReason);
......@@ -908,10 +908,10 @@ void AnalyzerManager::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)
if (id.name().startsWith(tool->id().name()))
if (tool->runMode() == runMode)
return tool;
return 0;
}
......
......@@ -38,6 +38,7 @@
#include "analyzerbase_global.h"
#include "analyzerconstants.h"
#include <coreplugin/id.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <QtCore/QObject>
......@@ -72,7 +73,7 @@ public:
// Register a tool and initialize it.
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.
static QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title,
......
......@@ -80,7 +80,7 @@ AnalyzerRunControl::Private::Private()
AnalyzerRunControl::AnalyzerRunControl(IAnalyzerTool *tool,
const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
: RunControl(runConfiguration, tool->id().toString()),
: RunControl(runConfiguration, tool->runMode()),
d(new Private)
{
d->m_engine = tool->createEngine(sp, runConfiguration);
......
......@@ -60,17 +60,17 @@ QString AnalyzerRunControlFactory::displayName() const
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)
return tool->canRun(runConfiguration, mode);
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)
return 0;
......
......@@ -49,8 +49,9 @@ public:
// IRunControlFactory implementation
QString displayName() const;
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
bool canRun(RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode);
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
......
......@@ -40,6 +40,7 @@
#include "analyzerstartparameters.h"
#include <coreplugin/id.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <QtCore/QObject>
......@@ -76,6 +77,8 @@ public:
/// Returns a unique ID for this tool.
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.
virtual QString displayName() const = 0;
/// Returns a user readable description name for this tool.
......@@ -124,12 +127,12 @@ public:
/// Returns true if the tool can be run
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
virtual AnalyzerStartParameters createStartParameters(
ProjectExplorer::RunConfiguration *runConfiguration,
const QString &mode) const = 0;
ProjectExplorer::RunMode mode) const = 0;
virtual void startTool(StartMode mode) = 0;
......
......@@ -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_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)
const char INTERRUPT[] = "Debugger.Interrupt";
const char CONTINUE[] = "Debugger.Continue";
......
......@@ -1427,21 +1427,21 @@ void DebuggerPluginPrivate::debugProject()
{
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (Project *pro = pe->startupProject())
pe->runProject(pro, QLatin1String(Constants::DEBUGMODE));
pe->runProject(pro, DebugRunMode);
}
void DebuggerPluginPrivate::debugProjectWithoutDeploy()
{
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (Project *pro = pe->startupProject())
pe->runProject(pro, QLatin1String(Constants::DEBUGMODE), true);
pe->runProject(pro, DebugRunMode, true);
}
void DebuggerPluginPrivate::debugProjectBreakMain()
{
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (Project *pro = pe->startupProject())
pe->runProject(pro, QLatin1String(Constants::DEBUGMODE2));
pe->runProject(pro, DebugRunModeWithBreakOnMain);
}
void DebuggerPluginPrivate::startExternalApplication()
......@@ -2048,7 +2048,7 @@ void DebuggerPluginPrivate::displayDebugger(DebuggerEngine *engine, bool updateE
void DebuggerPluginPrivate::startDebugger(RunControl *rc)
{
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();
Project *project = pe->startupProject();
const QString debugMode = _(Constants::DEBUGMODE);
const bool canRun = pe->canRun(project, debugMode);
const bool canRun = pe->canRun(project, DebugRunMode);
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);
// Step into/next: Start and break at 'main' unless a debugger is running.
if (m_snapshotHandler->currentIndex() < 0) {
const QString debugMode2 = _(Constants::DEBUGMODE2);
const bool canRunAndBreakMain = pe->canRun(project, debugMode2);
const bool canRunAndBreakMain = pe->canRun(project, DebugRunModeWithBreakOnMain);
m_stepAction->setEnabled(canRunAndBreakMain);
m_nextAction->setEnabled(canRunAndBreakMain);
QString toolTip;
......@@ -2395,10 +2393,10 @@ void DebuggerPluginPrivate::updateDebugActions()
toolTip = tr("Start '%1' and break at function 'main()'")
.arg(project->displayName());
} else {
// Do not display long tooltip saying 'debugMode2 is not supported
// for project' for projects to which 'break at main' is not applicable.
// Do not display long tooltip saying run mode is not supported
// for project for projects to which 'break at main' is not applicable.
if (!canRun)
toolTip = pe->cannotRunReason(project, debugMode2);
toolTip = pe->cannotRunReason(project, DebugRunModeWithBreakOnMain);
}
m_stepAction->setToolTip(toolTip);
m_nextAction->setToolTip(toolTip);
......
......@@ -49,13 +49,14 @@ public:
// FIXME: What to do in case of a 0 runConfiguration?
typedef ProjectExplorer::RunConfiguration RunConfiguration;
typedef ProjectExplorer::RunControl RunControl;
typedef ProjectExplorer::RunMode RunMode;
DebuggerRunControl *create(const DebuggerStartParameters &sp,
RunConfiguration *runConfiguration = 0);
// ProjectExplorer::IRunControlFactory
// FIXME: Used by qmljsinspector.cpp:469
RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
RunControl *create(RunConfiguration *runConfiguration, RunMode mode);
bool canRun(RunConfiguration *runConfiguration, RunMode mode) const;
static DebuggerEngine *createEngine(DebuggerEngineType et,
const DebuggerStartParameters &sp,
......
......@@ -185,7 +185,7 @@ DebuggerRunControlPrivate::DebuggerRunControlPrivate(DebuggerRunControl *parent,
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
const DebuggerStartParameters &sp,
const QPair<DebuggerEngineType, DebuggerEngineType> &masterSlaveEngineTypes)
: RunControl(runConfiguration, QLatin1String(Constants::DEBUGMODE)),
: RunControl(runConfiguration, ProjectExplorer::DebugRunMode),
d(new DebuggerRunControlPrivate(this, runConfiguration))
{
connect(this, SIGNAL(finished()), SLOT(handleFinished()));
......@@ -667,10 +667,9 @@ DebuggerRunControlFactory::DebuggerRunControlFactory(QObject *parent,
: 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)
|| mode == QLatin1String(Constants::DEBUGMODE2))
return (mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain)
&& qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
}
......@@ -782,14 +781,13 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
}
RunControl *DebuggerRunControlFactory::create
(RunConfiguration *runConfiguration, const QString &mode)
(RunConfiguration *runConfiguration, RunMode mode)
{
QTC_ASSERT(mode == QLatin1String(Constants::DEBUGMODE)
|| mode == QLatin1String(Constants::DEBUGMODE2), return 0);
QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0);
DebuggerStartParameters sp = localStartParameters(runConfiguration);
if (sp.startMode == NoStartMode)
return 0;
if (mode == QLatin1String(Constants::DEBUGMODE2))
if (mode == DebugRunModeWithBreakOnMain)
sp.breakOnMain = true;
return create(sp, runConfiguration);
}
......
......@@ -87,7 +87,7 @@ bool MaemoRunConfiguration::isEnabled() const
{
if (!RemoteLinuxRunConfiguration::isEnabled())
return false;
if (!hasEnoughFreePorts(ProjectExplorer::Constants::RUNMODE)) {
if (!hasEnoughFreePorts(NormalRunMode)) {
setDisabledReason(tr("Not enough free ports on the device."));
return false;
}
......@@ -165,15 +165,15 @@ QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const
+ QFileInfo(localExecutableFilePath()).fileName();
}
bool MaemoRunConfiguration::hasEnoughFreePorts(const QString &mode) const
bool MaemoRunConfiguration::hasEnoughFreePorts(RunMode mode) const
{
const int freePortCount = freePorts().count();
const bool remoteMountsAllowed = maemoTarget()->allowsRemoteMounts();
const int mountDirCount = remoteMountsAllowed
? remoteMounts()->validMountSpecificationCount() : 0;
if (mode == Debugger::Constants::DEBUGMODE)
if (mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain)
return freePortCount >= mountDirCount + portsUsedByDebuggers();
if (mode == ProjectExplorer::Constants::RUNMODE)
if (mode == NormalRunMode)
return freePortCount >= mountDirCount;
return false;
}
......
......@@ -55,7 +55,7 @@ public:
RemoteLinux::PortList freePorts() const;
Internal::MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; }
bool hasEnoughFreePorts(const QString &mode) const;
bool hasEnoughFreePorts(ProjectExplorer::RunMode mode) const;
QString localDirToMountForRemoteGdb() const;
QString remoteProjectSourcesMountPoint() const;
......
......@@ -153,8 +153,7 @@ MaemoRunControlFactory::~MaemoRunControlFactory()
{
}
bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration,
const QString &mode) const
bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{
const MaemoRunConfiguration * const maemoRunConfig
= qobject_cast<MaemoRunConfiguration *>(runConfiguration);
......@@ -163,16 +162,15 @@ bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration,
return maemoRunConfig->hasEnoughFreePorts(mode);
}
RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig,
const QString &mode)
RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig, RunMode mode)
{
Q_ASSERT(mode == ProjectExplorer::Constants::RUNMODE || mode == Debugger::Constants::DEBUGMODE);
Q_ASSERT(mode == NormalRunMode || mode == DebugRunMode);
Q_ASSERT(canRun(runConfig, mode));
MaemoRunConfiguration *rc = qobject_cast<MaemoRunConfiguration *>(runConfig);
Q_ASSERT(rc);
if (mode == ProjectExplorer::Constants::RUNMODE)
if (mode == NormalRunMode)
return new MaemoRunControl(rc);
const DebuggerStartParameters params
......
......@@ -80,8 +80,8 @@ public:
QString displayName() const;
RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode);
};
} // 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))
&& (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration) != 0);
return mode == NormalRunMode && qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
}
QString LocalApplicationRunControlFactory::displayName() const
......@@ -64,7 +63,7 @@ QString LocalApplicationRunControlFactory::displayName() const
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);
LocalApplicationRunConfiguration *localRunConfiguration = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
......@@ -82,7 +81,7 @@ RunConfigWidget *LocalApplicationRunControlFactory::createConfigurationWidget(Ru
// ApplicationRunControl
LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, QString mode)
LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, RunMode mode)
: RunControl(rc, mode)
{
Utils::Environment env = rc->environment();
......
......@@ -35,6 +35,7 @@
#include "runconfiguration.h"
#include "applicationlauncher.h"
#include "projectexplorerconstants.h"
namespace ProjectExplorer {
......@@ -47,9 +48,9 @@ class LocalApplicationRunControlFactory : public IRunControlFactory
public:
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 RunControl* create(RunConfiguration *runConfiguration, const QString &mode);
virtual RunControl* create(RunConfiguration *runConfiguration, RunMode mode);
virtual RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
};
......@@ -57,7 +58,7 @@ class LocalApplicationRunControl : public RunControl
{
Q_OBJECT
public:
LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration, QString mode);
LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration, RunMode mode);
virtual ~LocalApplicationRunControl();
virtual void start();
virtual StopResult stop();
......
......@@ -230,7 +230,7 @@ struct ProjectExplorerPluginPrivate {
QString m_lastOpenDirectory;
RunConfiguration *m_delayedRunConfiguration; // TODO this is not right
QString m_runMode;
RunMode m_runMode;
QString m_projectFilterString;
Internal::MiniProjectTargetSelector * m_targetSelector;
Internal::ProjectExplorerSettings m_projectExplorerSettings;
......@@ -245,6 +245,7 @@ ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
m_currentProject(0),
m_currentNode(0),
m_delayedRunConfiguration(0),
m_runMode(NoRunMode),
m_projectsMode(0),
m_toolChainManager(0)
{
......@@ -1548,7 +1549,7 @@ void ProjectExplorerPlugin::buildStateChanged(Project * pro)
updateActions();
}
void ProjectExplorerPlugin::executeRunConfiguration(RunConfiguration *runConfiguration, const QString &runMode)
void ProjectExplorerPlugin::executeRunConfiguration(RunConfiguration *runConfiguration, RunMode runMode)
{
if (IRunControlFactory *runControlFactory = findRunControlFactory(runConfiguration, 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);
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->showTabFor(runControl);
connect(runControl, SIGNAL(finished()), this, SLOT(runControlFinished()));
......@@ -1600,7 +1601,7 @@ void ProjectExplorerPlugin::buildQueueFinished(bool success)
d->m_buildManager->showTaskWindow();
}
d->m_delayedRunConfiguration = 0;
d->m_runMode.clear();
d->m_runMode = NoRunMode;
}
void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node *node)
......@@ -1935,19 +1936,19 @@ void ProjectExplorerPlugin::cleanSession()
void ProjectExplorerPlugin::runProject()
{
runProject(startupProject(), QLatin1String(ProjectExplorer::Constants::RUNMODE));
runProject(startupProject(), NormalRunMode);
}
void ProjectExplorerPlugin::runProjectWithoutDeploy()
{
runProject(startupProject(), QLatin1String(ProjectExplorer::Constants::RUNMODE), true);
runProject(startupProject(), NormalRunMode, true);
}
void ProjectExplorerPlugin::runProjectContextMenu()
{
ProjectNode *projectNode = qobject_cast<ProjectNode*>(d->m_currentNode);
if (projectNode == d->m_currentProject->rootProjectNode() || !projectNode) {
runProject(d->m_currentProject, QLatin1String(ProjectExplorer::Constants::RUNMODE));
runProject(d->m_currentProject, NormalRunMode);
} else {
QAction *act = qobject_cast<QAction *>(sender());
if (!act)
......@@ -1955,7 +1956,7 @@ void ProjectExplorerPlugin::runProjectContextMenu()
RunConfiguration *rc = act->data().value<RunConfiguration *>();
if (!rc)
return;
runRunConfiguration(rc, QLatin1String(ProjectExplorer::Constants::RUNMODE));
runRunConfiguration(rc, NormalRunMode);
}
}
......@@ -2059,7 +2060,7 @@ bool ProjectExplorerPlugin::hasDeploySettings(Project *pro)
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)
return;
......@@ -2068,7 +2069,7 @@ void ProjectExplorerPlugin::runProject(Project *pro, const QString &mode, const
}
void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguration *rc,
const QString &mode,
RunMode runMode,
const bool forceSkipDeploy)
{
if (!rc->isEnabled())
......@@ -2090,10 +2091,10 @@ void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguratio
if (queueCount > 0) {
// delay running till after our queued steps were processed
d->m_runMode = mode;
d->m_runMode = runMode;
d->m_delayedRunConfiguration = rc;
} else {
executeRunConfiguration(rc, mode);
executeRunConfiguration(rc, runMode);
}
emit updateRunActions();
}
......@@ -2190,7 +2191,7 @@ void ProjectExplorerPlugin::activeRunConfigurationChanged()
}
// 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();
const QList<IRunControlFactory *> factories = pm->getObjects<IRunControlFactory>();
......@@ -2254,7 +2255,7 @@ void ProjectExplorerPlugin::updateDeployActions()
emit updateRunActions();
}
bool ProjectExplorerPlugin::canRun(Project *project, const QString &runMode)
bool ProjectExplorerPlugin::canRun(Project *project, RunMode runMode)
{
if (!project ||
!project->activeTarget() ||
......@@ -2277,7 +2278,7 @@ bool ProjectExplorerPlugin::canRun(Project *project, const QString &runMode)
return (canRun && !building);
}
QString ProjectExplorerPlugin::cannotRunReason(Project *project, const QString &runMode)
QString ProjectExplorerPlugin::cannotRunReason(Project *project, RunMode runMode)
{
if (!project)
return tr("No active project");
......@@ -2317,10 +2318,9 @@ QString ProjectExplorerPlugin::cannotRunReason(Project *project, const QString &
void ProjectExplorerPlugin::slotUpdateRunActions()
{
Project *project = startupProject();
const QString runMode = QLatin1String(ProjectExplorer::Constants::RUNMODE);
const bool state = canRun(project, runMode);
const bool state = canRun(project, NormalRunMode);
d->m_runAction->setEnabled(state);
d->m_runAction->setToolTip(cannotRunReason(project, runMode));
d->m_runAction->setToolTip(cannotRunReason(project, NormalRunMode));
d->m_runWithoutDeployAction->setEnabled(state);
}
......
......@@ -34,6 +34,7 @@
#define PROJECTEXPLORER_H
#include "projectexplorer_export.h"
#include "projectexplorerconstants.h"
#include <extensionsystem/iplugin.h>
......@@ -105,7 +106,7 @@ public:
void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
Internal::ProjectExplorerSettings projectExplorerSettings() const;
void startRunControl(RunControl *runControl, const QString &mode);
void startRunControl(RunControl *runControl, RunMode runMode);
// internal public for FlatModel
void renameFile(Node *node, const QString &to);
......@@ -113,10 +114,10 @@ public:
bool coreAboutToClose();
QList<QPair<QString, QString> > recentProjects();
bool canRun(Project *pro, const QString &runMode);
QString cannotRunReason(Project *project, const QString &runMode);
void runProject(Project *pro, const QString &mode, const bool forceSkipDeploy = false);
void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, const QString &mode,
bool canRun(Project *pro, RunMode runMode);
QString cannotRunReason(Project *project, RunMode runMode);
void runProject(Project *pro, RunMode, const bool forceSkipDeploy = false);
void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, RunMode runMode,
const bool forceSkipDeploy = false);
void addExistingFiles(ProjectExplorer::ProjectNode *projectNode, const QStringList &filePaths);
......@@ -140,7 +141,7 @@ signals:
void currentProjectChanged(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 settingsChanged();
......@@ -262,7 +263,7 @@ private:
int queue(QList<Project *>, QStringList stepIds);
void updateContextMenuActions();
bool parseArguments(const QStringList &arguments, QString *error);
void executeRunConfiguration(RunConfiguration *, const QString &mode);
void executeRunConfiguration(RunConfiguration *, RunMode mode);
bool hasBuildSettings(Project *pro);
QPair<bool, QString> buildSettingsEnabledForSession();
QPair<bool, QString> buildSettingsEnabled(Project *pro);
......@@ -271,7 +272,7 @@ private:
void setCurrent(Project *project, QString filePath, Node *node);
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);
......
......@@ -88,8 +88,6 @@ const char SHOW_TASK_IN_EDITOR[] = "ProjectExplorer.ShowTaskInEditor";
const char VCS_ANNOTATE_TASK[] = "ProjectExplorer.VcsAnnotateTask";
const char SHOW_TASK_OUTPUT[] = "ProjectExplorer.ShowTaskOutput";
// Run modes
const char RUNMODE[] = "ProjectExplorer.RunMode";
const char SELECTTARGET[] = "ProjectExplorer.SelectTarget";
const char SELECTTARGETQUICK[] = "ProjectExplorer.SelectTargetQuick";
......@@ -224,6 +222,18 @@ const int QML_DEFAULT_DEBUG_SERVER_PORT = 3768;
const char DEFAULT_WORKING_DIR[] = "%{buildDir}";
} // namespace Constants
// Run modes
enum RunMode {
NoRunMode,
NormalRunMode,
DebugRunMode,
DebugRunModeWithBreakOnMain,