aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-18 13:29:40 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-19 20:12:55 +0900
commit047032ee46ef00d924dea0ee68b0f2726975fcd6 (patch)
treeb3a8c1120e2bc873e6996842fba7a820a7a0c282 /qt-ui
parent6d42a99e7f6d3ea3a9c977604c7cc980a4215f18 (diff)
downloadsubsurface-047032ee46ef00d924dea0ee68b0f2726975fcd6.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp13
-rw-r--r--qt-ui/downloadfromdivecomputer.h2
2 files changed, 10 insertions, 5 deletions
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);
}
diff --git a/qt-ui/downloadfromdivecomputer.h b/qt-ui/downloadfromdivecomputer.h
index e20ba3051..955322232 100644
--- a/qt-ui/downloadfromdivecomputer.h
+++ b/qt-ui/downloadfromdivecomputer.h
@@ -68,7 +68,7 @@ private:
QStringListModel *vendorModel;
QStringListModel *productModel;
void fill_computer_list();
- void fill_device_list();
+ void fill_device_list(int dc_type);
QString logFile;
QString dumpFile;
QTimer *timer;