Re: divelist and units

2014-10-30 Thread Linus Torvalds
On Thu, Oct 30, 2014 at 8:10 AM, Dirk Hohndel  wrote:
> So someone suggested this idea the other day (sorry, forgot who it was)
> when we were discussing the space issues and alignment issues with the
> header of the divelist. Don't show the units in the header at all, show
> them only in a tooltip. So I figured "how hard can that be?" and tried to
> implement it this morning. Surprisingly, it was ridiculously easy.

Nice. Me like.

And it reminded me of another issue - don't bother showing dive
duration in seconds. Patch attached.

NOTE! If we really have freedivers who use subsurface to log their
freediving, maybe this needs to be some kind of setting. I don't know.

 Linus
From c3681f9e9d7b11dfc9482ccb417bba81fae4e700 Mon Sep 17 00:00:00 2001
From: Linus Torvalds 
Date: Thu, 30 Oct 2014 09:49:05 -0700
Subject: [PATCH] Display dive duration in dive list in whole minutes

The whole "duration in seconds" is being way too OCD about the
information, and just makes it harder to read.

Signed-off-by: Linus Torvalds 
---
 qt-ui/models.cpp | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 1e41dc173df0..bf1c6a6deb62 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1324,19 +1324,17 @@ QString DiveItem::displayDepthWithUnit() const
 
 QString DiveItem::displayDuration() const
 {
-	int hrs, mins, secs;
+	int hrs, mins;
 	struct dive *dive = get_dive_by_uniq_id(diveId);
-	secs = dive->duration.seconds % 60;
-	mins = dive->duration.seconds / 60;
+	mins = (dive->duration.seconds+59) / 60;
 	hrs = mins / 60;
 	mins -= hrs * 60;
 
 	QString displayTime;
 	if (hrs)
-		displayTime = QString("%1:%2:").arg(hrs).arg(mins, 2, 10, QChar('0'));
+		displayTime = QString("%1:%2").arg(hrs).arg(mins, 2, 10, QChar('0'));
 	else
-		displayTime = QString("%1:").arg(mins);
-	displayTime += QString("%1").arg(secs, 2, 10, QChar('0'));
+		displayTime = QString("%1").arg(mins);
 	return displayTime;
 }
 
-- 
2.1.2.452.gd5ca7ae

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: divelist and units

2014-10-30 Thread John Van Ostrand
On Thu, Oct 30, 2014 at 11:29 AM, Dirk Hohndel  wrote:

> On Thu, Oct 30, 2014 at 11:25:25AM -0400, John Van Ostrand wrote:
> > On Thu, Oct 30, 2014 at 11:10 AM, Dirk Hohndel  wrote:
> >
> > > So someone suggested this idea the other day (sorry, forgot who it was)
> >
> > It was in trac where I made the suggestion. I'm glad it worked out,
> since I
> > really don't know what I'm doing..
>
> Thanks for the idea...
>
> > John Van Ostrand
> > At large on sabbatical
>
> Oh, so you have time to learn Qt and contribute even more! Awesome :-


I do have some time and I've enjoyed getting back into coding after a long
stint running a business but it's quite overwhelming. Also we are almost in
the "shoulder" of dive season here in Canada when the ice is too thick to
safely shore dive but not thick enough to ice dive so I'll have even more
time.

And, I did just submit my first UI patch.

-- 
John Van Ostrand
At large on sabbatical
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: divelist and units

2014-10-30 Thread Dirk Hohndel
On Thu, Oct 30, 2014 at 11:25:25AM -0400, John Van Ostrand wrote:
> On Thu, Oct 30, 2014 at 11:10 AM, Dirk Hohndel  wrote:
> 
> > So someone suggested this idea the other day (sorry, forgot who it was)
> 
> It was in trac where I made the suggestion. I'm glad it worked out, since I
> really don't know what I'm doing..

Thanks for the idea...

> John Van Ostrand
> At large on sabbatical

Oh, so you have time to learn Qt and contribute even more! Awesome :-)

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: divelist and units

2014-10-30 Thread John Van Ostrand
On Thu, Oct 30, 2014 at 11:10 AM, Dirk Hohndel  wrote:

> So someone suggested this idea the other day (sorry, forgot who it was)
> when we were discussing the space issues and alignment issues with the
> header of the divelist. Don't show the units in the header at all, show
> them only in a tooltip. So I figured "how hard can that be?" and tried to
> implement it this morning. Surprisingly, it was ridiculously easy.
>
> This Qt thing might be working out for us after all...
>

It was in trac where I made the suggestion. I'm glad it worked out, since I
really don't know what I'm doing..

-- 
John Van Ostrand
At large on sabbatical
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


divelist and units

2014-10-30 Thread Dirk Hohndel
So someone suggested this idea the other day (sorry, forgot who it was)
when we were discussing the space issues and alignment issues with the
header of the divelist. Don't show the units in the header at all, show
them only in a tooltip. So I figured "how hard can that be?" and tried to
implement it this morning. Surprisingly, it was ridiculously easy.

This Qt thing might be working out for us after all...

:-)

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface