summaryrefslogtreecommitdiff
path: root/src/plugins/ios/iosrunfactories.cpp
diff options
context:
space:
mode:
authorFawzi Mohamed <fawzi.mohamed@digia.com>2014-02-14 01:05:59 +0100
committerFawzi Mohamed <fawzi.mohamed@digia.com>2014-02-14 15:40:04 +0100
commitef7a5836be742b40a3af8f8f71fc8b7e595142cc (patch)
tree5439dc52673923757f54c4484f990a1ec4f113f1 /src/plugins/ios/iosrunfactories.cpp
parent3a2157d4e9ff1f9fdd893b1dc43f5b27c068dbe3 (diff)
downloadqt-creator-ef7a5836be742b40a3af8f8f71fc8b7e595142cc.tar.gz
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: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/ios/iosrunfactories.cpp')
-rw-r--r--src/plugins/ios/iosrunfactories.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/ios/iosrunfactories.cpp b/src/plugins/ios/iosrunfactories.cpp
index b7c78e8798..760d26d13d 100644
--- a/src/plugins/ios/iosrunfactories.cpp
+++ b/src/plugins/ios/iosrunfactories.cpp
@@ -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