Jocke,

On 15 Feb 2015, at 14:18, Joakim Bygdell <[email protected]> wrote:

If we do it this way we also should populate the “Available gases” list with all the gases we import from the parent dive.
Otherwise we are back where we started, that the planner uses gases that are not directly visible to the user.

you are right. I had thought the original patch did that already (I didn’t test since I was in a rush and I didn’t have a dive with unused cylinders ready).

Here is an amended version. 

From 10d7f99d3e322ac2e81827a095eef8cde7a64df1 Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <[email protected]>
Date: Sun, 15 Feb 2015 12:28:46 +0100
Subject: [PATCH] Use unused cylinders in planner if they are displayed

This makes prefs.display_unused_tanks also relevant for the planner.

Signed-off-by: Robert C. Helling <[email protected]>
---
 qt-ui/diveplanner.cpp | 4 ++--
 qt-ui/models.cpp      | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index f535a6a..434da1f 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -131,9 +131,9 @@ void DivePlannerPointsModel::loadFromDive(dive *d)
 void DivePlannerPointsModel::setupCylinders()
 {
        if (mode == PLAN && current_dive) {
-               // take the used cylinders from the selected dive as starting 
point
+               // take the displayed cylinders from the selected dive as 
starting point
                CylindersModel::instance()->copyFromDive(current_dive);
-               copy_cylinders(current_dive, &displayed_dive, false);
+               copy_cylinders(current_dive, &displayed_dive, 
!prefs.display_unused_tanks);
                reset_cylinders(&displayed_dive, true);
                return;
        }
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 19f0d12..bac9b4d 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -368,7 +368,8 @@ void CylindersModel::copyFromDive(dive *d)
                return;
        rows = 0;
        for (int i = 0; i < MAX_CYLINDERS; i++) {
-               if (!cylinder_none(&d->cylinder[i]) && is_cylinder_used(d, i)) {
+               if (!cylinder_none(&d->cylinder[i]) &&
+                   (is_cylinder_used(d, i) || prefs.display_unused_tanks)) {
                        rows = i + 1;
                }
        }
-- 
1.9.3 (Apple Git-50)


Best
Robert

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to