summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/TabDiveStatistics.cpp
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-05-11 22:43:36 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-26 15:50:52 -0700
commite6d884cf26161df65c2b4b8c39d6b4133760537b (patch)
tree2b9132e7d057c514c852a7cf7bed39fa67455a6f /desktop-widgets/tab-widgets/TabDiveStatistics.cpp
parent53a8075bd8d7231f2bb483b9adca0fc60d4446f1 (diff)
downloadsubsurface-e6d884cf26161df65c2b4b8c39d6b4133760537b.tar.gz
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>
Diffstat (limited to 'desktop-widgets/tab-widgets/TabDiveStatistics.cpp')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveStatistics.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp
index e05f076a9..53bab0ef5 100644
--- a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp
@@ -84,14 +84,19 @@ void TabDiveStatistics::updateData()
ui->divesAllText->setText(QString::number(stats_selection.selection_size));
- ui->totalTimeAllText->setText(get_time_string_s(stats_selection.total_time.seconds, 0, (displayed_dive.dc.divemode == FREEDIVE)));
+ ui->totalTimeAllText->setText(get_dive_duration_string(stats_selection.total_time.seconds, tr("h"), tr("min"), tr("sec"),
+ " ", displayed_dive.dc.divemode == FREEDIVE));
+
int seconds = stats_selection.total_time.seconds;
if (stats_selection.selection_size)
seconds /= stats_selection.selection_size;
- ui->timeLimits->setAverage(get_time_string_s(seconds, 0,(displayed_dive.dc.divemode == FREEDIVE)));
+ ui->timeLimits->setAverage(get_dive_duration_string(seconds, tr("h"), tr("min"), tr("sec"),
+ " ", displayed_dive.dc.divemode == FREEDIVE));
if (amount_selected > 1) {
- ui->timeLimits->setMaximum(get_time_string_s(stats_selection.longest_time.seconds, 0, (displayed_dive.dc.divemode == FREEDIVE)));
- ui->timeLimits->setMinimum(get_time_string_s(stats_selection.shortest_time.seconds, 0, (displayed_dive.dc.divemode == FREEDIVE)));
+ ui->timeLimits->setMaximum(get_dive_duration_string(stats_selection.longest_time.seconds, tr("h"), tr("min"), tr("sec"),
+ " ", displayed_dive.dc.divemode == FREEDIVE));
+ ui->timeLimits->setMinimum(get_dive_duration_string(stats_selection.shortest_time.seconds, tr("h"), tr("min"), tr("sec"),
+ " ", displayed_dive.dc.divemode == FREEDIVE));
} else {
ui->timeLimits->setMaximum("");
ui->timeLimits->setMinimum("");