diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-06-28 08:04:53 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-07-18 02:11:16 +0300 |
commit | b7bb9b417775b6ef69c7c865144d857fd00bb506 (patch) | |
tree | fd2fb0d27ed5eef49dc68da5c5cbe0917171d187 /desktop-widgets/btdeviceselectiondialog.cpp | |
parent | 6d72871942adf03e13436ff9342951543351cea6 (diff) | |
download | subsurface-b7bb9b417775b6ef69c7c865144d857fd00bb506.tar.gz |
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>
Diffstat (limited to 'desktop-widgets/btdeviceselectiondialog.cpp')
-rw-r--r-- | desktop-widgets/btdeviceselectiondialog.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/desktop-widgets/btdeviceselectiondialog.cpp b/desktop-widgets/btdeviceselectiondialog.cpp index 8077298f6..62558465f 100644 --- a/desktop-widgets/btdeviceselectiondialog.cpp +++ b/desktop-widgets/btdeviceselectiondialog.cpp @@ -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); } |