From a7a74ae9a630dba8ba29afb3fece6c9f5bf3639d Mon Sep 17 00:00:00 2001 From: "Joseph W. Joshua" Date: Thu, 5 Jun 2014 12:58:16 +0300 Subject: 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 Signed-off-by: Thiago Macieira --- qt-ui/configuredivecomputer.cpp | 11 ++++++----- 1 file 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") { -- cgit v1.2.3-70-g09d2