mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
eefaae35b3
commit
25bee36fcc
1 changed files with 24 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue