Creation of dive duration string and surface interval string

Update the function to create the dive duration string in a way that
it can be used also in info and stats tab and added some more flexibility.

Changed layout for <1h freedives to "0:05:35" (w/o units) or "5:35min"
(with units and :) or "5min 35sec" (with units with space).

Add a new function to create the surface interval string.

Completely remove old function get_time_string() and get_time_string_s().

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-05-11 22:43:36 +02:00 committed by Dirk Hohndel
parent 53a8075bd8
commit e6d884cf26
13 changed files with 68 additions and 48 deletions

View file

@ -74,15 +74,15 @@ void TabDiveInformation::updateData()
ui->gasUsedText->setText(volumes);
ui->oxygenHeliumText->setText(gaslist);
int sum = displayed_dive.dc.divemode != FREEDIVE ? 30 : 0;
ui->diveTimeText->setText(get_time_string_s(displayed_dive.duration.seconds + sum, 0, false));
ui->diveTimeText->setText(get_dive_duration_string(displayed_dive.duration.seconds, tr("h"), tr("min"), tr("sec"),
" ", displayed_dive.dc.divemode == FREEDIVE));
struct dive *prevd;
process_all_dives(&displayed_dive, &prevd);
if (prevd)
ui->surfaceIntervalText->setText(get_time_string_s(displayed_dive.when - (prevd->when + prevd->duration.seconds), 4,
(displayed_dive.dc.divemode == FREEDIVE)));
ui->surfaceIntervalText->setText(get_dive_surfint_string(displayed_dive.when - (prevd->when + prevd->duration.seconds), tr("d"), tr("h"), tr("min")));
else
ui->surfaceIntervalText->clear();