diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-09-24 07:04:21 -0700 |
---|---|---|
committer | Jan Mulder <jlmulder@xs4all.nl> | 2018-09-24 18:51:21 +0200 |
commit | ebb3fc8a0cc68036afa6cfc09bbc7edeb3e36356 (patch) | |
tree | 165222d495a89f506cd23fba68f017a467f6f0ce /desktop-widgets/downloadfromdivecomputer.cpp | |
parent | 02fc78570e7d0a44264a9084a4884581adafe218 (diff) | |
download | subsurface-ebb3fc8a0cc68036afa6cfc09bbc7edeb3e36356.tar.gz |
Desktop/remember DCs: insert the remember connection into dropdown
This still doesn't do the right thing for BT/BLE connections on a Mac, but it
should work on Linux and possibly Mac.
We definitely need to figure out how to get the Mac to successfully connect back
to a BT/BLE device.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/downloadfromdivecomputer.cpp')
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index c040575fc..561ff2998 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -121,6 +121,17 @@ void DownloadFromDCWidget::showRememberedDCs() SETUPDC(4) } +int DownloadFromDCWidget::deviceIndex(QString deviceText) +{ + int rv = ui.device->findText(deviceText); + if (rv == -1) { + // we need to insert the device text into the model + ui.device->addItem(deviceText); + rv = ui.device->findText(deviceText); + } + return rv; +} + // DC button slots #define DCBUTTON(num) \ void DownloadFromDCWidget::DC##num##Clicked() \ @@ -128,7 +139,7 @@ void DownloadFromDCWidget::DC##num##Clicked() \ ui.vendor->setCurrentIndex(ui.vendor->findText(qPrefDiveComputer::vendor##num())); \ productModel.setStringList(productList[qPrefDiveComputer::vendor##num()]); \ ui.product->setCurrentIndex(ui.product->findText(qPrefDiveComputer::product##num())); \ - ui.device->setCurrentIndex(ui.device->findText(qPrefDiveComputer::device##num())); \ + ui.device->setCurrentIndex(deviceIndex(qPrefDiveComputer::device##num())); \ if (QSysInfo::kernelType() == "darwin") { \ /* it makes no sense that this would be needed on macOS but not Linux */ \ QCoreApplication::processEvents(); \ |