mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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 <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0996908dd8
commit
ca8fc978d2
1 changed files with 4 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue