From a4f045abaa625db4780f915ab57ed3edc89bf000 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 16 Jul 2017 21:49:11 -0700 Subject: Add the connections that we find to the model So far this only deals with BT addresses. We also need to add other connections that we detect. Signed-off-by: Dirk Hohndel --- core/downloadfromdcthread.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/downloadfromdcthread.cpp') diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index 76b314da7..8abc46bcd 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -7,6 +7,7 @@ QStringList vendorList; QHash productList; static QHash mobileProductList; // BT, BLE or FTDI supported DCs for mobile QMap descriptorLookup; +ConnectionListModel connectionListModel; static QString str_error(const char *fmt, ...) { @@ -193,6 +194,16 @@ QStringList DCDeviceData::getProductListFromVendor(const QString &vendor) return productList[vendor]; } +int DCDeviceData::getMatchingAddress(const QString &vendor, const QString &product) +{ + for (int i = 0; i < connectionListModel.rowCount(); i++) { + QString address = connectionListModel.address(i); + if (address.contains(product)) + return i; + } + return -1; +} + DCDeviceData * DownloadThread::data() { return m_data; -- cgit v1.2.3-70-g09d2