From ddd7d2edccdd0460924ac65a78d89a546a47e4a8 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Wed, 5 Feb 2014 21:58:21 +0100 Subject: [PATCH] Fix DepthAxis when partial pressures aren't used. Set showWithPPGraph so that animateChangeLine() is always called the first time settingsChanged() is called. Signed-off-by: Michael Andreen Signed-off-by: Dirk Hohndel --- qt-ui/profile/divecartesianaxis.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp index c6567d413..1cfd9d13b 100644 --- a/qt-ui/profile/divecartesianaxis.cpp +++ b/qt-ui/profile/divecartesianaxis.cpp @@ -259,18 +259,26 @@ QColor DepthAxis::colorForValue(double value) return QColor(Qt::red); } -DepthAxis::DepthAxis() : showWithPPGraph(false) -{ - connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); - settingsChanged(); // force the correct size of the line. -} - -void DepthAxis::settingsChanged() +static bool isPPGraphEnabled() { QSettings s; s.beginGroup("TecDetails"); - bool ppGraph = s.value("phegraph").toBool() || s.value("po2graph").toBool() || s.value("pn2graph").toBool(); + return s.value("phegraph").toBool() || s.value("po2graph").toBool() || s.value("pn2graph").toBool(); +} + +DepthAxis::DepthAxis() : showWithPPGraph(false) +{ + connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); + + // force the correct size of the line. + showWithPPGraph = !isPPGraphEnabled(); + settingsChanged(); +} + +void DepthAxis::settingsChanged() +{ + bool ppGraph = isPPGraphEnabled(); if ( ppGraph == showWithPPGraph){ return; }