mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c0b169e0a3
commit
13083fb524
1 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue