Skip to content
Snippets Groups Projects
Commit ef7a5836 authored by Fawzi Mohamed's avatar Fawzi Mohamed
Browse files

ios: explicitly stop an application when running on the same device


iOS devices can run an application at a time.

Change-Id: I85a24ff32fbee571830a4bc4be8b18259f87924a
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 3a2157d4
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/target.h>
#include <debugger/debuggerconstants.h>
#include <qmakeprojectmanager/qmakeproject.h>
......@@ -46,7 +47,6 @@
#include <qtsupport/qtsupportconstants.h>
#include <coreplugin/id.h>
using namespace ProjectExplorer;
using namespace QmakeProjectManager;
......@@ -166,10 +166,21 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
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)) {
QPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[devId];
activeRunControl->stop();
m_activeRunControls.remove(devId);
}
if (mode == NormalRunMode)
return new Ios::Internal::IosRunControl(rc);
res = new Ios::Internal::IosRunControl(rc);
else
return IosDebugSupport::createDebugRunControl(rc, errorMessage);
res = IosDebugSupport::createDebugRunControl(rc, errorMessage);
if (devId.isValid())
m_activeRunControls[devId] = res;
return res;
}
} // namespace Internal
......
......@@ -85,6 +85,8 @@ public:
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode,
QString *errorMessage) QTC_OVERRIDE;
private:
mutable QMap<Core::Id, QPointer<ProjectExplorer::RunControl> > m_activeRunControls;
};
} // namespace Internal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment