mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Remove the .used member of the cylinder structure
Instead calculate this information on the fly, taking into account all dive computers on the dive in questions. There is one wrinkle to this - previously we abused the '.used' member to make sure that a manually added cylinder didn't disappear the moment it was added (think of the workflow: you add a cylinder, then you add a gas change to that cylinder -> right after you add it it is unused and would not be shown). I am thinking that we might have to add the "manually_added" property to the properties that we store in XML / git. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1a04013453
commit
c539c8f861
6 changed files with 39 additions and 38 deletions
|
@ -120,8 +120,13 @@ void DivePlannerPointsModel::setupCylinders()
|
|||
return;
|
||||
|
||||
if (stagingDive != current_dive) {
|
||||
// we are planning a dive
|
||||
if (current_dive) {
|
||||
// take the cylinders from the selected dive as starting point
|
||||
CylindersModel::instance()->copyFromDive(current_dive);
|
||||
copy_cylinders(current_dive, stagingDive);
|
||||
reset_cylinders(stagingDive);
|
||||
return;
|
||||
} else {
|
||||
if (!same_string(prefs.default_cylinder, "")) {
|
||||
fill_default_cylinder(&stagingDive->cylinder[0]);
|
||||
|
@ -130,7 +135,6 @@ void DivePlannerPointsModel::setupCylinders()
|
|||
stagingDive->cylinder[0].type.description = strdup(tr("unknown").toUtf8().constData());
|
||||
stagingDive->cylinder[0].type.size.mliter = 11100;
|
||||
stagingDive->cylinder[0].type.workingpressure.mbar = 207000;
|
||||
stagingDive->cylinder[0].used = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue