On Thu, Oct 30, 2014 at 8:10 AM, Dirk Hohndel <d...@hohndel.org> 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 <torva...@linux-foundation.org>
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 <torva...@linux-foundation.org>
---
 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

Reply via email to