mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Disable DC device node if it is not needed
This patch disables/enables the DC device node based on what type of transport the selected DC uses. The only time the device node field is used is if the selected DC uses a serial transport type. IrDA and USB type transports do not use the device node. Signed-off-by: Benjamin Fogel <nystire@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
55da333881
commit
31854f50a4
2 changed files with 18 additions and 0 deletions
|
@ -70,6 +70,7 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget* parent, Qt::WindowFlags f) :
|
||||||
if (default_dive_computer_product)
|
if (default_dive_computer_product)
|
||||||
ui.product->setCurrentIndex(ui.product->findText(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)
|
if (default_dive_computer_device)
|
||||||
ui.device->setEditText(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();
|
//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()
|
void DownloadFromDCWidget::fill_computer_list()
|
||||||
{
|
{
|
||||||
dc_iterator_t *iterator = NULL;
|
dc_iterator_t *iterator = NULL;
|
||||||
|
|
|
@ -40,6 +40,7 @@ public slots:
|
||||||
void on_ok_clicked();
|
void on_ok_clicked();
|
||||||
void on_cancel_clicked();
|
void on_cancel_clicked();
|
||||||
void on_vendor_currentIndexChanged(const QString& vendor);
|
void on_vendor_currentIndexChanged(const QString& vendor);
|
||||||
|
void on_product_currentIndexChanged();
|
||||||
|
|
||||||
void onDownloadThreadFinished();
|
void onDownloadThreadFinished();
|
||||||
void updateProgressBar();
|
void updateProgressBar();
|
||||||
|
|
Loading…
Add table
Reference in a new issue