mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Desktop: only show dive computers in the Bluetooth device list
By default we'll only show devices that we believe to be dive computers, but the user can override that with the recently introduced check box. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7b0cfb1772
commit
f35a0f3b09
3 changed files with 10 additions and 1 deletions
|
@ -82,7 +82,12 @@ static dc_descriptor_t *getDeviceType(QString btName)
|
|||
if (!vendor.isEmpty() && !product.isEmpty())
|
||||
return descriptorLookup.value(vendor + product);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool matchesKnownDiveComputerNames(QString btName)
|
||||
{
|
||||
return getDeviceType(btName) != nullptr;
|
||||
}
|
||||
|
||||
BTDiscovery::BTDiscovery(QObject*) : m_btValid(false),
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
void saveBtDeviceInfo(const QString &devaddr, QBluetoothDeviceInfo deviceInfo);
|
||||
bool isBluetoothAddress(const QString &address);
|
||||
bool matchesKnownDiveComputerNames(QString btName);
|
||||
QString extractBluetoothAddress(const QString &address);
|
||||
QString extractBluetoothNameAddress(const QString &address, QString &name);
|
||||
QBluetoothDeviceInfo getBtDeviceInfo(const QString &devaddr);
|
||||
|
|
|
@ -172,6 +172,9 @@ void BtDeviceSelectionDialog::hostModeStateChanged(QBluetoothLocalDevice::HostMo
|
|||
|
||||
void BtDeviceSelectionDialog::addRemoteDevice(const QBluetoothDeviceInfo &remoteDeviceInfo)
|
||||
{
|
||||
// are we supposed to show all devices or just dive computers?
|
||||
if (!ui->showNonDivecomputers->isChecked() && !matchesKnownDiveComputerNames(remoteDeviceInfo.name()))
|
||||
return;
|
||||
#if defined(Q_OS_WIN)
|
||||
// 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(),
|
||||
|
|
Loading…
Add table
Reference in a new issue