Device: Add method to get the index of a idevice

Add a method to get the index of an IDevice * in the DeviceManager.

Change-Id: Icf02c8a682185ebe9ea68fd4edb026d1c8335112
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Tobias Hunger
2012-03-13 16:39:25 +01:00
parent 2af301e253
commit 0949e083eb
2 changed files with 7 additions and 0 deletions

View File

@@ -405,6 +405,11 @@ IDevice::Id DeviceManager::internalId(const IDevice::ConstPtr &device) const
return device ? device->internalId() : IDevice::invalidId(); return device ? device->internalId() : IDevice::invalidId();
} }
int DeviceManager::indexOf(const IDevice *device) const
{
return indexForInternalId(device->internalId());
}
void DeviceManager::ensureOneDefaultDevicePerType() void DeviceManager::ensureOneDefaultDevicePerType()
{ {
foreach (const IDevice::Ptr &device, d->devices) { foreach (const IDevice::Ptr &device, d->devices) {

View File

@@ -64,6 +64,8 @@ public:
bool hasDevice(const QString &name) const; bool hasDevice(const QString &name) const;
IDevice::Id internalId(const IDevice::ConstPtr &device) const; IDevice::Id internalId(const IDevice::ConstPtr &device) const;
int indexOf(const IDevice *device) const;
void addDevice(const IDevice::Ptr &device); void addDevice(const IDevice::Ptr &device);
void removeDevice(int index); void removeDevice(int index);