Avoid unnecessary bluetooth device address scanning.

When switching from a non-bluetooth computer to a bluetooh computer an unnecessary bluetooth scan may be forced.   This patch will avoid the scan if the bluetooth device address is known.



Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
This commit is contained in:
jme 2024-03-05 09:05:08 +00:00 committed by Michael Keller
parent f4b35f67f6
commit 4dcc9210a9

View file

@ -150,6 +150,7 @@ int DownloadFromDCWidget::deviceIndex(QString deviceText)
void DownloadFromDCWidget::DC##num##Clicked() \ void DownloadFromDCWidget::DC##num##Clicked() \
{ \ { \
ui.vendor->setCurrentIndex(ui.vendor->findText(qPrefDiveComputer::vendor##num())); \ ui.vendor->setCurrentIndex(ui.vendor->findText(qPrefDiveComputer::vendor##num())); \
ui.device->setCurrentText(qPrefDiveComputer::device##num()); \
productModel.setStringList(productList[qPrefDiveComputer::vendor##num()]); \ productModel.setStringList(productList[qPrefDiveComputer::vendor##num()]); \
ui.product->setCurrentIndex(ui.product->findText(qPrefDiveComputer::product##num())); \ ui.product->setCurrentIndex(ui.product->findText(qPrefDiveComputer::product##num())); \
bool isBluetoothDevice = isBluetoothAddress(qPrefDiveComputer::device##num()); \ bool isBluetoothDevice = isBluetoothAddress(qPrefDiveComputer::device##num()); \
@ -634,10 +635,13 @@ void DownloadFromDCWidget::enableBluetoothMode(int state)
{ {
ui.chooseBluetoothDevice->setEnabled(state == Qt::Checked); ui.chooseBluetoothDevice->setEnabled(state == Qt::Checked);
if (state == Qt::Checked) if (state == Qt::Checked) {
selectRemoteBluetoothDevice(); if (ui.device->currentText().isEmpty()) {
else selectRemoteBluetoothDevice();
ui.device->setCurrentIndex(-1); } else {
ui.device->setCurrentIndex(-1);
}
}
} }
#endif #endif