summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/configuredivecomputerdialog.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-11-12 12:33:20 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-11-13 20:48:17 -0800
commitde81effb258c9c55af299ef48e79df4de941b391 (patch)
treef4b4b0501046790fdeed71a307c295db8718f676 /desktop-widgets/configuredivecomputerdialog.cpp
parent0d023068b340bea8db421523156b5b460eaea41d (diff)
downloadsubsurface-de81effb258c9c55af299ef48e79df4de941b391.tar.gz
Make Bluetooth naming consistent
Currently, on Linux, after selecting a Bluetooth device the name of the device is shown. On reopening the download dialog, on the other hand, the address is shown. In the device selection dialog both are shown. This patch changes the download dialog such that both, name and address, are shown. The bulk of the patch introduces the name of the device in the preferences and DCDeviceData. It has to be noted that DCDeviceData is an encapsulation of the libdivecomputer device_data_t. Nevertheless, the new Bluetooth-name field is, at the moment, not passed through to libdivecomputer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/configuredivecomputerdialog.cpp')
-rw-r--r--desktop-widgets/configuredivecomputerdialog.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp
index 24fe63c3e..dd9913da4 100644
--- a/desktop-widgets/configuredivecomputerdialog.cpp
+++ b/desktop-widgets/configuredivecomputerdialog.cpp
@@ -904,7 +904,9 @@ void ConfigureDiveComputerDialog::configError(QString err)
void ConfigureDiveComputerDialog::getDeviceData()
{
- device_data.devname = strdup(ui.device->currentText().toUtf8().data());
+ QString device = ui.bluetoothMode && btDeviceSelectionDialog ?
+ btDeviceSelectionDialog->getSelectedDeviceAddress() : ui.device->currentText();
+ device_data.devname = strdup(device.toUtf8().data());
device_data.vendor = strdup(selected_vendor.toUtf8().data());
device_data.product = strdup(selected_product.toUtf8().data());
@@ -913,6 +915,8 @@ void ConfigureDiveComputerDialog::getDeviceData()
auto dc = SettingsObjectWrapper::instance()->dive_computer_settings;
dc->setDevice(device_data.devname);
+ if (ui.bluetoothMode && btDeviceSelectionDialog)
+ dc->setDeviceName(btDeviceSelectionDialog->getSelectedDeviceName());
}
void ConfigureDiveComputerDialog::on_cancel_clicked()
@@ -1488,7 +1492,7 @@ void ConfigureDiveComputerDialog::selectRemoteBluetoothDevice()
void ConfigureDiveComputerDialog::bluetoothSelectionDialogIsFinished(int result)
{
if (result == QDialog::Accepted) {
- ui.device->setCurrentText(btDeviceSelectionDialog->getSelectedDeviceAddress());
+ ui.device->setCurrentText(btDeviceSelectionDialog->getSelectedDeviceText());
device_data.bluetooth_mode = true;
ui.progressBar->setFormat("Connecting to device...");