diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-11-14 18:06:08 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-15 09:21:50 +0900 |
commit | 2235da57a795cd7ffd0ef17ffec274f1a03d6c21 (patch) | |
tree | ac17ba114b50ee8a7b8149562459d3ffc25ee9df /qt-ui/diveplanner.cpp | |
parent | a07c3d62afe446df4eb6d185a201c235bfe2c64a (diff) | |
download | subsurface-2235da57a795cd7ffd0ef17ffec274f1a03d6c21.tar.gz |
Fix adding DivePoints on the planner via the table.
Somewhere we broke this, most probably in the code that activated the
planner to be used together as an 'add dive'. This commit makes the code
workable again.
There's one thing, though. if the model is empty, this will add something
in the first point - it's behaving strangely. I'll try to fix this in a
way that's invisible to the user, but overall, why are we inserting
something in the first(0,0) time and depth?
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 9bbce05f4..2efc035da 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -1149,6 +1149,12 @@ bool DivePlannerPointsModel::addGas(int o2, int he) int DivePlannerPointsModel::addStop(int milimeters, int minutes, int o2, int he, int ccpoint) { int row = divepoints.count(); + if (minutes == 0 && milimeters == 0 && row != 0){ + /* this is only possible if the user clicked on the 'plus' sign on the DivePoints Table */ + struct divedatapoint& t = divepoints.last(); + milimeters = t.depth; + minutes = t.time + 600; // 10 minutes. + } if (o2 != -1) if (!addGas(o2, he)) qDebug("addGas failed"); // FIXME add error propagation |