diff options
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 2078ff8a8..169158987 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -425,6 +425,22 @@ void DivePlannerPointsModel::createSimpleDive() plannerModel->addStop(M_OR_FT(5,15), 45 * 60, tr("Air"), 0); } +void DivePlannerPointsModel::loadFromDive(dive* d) +{ + /* We need to make a copy, because + * as soon as the model is modified, it will + * remove all samples from the current dive. + * */ + backupSamples.clear(); + for(int i = 1; i < d->dc.samples-1; i++){ + backupSamples.push_back( d->dc.sample[i]); + } + + Q_FOREACH(const sample &s, backupSamples){ + plannerModel->addStop(s.depth.mm, s.time.seconds, tr("Air"), 0); + } +} + void DivePlannerGraphics::prepareSelectGas() { currentGasChoice = static_cast<Button*>(sender()); @@ -1181,6 +1197,16 @@ void DivePlannerPointsModel::createTemporaryPlan() #endif } +void DivePlannerPointsModel::undoEdition() +{ + beginRemoveRows(QModelIndex(), 0, rowCount()-1); + divepoints.clear(); + endRemoveRows(); + Q_FOREACH(const sample &s, backupSamples){ + plannerModel->addStop(s.depth.mm, s.time.seconds, tr("Air"), 0); + } +} + void DivePlannerPointsModel::deleteTemporaryPlan() { deleteTemporaryPlan(diveplan.dp); |