From b61f6f66d8859e62023e3818879b90de529e9a72 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 6 Oct 2018 16:30:57 +0200 Subject: Statistics: un-globalize stats_selection The statistics of the selected dives were calculated a) into a global objects and b) at a completely different place than where they're used. There's no plausible reason for either. There fore render into a caller-provided structure at the place of use. Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/TabDiveStatistics.cpp | 2 ++ desktop-widgets/tab-widgets/maintab.cpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp index 55f61eb5a..67e80ed24 100644 --- a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp @@ -44,6 +44,8 @@ void TabDiveStatistics::clear() void TabDiveStatistics::updateData() { + stats_t stats_selection; + calculate_stats_selected(&stats_selection); clear(); ui->depthLimits->setMaximum(get_depth_string(stats_selection.max_depth, true)); if (amount_selected > 1) diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 25fe34adc..070184a86 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -424,8 +424,6 @@ void MainTab::updateDiveInfo(bool clear) setEnabled(false); editMode = IGNORE; // don't trigger on changes to the widgets - process_selected_dives(); - for (auto widget : extraWidgets) { widget->updateData(); } -- cgit v1.2.3-70-g09d2