mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Desktop: Fix Gas Editing for Manually Added Dives.
- show the correct gasmix in the profile; - make gases available for gas switches in the profile after they have been added; - persist gas changes; - add air as a default gas when adding a dive. This still has problems when undoing a gas switch - instead of completely removing the gas switch it is just moved to the next point in the profile. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
9243921cbb
commit
f65afaf5d2
13 changed files with 121 additions and 54 deletions
|
|
@ -499,7 +499,7 @@ void CylindersModel::add()
|
|||
if (!d)
|
||||
return;
|
||||
int row = d->cylinders.nr;
|
||||
cylinder_t cyl = create_new_cylinder(d);
|
||||
cylinder_t cyl = create_new_manual_cylinder(d);
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
add_cylinder(&d->cylinders, row, cyl);
|
||||
++numRows;
|
||||
|
|
|
|||
|
|
@ -206,20 +206,8 @@ void DivePlannerPointsModel::setupCylinders()
|
|||
return; // We have at least one cylinder
|
||||
}
|
||||
}
|
||||
if (!empty_string(prefs.default_cylinder)) {
|
||||
cylinder_t cyl = empty_cylinder;
|
||||
fill_default_cylinder(d, &cyl);
|
||||
cyl.start = cyl.type.workingpressure;
|
||||
add_cylinder(&d->cylinders, 0, cyl);
|
||||
} else {
|
||||
cylinder_t cyl = empty_cylinder;
|
||||
// roughly an AL80
|
||||
cyl.type.description = copy_qstring(tr("unknown"));
|
||||
cyl.type.size.mliter = 11100;
|
||||
cyl.type.workingpressure.mbar = 207000;
|
||||
add_cylinder(&d->cylinders, 0, cyl);
|
||||
}
|
||||
reset_cylinders(d, false);
|
||||
|
||||
add_default_cylinder(d);
|
||||
cylinders.updateDive(d, dcNr);
|
||||
}
|
||||
|
||||
|
|
@ -1288,7 +1276,7 @@ void DivePlannerPointsModel::computeVariationsDone(QString variations)
|
|||
emit calculatedPlanNotes(QString(d->notes));
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::createPlan(bool replanCopy)
|
||||
void DivePlannerPointsModel::createPlan(bool saveAsNew)
|
||||
{
|
||||
// Ok, so, here the diveplan creates a dive
|
||||
deco_state_cache cache;
|
||||
|
|
@ -1350,7 +1338,7 @@ void DivePlannerPointsModel::createPlan(bool replanCopy)
|
|||
#endif // !SUBSURFACE_TESTING
|
||||
} else {
|
||||
copy_events_until(current_dive, d, dcNr, preserved_until.seconds);
|
||||
if (replanCopy) {
|
||||
if (saveAsNew) {
|
||||
// we were planning an old dive and save as a new dive
|
||||
d->id = dive_getUniqID(); // Things will break horribly if we create dives with the same id.
|
||||
#if !defined(SUBSURFACE_TESTING)
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ public:
|
|||
GAS,
|
||||
CCSETPOINT,
|
||||
DIVEMODE,
|
||||
COLUMNS
|
||||
COLUMNS,
|
||||
};
|
||||
enum Mode {
|
||||
NOTHING,
|
||||
PLAN,
|
||||
ADD
|
||||
EDIT,
|
||||
};
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue