iOS: Dissolve IosRunControlFactory

Follows suite.

Change-Id: I2ef11d19d9a2d3d0f3f282a94f98a40478273fbc
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
hjk
2017-07-14 10:12:37 +02:00
parent cb0a09b74b
commit 6c04099601
4 changed files with 37 additions and 68 deletions

View File

@@ -74,9 +74,29 @@ using namespace Utils;
namespace Ios {
namespace Internal {
static void stopRunningRunControl(RunControl *runControl)
{
static QMap<Core::Id, QPointer<RunControl>> activeRunControls;
RunConfiguration *runConfig = runControl->runConfiguration();
Target *target = runConfig->target();
Core::Id devId = DeviceKitInformation::deviceId(target->kit());
// The device can only run an application at a time, if an app is running stop it.
if (activeRunControls.contains(devId)) {
if (QPointer<RunControl> activeRunControl = activeRunControls[devId])
activeRunControl->initiateStop();
activeRunControls.remove(devId);
}
if (devId.isValid())
activeRunControls[devId] = runControl;
}
IosRunner::IosRunner(RunControl *runControl)
: RunWorker(runControl)
{
stopRunningRunControl(runControl);
auto runConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration());
m_bundleDir = runConfig->bundleDirectory().toString();
m_arguments = QStringList(runConfig->commandLineArguments());