Simplify IDeviceFactory use

With a 1:1 mapping of factory and created device types, the signatures
of the device factory methods are much simpler, and yield even in
the cases where a factory created more than one device type
(WinRt and Qdb) less code after duplication of the factory.

Change-Id: I1c6279a88e8483001e5603cfe1922029243be610
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2018-10-04 19:08:16 +02:00
parent 9fe5733ef3
commit 0c2101d816
26 changed files with 109 additions and 186 deletions

View File

@@ -36,23 +36,18 @@ namespace Ios {
namespace Internal {
IosDeviceFactory::IosDeviceFactory()
: ProjectExplorer::IDeviceFactory(Constants::IOS_DEVICE_ID)
{
setObjectName(QLatin1String("IosDeviceFactory"));
}
QString IosDeviceFactory::displayNameForId(Core::Id type) const
QString IosDeviceFactory::displayName() const
{
return type == Constants::IOS_DEVICE_TYPE ? IosDevice::name() : QString();
return IosDevice::name();
}
QList<Core::Id> IosDeviceFactory::availableCreationIds() const
QIcon IosDeviceFactory::icon() const
{
return QList<Core::Id>() << Core::Id(Constants::IOS_DEVICE_TYPE);
}
QIcon IosDeviceFactory::iconForId(Core::Id type) const
{
Q_UNUSED(type)
using namespace Utils;
static const QIcon icon =
Icon::combinedIcon({Icon({{":/ios/images/iosdevicesmall.png",
@@ -67,9 +62,8 @@ bool IosDeviceFactory::canCreate() const
return false;
}
ProjectExplorer::IDevice::Ptr IosDeviceFactory::create(Core::Id id) const
ProjectExplorer::IDevice::Ptr IosDeviceFactory::create() const
{
Q_UNUSED(id)
return ProjectExplorer::IDevice::Ptr();
}