diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/downloadfromdivecomputer.cpp | 17 | ||||
-rw-r--r-- | qt-ui/downloadfromdivecomputer.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index 57415fac5..b7eb520c4 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -70,6 +70,7 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget* parent, Qt::WindowFlags f) : if (default_dive_computer_product) ui.product->setCurrentIndex(ui.product->findText(default_dive_computer_product)); } + connect(ui.product, SIGNAL(currentIndexChanged(int)), this, SLOT(on_product_currentIndexChanged()), Qt::UniqueConnection); if (default_dive_computer_device) ui.device->setEditText(default_dive_computer_device); @@ -168,6 +169,22 @@ void DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString& vendor) //currentModel->deleteLater(); } +void DownloadFromDCWidget::on_product_currentIndexChanged() +{ + // Set up the DC descriptor + dc_descriptor_t *descriptor = NULL; + descriptor = descriptorLookup[ui.vendor->currentText() + ui.product->currentText()]; + + // call dc_descriptor_get_transport to see if the dc_transport_t is DC_TRANSPORT_SERIAL + if (dc_descriptor_get_transport(descriptor) == DC_TRANSPORT_SERIAL) { + // if the dc_transport_t is DC_TRANSPORT_SERIAL, then enable the device node box. + ui.device->setEnabled(true); + } else { + // otherwise disable the device node box + ui.device->setEnabled(false); + } +} + void DownloadFromDCWidget::fill_computer_list() { dc_iterator_t *iterator = NULL; diff --git a/qt-ui/downloadfromdivecomputer.h b/qt-ui/downloadfromdivecomputer.h index 943a1aa43..8f1f6aa2b 100644 --- a/qt-ui/downloadfromdivecomputer.h +++ b/qt-ui/downloadfromdivecomputer.h @@ -40,6 +40,7 @@ public slots: void on_ok_clicked(); void on_cancel_clicked(); void on_vendor_currentIndexChanged(const QString& vendor); + void on_product_currentIndexChanged(); void onDownloadThreadFinished(); void updateProgressBar(); |