>
> Claudiu, most people only have one local bluetooth device. We shouldn't
> display a list to select an entry if there's only one entry to be selected.
> Can you hide the list if the list contains only one?
>

Of course I can do. One of the attached patches (#0009) should do the trick.


> Where is this deleted? Does QBluetoothLocalDevice take ownership?
>

This information should remain until the widget is destroyed. I thought
that it will be automatically deleted when I delete the *ui *instance.
Should I
manually clean his children?


> All of those QString() should be tr() so they cna be translated. I haven't
> checked previous patches for this...
>

None of the patches uses tr() . I will create a patch in the end which will
do the
translations.


> > +#elif defined(Q_OS_ANDROID) || (QT_VERSION >= 0x050500 &&
> > (defined(Q_OS_IOS) || defined(Q_OS_OSX)))
>
> Hint: Q_OS_DARWIN and Q_OS_MAC also mean Q_OS_IOS || Q_OS_OSX.
>

I saw that Q_OS_MAC doesn't include the open source version and I didn't
know which is that :).

Thanks for the hints,
Claudiu
From 3608bc8431449aff26f0f0563337d136de08cd2b Mon Sep 17 00:00:00 2001
From: Claudiu Olteanu <olteanu.clau...@ymail.com>
Date: Sun, 19 Jul 2015 22:11:16 +0300
Subject: [PATCH 11/11] Update the message shown on pairing erorrs

Advice the user to use his operating system for the pairing
step if the remote device requires a custom PIN code.

Signed-off-by: Claudiu Olteanu <olteanu.clau...@ymail.com>
---
 qt-ui/btdeviceselectiondialog.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp
index 9cde87e..007fe94 100644
--- a/qt-ui/btdeviceselectiondialog.cpp
+++ b/qt-ui/btdeviceselectiondialog.cpp
@@ -272,7 +272,9 @@ void BtDeviceSelectionDialog::pairingFinished(const QBluetoothAddress &address,
 void BtDeviceSelectionDialog::error(QBluetoothLocalDevice::Error error)
 {
 	ui->dialogStatus->setText(QString("Local device error: %1.")
-				  .arg((error == QBluetoothLocalDevice::PairingError)? "Pairing error" : "Unknown error"));
+				  .arg((error == QBluetoothLocalDevice::PairingError)? "Pairing error. If the remote device requires a custom PIN code, "
+										       "please try to pair the devices using your operating system. "
+										     : "Unknown error"));
 }
 
 void BtDeviceSelectionDialog::deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error error)
-- 
2.1.4

From f9dc098f4912b339d956195777bbc171ca4c2836 Mon Sep 17 00:00:00 2001
From: Claudiu Olteanu <olteanu.clau...@ymail.com>
Date: Sun, 19 Jul 2015 21:50:06 +0300
Subject: [PATCH 09/11] 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.clau...@ymail.com>
---
 qt-ui/btdeviceselectiondialog.cpp | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp
index f84d9cd..1d6b812 100644
--- a/qt-ui/btdeviceselectiondialog.cpp
+++ b/qt-ui/btdeviceselectiondialog.cpp
@@ -26,22 +26,29 @@ BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) :
 
 	// Populate the list with local bluetooth devices
 	QList<QBluetoothHostInfo> localAvailableDevices = localDevice->allDevices();
-	int defaultDeviceIndex = -1;
 	int availableDevicesSize = localAvailableDevices.size();
 
-	for (int it = 0; it < availableDevicesSize; it++) {
-		QBluetoothHostInfo localAvailableDevice = localAvailableDevices.at(it);
-		ui->localSelectedDevice->addItem(localAvailableDevice.name(),
-						 QVariant::fromValue(localAvailableDevice.address()));
+	if (availableDevicesSize > 1) {
+		int defaultDeviceIndex = -1;
 
-		if (localDevice->address() == localAvailableDevice.address())
-			defaultDeviceIndex = it;
-	}
+		for (int it = 0; it < availableDevicesSize; it++) {
+			QBluetoothHostInfo localAvailableDevice = localAvailableDevices.at(it);
+			ui->localSelectedDevice->addItem(localAvailableDevice.name(),
+							 QVariant::fromValue(localAvailableDevice.address()));
+
+			if (localDevice->address() == localAvailableDevice.address())
+				defaultDeviceIndex = it;
+		}
 
-	// Positionate the current index to the default device and register to index changes events
-	ui->localSelectedDevice->setCurrentIndex(defaultDeviceIndex);
-	connect(ui->localSelectedDevice, SIGNAL(currentIndexChanged(int)),
-		this, SLOT(localDeviceChanged(int)));
+		// Positionate the current index to the default device and register to index changes events
+		ui->localSelectedDevice->setCurrentIndex(defaultDeviceIndex);
+		connect(ui->localSelectedDevice, SIGNAL(currentIndexChanged(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
 	updateLocalDeviceInformation();
-- 
2.1.4

From a03c8bada1cb0856bd57e7ade2993d74939c7da2 Mon Sep 17 00:00:00 2001
From: Claudiu Olteanu <olteanu.clau...@ymail.com>
Date: Sun, 19 Jul 2015 22:05:00 +0300
Subject: [PATCH 10/11] Fix typos on Bluetooth selection widget

Fix "lable" typos from Bluetooth selection widget.

Signed-off-by: Claudiu Olteanu <olteanu.clau...@ymail.com>
---
 qt-ui/btdeviceselectiondialog.cpp | 8 ++++----
 qt-ui/btdeviceselectiondialog.ui  | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp
index 1d6b812..9cde87e 100644
--- a/qt-ui/btdeviceselectiondialog.cpp
+++ b/qt-ui/btdeviceselectiondialog.cpp
@@ -46,7 +46,7 @@ BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) :
 			this, SLOT(localDeviceChanged(int)));
 	} else {
 		// If there is only one local Bluetooth adapter hide the combobox and the label
-		ui->selectDeviceLable->hide();
+		ui->selectDeviceLabel->hide();
 		ui->localSelectedDevice->hide();
 	}
 
@@ -131,12 +131,12 @@ void BtDeviceSelectionDialog::hostModeStateChanged(QBluetoothLocalDevice::HostMo
 
 void BtDeviceSelectionDialog::addRemoteDevice(const QBluetoothDeviceInfo &remoteDeviceInfo)
 {
-	QString deviceLable = QString("%1  (%2)").arg(remoteDeviceInfo.name()).arg(remoteDeviceInfo.address().toString());
-	QList<QListWidgetItem *> itemsWithSameSignature = ui->discoveredDevicesList->findItems(deviceLable, Qt::MatchStartsWith);
+	QString deviceLabel = QString("%1  (%2)").arg(remoteDeviceInfo.name()).arg(remoteDeviceInfo.address().toString());
+	QList<QListWidgetItem *> itemsWithSameSignature = ui->discoveredDevicesList->findItems(deviceLabel, Qt::MatchStartsWith);
 
 	// Check if the remote device is already in the list
 	if (itemsWithSameSignature.empty()) {
-		QListWidgetItem *item = new QListWidgetItem(deviceLable);
+		QListWidgetItem *item = new QListWidgetItem(deviceLabel);
 		QBluetoothLocalDevice::Pairing pairingStatus = localDevice->pairingStatus(remoteDeviceInfo.address());
 		item->setData(Qt::UserRole, QVariant::fromValue(remoteDeviceInfo));
 
diff --git a/qt-ui/btdeviceselectiondialog.ui b/qt-ui/btdeviceselectiondialog.ui
index 6f81c9a..95c09d1 100644
--- a/qt-ui/btdeviceselectiondialog.ui
+++ b/qt-ui/btdeviceselectiondialog.ui
@@ -123,7 +123,7 @@
      </property>
      <layout class="QFormLayout" name="formLayout_2">
       <item row="2" column="0">
-       <widget class="QLabel" name="deviceNameLable">
+       <widget class="QLabel" name="deviceNameLabel">
         <property name="text">
          <string>Name: </string>
         </property>
@@ -137,7 +137,7 @@
        </widget>
       </item>
       <item row="3" column="0">
-       <widget class="QLabel" name="deviceAddressLable">
+       <widget class="QLabel" name="deviceAddressLabel">
         <property name="text">
          <string>Address:</string>
         </property>
@@ -198,7 +198,7 @@
        <widget class="QComboBox" name="localSelectedDevice"/>
       </item>
       <item row="1" column="0">
-       <widget class="QLabel" name="selectDeviceLable">
+       <widget class="QLabel" name="selectDeviceLabel">
         <property name="text">
          <string>Select device:</string>
         </property>
-- 
2.1.4

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to