mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Mobile: save gasmixes
Same as for cylinder info, we need to make sure that the gasmixes gets saved to the correct cylinder. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
parent
9c9450748b
commit
891e8acaa8
3 changed files with 23 additions and 12 deletions
|
@ -1004,7 +1004,7 @@ bool QMLManager::checkDepth(DiveObjectHelper *myDive, dive *d, QString depth)
|
|||
// update the dive and return the notes field, stripped of the HTML junk
|
||||
void QMLManager::commitChanges(QString diveId, QString date, QString location, QString gps, QString duration, QString depth,
|
||||
QString airtemp, QString watertemp, QString suit, QString buddy, QString diveMaster, QString weight, QString notes,
|
||||
QString startpressure, QString endpressure, QString gasmix, QStringList usedCylinder, int rating, int visibility)
|
||||
QString startpressure, QString endpressure, QStringList gasmix, QStringList usedCylinder, int rating, int visibility)
|
||||
{
|
||||
struct dive *d = get_dive_by_uniq_id(diveId.toInt());
|
||||
|
||||
|
@ -1057,15 +1057,21 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
|
|||
}
|
||||
// gasmix for first cylinder
|
||||
if (myDive->firstGas() != gasmix) {
|
||||
int o2 = parseGasMixO2(gasmix);
|
||||
int he = parseGasMixHE(gasmix);
|
||||
// the QML code SHOULD only accept valid gas mixes, but just to make sure
|
||||
if (o2 >= 0 && o2 <= 1000 &&
|
||||
he >= 0 && he <= 1000 &&
|
||||
o2 + he <= 1000) {
|
||||
diveChanged = true;
|
||||
d->cylinder[0].gasmix.o2.permille = o2;
|
||||
d->cylinder[0].gasmix.he.permille = he;
|
||||
for ( int i = 0, j = 0 ; j < gasmix.length() ; i++ ) {
|
||||
if (!is_cylinder_used(d, i))
|
||||
continue;
|
||||
|
||||
int o2 = parseGasMixO2(gasmix[j]);
|
||||
int he = parseGasMixHE(gasmix[j]);
|
||||
// the QML code SHOULD only accept valid gas mixes, but just to make sure
|
||||
if (o2 >= 0 && o2 <= 1000 &&
|
||||
he >= 0 && he <= 1000 &&
|
||||
o2 + he <= 1000) {
|
||||
diveChanged = true;
|
||||
d->cylinder[i].gasmix.o2.permille = o2;
|
||||
d->cylinder[i].gasmix.he.permille = he;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
// info for first cylinder
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue