Skip to content
Snippets Groups Projects
Commit 0949e083 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

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: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 2af301e2
No related branches found
No related tags found
No related merge requests found
...@@ -405,6 +405,11 @@ IDevice::Id DeviceManager::internalId(const IDevice::ConstPtr &device) const ...@@ -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) {
......
...@@ -64,6 +64,8 @@ public: ...@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment