QML UI: ensure we track vendor/product for download

This is based on something that Anton Ludin sent to the mailing list.
Reading through the code it seemed that there were scenarios in which
DC_vendor and DC_product were not updated correctly. That's one of the
problems of the declarative approach in QML - it can be very hard to
figure out which code is run when in certain situations.

This may help address the issue with FTDI downloads no longer working on
Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-06-20 12:07:08 +09:00
parent 1ccf21f08d
commit 7f7e7cf51d

View file

@ -79,6 +79,7 @@ Kirigami.Page {
elide: Text.ElideRight
}
onCurrentTextChanged: {
manager.DC_vendor = currentText
comboProduct.model = manager.getProductListFromVendor(currentText)
if (currentIndex == manager.getDetectedVendorIndex())
comboProduct.currentIndex = manager.getDetectedProductIndex(currentText)
@ -109,6 +110,7 @@ Kirigami.Page {
elide: Text.ElideRight
}
onCurrentTextChanged: {
manager.DC_product = currentText
var newIdx = manager.getMatchingAddress(comboVendor.currentText, currentText)
if (newIdx != -1)
comboConnection.currentIndex = newIdx
@ -188,7 +190,7 @@ Kirigami.Page {
// strip any BT Name from the address
var devName = manager.DC_devName
manager.DC_devName = devName.replace(/^(.*) /, "")
manager.appendTextToLog("DCDownloadThread started for " + manager.product + " on "+ manager.DC_devName)
manager.appendTextToLog("DCDownloadThread started for " + manager.DC_vendor + " " + manager.DC_product + " on "+ manager.DC_devName)
progressBar.visible = true
downloadThread.start()
}