mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
First steps to make add dive work with the correct infrastructure
This just makes sure that we do the right thing with the staging drive, that we don't mess up the selection, the we are smart about using our helper functions, etc. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
94222fbe49
commit
a683a217b9
3 changed files with 20 additions and 11 deletions
|
@ -1251,8 +1251,9 @@ void DivePlannerPointsModel::cancelPlan()
|
|||
}
|
||||
clear();
|
||||
emit planCanceled();
|
||||
if (mode != ADD)
|
||||
free(stagingDive);
|
||||
setPlanMode(NOTHING);
|
||||
free(stagingDive);
|
||||
stagingDive = NULL;
|
||||
CylindersModel::instance()->setDive(current_dive);
|
||||
CylindersModel::instance()->update();
|
||||
|
@ -1265,9 +1266,13 @@ DivePlannerPointsModel::Mode DivePlannerPointsModel::currentMode() const
|
|||
|
||||
void DivePlannerPointsModel::clear()
|
||||
{
|
||||
if (!stagingDive)
|
||||
stagingDive = alloc_dive();
|
||||
memset(stagingDive->cylinder, 0, MAX_CYLINDERS * sizeof(cylinder_t));
|
||||
if (mode == ADD) {
|
||||
stagingDive = current_dive;
|
||||
} else {
|
||||
if (!stagingDive)
|
||||
stagingDive = alloc_dive();
|
||||
memset(stagingDive->cylinder, 0, MAX_CYLINDERS * sizeof(cylinder_t));
|
||||
}
|
||||
CylindersModel::instance()->setDive(stagingDive);
|
||||
beginRemoveRows(QModelIndex(), 0, rowCount()-1);
|
||||
divepoints.clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue