RunControl *IosRunControlFactory::create(RunConfiguration *runConfig, ProjectExplorer::RunMode mode, QString *errorMessage) { Q_ASSERT(canRun(runConfig, mode)); IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfig); Q_ASSERT(rc); RunControl *res = 0; Core::Id devId = ProjectExplorer::DeviceKitInformation::deviceId(rc->target()->kit()); // The device can only run an application at a time, if an app is running stop it. if (m_activeRunControls.contains(devId)) { if (QPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[devId]) activeRunControl->stop(); m_activeRunControls.remove(devId); } if (mode == NormalRunMode) res = new Ios::Internal::IosRunControl(rc); else res = IosDebugSupport::createDebugRunControl(rc, errorMessage); if (devId.isValid()) m_activeRunControls[devId] = res; return res; }
RunControl *IosRunControlFactory::create(RunConfiguration *runConfig, Core::Id mode, QString *errorMessage) { Q_ASSERT(canRun(runConfig, mode)); IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfig); Q_ASSERT(rc); Target *target = runConfig->target(); QTC_ASSERT(target, return 0); RunControl *res = 0; Core::Id devId = DeviceKitInformation::deviceId(rc->target()->kit()); // The device can only run an application at a time, if an app is running stop it. if (m_activeRunControls.contains(devId)) { if (QPointer<RunControl> activeRunControl = m_activeRunControls[devId]) activeRunControl->stop(); m_activeRunControls.remove(devId); } if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE) res = new Ios::Internal::IosRunControl(rc); else if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(runConfig, mode); QTC_ASSERT(runControl, return 0); IDevice::ConstPtr device = DeviceKitInformation::device(target->kit()); if (device.isNull()) return 0; auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runConfig); StandardRunnable runnable; runnable.executable = iosRunConfig->localExecutable().toUserOutput(); runnable.commandLineArguments = iosRunConfig->commandLineArguments(); AnalyzerConnection connection; connection.analyzerHost = QLatin1String("localhost"); runControl->setRunnable(runnable); runControl->setConnection(connection); runControl->setDisplayName(iosRunConfig->applicationName()); (void) new IosAnalyzeSupport(iosRunConfig, runControl, false, true); return runControl; }