diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-11-01 11:19:23 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-01 11:19:23 -0700 |
commit | 9e635392373cdc56fb3a897ea491e7c33fdbd424 (patch) | |
tree | f774d955632b301428088365d41abe62badfdd26 /qt-ui/diveplanner.cpp | |
parent | 1a4d098ef2062923bbe09538cc01c1d130989640 (diff) | |
parent | 0e96c9f62e3a7030d9208f32e59390cb3fd20bbe (diff) | |
download | subsurface-9e635392373cdc56fb3a897ea491e7c33fdbd424.tar.gz |
Merge branch 'editMode' of github.com:tcanabrava/subsurface
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); |