summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-22 23:24:33 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-22 23:24:33 -0700
commitc917a99eb2973701a79ba8bdb6002bb6ec0ad880 (patch)
tree12fe6edd7571812e92d0451f00081f513152f404 /qt-ui
parent115e5e5fbc5fcf190ceafaa2b800160cec93d52e (diff)
downloadsubsurface-c917a99eb2973701a79ba8bdb6002bb6ec0ad880.tar.gz
Implement default dive computer and device
The data is saved in the settings and the correct dive computer (vendor and product) and device are picked when the download dialog is openend. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index 9b8ad29ef..9411ddd88 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -2,6 +2,8 @@
#include "ui_downloadfromdivecomputer.h"
#include "../libdivecomputer.h"
+#include "../helpers.h"
+#include "../display.h"
#include <cstdlib>
#include <QThread>
#include <QDebug>
@@ -41,7 +43,15 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget* parent, Qt::WindowFlags f) :
vendorModel = new QStringListModel(vendorList);
ui->vendor->setModel(vendorModel);
- ui->product->setModel(0);
+ if (default_dive_computer_vendor) {
+ ui->vendor->setCurrentIndex(ui->vendor->findText(default_dive_computer_vendor));
+ productModel = new QStringListModel(productList[default_dive_computer_vendor]);
+ ui->product->setModel(productModel);
+ if (default_dive_computer_product)
+ ui->product->setCurrentIndex(ui->product->findText(default_dive_computer_product));
+ }
+ if (default_dive_computer_device)
+ ui->device->setText(default_dive_computer_device);
}
void DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString& vendor)
@@ -128,8 +138,8 @@ void DownloadFromDCWidget::on_ok_clicked()
data.product = strdup(ui->product->currentText().toUtf8().data());
data.descriptor = descriptorLookup[ui->vendor->currentText() + ui->product->currentText()];
data.force_download = ui->forceDownload->isChecked();
- // still needs to be implemented
- // set_default_dive_computer(data.vendor, data.product);
+ set_default_dive_computer(data.vendor, data.product);
+ set_default_dive_computer_device(data.devname);
thread = new InterfaceThread(this, &data);
connect(thread, SIGNAL(updateInterface(int)),