On Thu, Mar 27, 2014 at 12:55 PM, Dirk Hohndel <[email protected]> wrote:
> On Wed, 2014-03-26 at 13:34 -0500, Lakshman wrote:
>> >> You meant to say it doesn't provide any information that you are
>> >> interested in? Whether you care about it or not, it sure is meaningful.
>> >> Feel free to file an enhancement request at trac.hohndel.org
>> >
>> >
>> > http://trac.hohndel.org/ticket/475#ticket
>> >
>> Attached patch adds this feature. By default hide average depth option
>> is unchecked, to show average depth.
>
> Thanks for jumping on this. One request: could you switch the logic that
> the option is to SHOW the average and have it on by default?
>
> The reason is simple: It's in the "Show" section of the preferences, so
> the current logic seems backwards.
>
Attached patch is updated as per the suggestion.

Thank you,
Lakshman
From 5e9ae5608334b7d56af199b69649b8615fc89ca4 Mon Sep 17 00:00:00 2001
From: Lakshman Anumolu <[email protected]>
Date: Wed, 26 Mar 2014 13:25:27 -0500
Subject: [PATCH] Ticket#475_Toggle showing average depth

This patch addresses ticket#475 by adding additional check box
in "preferences->graph" section, for facilitating users to hide
average depth on dive profile. By default this option is checked
to show average depth.

Signed-off-by: Lakshman Anumolu <[email protected]>
---
 pref.h                           |  1 +
 qt-ui/preferences.cpp            |  3 +++
 qt-ui/preferences.ui             | 13 ++++++++++++-
 qt-ui/profile/profilewidget2.cpp |  4 ++++
 subsurfacestartup.c              |  1 +
 5 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/pref.h b/pref.h
index 3955b88..ec2aab2 100644
--- a/pref.h
+++ b/pref.h
@@ -39,6 +39,7 @@ struct preferences {
 	struct units units;
 	short show_sac;
 	bool display_unused_tanks;
+	bool show_average_depth;
 	bool zoomed_plot;
 	bool text_label_with_units;
 };
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index e2473d6..7c74b15 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -88,6 +88,7 @@ void PreferencesDialog::setUiFromPrefs()
 	}
 	ui.displayinvalid->setChecked(prefs.display_invalid_dives);
 	ui.display_unused_tanks->setChecked(prefs.display_unused_tanks);
+	ui.show_average_depth->setChecked(prefs.show_average_depth);
 	ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
 	ui.vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
 
@@ -184,6 +185,7 @@ void PreferencesDialog::syncSettings()
 	s.setValue("gfhigh", ui.gfhigh->value());
 	SB("gf_low_at_maxdepth", ui.gf_low_at_maxdepth);
 	SB("display_unused_tanks", ui.display_unused_tanks);
+	SB("show_average_depth", ui.show_average_depth);
 	s.endGroup();
 
 	// Units
@@ -278,6 +280,7 @@ void PreferencesDialog::loadSettings()
 	set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
 	GET_BOOL("show_sac", show_sac);
 	GET_BOOL("display_unused_tanks", display_unused_tanks);
+	GET_BOOL("show_average_depth", show_average_depth);
 	s.endGroup();
 
 	s.beginGroup("GeneralSettings");
diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index e0bd4c2..06e0001 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -657,7 +657,18 @@
                </widget>
               </item>
              </layout>
-            </item>
+	    </item>
+	    <item>
+	     <layout class="QHBoxLayout" name="horizontalLayout_11d">
+	      <item>
+	       <widget class="QCheckBox" name="show_average_depth">
+		<property name="text">
+		 <string>show average depth</string>
+		</property>
+	       </widget>
+	      </item>
+	     </layout>
+	    </item>
            </layout>
           </widget>
          </item>
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index cba977b..cbbc551 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -418,6 +418,10 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
 	cylinderPressureAxis->setMaximum(pInfo.maxpressure);
 
 	rulerItem->setPlotInfo(pInfo);
+	if (prefs.show_average_depth)
+		meanDepth->setVisible(true);
+	else
+		meanDepth->setVisible(false);
 	meanDepth->setMeanDepth(pInfo.meandepth);
 	meanDepth->setLine(0, 0, timeAxis->posAtValue(d->duration.seconds), 0);
 	meanDepth->animateMoveTo(3, profileYAxis->posAtValue(pInfo.meandepth));
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index b16c1fb..06a76d0 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -30,6 +30,7 @@ struct preferences default_prefs = {
 	.display_invalid_dives = false,
 	.show_sac = false,
 	.display_unused_tanks = false,
+	.show_average_depth = true,
 	.text_label_with_units = false
 };
 
-- 
1.8.3.2

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

Reply via email to