From 047032ee46ef00d924dea0ee68b0f2726975fcd6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 18 May 2014 13:29:40 +0900 Subject: Divecomputer download: try to offer only those devices that make sense If the user selects a Uemis divecomputer, don't show serial devices. If the user selects a serial divecomputer, don't show the Uemis filesystem. Signed-off-by: Dirk Hohndel --- qt-ui/downloadfromdivecomputer.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'qt-ui/downloadfromdivecomputer.cpp') diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index 17c2a4eaa..0347932d5 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -56,7 +56,7 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) : progress_bar_text = ""; - fill_device_list(); + fill_device_list(DC_TYPE_OTHER); fill_computer_list(); ui.chooseDumpFile->setEnabled(ui.dumpToFile->isChecked()); @@ -104,7 +104,7 @@ void DownloadFromDCWidget::updateState(states state) return; if (state == INITIAL) { - fill_device_list(); + fill_device_list(DC_TYPE_OTHER); ui.progressBar->hide(); markChildrenAsEnabled(); timer->stop(); @@ -176,6 +176,7 @@ void DownloadFromDCWidget::updateState(states state) void DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString &vendor) { + int dcType = DC_TYPE_SERIAL; QAbstractItemModel *currentModel = ui.product->model(); if (!currentModel) return; @@ -183,6 +184,10 @@ void DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString &vendor) productModel = new QStringListModel(productList[vendor]); ui.product->setModel(productModel); + if (vendor == QString("Uemis")) + dcType = DC_TYPE_UEMIS; + fill_device_list(dcType); + // Memleak - but deleting gives me a crash. //currentModel->deleteLater(); } @@ -429,11 +434,11 @@ static void fillDeviceList(const char *name, void *data) comboBox->addItem(name); } -void DownloadFromDCWidget::fill_device_list() +void DownloadFromDCWidget::fill_device_list(int dc_type) { int deviceIndex; ui.device->clear(); - deviceIndex = enumerate_devices(fillDeviceList, ui.device); + deviceIndex = enumerate_devices(fillDeviceList, ui.device, dc_type); if (deviceIndex >= 0) ui.device->setCurrentIndex(deviceIndex); } -- cgit v1.2.3-70-g09d2