From 13083fb5245d6e7212ddc213b5ca9dc9fe10702d Mon Sep 17 00:00:00 2001 From: Claudiu Olteanu Date: Tue, 18 Aug 2015 22:27:16 +0300 Subject: Add implementation for add remote Bluetooth device handler On Windows we cannot determine the pairing status of the device. Therefore we print only information about its name and about its BTH address. Signed-off-by: Claudiu Olteanu Signed-off-by: Dirk Hohndel --- qt-ui/btdeviceselectiondialog.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp index a257e249c..c78b01b94 100644 --- a/qt-ui/btdeviceselectiondialog.cpp +++ b/qt-ui/btdeviceselectiondialog.cpp @@ -192,7 +192,10 @@ void BtDeviceSelectionDialog::hostModeStateChanged(QBluetoothLocalDevice::HostMo void BtDeviceSelectionDialog::addRemoteDevice(const QBluetoothDeviceInfo &remoteDeviceInfo) { #if defined(Q_OS_WIN) - // TODO add the remote device + // On Windows we cannot obtain the pairing status so we set only the name and the address of the device + QString deviceLabel = QString("%1 (%2)").arg(remoteDeviceInfo.name(), + remoteDeviceInfo.address().toString()); + QColor pairingColor = QColor(Qt::white); #else // By default we use the status label and the color for the UNPAIRED state QColor pairingColor = QColor(Qt::red); @@ -210,13 +213,14 @@ void BtDeviceSelectionDialog::addRemoteDevice(const QBluetoothDeviceInfo &remote QString deviceLabel = QString("%1 (%2) [State: %3]").arg(remoteDeviceInfo.name(), remoteDeviceInfo.address().toString(), pairingStatusLabel); +#endif + // Create the new item, set its information and add it to the list QListWidgetItem *item = new QListWidgetItem(deviceLabel); item->setData(Qt::UserRole, QVariant::fromValue(remoteDeviceInfo)); item->setBackgroundColor(pairingColor); ui->discoveredDevicesList->addItem(item); -#endif } void BtDeviceSelectionDialog::itemClicked(QListWidgetItem *item) -- cgit v1.2.3-70-g09d2