cleanup: move minute formating to format-string.cpp

The get_minutes() function formats a time as m:ss
and returns a static C-string. Since all callers are
C++ anyway and transform directly into QString, let us
move this to the other string formatting function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-09-03 10:37:58 +02:00 committed by Dirk Hohndel
parent 1047937197
commit 4a7ee872f3
7 changed files with 17 additions and 18 deletions

View file

@ -3,6 +3,7 @@
#include "core/qthelper.h"
#include "core/metrics.h"
#include "core/statistics.h"
#include "core/string-format.h"
#include "core/dive.h" // For NUM_DIVEMODE
class YearStatisticsItem : public TreeItem {
@ -65,13 +66,13 @@ QVariant YearStatisticsItem::data(int column, int role) const
ret = get_dive_duration_string(stats_interval.total_time.seconds, tr("h"), tr("min"), tr("sec"), " ");
break;
case AVERAGE_TIME:
ret = get_minutes(stats_interval.total_time.seconds / stats_interval.selection_size);
ret = formatMinutes(stats_interval.total_time.seconds / stats_interval.selection_size);
break;
case SHORTEST_TIME:
ret = get_minutes(stats_interval.shortest_time.seconds);
ret = formatMinutes(stats_interval.shortest_time.seconds);
break;
case LONGEST_TIME:
ret = get_minutes(stats_interval.longest_time.seconds);
ret = formatMinutes(stats_interval.longest_time.seconds);
break;
case AVG_DEPTH:
ret = get_depth_string(stats_interval.avg_depth);