only init devices after their parents have been set up
This commit is contained in:
parent
b2a47036e4
commit
12ff672216
@ -1149,14 +1149,28 @@ void DeviceManager::loadConfiguredDevices()
|
|||||||
|
|
||||||
// We always add the device to the list in this case. If its in the storedDevices
|
// We always add the device to the list in this case. If its in the storedDevices
|
||||||
// it means that it was working at some point so lets still add it as there might
|
// it means that it was working at some point so lets still add it as there might
|
||||||
// be rules associated with this device. Device::setupCompleted() will be false.
|
// be rules associated with this device.
|
||||||
DeviceSetupStatus status = setupDevice(device);
|
|
||||||
m_configuredDevices.insert(device->id(), device);
|
m_configuredDevices.insert(device->id(), device);
|
||||||
|
}
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
QHash<DeviceId, Device*> setupList = m_configuredDevices;
|
||||||
|
while (!setupList.isEmpty()) {
|
||||||
|
Device *device = nullptr;
|
||||||
|
foreach (Device *d, setupList) {
|
||||||
|
if (d->parentId().isNull() || !setupList.contains(d->parentId())) {
|
||||||
|
device = d;
|
||||||
|
setupList.take(d->id());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Q_ASSERT(device != nullptr);
|
||||||
|
|
||||||
|
DeviceSetupStatus status = setupDevice(device);
|
||||||
if (status == DeviceSetupStatus::DeviceSetupStatusSuccess)
|
if (status == DeviceSetupStatus::DeviceSetupStatusSuccess)
|
||||||
postSetupDevice(device);
|
postSetupDevice(device);
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::storeConfiguredDevices()
|
void DeviceManager::storeConfiguredDevices()
|
||||||
|
|||||||
Reference in New Issue
Block a user