forked from qt-creator/qt-creator
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:
@@ -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,
|
||||
QmlProfilerRunMode,
|
||||
CallgrindRunMode,
|
||||
MemcheckRunMode
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#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.
|
||||
*/
|
||||
|
||||
RunControl::RunControl(RunConfiguration *runConfiguration, QString mode)
|
||||
RunControl::RunControl(RunConfiguration *runConfiguration, RunMode mode)
|
||||
: m_runMode(mode), m_runConfiguration(runConfiguration), m_outputFormatter(0)
|
||||
{
|
||||
if (runConfiguration) {
|
||||
@@ -526,7 +526,7 @@ Utils::OutputFormatter *RunControl::outputFormatter()
|
||||
return m_outputFormatter;
|
||||
}
|
||||
|
||||
QString RunControl::runMode() const
|
||||
RunMode RunControl::runMode() const
|
||||
{
|
||||
return m_runMode;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "projectconfiguration.h"
|
||||
#include "projectexplorer_export.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
|
||||
#include <utils/outputformat.h>
|
||||
|
||||
@@ -190,8 +191,8 @@ public:
|
||||
explicit IRunControlFactory(QObject *parent = 0);
|
||||
virtual ~IRunControlFactory();
|
||||
|
||||
virtual bool canRun(RunConfiguration *runConfiguration, const QString &mode) const = 0;
|
||||
virtual RunControl* create(RunConfiguration *runConfiguration, const QString &mode) = 0;
|
||||
virtual bool canRun(RunConfiguration *runConfiguration, RunMode mode) const = 0;
|
||||
virtual RunControl *create(RunConfiguration *runConfiguration, RunMode mode) = 0;
|
||||
|
||||
virtual QString displayName() const = 0;
|
||||
|
||||
@@ -223,7 +224,7 @@ public:
|
||||
AsynchronousStop // Stop sequence has been started
|
||||
};
|
||||
|
||||
explicit RunControl(RunConfiguration *runConfiguration, QString mode);
|
||||
RunControl(RunConfiguration *runConfiguration, RunMode mode);
|
||||
virtual ~RunControl();
|
||||
virtual void start() = 0;
|
||||
|
||||
@@ -240,7 +241,7 @@ public:
|
||||
bool sameRunConfiguration(const RunControl *other) const;
|
||||
|
||||
Utils::OutputFormatter *outputFormatter();
|
||||
QString runMode() const;
|
||||
RunMode runMode() const;
|
||||
|
||||
public slots:
|
||||
void bringApplicationToForeground(qint64 pid);
|
||||
@@ -264,7 +265,7 @@ protected:
|
||||
|
||||
private:
|
||||
QString m_displayName;
|
||||
QString m_runMode;
|
||||
RunMode m_runMode;
|
||||
const QWeakPointer<RunConfiguration> m_runConfiguration;
|
||||
Utils::OutputFormatter *m_outputFormatter;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ CodaQmlProfilerRunner::CodaQmlProfilerRunner(S60DeviceRunConfiguration *configur
|
||||
QObject *parent) :
|
||||
AbstractQmlProfilerRunner(parent),
|
||||
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,
|
||||
|
||||
@@ -199,6 +199,11 @@ Core::Id QmlProfilerTool::id() const
|
||||
return "QmlProfiler";
|
||||
}
|
||||
|
||||
RunMode QmlProfilerTool::runMode() const
|
||||
{
|
||||
return QmlProfilerRunMode;
|
||||
}
|
||||
|
||||
QString QmlProfilerTool::displayName() const
|
||||
{
|
||||
return tr("QML Profiler");
|
||||
@@ -365,19 +370,17 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
|
||||
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)
|
||||
|| qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration)
|
||||
|| qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)
|
||||
|| qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration))
|
||||
return true;
|
||||
return mode == runMode();
|
||||
return false;
|
||||
}
|
||||
|
||||
AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration *runConfiguration, const QString &mode) const
|
||||
AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration *runConfiguration, RunMode mode) const
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
|
||||
@@ -693,7 +696,7 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
||||
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()
|
||||
@@ -786,7 +789,7 @@ void QmlProfilerTool::startTool(StartMode mode)
|
||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||
// ### not sure if we're supposed to check if the RunConFiguration isEnabled
|
||||
Project *pro = pe->startupProject();
|
||||
pe->runProject(pro, id().toString());
|
||||
pe->runProject(pro, runMode());
|
||||
} else if (mode == StartRemote) {
|
||||
startRemoteTool(this, mode);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
~QmlProfilerTool();
|
||||
|
||||
Core::Id id() const;
|
||||
ProjectExplorer::RunMode runMode() const;
|
||||
QString displayName() const;
|
||||
QString description() const;
|
||||
ToolMode toolMode() const;
|
||||
@@ -62,11 +63,11 @@ public:
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||
|
||||
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
const QString &mode) const;
|
||||
ProjectExplorer::RunMode mode) const;
|
||||
|
||||
Analyzer::AnalyzerStartParameters createStartParameters(
|
||||
ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
const QString &mode) const;
|
||||
ProjectExplorer::RunMode mode) const;
|
||||
|
||||
QWidget *createWidgets();
|
||||
void startTool(Analyzer::StartMode mode);
|
||||
|
||||
@@ -54,7 +54,7 @@ RemoteLinuxQmlProfilerRunner::RemoteLinuxQmlProfilerRunner(
|
||||
= PluginManager::instance()->getObjects<IRunControlFactory>();
|
||||
|
||||
foreach (IRunControlFactory *factory, runControlFactories) {
|
||||
if (factory->canRun(runConfiguration, ProjectExplorer::Constants::RUNMODE)) {
|
||||
if (factory->canRun(runConfiguration, NormalRunMode)) {
|
||||
runControlFactory = factory;
|
||||
break;
|
||||
}
|
||||
@@ -63,8 +63,7 @@ RemoteLinuxQmlProfilerRunner::RemoteLinuxQmlProfilerRunner(
|
||||
QTC_ASSERT(runControlFactory, return);
|
||||
|
||||
// create run control
|
||||
RunControl *runControl = runControlFactory->create(runConfiguration,
|
||||
ProjectExplorer::Constants::RUNMODE);
|
||||
RunControl *runControl = runControlFactory->create(runConfiguration, NormalRunMode);
|
||||
|
||||
m_runControl = qobject_cast<AbstractRemoteLinuxRunControl*>(runControl);
|
||||
QTC_ASSERT(m_runControl, return);
|
||||
|
||||
@@ -54,13 +54,13 @@ namespace QmlProjectManager {
|
||||
|
||||
namespace Internal {
|
||||
|
||||
QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration, QString mode)
|
||||
QmlProjectRunControl::QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration, RunMode mode)
|
||||
: RunControl(runConfiguration, mode)
|
||||
{
|
||||
m_applicationLauncher.setEnvironment(runConfiguration->environment());
|
||||
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
|
||||
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE) {
|
||||
if (mode == NormalRunMode) {
|
||||
m_executable = runConfiguration->viewerPath();
|
||||
} else {
|
||||
m_executable = runConfiguration->observerPath();
|
||||
@@ -141,15 +141,15 @@ QmlProjectRunControlFactory::~QmlProjectRunControlFactory()
|
||||
}
|
||||
|
||||
bool QmlProjectRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
||||
const QString &mode) const
|
||||
RunMode mode) const
|
||||
{
|
||||
QmlProjectRunConfiguration *config =
|
||||
qobject_cast<QmlProjectRunConfiguration*>(runConfiguration);
|
||||
if (!config)
|
||||
return false;
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE)
|
||||
if (mode == NormalRunMode)
|
||||
return !config->viewerPath().isEmpty();
|
||||
if (mode != Debugger::Constants::DEBUGMODE)
|
||||
if (mode != DebugRunMode)
|
||||
return false;
|
||||
|
||||
if (!Debugger::DebuggerPlugin::isActiveDebugLanguage(Debugger::QmlLanguage))
|
||||
@@ -167,7 +167,7 @@ bool QmlProjectRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
||||
}
|
||||
|
||||
RunControl *QmlProjectRunControlFactory::create(RunConfiguration *runConfiguration,
|
||||
const QString &mode)
|
||||
RunMode mode)
|
||||
{
|
||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||
QmlProjectRunConfiguration *config = qobject_cast<QmlProjectRunConfiguration *>(runConfiguration);
|
||||
@@ -184,9 +184,9 @@ RunControl *QmlProjectRunControlFactory::create(RunConfiguration *runConfigurati
|
||||
}
|
||||
|
||||
RunControl *runControl = 0;
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE)
|
||||
if (mode == NormalRunMode)
|
||||
runControl = new QmlProjectRunControl(config, mode);
|
||||
else if (mode == Debugger::Constants::DEBUGMODE)
|
||||
else if (mode == DebugRunMode)
|
||||
runControl = createDebugRunControl(config);
|
||||
return runControl;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ class QmlProjectRunControl : public ProjectExplorer::RunControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration, QString mode);
|
||||
QmlProjectRunControl(QmlProjectRunConfiguration *runConfiguration,
|
||||
ProjectExplorer::RunMode mode);
|
||||
virtual ~QmlProjectRunControl ();
|
||||
|
||||
// RunControl
|
||||
@@ -77,8 +78,8 @@ public:
|
||||
virtual ~QmlProjectRunControlFactory();
|
||||
|
||||
// IRunControlFactory
|
||||
virtual bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const;
|
||||
virtual ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
|
||||
virtual bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
|
||||
virtual ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode);
|
||||
virtual QString displayName() const;
|
||||
virtual ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration
|
||||
*runConfiguration);
|
||||
|
||||
@@ -65,7 +65,7 @@ using namespace Coda;
|
||||
|
||||
enum { debug = 0 };
|
||||
|
||||
CodaRunControl::CodaRunControl(RunConfiguration *runConfiguration, const QString &mode) :
|
||||
CodaRunControl::CodaRunControl(RunConfiguration *runConfiguration, RunMode mode) :
|
||||
S60RunControlBase(runConfiguration, mode),
|
||||
m_port(0),
|
||||
m_state(StateUninit),
|
||||
|
||||
@@ -57,7 +57,8 @@ class QT4PROJECTMANAGER_EXPORT CodaRunControl : public S60RunControlBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CodaRunControl(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
|
||||
CodaRunControl(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
ProjectExplorer::RunMode mode);
|
||||
virtual ~CodaRunControl();
|
||||
|
||||
virtual bool isRunning() const;
|
||||
|
||||
@@ -160,7 +160,7 @@ void S60DeviceDebugRunControl::remoteSetupRequested()
|
||||
{
|
||||
// This is called from Engine->setupInferior(), ie InferiorSetupRequested state
|
||||
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(finished()), this, SLOT(codaFinished()));
|
||||
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)
|
||||
&& qobject_cast<S60DeviceRunConfiguration *>(runConfiguration) != 0;
|
||||
return mode == DebugRunMode && qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
|
||||
}
|
||||
|
||||
ProjectExplorer::RunControl* S60DeviceDebugRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode)
|
||||
ProjectExplorer::RunControl* S60DeviceDebugRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode)
|
||||
{
|
||||
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::ConfigurationCheck check = Debugger::checkDebugConfiguration(startParameters);
|
||||
if (!check) {
|
||||
|
||||
@@ -74,9 +74,9 @@ class S60DeviceDebugRunControlFactory : public ProjectExplorer::IRunControlFacto
|
||||
{
|
||||
public:
|
||||
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;
|
||||
ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration * /*runConfiguration */);
|
||||
};
|
||||
|
||||
@@ -345,7 +345,7 @@ QString S60EmulatorRunConfigurationFactory::displayNameForId(const QString &id)
|
||||
|
||||
// ======== S60EmulatorRunControl
|
||||
|
||||
S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runConfiguration, QString mode)
|
||||
S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runConfiguration, RunMode mode)
|
||||
: RunControl(runConfiguration, mode)
|
||||
{
|
||||
// FIXME: This should be configurable!
|
||||
|
||||
@@ -141,7 +141,8 @@ class S60EmulatorRunControl : public ProjectExplorer::RunControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit S60EmulatorRunControl(S60EmulatorRunConfiguration *runConfiguration, QString mode);
|
||||
S60EmulatorRunControl(S60EmulatorRunConfiguration *runConfiguration,
|
||||
ProjectExplorer::RunMode mode);
|
||||
~S60EmulatorRunControl() {}
|
||||
void start();
|
||||
virtual StopResult stop();
|
||||
|
||||
@@ -74,17 +74,17 @@ template <class RunControl, class RunConfiguration>
|
||||
class RunControlFactory : public ProjectExplorer::IRunControlFactory
|
||||
{
|
||||
public:
|
||||
explicit RunControlFactory(const QString &mode,
|
||||
const QString &name,
|
||||
QObject *parent = 0) :
|
||||
RunControlFactory(ProjectExplorer::RunMode mode, const QString &name, QObject *parent = 0) :
|
||||
IRunControlFactory(parent), m_mode(mode), m_name(name) {}
|
||||
|
||||
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const {
|
||||
return (mode == m_mode)
|
||||
&& (qobject_cast<RunConfiguration *>(runConfiguration) != 0);
|
||||
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const
|
||||
{
|
||||
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);
|
||||
QTC_ASSERT(rc && mode == m_mode, return 0);
|
||||
return new RunControl(rc, mode);
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
const QString m_mode;
|
||||
const ProjectExplorer::RunMode m_mode;
|
||||
const QString m_name;
|
||||
};
|
||||
|
||||
@@ -117,10 +117,9 @@ S60Manager::S60Manager(QObject *parent) : QObject(parent)
|
||||
|
||||
addAutoReleasedObject(new S60EmulatorRunConfigurationFactory);
|
||||
addAutoReleasedObject(new RunControlFactory<S60EmulatorRunControl, S60EmulatorRunConfiguration>
|
||||
(QLatin1String(ProjectExplorer::Constants::RUNMODE),
|
||||
tr("Run in Emulator"), parent));
|
||||
(ProjectExplorer::NormalRunMode, tr("Run in Emulator"), parent));
|
||||
addAutoReleasedObject(new S60DeviceRunConfigurationFactory);
|
||||
addAutoReleasedObject(new S60RunControlFactory(QLatin1String(ProjectExplorer::Constants::RUNMODE),
|
||||
addAutoReleasedObject(new S60RunControlFactory(ProjectExplorer::NormalRunMode,
|
||||
tr("Run on Device"), parent));
|
||||
addAutoReleasedObject(new S60CreatePackageStepFactory);
|
||||
addAutoReleasedObject(new S60DeployStepFactory);
|
||||
|
||||
@@ -73,7 +73,8 @@ QString S60RunControlBase::msgListFile(const QString &file)
|
||||
return rc;
|
||||
}
|
||||
|
||||
S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration, const QString &mode) :
|
||||
S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration,
|
||||
RunMode mode) :
|
||||
RunControl(runConfiguration, mode),
|
||||
m_launchProgress(0)
|
||||
{
|
||||
@@ -91,9 +92,7 @@ S60RunControlBase::S60RunControlBase(RunConfiguration *runConfiguration, const Q
|
||||
m_targetName = s60runConfig->targetName();
|
||||
m_commandLineArguments = s60runConfig->commandLineArguments();
|
||||
QString qmlArgs = s60runConfig->qmlCommandLineArguments();
|
||||
if (((mode == Debugger::Constants::DEBUGMODE)
|
||||
|| (mode == Analyzer::Constants::MODE_ANALYZE))
|
||||
&& !qmlArgs.isEmpty()) {
|
||||
if ((mode == DebugRunMode || mode == QmlProfilerRunMode) && !qmlArgs.isEmpty()) {
|
||||
m_commandLineArguments.prepend(' ');
|
||||
m_commandLineArguments.prepend(qmlArgs);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ class QT4PROJECTMANAGER_EXPORT S60RunControlBase : public ProjectExplorer::RunCo
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit S60RunControlBase(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
|
||||
S60RunControlBase(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
ProjectExplorer::RunMode mode);
|
||||
~S60RunControlBase();
|
||||
|
||||
virtual void start();
|
||||
|
||||
@@ -43,14 +43,12 @@ using namespace ProjectExplorer;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
S60RunControlFactory::S60RunControlFactory(const QString &mode,
|
||||
const QString &name,
|
||||
QObject *parent) :
|
||||
S60RunControlFactory::S60RunControlFactory(RunMode mode, const QString &name, QObject *parent) :
|
||||
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)
|
||||
return false;
|
||||
@@ -61,7 +59,7 @@ bool S60RunControlFactory::canRun(RunConfiguration *runConfiguration, const QStr
|
||||
return activeDeployConf != 0;
|
||||
}
|
||||
|
||||
RunControl* S60RunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
|
||||
RunControl* S60RunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode)
|
||||
{
|
||||
S60DeviceRunConfiguration *rc = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
|
||||
|
||||
|
||||
@@ -41,20 +41,22 @@ namespace Internal {
|
||||
class S60RunControlFactory : public ProjectExplorer::IRunControlFactory
|
||||
{
|
||||
public:
|
||||
explicit S60RunControlFactory(const QString &mode,
|
||||
explicit S60RunControlFactory(ProjectExplorer::RunMode mode,
|
||||
const QString &name,
|
||||
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;
|
||||
|
||||
ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration *runConfiguration);
|
||||
|
||||
private:
|
||||
const QString m_mode;
|
||||
const ProjectExplorer::RunMode m_mode;
|
||||
const QString m_name;
|
||||
};
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace RemoteLinux {
|
||||
using ProjectExplorer::RunConfiguration;
|
||||
|
||||
AbstractRemoteLinuxRunControl::AbstractRemoteLinuxRunControl(RunConfiguration *rc)
|
||||
: RunControl(rc, ProjectExplorer::Constants::RUNMODE)
|
||||
: RunControl(rc, ProjectExplorer::NormalRunMode)
|
||||
, m_running(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -57,11 +57,9 @@ RemoteLinuxRunControlFactory::~RemoteLinuxRunControlFactory()
|
||||
{
|
||||
}
|
||||
|
||||
bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
||||
const QString &mode) const
|
||||
bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
|
||||
{
|
||||
if (mode != QLatin1String(ProjectExplorer::Constants::RUNMODE)
|
||||
&& mode != QLatin1String(Debugger::Constants::DEBUGMODE))
|
||||
if (mode != NormalRunMode && mode != DebugRunMode)
|
||||
return false;
|
||||
|
||||
if (!runConfiguration->isEnabled()
|
||||
@@ -71,19 +69,18 @@ bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
||||
|
||||
const RemoteLinuxRunConfiguration * const remoteRunConfig
|
||||
= qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration);
|
||||
if (mode == QLatin1String(Debugger::Constants::DEBUGMODE))
|
||||
if (mode == DebugRunMode)
|
||||
return remoteRunConfig->portsUsedByDebuggers() <= remoteRunConfig->freePorts().count();
|
||||
return true;
|
||||
}
|
||||
|
||||
RunControl* RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig,
|
||||
const QString &mode)
|
||||
RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, RunMode mode)
|
||||
{
|
||||
Q_ASSERT(canRun(runConfig, mode));
|
||||
|
||||
RemoteLinuxRunConfiguration *rc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig);
|
||||
Q_ASSERT(rc);
|
||||
if (mode == ProjectExplorer::Constants::RUNMODE)
|
||||
if (mode == ProjectExplorer::NormalRunMode)
|
||||
return new RemoteLinuxRunControl(rc);
|
||||
|
||||
const DebuggerStartParameters params
|
||||
|
||||
@@ -46,9 +46,10 @@ public:
|
||||
QString displayName() const;
|
||||
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,
|
||||
const QString &mode);
|
||||
ProjectExplorer::RunMode mode);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -518,6 +518,11 @@ Core::Id CallgrindTool::id() const
|
||||
return "Callgrind";
|
||||
}
|
||||
|
||||
ProjectExplorer::RunMode CallgrindTool::runMode() const
|
||||
{
|
||||
return ProjectExplorer::CallgrindRunMode;
|
||||
}
|
||||
|
||||
QString CallgrindTool::displayName() const
|
||||
{
|
||||
return tr("Valgrind Function Profiler");
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
~CallgrindTool();
|
||||
|
||||
Core::Id id() const;
|
||||
ProjectExplorer::RunMode runMode() const;
|
||||
QString displayName() const;
|
||||
QString description() const;
|
||||
ToolMode toolMode() const;
|
||||
|
||||
@@ -290,6 +290,11 @@ Core::Id MemcheckTool::id() const
|
||||
return "Memcheck";
|
||||
}
|
||||
|
||||
ProjectExplorer::RunMode MemcheckTool::runMode() const
|
||||
{
|
||||
return ProjectExplorer::MemcheckRunMode;
|
||||
}
|
||||
|
||||
QString MemcheckTool::displayName() const
|
||||
{
|
||||
return tr("Valgrind Memory Analyzer");
|
||||
|
||||
@@ -94,6 +94,7 @@ public:
|
||||
MemcheckTool(QObject *parent);
|
||||
|
||||
Core::Id id() const;
|
||||
ProjectExplorer::RunMode runMode() const;
|
||||
QString displayName() const;
|
||||
QString description() const;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ static void startRemoteTool(IAnalyzerTool *tool)
|
||||
//m_currentRunControl = rc;
|
||||
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)
|
||||
|
||||
@@ -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(
|
||||
ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
const QString &mode) const
|
||||
RunConfiguration *runConfiguration, RunMode mode) const
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
|
||||
|
||||
@@ -45,11 +45,11 @@ public:
|
||||
explicit ValgrindTool(QObject *parent);
|
||||
|
||||
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
const QString &mode) const;
|
||||
ProjectExplorer::RunMode mode) const;
|
||||
|
||||
Analyzer::AnalyzerStartParameters createStartParameters(
|
||||
ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
const QString &mode) const;
|
||||
ProjectExplorer::RunMode mode) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user