From 326772cbdbdbfd29b953a21fabb722676ffedfdc Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 13 Apr 2020 18:58:16 +0200 Subject: statistics tab: use current_dive to decide whether user is freediving This used the displayed_dive object. However, we now use current_dive to designate the currently displayed dive. Thus, use this instead. Signed-off-by: Berthold Stoeger Signed-off-by: Dirk Hohndel --- desktop-widgets/tab-widgets/TabDiveStatistics.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'desktop-widgets/tab-widgets/TabDiveStatistics.cpp') diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp index 83df3ab2c..bedc15402 100644 --- a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp @@ -107,20 +107,18 @@ void TabDiveStatistics::updateData() } + bool is_freedive = current_dive && current_dive->dc.divemode == FREEDIVE; ui->divesAllText->setText(QString::number(stats_selection.selection_size)); - ui->totalTimeAllText->setText(get_dive_duration_string(stats_selection.total_time.seconds, tr("h"), tr("min"), tr("sec"), - " ", displayed_dive.dc.divemode == FREEDIVE)); + ui->totalTimeAllText->setText(get_dive_duration_string(stats_selection.total_time.seconds, tr("h"), tr("min"), tr("sec"), " ", is_freedive)); int seconds = stats_selection.total_time.seconds; if (stats_selection.selection_size) seconds /= stats_selection.selection_size; ui->timeLimits->setAverage(get_dive_duration_string(seconds, tr("h"), tr("min"), tr("sec"), - " ", displayed_dive.dc.divemode == FREEDIVE)); + " ", is_freedive)); if (amount_selected > 1) { - 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)); + ui->timeLimits->setMaximum(get_dive_duration_string(stats_selection.longest_time.seconds, tr("h"), tr("min"), tr("sec"), " ", is_freedive)); + ui->timeLimits->setMinimum(get_dive_duration_string(stats_selection.shortest_time.seconds, tr("h"), tr("min"), tr("sec"), " ", is_freedive)); } else { ui->timeLimits->setMaximum(""); ui->timeLimits->setMinimum(""); -- cgit v1.2.3-70-g09d2