This patch fixes the problem that when the user tried to change the dive mode of a dive via the combo box, it jumped back as soon as apply was pressed (and the change was never reflected in the profile). This came about as replot copied current_dive over displayed dive before replotting so the change in dive mode was overwritten.

This patch just updates the ceiling rather than asking for a full replot.

From d09e1272b9d2035cfb4b11150fc8c6f5dbb48dae Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <[email protected]>
Date: Fri, 30 Jan 2015 11:16:55 +0100
Subject: [PATCH] Update ceiling when changing dive mode

Without this patch, the user effectively cannot change the dive mode as any 
change is overwritten by
replot copying current_dive over displayed_dive. The way out is not to call 
replot but only
update the deco ceiling directly.

Signed-off-by: Robert C. Helling <[email protected]>
---
 qt-ui/maintab.cpp                | 2 +-
 qt-ui/profile/profilewidget2.cpp | 5 +++++
 qt-ui/profile/profilewidget2.h   | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c247b77..cf4981c 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -1018,7 +1018,7 @@ void MainTab::divetype_Changed(int index)
        displayed_dive.dc.divemode = (enum dive_comp_type) index;
        update_setpoint_events(&displayed_dive.dc);
        markChangedWidget(ui.DiveType);
-       MainWindow::instance()->graphics()->replot();
+       MainWindow::instance()->graphics()->recalcCeiling();
 }
 
 void MainTab::on_watertemp_textChanged(const QString &text)
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 924c800..99f497e 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -648,6 +648,11 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
        }
 }
 
+void ProfileWidget2::recalcCeiling()
+{
+       diveCeiling->recalc();
+}
+
 void ProfileWidget2::settingsChanged()
 {
        // if we are showing calculated ceilings then we have to replot()
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index d594748..c0ada09 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -82,6 +82,7 @@ public:
        double getFontPrintScale();
        void setFontPrintScale(double scale);
        void clearHandlers();
+       void recalcCeiling();
        State currentState;
 
 public
-- 
1.9.3 (Apple Git-50)


Best
Robert

-- 
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
Robert C. Helling     Elite Master Course Theoretical and Mathematical Physics
                      Scientific Coordinator
                      Ludwig Maximilians Universitaet Muenchen, Dept. Physik
                      Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339
                      http://www.atdotde.de

Enhance your privacy, use cryptography! My PGP keys have fingerprints
A9D1 A01D 13A5 31FA 6515  BB44 0820 367C 36BC 0C1D    and
DCED 37B6 251C 7861 270D  5613 95C7 9D32 9A8D 9B8F





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