| 35 | } |
| 36 | |
| 37 | bool DeviceListModel::loadRemaining(PresetRuleTableModel* ruleModel) |
| 38 | { |
| 39 | auto devices = service->outputDevices(); |
| 40 | // Find all devices with at least one unused route |
| 41 | for(int i = devices.size() - 1; i >= 0; i--) |
| 42 | { |
| 43 | // Find all unused routes |
| 44 | QList<Route> routes = devices.at(i).output_routes; |
| 45 | routes.append(RouteListModel::makeDefaultRoute()); |
| 46 | for(int j = routes.size() - 1; j >= 0; j--) |
| 47 | { |
| 48 | if(ruleModel->containsDeviceAndRouteId(QString::fromStdString(devices.at(i).name), |
| 49 | QString::fromStdString(routes.at(j).name))) |
| 50 | { |
| 51 | routes.erase(routes.begin() + j); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | if(routes.empty()) { |
| 56 | devices.erase(devices.begin() + i); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | if(devices.empty()) |
| 61 | { |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | load(devices); |
| 66 | return true; |
| 67 | } |
| 68 | |
| 69 | void DeviceListModel::load(const QVector<IOutputDevice> &_devices) |
| 70 | { |
nothing calls this directly
no test coverage detected