diff options
author | Fawzi Mohamed <[email protected]> | 2014-11-12 19:41:59 +0100 |
---|---|---|
committer | Fawzi Mohamed <[email protected]> | 2014-11-25 17:36:58 +0100 |
commit | e757643690b61f7377329fd363b2f1dd1e4f7505 (patch) | |
tree | b7305f0b12934c9bcca8f91d07c28ab39714df65 /src/plugins/ios/iostoolhandler.cpp | |
parent | a3c9104e35789a0148d11889b898464d7403f047 (diff) |
iOS: fix simulator selection
get simulator type and SDK version dynamically from the available ones,
and let the user choose which one to use.
This fixes the static solution that did break with Xcode 6
Change-Id: I5cb2be68b9ea8736fc880cf3dd9d39d77f030293
Reviewed-by: Fawzi Mohamed <[email protected]>
Diffstat (limited to 'src/plugins/ios/iostoolhandler.cpp')
-rw-r--r-- | src/plugins/ios/iostoolhandler.cpp | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp index 61617bc5a85..cd640edc99b 100644 --- a/src/plugins/ios/iostoolhandler.cpp +++ b/src/plugins/ios/iostoolhandler.cpp @@ -31,6 +31,7 @@ #include "iostoolhandler.h" #include "iosconfigurations.h" #include "iosconstants.h" +#include "iossimulator.h" #include <coreplugin/icore.h> #include <utils/qtcassert.h> @@ -126,7 +127,7 @@ public: OpAppRun }; - explicit IosToolHandlerPrivate(IosDeviceType::Enum devType, IosToolHandler *q); + explicit IosToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q); virtual ~IosToolHandlerPrivate() {} virtual void requestTransferApp(const QString &bundlePath, const QString &deviceId, int timeout = 1000) = 0; @@ -170,7 +171,7 @@ protected: IosToolHandler::RunKind runKind; State state; Op op; - IosDeviceType::Enum devType; + IosDeviceType devType; static const int lookaheadSize = 67; int iBegin, iEnd, gdbSocket; QList<ParserState> stack; @@ -179,7 +180,7 @@ protected: class IosDeviceToolHandlerPrivate : public IosToolHandlerPrivate { public: - explicit IosDeviceToolHandlerPrivate(IosDeviceType::Enum devType, IosToolHandler *q); + explicit IosDeviceToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q); virtual void requestTransferApp(const QString &bundlePath, const QString &deviceId, int timeout = 1000); virtual void requestRunApp(const QString &bundlePath, const QStringList &extraArgs, @@ -192,7 +193,7 @@ public: class IosSimulatorToolHandlerPrivate : public IosToolHandlerPrivate { public: - explicit IosSimulatorToolHandlerPrivate(IosDeviceType::Enum devType, IosToolHandler *q); + explicit IosSimulatorToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q); virtual void requestTransferApp(const QString &bundlePath, const QString &deviceId, int timeout = 1000); virtual void requestRunApp(const QString &bundlePath, const QStringList &extraArgs, @@ -204,7 +205,7 @@ private: void addDeviceArguments(QStringList &args) const; }; -IosToolHandlerPrivate::IosToolHandlerPrivate(IosDeviceType::Enum devType, +IosToolHandlerPrivate::IosToolHandlerPrivate(const IosDeviceType &devType, Ios::IosToolHandler *q) : q(q), state(NonStarted), devType(devType), iBegin(0), iEnd(0), gdbSocket(-1) @@ -578,7 +579,7 @@ void IosToolHandlerPrivate::subprocessHasData() // IosDeviceToolHandlerPrivate -IosDeviceToolHandlerPrivate::IosDeviceToolHandlerPrivate(IosDeviceType::Enum devType, +IosDeviceToolHandlerPrivate::IosDeviceToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q) : IosToolHandlerPrivate(devType, q) { } @@ -637,7 +638,7 @@ bool IosDeviceToolHandlerPrivate::expectsFileDescriptor() // IosSimulatorToolHandlerPrivate -IosSimulatorToolHandlerPrivate::IosSimulatorToolHandlerPrivate(IosDeviceType::Enum devType, +IosSimulatorToolHandlerPrivate::IosSimulatorToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q) : IosToolHandlerPrivate(devType, q) { } @@ -684,7 +685,7 @@ void IosSimulatorToolHandlerPrivate::requestDeviceInfo(const QString &deviceId, Q_UNUSED(timeout); this->deviceId = deviceId; QStringList args; - args << QLatin1String("showsdks"); + args << QLatin1String("showdevicetypes"); op = OpDeviceInfo; start(IosToolHandler::iosSimulatorToolPath(), args); } @@ -696,27 +697,11 @@ bool IosSimulatorToolHandlerPrivate::expectsFileDescriptor() void IosSimulatorToolHandlerPrivate::addDeviceArguments(QStringList &args) const { - switch (devType) { - case IosDeviceType::IosDevice: - qCWarning(toolHandlerLog) << "IosSimulatorToolHandlerPrivate has device type IosDeviceType"; - break; - case IosDeviceType::SimulatedIphone: - args << QLatin1String("--family") << QLatin1String("iphone"); - break; - case IosDeviceType::SimulatedIpad: - args << QLatin1String("--family") << QLatin1String("ipad"); - break; - case IosDeviceType::SimulatedIphoneRetina4Inch: - args << QLatin1String("--family") << QLatin1String("iphone") - << QLatin1String("--retina") << QLatin1String("--tall"); - break; - case IosDeviceType::SimulatedIphoneRetina3_5Inch: - args << QLatin1String("--family") << QLatin1String("iphone") << QLatin1String("--retina"); - break; - case IosDeviceType::SimulatedIpadRetina: - args << QLatin1String("--family") << QLatin1String("ipad") << QLatin1String("--retina"); - break; + if (devType.type != IosDeviceType::SimulatedDevice) { + qCWarning(toolHandlerLog) << "IosSimulatorToolHandlerPrivate device type is not SimulatedDevice"; + return; } + args << QLatin1String("--devicetypeid") << devType.identifier; } void IosToolHandlerPrivate::killProcess() @@ -745,10 +730,10 @@ QString IosToolHandler::iosSimulatorToolPath() return res; } -IosToolHandler::IosToolHandler(IosDeviceType::Enum devType, QObject *parent) : +IosToolHandler::IosToolHandler(const Internal::IosDeviceType &devType, QObject *parent) : QObject(parent) { - if (devType == IosDeviceType::IosDevice) + if (devType.type == Internal::IosDeviceType::IosDevice) d = new Internal::IosDeviceToolHandlerPrivate(devType, this); else d = new Internal::IosSimulatorToolHandlerPrivate(devType, this); |