summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/downloadfromdivecomputer.cpp44
-rw-r--r--desktop-widgets/downloadfromdivecomputer.h1
2 files changed, 45 insertions, 0 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp
index 2929a25da..41acae7c5 100644
--- a/desktop-widgets/downloadfromdivecomputer.cpp
+++ b/desktop-widgets/downloadfromdivecomputer.cpp
@@ -331,6 +331,8 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
qPrefDiveComputer::set_product(data->product());
qPrefDiveComputer::set_device(data->devName());
+ updateRememberedDCs();
+
#if defined(BT_SUPPORT)
qPrefDiveComputer::set_download_mode(ui.bluetoothMode->isChecked() ? DC_TRANSPORT_BLUETOOTH : DC_TRANSPORT_SERIAL);
#endif
@@ -353,6 +355,48 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
}
}
+void DownloadFromDCWidget::updateRememberedDCs()
+{
+ QString current = qPrefDiveComputer::vendor() + " - " + qPrefDiveComputer::product();
+ QStringList dcs = {
+ qPrefDiveComputer::vendor1() + " - " + qPrefDiveComputer::product1(),
+ qPrefDiveComputer::vendor2() + " - " + qPrefDiveComputer::product2(),
+ qPrefDiveComputer::vendor3() + " - " + qPrefDiveComputer::product3(),
+ qPrefDiveComputer::vendor4() + " - " + qPrefDiveComputer::product4()
+ };
+ if (dcs.contains(current))
+ // already in the list
+ return;
+ // add the current one as the first remembered one and drop the 4th one
+ // don't get confused by 0-based and 1-based indices!
+ if (dcs[2] != " - ") {
+ qPrefDiveComputer::set_vendor4(qPrefDiveComputer::vendor3());
+ qPrefDiveComputer::set_product4(qPrefDiveComputer::product3());
+ qPrefDiveComputer::set_device4(qPrefDiveComputer::device3());
+ ui.DC4->setText(dcs[2]);
+ ui.DC4->setVisible(true);
+ }
+ if (dcs[1] != " - ") {
+ qPrefDiveComputer::set_vendor3(qPrefDiveComputer::vendor2());
+ qPrefDiveComputer::set_product3(qPrefDiveComputer::product2());
+ qPrefDiveComputer::set_device3(qPrefDiveComputer::device2());
+ ui.DC3->setText(dcs[1]);
+ ui.DC3->setVisible(true);
+ }
+ if (dcs[0] != " - ") {
+ qPrefDiveComputer::set_vendor2(qPrefDiveComputer::vendor1());
+ qPrefDiveComputer::set_product2(qPrefDiveComputer::product1());
+ qPrefDiveComputer::set_device2(qPrefDiveComputer::device1());
+ ui.DC2->setText(dcs[0]);
+ ui.DC2->setVisible(true);
+ }
+ qPrefDiveComputer::set_vendor1(qPrefDiveComputer::vendor());
+ qPrefDiveComputer::set_product1(qPrefDiveComputer::product());
+ qPrefDiveComputer::set_device1(qPrefDiveComputer::device());
+ ui.DC1->setText(current);
+ ui.DC1->setVisible(true);
+}
+
bool DownloadFromDCWidget::preferDownloaded()
{
return ui.preferDownloaded->isChecked();
diff --git a/desktop-widgets/downloadfromdivecomputer.h b/desktop-widgets/downloadfromdivecomputer.h
index b357f186f..f9cc83e64 100644
--- a/desktop-widgets/downloadfromdivecomputer.h
+++ b/desktop-widgets/downloadfromdivecomputer.h
@@ -59,6 +59,7 @@ private:
void markChildrenAsDisabled();
void markChildrenAsEnabled();
void updateDeviceEnabled();
+ void updateRememberedDCs();
QStringListModel vendorModel;
QStringListModel productModel;