aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-07-17 17:19:19 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-17 08:28:21 -0700
commit950638ec1c560083cbf7c49fc0a5e6139560cc85 (patch)
treea98979ed5a7b8386db6c939ae8f3d5a75c8432ef /qt-ui
parent810880ea1d435e273d2f9b7c2292f3eb6134b1f1 (diff)
downloadsubsurface-950638ec1c560083cbf7c49fc0a5e6139560cc85.tar.gz
Replace cylinder_is_used with is_cylinder_used
is_cylinder_used uses get_cylinder_index as underlaying function that does the right thing with with respect on how to find the closest matching cylinder, and handles both types of gaschange events correctly. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/models.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index b098659e4..9d43da624 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -308,7 +308,7 @@ void CylindersModel::updateDive()
for (int i = 0; i < MAX_CYLINDERS; i++) {
if (!cylinder_none(&displayed_dive.cylinder[i]) &&
(prefs.display_unused_tanks ||
- cylinder_is_used(&displayed_dive, &displayed_dive.cylinder[i]) ||
+ is_cylinder_used(&displayed_dive, i) ||
displayed_dive.cylinder[i].manually_added))
rows = i + 1;
}
@@ -324,7 +324,7 @@ void CylindersModel::copyFromDive(dive *d)
return;
rows = 0;
for (int i = 0; i < MAX_CYLINDERS; i++) {
- if (!cylinder_none(&d->cylinder[i]) && cylinder_is_used(d, &d->cylinder[i])) {
+ if (!cylinder_none(&d->cylinder[i]) && is_cylinder_used(d, i)) {
rows = i + 1;
}
}
@@ -360,7 +360,7 @@ void CylindersModel::remove(const QModelIndex &index)
((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING &&
DivePlannerPointsModel::instance()->tankInUse(cyl->gasmix)) ||
(DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING &&
- (cyl->manually_added || cylinder_is_used(&displayed_dive, cyl))))) {
+ (cyl->manually_added || is_cylinder_used(&displayed_dive, index.row()))))) {
QMessageBox::warning(MainWindow::instance(), TITLE_OR_TEXT(
tr("Cylinder cannot be removed"),
tr("This gas is in use. Only cylinders that are not used in the dive can be removed.")),