mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Hide the local BT combobox if there is only one device
If there is only one local Bluetooth adapter, then hide the selection combobox and the label. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8c373f419d
commit
aaf61c52d8
1 changed files with 19 additions and 12 deletions
|
@ -26,9 +26,11 @@ BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) :
|
||||||
|
|
||||||
// Populate the list with local bluetooth devices
|
// Populate the list with local bluetooth devices
|
||||||
QList<QBluetoothHostInfo> localAvailableDevices = localDevice->allDevices();
|
QList<QBluetoothHostInfo> localAvailableDevices = localDevice->allDevices();
|
||||||
int defaultDeviceIndex = -1;
|
|
||||||
int availableDevicesSize = localAvailableDevices.size();
|
int availableDevicesSize = localAvailableDevices.size();
|
||||||
|
|
||||||
|
if (availableDevicesSize > 1) {
|
||||||
|
int defaultDeviceIndex = -1;
|
||||||
|
|
||||||
for (int it = 0; it < availableDevicesSize; it++) {
|
for (int it = 0; it < availableDevicesSize; it++) {
|
||||||
QBluetoothHostInfo localAvailableDevice = localAvailableDevices.at(it);
|
QBluetoothHostInfo localAvailableDevice = localAvailableDevices.at(it);
|
||||||
ui->localSelectedDevice->addItem(localAvailableDevice.name(),
|
ui->localSelectedDevice->addItem(localAvailableDevice.name(),
|
||||||
|
@ -42,6 +44,11 @@ BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) :
|
||||||
ui->localSelectedDevice->setCurrentIndex(defaultDeviceIndex);
|
ui->localSelectedDevice->setCurrentIndex(defaultDeviceIndex);
|
||||||
connect(ui->localSelectedDevice, SIGNAL(currentIndexChanged(int)),
|
connect(ui->localSelectedDevice, SIGNAL(currentIndexChanged(int)),
|
||||||
this, SLOT(localDeviceChanged(int)));
|
this, SLOT(localDeviceChanged(int)));
|
||||||
|
} else {
|
||||||
|
// If there is only one local Bluetooth adapter hide the combobox and the label
|
||||||
|
ui->selectDeviceLable->hide();
|
||||||
|
ui->localSelectedDevice->hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Update the UI information about the local device
|
// Update the UI information about the local device
|
||||||
updateLocalDeviceInformation();
|
updateLocalDeviceInformation();
|
||||||
|
|
Loading…
Add table
Reference in a new issue