Before this, if you did click save backup xml before you read the data,
you would get a xml file full of bogus. This initializes everything to
zero.

Signed-off-by: Anton Lundin <[email protected]>
---
 devicedetails.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 48 insertions(+), 2 deletions(-)

diff --git a/devicedetails.cpp b/devicedetails.cpp
index 4f4d040..d192c67 100644
--- a/devicedetails.cpp
+++ b/devicedetails.cpp
@@ -1,9 +1,55 @@
 #include "devicedetails.h"
 
+// This can probably be done better by someone with better c++-FU
+const struct gas zero_gas = {0};
+const struct setpoint zero_setpoint = {0};
+
 DeviceDetails::DeviceDetails(QObject *parent) :
-       QObject(parent)
+       QObject(parent),
+       m_data(0),
+       m_serialNo(""),
+       m_firmwareVersion(""),
+       m_customText(""),
+       m_syncTime(false),
+       m_gas1(zero_gas),
+       m_gas2(zero_gas),
+       m_gas3(zero_gas),
+       m_gas4(zero_gas),
+       m_gas5(zero_gas),
+       m_dil1(zero_gas),
+       m_dil2(zero_gas),
+       m_dil3(zero_gas),
+       m_dil4(zero_gas),
+       m_dil5(zero_gas),
+       m_sp1(zero_setpoint),
+       m_sp2(zero_setpoint),
+       m_sp3(zero_setpoint),
+       m_sp4(zero_setpoint),
+       m_sp5(zero_setpoint),
+       m_ccrMode(0),
+       m_diveMode(0),
+       m_decoType(0),
+       m_pp02Max(0),
+       m_pp02Min(0),
+       m_futureTTS(0),
+       m_gfLow(0),
+       m_gfHigh(0),
+       m_aGFLow(0),
+       m_aGFHigh(0),
+       m_aGFSelectable(0),
+       m_saturation(0),
+       m_desaturation(0),
+       m_lastDeco(0),
+       m_brightness(0),
+       m_units(0),
+       m_samplingRate(0),
+       m_salinity(0),
+       m_diveModeColor(0),
+       m_language(0),
+       m_dateFormat(0),
+       m_compassGain(0),
+       m_pressureSensorOffset(0)
 {
-
 }
 
 device_data_t *DeviceDetails::data() const
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to