iOS: Put common IosDevice constructor code into a function

It is not even clear that the remaining difference are needed.

Change-Id: Ic4418143242793d82a1f4c4c368af69a2e537078
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-08-16 10:26:42 +02:00
parent 14da061c33
commit f187ddd590
2 changed files with 12 additions and 10 deletions

View File

@@ -78,16 +78,22 @@ static QString CFStringRef2QString(CFStringRef s)
namespace Ios {
namespace Internal {
IosDevice::IosDevice()
IosDevice::IosDevice(CtorHelper)
: m_lastPort(Constants::IOS_DEVICE_PORT_START)
{
setupId(IDevice::AutoDetected, Constants::IOS_DEVICE_ID);
setType(Constants::IOS_DEVICE_TYPE);
setDefaultDisplayName(IosDevice::name());
setDisplayType(QCoreApplication::translate("Ios::Internal::IosDevice", "iOS"));
setMachineType(IDevice::Hardware);
setOsType(Utils::OsTypeMac);
setDeviceState(DeviceDisconnected);
}
IosDevice::IosDevice()
: IosDevice(CtorHelper{})
{
setupId(IDevice::AutoDetected, Constants::IOS_DEVICE_ID);
Utils::PortList ports;
ports.addRange(Utils::Port(Constants::IOS_DEVICE_PORT_START),
Utils::Port(Constants::IOS_DEVICE_PORT_END));
@@ -95,18 +101,11 @@ IosDevice::IosDevice()
}
IosDevice::IosDevice(const QString &uid)
: m_lastPort(Constants::IOS_DEVICE_PORT_START)
: IosDevice(CtorHelper{})
{
setupId(IDevice::AutoDetected, Core::Id(Constants::IOS_DEVICE_ID).withSuffix(uid));
setType(Constants::IOS_DEVICE_TYPE);
setDefaultDisplayName(IosDevice::name());
setDisplayType(QCoreApplication::translate("Ios::Internal::IosDevice", "iOS"));
setMachineType(IDevice::Hardware);
setOsType(Utils::OsTypeMac);
setDeviceState(DeviceDisconnected);
}
IDevice::DeviceInfo IosDevice::deviceInformation() const
{
IDevice::DeviceInfo res;

View File

@@ -68,6 +68,9 @@ protected:
IosDevice();
IosDevice(const QString &uid);
enum CtorHelper {};
IosDevice(CtorHelper);
Dict m_extraInfo;
bool m_ignoreDevice = false;
mutable quint16 m_lastPort;