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 @@ ...@@ -37,6 +37,7 @@
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <debugger/debuggerconstants.h> #include <debugger/debuggerconstants.h>
#include <qmakeprojectmanager/qmakeproject.h> #include <qmakeprojectmanager/qmakeproject.h>
...@@ -46,7 +47,6 @@ ...@@ -46,7 +47,6 @@
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>
#include <coreplugin/id.h> #include <coreplugin/id.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace QmakeProjectManager; using namespace QmakeProjectManager;
...@@ -166,10 +166,21 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig, ...@@ -166,10 +166,21 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
Q_ASSERT(canRun(runConfig, mode)); Q_ASSERT(canRun(runConfig, mode));
IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfig); IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfig);
Q_ASSERT(rc); 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) if (mode == NormalRunMode)
return new Ios::Internal::IosRunControl(rc); res = new Ios::Internal::IosRunControl(rc);
else else
return IosDebugSupport::createDebugRunControl(rc, errorMessage); res = IosDebugSupport::createDebugRunControl(rc, errorMessage);
if (devId.isValid())
m_activeRunControls[devId] = res;
return res;
} }
} // namespace Internal } // namespace Internal
......
...@@ -85,6 +85,8 @@ public: ...@@ -85,6 +85,8 @@ public:
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode, ProjectExplorer::RunMode mode,
QString *errorMessage) QTC_OVERRIDE; QString *errorMessage) QTC_OVERRIDE;
private:
mutable QMap<Core::Id, QPointer<ProjectExplorer::RunControl> > m_activeRunControls;
}; };
} // namespace Internal } // 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