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

View File

@@ -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,

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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);