diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2019-07-04 13:49:37 +0900 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2019-07-09 21:41:04 +0200 |
commit | 25bee36fcc06f52761f07ec3957c9a8663c6b39e (patch) | |
tree | 764637de5c0a95ecc3662cb2eb4d3b61f20826f5 /desktop-widgets/downloadfromdivecomputer.cpp | |
parent | eefaae35b3e1a969d0ff04879f8d4fe76ee6eeb6 (diff) | |
download | subsurface-25bee36fcc06f52761f07ec3957c9a8663c6b39e.tar.gz |
Desktop: update BT selection when picking remembered dive computer
When switching to a BT dive computer, the device selection dialog is opened,
when switching away from BT, the device address is set.
Fixes #2139
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/downloadfromdivecomputer.cpp')
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index f948097b2..7c6101845 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -131,6 +131,27 @@ int DownloadFromDCWidget::deviceIndex(QString deviceText) } // DC button slots +// we need two versions as one of the helper functions used is only available if +// Bluetooth support is enabled +#ifdef BT_SUPPORT +#define DCBUTTON(num) \ +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.bluetoothMode->setChecked(isBluetoothAddress(qPrefDiveComputer::device##num())); \ + if (ui.device->currentIndex() == -1) \ + 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(); \ + ui.vendor->update(); \ + ui.product->update(); \ + ui.device->update(); \ + } \ +} +#else #define DCBUTTON(num) \ void DownloadFromDCWidget::DC##num##Clicked() \ { \ @@ -146,6 +167,9 @@ void DownloadFromDCWidget::DC##num##Clicked() \ ui.device->update(); \ } \ } +#endif + + DCBUTTON(1) DCBUTTON(2) |