QML UI: correctly match BT names with products

And remove the remaining references to the "Paired Bluetooth
Devices".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-07-17 12:40:30 -07:00
parent bb3387f234
commit 8f0621f733
2 changed files with 11 additions and 20 deletions

View file

@ -197,23 +197,17 @@ void BTDiscovery::btDeviceDiscoveredMain(const btPairedDevice &device)
newDevice = device.name; newDevice = device.name;
qDebug() << "Found new device:" << newDevice << device.address; qDebug() << "Found new device:" << newDevice << device.address;
QString vendor; if (newDC) {
if (newDC) QString vendor = dc_descriptor_get_vendor(newDC);
foreach (vendor, productList.keys()) { qDebug() << "this could be a " + vendor + " " + newDevice;
if (productList[vendor].contains(newDevice)) { btVP.btpdi = device;
qDebug() << "this could be a " + vendor + " " + btVP.dcDescriptor = newDC;
(newDevice == "OSTC 3" ? "OSTC family" : newDevice); btVP.vendorIdx = vendorList.indexOf(vendor);
btVP.btpdi = device; btVP.productIdx = productList[vendor].indexOf(newDevice);
btVP.dcDescriptor = newDC; btDCs << btVP;
btVP.vendorIdx = vendorList.indexOf(vendor); connectionListModel.addAddress(device.address + " (" + newDevice + ")");
btVP.productIdx = productList[vendor].indexOf(newDevice); return;
qDebug() << "adding new btDCs entry (detected DC)" << newDevice << btVP.vendorIdx << btVP.productIdx << btVP.btpdi.address;; }
btDCs << btVP;
productList[QObject::tr("Paired Bluetooth Devices")].append(device.name + " (" + device.address + ")");
connectionListModel.addAddress(device.address + " (" + device.name + ")");
return;
}
}
connectionListModel.addAddress(device.address); connectionListModel.addAddress(device.address);
qDebug() << "Not recognized as dive computer"; qDebug() << "Not recognized as dive computer";
} }

View file

@ -161,9 +161,6 @@ void fill_computer_list()
#endif #endif
qSort(vendorList); qSort(vendorList);
#if defined(SUBSURFACE_MOBILE) && defined(BT_SUPPORT)
vendorList.append(QObject::tr("Paired Bluetooth Devices"));
#endif
} }
DCDeviceData *DCDeviceData::m_instance = NULL; DCDeviceData *DCDeviceData::m_instance = NULL;