summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-01 11:19:23 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-01 11:19:23 -0700
commit9e635392373cdc56fb3a897ea491e7c33fdbd424 (patch)
treef774d955632b301428088365d41abe62badfdd26 /qt-ui/diveplanner.cpp
parent1a4d098ef2062923bbe09538cc01c1d130989640 (diff)
parent0e96c9f62e3a7030d9208f32e59390cb3fd20bbe (diff)
downloadsubsurface-9e635392373cdc56fb3a897ea491e7c33fdbd424.tar.gz
Merge branch 'editMode' of github.com:tcanabrava/subsurface
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp26
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);