aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ios/simulatorcontrol.h
diff options
context:
space:
mode:
authorVikas Pachdha <vikas.pachdha@qt.io>2016-11-04 17:39:39 +0100
committerEike Ziller <eike.ziller@qt.io>2016-11-16 08:50:45 +0000
commitf28cefce8c8b9cd834fa029f36fe01c61541b9c1 (patch)
treeee2e8b0d6c6faa9b10822a1eae51ecbd3facf4bb /src/plugins/ios/simulatorcontrol.h
parent88ff6cd5ae1f6de7674c63c3b850cb7282fc93c3 (diff)
iOS: Make iOS simulator usage asynchronous
Change-Id: I5770b372542690560680ef3208a284c7f0cf6670 Reviewed-by: Eike Ziller <eike.ziller@qt.io> (cherry picked from commit aa355b4f704db3f2d45b674c9532c8425ba47333)
Diffstat (limited to 'src/plugins/ios/simulatorcontrol.h')
-rw-r--r--src/plugins/ios/simulatorcontrol.h47
1 files changed, 31 insertions, 16 deletions
diff --git a/src/plugins/ios/simulatorcontrol.h b/src/plugins/ios/simulatorcontrol.h
index 1a674d644eb..4680350c48b 100644
--- a/src/plugins/ios/simulatorcontrol.h
+++ b/src/plugins/ios/simulatorcontrol.h
@@ -22,10 +22,10 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
-#ifndef SIMULATORCONTROL_H
-#define SIMULATORCONTROL_H
+#pragma once
-#include <QHash>
+#include <QObject>
+#include <QFuture>
#include "utils/fileutils.h"
QT_BEGIN_NAMESPACE
@@ -38,29 +38,44 @@ namespace Internal {
class IosDeviceType;
class SimulatorControlPrivate;
-class SimulatorControl
+class SimulatorControl : public QObject
{
- explicit SimulatorControl();
+ Q_OBJECT
+public:
+ struct ResponseData {
+ ResponseData(const QString & udid):
+ simUdid(udid) { }
+
+ QString simUdid;
+ bool success = false;
+ qint64 pID = -1;
+ QByteArray commandOutput = "";
+ // For response type APP_SPAWN, the processInstance represents the control process of the spwaned app
+ // For other response types its null.
+ std::shared_ptr<QProcess> processInstance;
+ };
+
+public:
+ explicit SimulatorControl(QObject* parent = nullptr);
+ ~SimulatorControl();
public:
static QList<IosDeviceType> availableSimulators();
static void updateAvailableSimulators();
-
- static bool startSimulator(const QString &simUdid);
static bool isSimulatorRunning(const QString &simUdid);
-
- static bool installApp(const QString &simUdid, const Utils::FileName &bundlePath, QByteArray &commandOutput);
- static QProcess* spawnAppProcess(const QString &simUdid, const Utils::FileName &bundlePath, qint64 &pId,
- bool waitForDebugger, const QStringList &extraArgs);
-
- static qint64 launchApp(const QString &simUdid, const QString &bundleIdentifier, QByteArray *commandOutput = nullptr);
static QString bundleIdentifier(const Utils::FileName &bundlePath);
static QString bundleExecutable(const Utils::FileName &bundlePath);
- static bool waitForProcessSpawn(qint64 processPId);
+
+public:
+ QFuture<ResponseData> startSimulator(const QString &simUdid);
+ QFuture<ResponseData> installApp(const QString &simUdid, const Utils::FileName &bundlePath) const;
+ QFuture<ResponseData> spawnAppProcess(const QString &simUdid, const Utils::FileName &bundlePath,
+ bool waitForDebugger, const QStringList &extraArgs) const;
+ QFuture<ResponseData> launchApp(const QString &simUdid, const QString &bundleIdentifier,
+ qint64 spawnedPID = -1) const;
private:
- static SimulatorControlPrivate *d;
+ SimulatorControlPrivate *d;
};
} // namespace Internal
} // namespace Ios
-#endif // SIMULATORCONTROL_H