Move IDeviceFactory closer to IDevice implementation

Except for the DesktopDevice, which is kind of special. Also try
a bit to make (and partially fail at doing so) naming and code
structure (#include, use of namespaces) more similar to each other.

Change-Id: I9fe266e706b72c14f59ff03ca1ae02dba3adcc71
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-02-20 19:13:28 +01:00
parent 317ab49793
commit 9e965409d1
44 changed files with 492 additions and 910 deletions

View File

@@ -547,5 +547,27 @@ IosDevice::ConstPtr IosKitAspect::device(Kit *kit)
return res;
}
// Factory
IosDeviceFactory::IosDeviceFactory()
: IDeviceFactory(Constants::IOS_DEVICE_ID)
{
setObjectName(QLatin1String("IosDeviceFactory"));
setDisplayName(IosDevice::name());
setCombinedIcon(":/ios/images/iosdevicesmall.png",
":/ios/images/iosdevice.png");
setConstructionFunction([] { return IDevice::Ptr(new IosDevice); });
}
bool IosDeviceFactory::canRestore(const QVariantMap &map) const
{
QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap();
if (vMap.isEmpty()
|| vMap.value(QLatin1String("deviceName")).toString() == QLatin1String("*unknown*"))
return false; // transient device (probably generated during an activation)
return true;
}
} // namespace Internal
} // namespace Ios