diff options
author | Christian Kandeler <christian.kandeler@nokia.com> | 2012-04-18 12:05:04 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@nokia.com> | 2012-04-18 15:29:07 +0200 |
commit | 1eb1effb37a6e8a77dd331244b987349cb00e161 (patch) | |
tree | b712bc8e486076612bdbe587621782a36c989aae /src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp | |
parent | 40e76b742c0aa2405258ae3385760b1826a13b43 (diff) |
Device Support: Add canRestore() to device factory.
Also get rid of supportsDeviceType(), which is no longer needed now that
most services live in IDevice itself.
The new approach is more flexible as well, allowing factories to refuse
loading a device even if they know its type (e.g. because it is no
longer relevant).
We also rename loadDevice() to restore(), because that is more
exact and is also the name that is being used elsewhere in QtCreator.
Change-Id: I51f57c118a048c1a781a55a94966d554d7aed7a2
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp')
-rw-r--r-- | src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp index 7a9f4ad6500..670e8653f35 100644 --- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp +++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp @@ -64,18 +64,17 @@ IDevice::Ptr GenericLinuxDeviceConfigurationFactory::create() const return wizard.device(); } -IDevice::Ptr GenericLinuxDeviceConfigurationFactory::loadDevice(const QVariantMap &map) const +bool GenericLinuxDeviceConfigurationFactory::canRestore(const QVariantMap &map) const { - QTC_ASSERT(supportsDeviceType(IDevice::typeFromMap(map)), - return LinuxDeviceConfiguration::Ptr()); - LinuxDeviceConfiguration::Ptr device = LinuxDeviceConfiguration::create(); - device->fromMap(map); - return device; + return IDevice::typeFromMap(map) == QLatin1String(Constants::GenericLinuxOsType); } -bool GenericLinuxDeviceConfigurationFactory::supportsDeviceType(const QString &deviceType) const +IDevice::Ptr GenericLinuxDeviceConfigurationFactory::restore(const QVariantMap &map) const { - return deviceType == QLatin1String(Constants::GenericLinuxOsType); + QTC_ASSERT(canRestore(map), return LinuxDeviceConfiguration::Ptr()); + const LinuxDeviceConfiguration::Ptr device = LinuxDeviceConfiguration::create(); + device->fromMap(map); + return device; } } // namespace RemoteLinux |