aboutsummaryrefslogtreecommitdiffstats
path: root/core/subsurface-qt
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 /core/subsurface-qt
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 'core/subsurface-qt')
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp18
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h4
2 files changed, 22 insertions, 0 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index ed4b556d1..d1146b7b6 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -29,6 +29,11 @@ QString DiveComputerSettings::dc_device() const
return prefs.dive_computer.device;
}
+QString DiveComputerSettings::dc_device_name() const
+{
+ return prefs.dive_computer.device_name;
+}
+
int DiveComputerSettings::downloadMode() const
{
return prefs.dive_computer.download_mode;
@@ -70,6 +75,18 @@ void DiveComputerSettings::setDevice(const QString& device)
prefs.dive_computer.device = copy_string(qPrintable(device));
}
+void DiveComputerSettings::setDeviceName(const QString& device_name)
+{
+ if (device_name == prefs.dive_computer.device_name)
+ return;
+
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("dive_computer_device_name", device_name);
+ free(prefs.dive_computer.device_name);
+ prefs.dive_computer.device_name = copy_string(qPrintable(device_name));
+}
+
void DiveComputerSettings::setDownloadMode(int mode)
{
if (mode == prefs.dive_computer.download_mode)
@@ -2333,6 +2350,7 @@ void SettingsObjectWrapper::load()
GET_TXT("dive_computer_vendor",dive_computer.vendor);
GET_TXT("dive_computer_product", dive_computer.product);
GET_TXT("dive_computer_device", dive_computer.device);
+ GET_TXT("dive_computer_device_name", dive_computer.device_name);
GET_INT("dive_computer_download_mode", dive_computer.download_mode);
s.endGroup();
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index d16d3fa27..19cfcdd50 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -18,24 +18,28 @@ class DiveComputerSettings : public QObject {
Q_PROPERTY(QString vendor READ dc_vendor WRITE setVendor NOTIFY vendorChanged)
Q_PROPERTY(QString product READ dc_product WRITE setProduct NOTIFY productChanged)
Q_PROPERTY(QString device READ dc_device WRITE setDevice NOTIFY deviceChanged)
+ Q_PROPERTY(QString device_name READ dc_device_name WRITE setDeviceName NOTIFY deviceNameChanged)
Q_PROPERTY(int download_mode READ downloadMode WRITE setDownloadMode NOTIFY downloadModeChanged)
public:
DiveComputerSettings(QObject *parent);
QString dc_vendor() const;
QString dc_product() const;
QString dc_device() const;
+ QString dc_device_name() const;
int downloadMode() const;
public slots:
void setVendor(const QString& vendor);
void setProduct(const QString& product);
void setDevice(const QString& device);
+ void setDeviceName(const QString& device_name);
void setDownloadMode(int mode);
signals:
void vendorChanged(const QString& vendor);
void productChanged(const QString& product);
void deviceChanged(const QString& device);
+ void deviceNameChanged(const QString& device_name);
void downloadModeChanged(int mode);
private:
const QString group = QStringLiteral("DiveComputer");