aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-05 12:58:16 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-09 12:01:56 -0300
commita7a74ae9a630dba8ba29afb3fece6c9f5bf3639d (patch)
treed88126c00ecdd14535cec2e3b36e96c3915832e5 /qt-ui
parentee2403d63c282cbf7ef6b155013ae2cc42278ee7 (diff)
downloadsubsurface-a7a74ae9a630dba8ba29afb3fece6c9f5bf3639d.tar.gz
Improve writing of device name to dive computers.
Improves the writing of device name to the dive computer. The code has been updated to use a switch statement. This will make it easier to add new devices in the future. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/configuredivecomputer.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp
index 2d7008b81..f591efffa 100644
--- a/qt-ui/configuredivecomputer.cpp
+++ b/qt-ui/configuredivecomputer.cpp
@@ -114,15 +114,16 @@ void WriteSettingsThread::run()
rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname);
if (rc == DC_STATUS_SUCCESS) {
dc_status_t result;
- if (dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3) {
- if (m_settingName == "Name") {
+ if (m_settingName == "Name") {
+ switch (dc_device_get_type(data->device)) {
+ case DC_FAMILY_HW_OSTC3:
supported = true;
result = hw_ostc3_device_customtext(data->device, m_settingValue.toByteArray().data());
- }
- } else if ( dc_device_get_type(data->device) == DC_FAMILY_HW_FROG ) {
- if (m_settingName == "Name") {
+ break;
+ case DC_FAMILY_HW_FROG:
supported = true;
result = hw_frog_device_customtext(data->device, m_settingValue.toByteArray().data());
+ break;
}
}
if (m_settingName == "DateAndTime") {