diff options
author | Joseph W. Joshua <joejoshw@gmail.com> | 2014-06-21 10:22:47 +0300 |
---|---|---|
committer | Thiago Macieira <thiago@macieira.org> | 2014-08-13 10:48:15 -0700 |
commit | 8aa7fddb22cd6ab4d533082598be04649bb1ff21 (patch) | |
tree | 041bf6c67978468389a65f45d83bde4ee1add6e9 /configuredivecomputer.cpp | |
parent | 9c032f20c02fbb7c1e3906dbc8392539e0125327 (diff) | |
download | subsurface-8aa7fddb22cd6ab4d533082598be04649bb1ff21.tar.gz |
Add read/write support for OSTC 3 SetPoint settings
Implements support for reading, writing and backup/restore of set point
settings for the OSTC 3.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'configuredivecomputer.cpp')
-rw-r--r-- | configuredivecomputer.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp index 7b86d5bb0..657f6fd10 100644 --- a/configuredivecomputer.cpp +++ b/configuredivecomputer.cpp @@ -135,6 +135,34 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai xml += addSettingToXML("Dil4", dil4); xml += addSettingToXML("Dil5", dil5); // + //Add set point values + QString sp1 = QString("%1,%2") + .arg(QString::number(details->sp1().sp), + QString::number(details->sp1().depth) + ); + QString sp2 = QString("%1,%2") + .arg(QString::number(details->sp2().sp), + QString::number(details->sp2().depth) + ); + QString sp3 = QString("%1,%2") + .arg(QString::number(details->sp3().sp), + QString::number(details->sp3().depth) + ); + QString sp4 = QString("%1,%2") + .arg(QString::number(details->sp4().sp), + QString::number(details->sp4().depth) + ); + QString sp5 = QString("%1,%2") + .arg(QString::number(details->sp5().sp), + QString::number(details->sp5().depth) + ); + xml += addSettingToXML("SetPoint1", sp1); + xml += addSettingToXML("SetPoint2", sp2); + xml += addSettingToXML("SetPoint3", sp3); + xml += addSettingToXML("SetPoint4", sp4); + xml += addSettingToXML("SetPoint5", sp5); + + //Other Settings xml += addSettingToXML("DiveMode", details->diveMode()); xml += addSettingToXML("Saturation", details->saturation()); xml += addSettingToXML("Desaturation", details->desaturation()); @@ -303,6 +331,46 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de details->setDil5(dil5); } + if (settingName == "SetPoint1") { + QStringList spData = keyString.split(","); + setpoint sp1; + sp1.sp = spData.at(0).toInt(); + sp1.depth = spData.at(1).toInt(); + details->setSp1(sp1); + } + + if (settingName == "SetPoint2") { + QStringList spData = keyString.split(","); + setpoint sp2; + sp2.sp = spData.at(0).toInt(); + sp2.depth = spData.at(1).toInt(); + details->setSp2(sp2); + } + + if (settingName == "SetPoint3") { + QStringList spData = keyString.split(","); + setpoint sp3; + sp3.sp = spData.at(0).toInt(); + sp3.depth = spData.at(1).toInt(); + details->setSp3(sp3); + } + + if (settingName == "SetPoint4") { + QStringList spData = keyString.split(","); + setpoint sp4; + sp4.sp = spData.at(0).toInt(); + sp4.depth = spData.at(1).toInt(); + details->setSp4(sp4); + } + + if (settingName == "SetPoint5") { + QStringList spData = keyString.split(","); + setpoint sp5; + sp5.sp = spData.at(0).toInt(); + sp5.depth = spData.at(1).toInt(); + details->setSp5(sp5); + } + if (settingName == "Saturation") details->setSaturation(keyString.toInt()); |