mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Bluetooth: don't call deviceDiscoveryError() on scan finished
In the remoteDeviceScanFinished slot, the old code called into the deviceDiscoveryError() in case the device discovery agent had the error flag set. This is not necessary, since the agent will send an error signal in such a case. For Qt's device discovery agent, the whole check-for-error is unnecessary, as the documentation states: "The signal is not going to be emitted if the device discovery finishes with an error." But for the homebrew WinBluetoothDeviceDiscoveryAgent, which derives from QThread, both an error() *and* a finished() signal will be sent. Therefore keep the test, but don't call into the slot twice. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
6d72871942
commit
b7bb9b4177
1 changed files with 5 additions and 4 deletions
|
@ -194,11 +194,12 @@ void BtDeviceSelectionDialog::on_scan_clicked()
|
|||
|
||||
void BtDeviceSelectionDialog::remoteDeviceScanFinished()
|
||||
{
|
||||
if (remoteDeviceDiscoveryAgent->error() == QBluetoothDeviceDiscoveryAgent::NoError) {
|
||||
// This check is not necessary for Qt's QBluetoothDeviceDiscoveryAgent,
|
||||
// but with the home-brew WinBluetoothDeviceDiscoveryAgent, on error we
|
||||
// get an error() and an finished() signal. Thus, don't overwrite the
|
||||
// error message with a success message.
|
||||
if (remoteDeviceDiscoveryAgent->error() == QBluetoothDeviceDiscoveryAgent::NoError)
|
||||
ui->dialogStatus->setText(tr("Scanning finished successfully."));
|
||||
} else {
|
||||
deviceDiscoveryError(remoteDeviceDiscoveryAgent->error());
|
||||
}
|
||||
|
||||
ui->scan->setEnabled(true);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue