mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
21d1903656
commit
05552c7339
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue