summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-08-26 16:55:30 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-08-26 16:55:30 -0300
commit760c14ac0cb225ac391b9b9e04a1e9d5f7b3aa3c (patch)
tree23705eae92e9fe38bf324e2c413bd786a4e436fb /qt-ui
parent9d90034109e96714bfa75629f8fad53e0bac79e8 (diff)
downloadsubsurface-760c14ac0cb225ac391b9b9e04a1e9d5f7b3aa3c.tar.gz
Fixed entering a dive stop before another dive stop.
Fixed entering a dive stop before another dive stop, the correct way is to fix the position of them but this is easyer - I'll update the correct one in a couple of patches. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index adb1bb62a..61f39bc31 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -959,6 +959,14 @@ void DivePlannerPointsModel::setStartTime(const QTime& t)
int DivePlannerPointsModel::addStop(int meters, int minutes, const QString& gas, int ccpoint)
{
int row = divepoints.count();
+ // check if there's already a new stop before this one:
+ Q_FOREACH(const divedatapoint& dp, divepoints){
+ if (dp.time > minutes ){
+ return -1;
+ }
+ }
+
+ // add the new stop
beginInsertRows(QModelIndex(), row, row);
divedatapoint point;
point.depth = meters;