aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-21 09:31:19 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-13 10:48:14 -0700
commit65b0b8a64b5477cd7121699eea4c951a873c7a9f (patch)
tree9d0514b95bfc72cf957cf465005ca43face4f957
parenta52beebbe9ba8d335d6d867a868166996dc6711e (diff)
downloadsubsurface-65b0b8a64b5477cd7121699eea4c951a873c7a9f.tar.gz
Backup/Restore of OSTC3 Gas Settings
Implements backup and restore for OSTC3 Gas Settings. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
-rw-r--r--configuredivecomputer.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp
index 01df1c744..0459640ad 100644
--- a/configuredivecomputer.cpp
+++ b/configuredivecomputer.cpp
@@ -61,6 +61,43 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
xml += "\n</DiveComputer>";
xml += "\n<Settings>";
xml += addSettingToXML("CustomText", details->customText());
+ //Add gasses
+ QString gas1 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas1().oxygen),
+ QString::number(details->gas1().helium),
+ QString::number(details->gas1().type),
+ QString::number(details->gas1().depth)
+ );
+ QString gas2 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas2().oxygen),
+ QString::number(details->gas2().helium),
+ QString::number(details->gas2().type),
+ QString::number(details->gas2().depth)
+ );
+ QString gas3 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas3().oxygen),
+ QString::number(details->gas3().helium),
+ QString::number(details->gas3().type),
+ QString::number(details->gas3().depth)
+ );
+ QString gas4 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas4().oxygen),
+ QString::number(details->gas4().helium),
+ QString::number(details->gas4().type),
+ QString::number(details->gas4().depth)
+ );
+ QString gas5 = QString("%1,%2,%3,%4")
+ .arg(QString::number(details->gas5().oxygen),
+ QString::number(details->gas5().helium),
+ QString::number(details->gas5().type),
+ QString::number(details->gas5().depth)
+ );
+ xml += addSettingToXML("Gas1", gas1);
+ xml += addSettingToXML("Gas2", gas2);
+ xml += addSettingToXML("Gas3", gas3);
+ xml += addSettingToXML("Gas4", gas4);
+ xml += addSettingToXML("Gas5", gas5);
+ //
xml += addSettingToXML("DiveMode", details->diveMode());
xml += addSettingToXML("Saturation", details->saturation());
xml += addSettingToXML("Desaturation", details->desaturation());
@@ -129,6 +166,56 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
if (settingName == "CustomText")
details->setCustomText(keyString);
+ if (settingName == "Gas1") {
+ QStringList gasData = keyString.split(",");
+ gas gas1;
+ gas1.oxygen = gasData.at(0).toInt();
+ gas1.helium = gasData.at(1).toInt();
+ gas1.type = gasData.at(2).toInt();
+ gas1.depth = gasData.at(3).toInt();
+ details->setGas1(gas1);
+ }
+
+ if (settingName == "Gas2") {
+ QStringList gasData = keyString.split(",");
+ gas gas2;
+ gas2.oxygen = gasData.at(0).toInt();
+ gas2.helium = gasData.at(1).toInt();
+ gas2.type = gasData.at(2).toInt();
+ gas2.depth = gasData.at(3).toInt();
+ details->setGas1(gas2);
+ }
+
+ if (settingName == "Gas3") {
+ QStringList gasData = keyString.split(",");
+ gas gas3;
+ gas3.oxygen = gasData.at(0).toInt();
+ gas3.helium = gasData.at(1).toInt();
+ gas3.type = gasData.at(2).toInt();
+ gas3.depth = gasData.at(3).toInt();
+ details->setGas3(gas3);
+ }
+
+ if (settingName == "Gas4") {
+ QStringList gasData = keyString.split(",");
+ gas gas4;
+ gas4.oxygen = gasData.at(0).toInt();
+ gas4.helium = gasData.at(1).toInt();
+ gas4.type = gasData.at(2).toInt();
+ gas4.depth = gasData.at(3).toInt();
+ details->setGas4(gas4);
+ }
+
+ if (settingName == "Gas5") {
+ QStringList gasData = keyString.split(",");
+ gas gas5;
+ gas5.oxygen = gasData.at(0).toInt();
+ gas5.helium = gasData.at(1).toInt();
+ gas5.type = gasData.at(2).toInt();
+ gas5.depth = gasData.at(3).toInt();
+ details->setGas5(gas5);
+ }
+
if (settingName == "Saturation")
details->setSaturation(keyString.toInt());