aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/btdeviceselectiondialog.cpp
diff options
context:
space:
mode:
authorGravatar Claudiu Olteanu <olteanu.claudiu@ymail.com>2015-07-13 23:44:09 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-13 15:21:30 -0700
commit94d3aa04dccc3c10980188bd357618e2a9f2fa83 (patch)
tree3a17684d73468f95f1beb3243094cc11d28079a8 /qt-ui/btdeviceselectiondialog.cpp
parentc6c706c28a90c78617c911b8c9c1192e6800d8f7 (diff)
downloadsubsurface-94d3aa04dccc3c10980188bd357618e2a9f2fa83.tar.gz
Wait until the BT scanning process is done on Android platforms
Block the Save button on Android platforms until the scanning for remote Bluetooth devices is finished. The reason we do that is because there is a bug on the Android platform or on the QtBluetooth library which stops the downloading process and blocks the devices on the Download mode. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/btdeviceselectiondialog.cpp')
-rw-r--r--qt-ui/btdeviceselectiondialog.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp
index 436dca510..9b97da3a9 100644
--- a/qt-ui/btdeviceselectiondialog.cpp
+++ b/qt-ui/btdeviceselectiondialog.cpp
@@ -108,6 +108,21 @@ void BtDeviceSelectionDialog::remoteDeviceScanFinished()
{
ui->dialogStatus->setText("Scanning finished.");
ui->scan->setEnabled(true);
+
+#if defined(Q_OS_ANDROID)
+ // Check if there is a selected device and activate the Save button if it is paired
+ QListWidgetItem *currentItem = ui->discoveredDevicesList->currentItem();
+
+ if (currentItem != NULL) {
+ QBluetoothDeviceInfo remoteDeviceInfo = currentItem->data(Qt::UserRole).value<QBluetoothDeviceInfo>();
+ QBluetoothLocalDevice::Pairing pairingStatus = localDevice->pairingStatus(remoteDeviceInfo.address());
+
+ if (pairingStatus != QBluetoothLocalDevice::Unpaired) {
+ ui->save->setEnabled(true);
+ ui->dialogStatus->setText("Scanning finished. You can press the Save button and start the download.");
+ }
+ }
+#endif
}
void BtDeviceSelectionDialog::hostModeStateChanged(QBluetoothLocalDevice::HostMode mode)
@@ -156,6 +171,13 @@ void BtDeviceSelectionDialog::itemActivated(QListWidgetItem *item)
.arg(remoteDeviceInfo.address().toString()));
ui->save->setEnabled(false);
} else {
+#if defined(Q_OS_ANDROID)
+ if (remoteDeviceDiscoveryAgent->isActive()) {
+ ui->dialogStatus->setText(QString("The device %1 can be used for connection. Wait until the device scanning is done and press the Save button.")
+ .arg(remoteDeviceInfo.address().toString()));
+ return;
+ }
+#endif
ui->dialogStatus->setText(QString("The device %1 can be used for connection. You can press the Save button.")
.arg(remoteDeviceInfo.address().toString()));
ui->save->setEnabled(true);