Handle IDeviceFactory restoring in base class

Change-Id: Idb892bcff6b91dbc11a8271915e5cc86d1669e74
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2018-10-05 19:00:16 +02:00
parent 511bd64f3f
commit d58eac6325
19 changed files with 23 additions and 76 deletions

View File

@@ -38,6 +38,7 @@ IosDeviceFactory::IosDeviceFactory()
setDisplayName(IosDevice::name());
setCombinedIcon(":/ios/images/iosdevicesmall.png",
":/ios/images/iosdevice.png");
setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosDevice); });
}
bool IosDeviceFactory::canRestore(const QVariantMap &map) const
@@ -49,14 +50,5 @@ bool IosDeviceFactory::canRestore(const QVariantMap &map) const
return true;
}
ProjectExplorer::IDevice::Ptr IosDeviceFactory::restore(const QVariantMap &map) const
{
IosDevice *newDev = new IosDevice;
newDev->fromMap(map);
// updating the active ones should be enough...
//IosDeviceManager::instance()->updateInfo(newDev->uniqueDeviceID());
return ProjectExplorer::IDevice::Ptr(newDev);
}
} // namespace Internal
} // namespace Ios

View File

@@ -37,7 +37,6 @@ public:
IosDeviceFactory();
bool canRestore(const QVariantMap &map) const override;
ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const override;
};
} // namespace Internal

View File

@@ -40,14 +40,7 @@ IosSimulatorFactory::IosSimulatorFactory()
setDisplayName(tr("iOS Simulator"));
setCombinedIcon(":/ios/images/iosdevicesmall.png",
":/ios/images/iosdevice.png");
}
ProjectExplorer::IDevice::Ptr IosSimulatorFactory::restore(const QVariantMap &map) const
{
QTC_ASSERT(canRestore(map), return ProjectExplorer::IDevice::Ptr());
const ProjectExplorer::IDevice::Ptr device = ProjectExplorer::IDevice::Ptr(new IosSimulator());
device->fromMap(map);
return device;
setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosSimulator()); });
}
} // namespace Internal

View File

@@ -35,8 +35,6 @@ class IosSimulatorFactory : public ProjectExplorer::IDeviceFactory
Q_OBJECT
public:
IosSimulatorFactory();
ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const override;
};
} // namespace Internal