diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2018-02-18 21:55:57 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-02-24 11:45:17 -0800 |
commit | 95a23cf4701d4918f866cb5ef1c25a5b2b380096 (patch) | |
tree | d4735ee6e8fe357483f88cab290e1749ad303656 /desktop-widgets/tab-widgets/TabDiveStatistics.cpp | |
parent | 928e7ed8694e49efdabe3502eef32c4519bf6b0c (diff) | |
download | subsurface-95a23cf4701d4918f866cb5ef1c25a5b2b380096.tar.gz |
Use temperature_t for temperatures in struct stats_t
Use struct temperature_t for temperatures in struct stats_t and
use get_temperature_string() when printing these temperatures for
statistics and HTML export.
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.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp index 0582ec930..cc7946a88 100644 --- a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp +++ b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp @@ -71,15 +71,12 @@ void TabDiveStatistics::updateData() else ui->sacLimits->setAverage(""); - temperature_t temp; - temp.mkelvin = stats_selection.max_temp; - ui->tempLimits->setMaximum(get_temperature_string(temp, true)); - temp.mkelvin = stats_selection.min_temp; - ui->tempLimits->setMinimum(get_temperature_string(temp, true)); - if (stats_selection.combined_temp && stats_selection.combined_count) { - const char *unit; - get_temp_units(0, &unit); - ui->tempLimits->setAverage(QString("%1%2").arg(stats_selection.combined_temp / stats_selection.combined_count, 0, 'f', 1).arg(unit)); + ui->tempLimits->setMaximum(get_temperature_string(stats_selection.max_temp, true)); + ui->tempLimits->setMinimum(get_temperature_string(stats_selection.min_temp, true)); + if (stats_selection.combined_temp.mkelvin && stats_selection.combined_count) { + temperature_t avg_temp; + avg_temp.mkelvin = stats_selection.combined_temp.mkelvin / stats_selection.combined_count; + ui->tempLimits->setAverage(get_temperature_string(avg_temp, true)); } |