4.6.4-675 could use some testing

Linus Torvalds torvalds at linux-foundation.org
Tue Aug 1 19:52:01 PDT 2017


On Tue, Aug 1, 2017 at 7:29 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
> On Tue, Aug 1, 2017 at 7:22 PM, Miika Turkia <miika.turkia at gmail.com> wrote:
>> There is some layout problem in the profile. EAN and start pressure is
>> overlayed as shown on attachment.
>
> Yeah, I guess I should look at it more. We had some magical offsetting
> behavior for the "normal vs o2pressure" that I cut out because it
> didn't work with multiple pressures. But the offsetting is odd anyway,
> and changes as you zoom in on it..

I didn't fix that, but I brought back the same offset values that we
used to have.

With multiple gases, we could try to look at which gas pressure line
(and thus text) is higher, and which is lower. We used to do that, but
it only works for two values, and oddly at that.

I think this is good enough for now. Does it get you what you
remembered (and yes, it acts oddly under zooming, that is not new -
the values are clearly picked for whatever font size at unzoomed
behavior)

                   Linus
-------------- next part --------------
 profile-widget/diveprofileitem.cpp | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index 6f2bf98b..9479998c 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -736,12 +736,13 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
 	int last_pressure[MAX_CYLINDERS] = { 0, };
 	int last_time[MAX_CYLINDERS] = { 0, };
 
-	double print_y_offset[8][2] = { { 0, -0.5 }, { 0, -0.5 }, { 0, -0.5 }, { 0, -0.5 }, { 0, -0.5 } ,{ 0, -0.5 }, { 0, -0.5 }, { 0, -0.5 } };
 	// These are offset values used to print the gas lables and pressures on a
-	// dive profile at appropriate Y-coordinates: One doublet of values for each
-	// of 8 cylinders.
-	// Order of offsets within a doublet: gas lable offset; gas pressure offset.
-	// The array is initialised with default values that apply to non-CCR dives.
+	// dive profile at appropriate Y-coordinates. We alternate aligning the
+	// label and the gas pressure above and under the pressure line.
+	// The values are historical, and we could try to pick the over/under
+	// depending on whether this pressure is higher or lower than the average.
+	// Right now it's just strictly alternating when you have multiple gas
+	// pressures.
 
 	QFlags<Qt::AlignmentFlag> alignVar = Qt::AlignTop;
 	QFlags<Qt::AlignmentFlag> align[MAX_CYLINDERS];
@@ -759,8 +760,19 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
 				continue;
 
 			if (!seen_cyl[cyl]) {
-				plotPressureValue(mbar, entry->sec, alignVar, print_y_offset[cyl][1]);
-				plotGasValue(mbar, entry->sec, displayed_dive.cylinder[cyl].gasmix, alignVar, print_y_offset[cyl][0]);
+				double value_y_offset, label_y_offset;
+
+				// Magic Y offset depending on whether we're aliging
+				// the top of the text or the bottom of the text to
+				// the pressure line.
+				value_y_offset = -0.5;
+				if (alignVar & Qt::AlignTop) {
+					label_y_offset = 5 * axisLog;
+				} else {
+					label_y_offset = -7 * axisLog;
+				}
+				plotPressureValue(mbar, entry->sec, alignVar, value_y_offset);
+				plotGasValue(mbar, entry->sec, displayed_dive.cylinder[cyl].gasmix, alignVar, label_y_offset);
 				seen_cyl[cyl] = true;
 
 				/* Alternate alignment as we see cylinder use.. */


More information about the subsurface mailing list