diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-08-26 16:55:30 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-08-26 16:55:30 -0300 |
commit | 760c14ac0cb225ac391b9b9e04a1e9d5f7b3aa3c (patch) | |
tree | 23705eae92e9fe38bf324e2c413bd786a4e436fb /qt-ui | |
parent | 9d90034109e96714bfa75629f8fad53e0bac79e8 (diff) | |
download | subsurface-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.cpp | 8 |
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; |