forked from qt-creator/qt-creator
ProjectExplorer: Use Core::Id as RunMode "enum values"
This provides a way for third-party plugins to implement run modes without the need to add a value to the central enum or using manual workarounds like RunMode(*(int*)&someUniqueObject). Instead of centrally defined enum values this uses Core::Id that could be defined anywhere. Change-Id: Ic350e3d8dbb8042c61b2d4ffec993ca151f53099 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -84,7 +84,7 @@ RunControl *IosAnalyzeSupport::createAnalyzeRunControl(IosRunConfiguration *runC
|
||||
if (device.isNull())
|
||||
return 0;
|
||||
AnalyzerStartParameters params;
|
||||
params.runMode = QmlProfilerRunMode;
|
||||
params.runMode = ProjectExplorer::Constants::QML_PROFILER_RUN_MODE;
|
||||
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
|
||||
params.debuggee = runConfig->localExecutable().toUserOutput();
|
||||
params.debuggeeArgs = Utils::QtcProcess::joinArgs(runConfig->commandLineArguments());
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
IosRunControl::IosRunControl(IosRunConfiguration *rc)
|
||||
: RunControl(rc, NormalRunMode)
|
||||
: RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE)
|
||||
, m_runner(new IosRunner(this, rc, false, false))
|
||||
, m_running(false)
|
||||
{
|
||||
|
||||
@@ -159,16 +159,20 @@ IosRunControlFactory::IosRunControlFactory(QObject *parent)
|
||||
}
|
||||
|
||||
bool IosRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
||||
RunMode mode) const
|
||||
Core::Id mode) const
|
||||
{
|
||||
if (mode != NormalRunMode && mode != DebugRunMode && mode != QmlProfilerRunMode
|
||||
&& mode != DebugRunModeWithBreakOnMain)
|
||||
if (mode != ProjectExplorer::Constants::NORMAL_RUN_MODE
|
||||
&& mode != ProjectExplorer::Constants::DEBUG_RUN_MODE
|
||||
&& mode != ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN
|
||||
&& mode != ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return qobject_cast<IosRunConfiguration *>(runConfiguration);
|
||||
}
|
||||
|
||||
RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
|
||||
RunMode mode, QString *errorMessage)
|
||||
Core::Id mode, QString *errorMessage)
|
||||
{
|
||||
Q_ASSERT(canRun(runConfig, mode));
|
||||
IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfig);
|
||||
@@ -181,9 +185,9 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
|
||||
activeRunControl->stop();
|
||||
m_activeRunControls.remove(devId);
|
||||
}
|
||||
if (mode == NormalRunMode)
|
||||
if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE)
|
||||
res = new Ios::Internal::IosRunControl(rc);
|
||||
else if (mode == QmlProfilerRunMode)
|
||||
else if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
|
||||
res = IosAnalyzeSupport::createAnalyzeRunControl(rc, errorMessage);
|
||||
else
|
||||
res = IosDebugSupport::createDebugRunControl(rc, errorMessage);
|
||||
|
||||
@@ -81,9 +81,9 @@ public:
|
||||
explicit IosRunControlFactory(QObject *parent = 0);
|
||||
|
||||
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
ProjectExplorer::RunMode mode) const override;
|
||||
Core::Id mode) const override;
|
||||
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
ProjectExplorer::RunMode mode,
|
||||
Core::Id mode,
|
||||
QString *errorMessage) override;
|
||||
private:
|
||||
mutable QMap<Core::Id, QPointer<ProjectExplorer::RunControl> > m_activeRunControls;
|
||||
|
||||
Reference in New Issue
Block a user