mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
QML UI: do not try to download from DC with empty vendor/product
Disable the Download button when one of the fields vendor, product, connection is not filled in. The app will crash when trying. In addition, make the underlying core code to actual download more safe by checking this, and silently fail instead of crash. And, yes, this is a double fix in this scenario, but the core code is used in more places, so better safe than sorry. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
parent
8686b53c37
commit
8034af5ad5
2 changed files with 6 additions and 0 deletions
|
@ -71,6 +71,10 @@ void DownloadThread::run()
|
|||
internalData->descriptor = descriptorLookup[m_data->vendor() + m_data->product()];
|
||||
internalData->download_table = &downloadTable;
|
||||
internalData->btname = strdup(m_data->devBluetoothName().toUtf8());
|
||||
if (!internalData->descriptor) {
|
||||
qDebug() << "No download possible when DC type is unknown";
|
||||
return;
|
||||
}
|
||||
#if defined(Q_OS_ANDROID)
|
||||
// on Android we either use BT, a USB device, or we download via FTDI cable
|
||||
if (!internalData->bluetooth_mode && (same_string(internalData->devname, "FTDI") || same_string(internalData->devname, "")))
|
||||
|
|
|
@ -273,6 +273,8 @@ Kirigami.Page {
|
|||
SsrfButton {
|
||||
id: download
|
||||
text: qsTr("Download")
|
||||
enabled: comboVendor.currentIndex != -1 && comboProduct.currentIndex != -1 &&
|
||||
comboConnection.currentIndex != -1
|
||||
onClicked: {
|
||||
text = qsTr("Retry")
|
||||
// strip any BT Name from the address
|
||||
|
|
Loading…
Reference in a new issue