mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile/download: only use device guess if no USB device plugged in
If we explicitly open the download page after the use plugged in a USB device, don't try to use guesses from the BT/BLE pairings to populate the device/connection dropdowns. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5e89d81d9d
commit
822b05bec4
2 changed files with 17 additions and 6 deletions
|
@ -23,6 +23,7 @@ Kirigami.Page {
|
||||||
property alias vendor: comboVendor.currentIndex
|
property alias vendor: comboVendor.currentIndex
|
||||||
property alias product: comboProduct.currentIndex
|
property alias product: comboProduct.currentIndex
|
||||||
property alias connection: comboConnection.currentIndex
|
property alias connection: comboConnection.currentIndex
|
||||||
|
property bool setupUSB: false
|
||||||
|
|
||||||
DCImportModel {
|
DCImportModel {
|
||||||
id: importModel
|
id: importModel
|
||||||
|
@ -224,6 +225,7 @@ Kirigami.Page {
|
||||||
spacing: Kirigami.Units.smallSpacing;
|
spacing: Kirigami.Units.smallSpacing;
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
function setDC(vendor, product, device) {
|
function setDC(vendor, product, device) {
|
||||||
|
manager.appendTextToLog("setDC called with " + vendor + "/" + product + "/" + device)
|
||||||
comboVendor.currentIndex = comboVendor.find(vendor);
|
comboVendor.currentIndex = comboVendor.find(vendor);
|
||||||
comboProduct.currentIndex = comboProduct.find(product);
|
comboProduct.currentIndex = comboProduct.find(product);
|
||||||
comboConnection.currentIndex = manager.getConnectionIndex(device);
|
comboConnection.currentIndex = manager.getConnectionIndex(device);
|
||||||
|
@ -477,12 +479,17 @@ Kirigami.Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
comboVendor.currentIndex = comboProduct.currentIndex = comboConnection.currentIndex = -1
|
if (!setupUSB) {
|
||||||
dc1.enabled = dc2.enabled = dc3.enabled = dc4.enabled = true
|
// if we aren't called with a known USB connection, check if we can find
|
||||||
if (visible) {
|
// a known BT/BLE device
|
||||||
comboVendor.currentIndex = manager.getDetectedVendorIndex()
|
manager.appendTextToLog("download page -- looking for known BT/BLE device")
|
||||||
comboProduct.currentIndex = manager.getDetectedProductIndex(comboVendor.currentText)
|
comboVendor.currentIndex = comboProduct.currentIndex = comboConnection.currentIndex = -1
|
||||||
comboConnection.currentIndex = manager.getMatchingAddress(comboVendor.currentText, comboProduct.currentText)
|
dc1.enabled = dc2.enabled = dc3.enabled = dc4.enabled = true
|
||||||
|
if (visible) {
|
||||||
|
comboVendor.currentIndex = manager.getDetectedVendorIndex()
|
||||||
|
comboProduct.currentIndex = manager.getDetectedProductIndex(comboVendor.currentText)
|
||||||
|
comboConnection.currentIndex = manager.getMatchingAddress(comboVendor.currentText, comboProduct.currentText)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -819,6 +819,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
||||||
manager.appendTextToLog("show download page for " + vendor + " / " + product + " / " + connection)
|
manager.appendTextToLog("show download page for " + vendor + " / " + product + " / " + connection)
|
||||||
downloadFromDc.dcImportModel.clearTable()
|
downloadFromDc.dcImportModel.clearTable()
|
||||||
if (vendor !== undefined && product !== undefined && connection !== undefined) {
|
if (vendor !== undefined && product !== undefined && connection !== undefined) {
|
||||||
|
downloadFromDc.setupUSB = true
|
||||||
/* set up the correct values on the download page */
|
/* set up the correct values on the download page */
|
||||||
if (vendor !== -1)
|
if (vendor !== -1)
|
||||||
downloadFromDc.vendor = vendor
|
downloadFromDc.vendor = vendor
|
||||||
|
@ -826,7 +827,10 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
||||||
downloadFromDc.product = product
|
downloadFromDc.product = product
|
||||||
if (connection !== -1)
|
if (connection !== -1)
|
||||||
downloadFromDc.connection = connection
|
downloadFromDc.connection = connection
|
||||||
|
} else {
|
||||||
|
downloadFromDc.setupUSB = false
|
||||||
}
|
}
|
||||||
|
|
||||||
showPage(downloadFromDc)
|
showPage(downloadFromDc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue