Show seconds for free dives

Dirk Hohndel dirk at hohndel.org
Sun May 17 13:41:29 PDT 2015


I finally am beginning to figure out why I sometimes miss your patches...
The email inside the email says [PATCH] in its subject. But the outer
email (the one I see in my inbox) doesn't. And often I scan for that when
making sure that I don't miss anything :-/

/D

On Sat, May 16, 2015 at 12:45:03PM +0200, Robert C. Helling wrote:
> 
> Hi,
> 
> this was suggested in the forum.
> 
> Best
> Robert

> From ff81646d158ad197b241de9573c485b765c06bef Mon Sep 17 00:00:00 2001
> From: "Robert C. Helling" <helling at atdotde.de>
> Date: Sat, 16 May 2015 12:42:26 +0200
> Subject: [PATCH] Show seconds in duration for free dives
> 
> For free dives (corresponding to dive mode or duration shorter than
> 15min), the display format for duration is changed to display minutes
> and seconds.
> 
> Signed-off-by: Robert C. Helling <helling at atdotde.de>
> ---
>  qt-ui/models.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
> index d6b425b..69a276b 100644
> --- a/qt-ui/models.cpp
> +++ b/qt-ui/models.cpp
> @@ -1372,15 +1372,19 @@ QString DiveItem::displayDepthWithUnit() const
>  
>  QString DiveItem::displayDuration() const
>  {
> -	int hrs, mins;
> +	int hrs, mins, fullmins, secs;
>  	struct dive *dive = get_dive_by_uniq_id(diveId);
>  	mins = (dive->duration.seconds + 59) / 60;
> +	fullmins = dive->duration.seconds / 60;
> +	secs = dive->duration.seconds - 60 * fullmins;
>  	hrs = mins / 60;
>  	mins -= hrs * 60;
>  
>  	QString displayTime;
>  	if (hrs)
>  		displayTime = QString("%1:%2").arg(hrs).arg(mins, 2, 10, QChar('0'));
> +	else if (mins < 15 || dive->dc.divemode == FREEDIVE)
> +		displayTime = QString("%1m%2s").arg(fullmins).arg(secs, 2, 10, QChar('0'));
>  	else
>  		displayTime = QString("%1").arg(mins);
>  	return displayTime;
> -- 
> 1.9.5 (Apple Git-50.3)
> 

> _______________________________________________
> subsurface mailing list
> subsurface at subsurface-divelog.org
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface



More information about the subsurface mailing list