summaryrefslogtreecommitdiffstats
path: root/configuredivecomputer.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-10-12 16:51:27 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-12 12:30:52 -0400
commit263896dd8142a24daf892492ff15c42c753868e3 (patch)
tree1cd33a817c9cbd11591a44030168f4c5b2d8e996 /configuredivecomputer.cpp
parentd85508b25c95c8a915c5ea0c6a83508da46ba711 (diff)
downloadsubsurface-263896dd8142a24daf892492ff15c42c753868e3.tar.gz
This saves and restores Suunto Vyper configs
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'configuredivecomputer.cpp')
-rw-r--r--configuredivecomputer.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp
index 5fe5a4a91..addc2a728 100644
--- a/configuredivecomputer.cpp
+++ b/configuredivecomputer.cpp
@@ -181,6 +181,26 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
writer.writeTextElement("DateFormat", QString::number(details->dateFormat()));
writer.writeTextElement("CompassGain", QString::number(details->compassGain()));
+ // Suunto vyper settings.
+ writer.writeTextElement("Altitude", QString::number(details->altitude()));
+ writer.writeTextElement("PersonalSafety", QString::number(details->personalSafety()));
+ writer.writeTextElement("TimeFormat", QString::number(details->timeFormat()));
+
+ writer.writeStartElement("Light");
+ writer.writeAttribute("enabled", QString::number(details->lightEnabled()));
+ writer.writeCharacters(QString::number(details->light()));
+ writer.writeEndElement();
+
+ writer.writeStartElement("AlarmTime");
+ writer.writeAttribute("enabled", QString::number(details->alarmTimeEnabled()));
+ writer.writeCharacters(QString::number(details->alarmTime()));
+ writer.writeEndElement();
+
+ writer.writeStartElement("AlarmDepth");
+ writer.writeAttribute("enabled", QString::number(details->alarmDepthEnabled()));
+ writer.writeCharacters(QString::number(details->alarmDepth()));
+ writer.writeEndElement();
+
writer.writeEndElement();
writer.writeEndElement();
@@ -213,6 +233,7 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
while (!reader.atEnd()) {
if (reader.isStartElement()) {
QString settingName = reader.name().toString();
+ QXmlStreamAttributes attributes = reader.attributes();
reader.readNext();
QString keyString = reader.text().toString();
@@ -394,6 +415,33 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
if (settingName == "CompassGain")
details->setCompassGain(keyString.toInt());
+
+ if (settingName == "Altitude")
+ details->setAltitude(keyString.toInt());
+
+ if (settingName == "PersonalSafety")
+ details->setPersonalSafety(keyString.toInt());
+
+ if (settingName == "TimeFormat")
+ details->setTimeFormat(keyString.toInt());
+
+ if (settingName == "Light") {
+ if (attributes.hasAttribute("enabled"))
+ details->setLightEnabled(attributes.value("enabled").toString().toInt());
+ details->setLight(keyString.toInt());
+ }
+
+ if (settingName == "AlarmDepth") {
+ if (attributes.hasAttribute("enabled"))
+ details->setAlarmDepthEnabled(attributes.value("enabled").toString().toInt());
+ details->setAlarmDepth(keyString.toInt());
+ }
+
+ if (settingName == "AlarmTime") {
+ if (attributes.hasAttribute("enabled"))
+ details->setAlarmTimeEnabled(attributes.value("enabled").toString().toInt());
+ details->setAlarmTime(keyString.toInt());
+ }
}
reader.readNext();
}