aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveStatistics.cpp15
-rw-r--r--desktop-widgets/templatelayout.h8
2 files changed, 8 insertions, 15 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));
}
diff --git a/desktop-widgets/templatelayout.h b/desktop-widgets/templatelayout.h
index cb60cc03d..6c3c079e4 100644
--- a/desktop-widgets/templatelayout.h
+++ b/desktop-widgets/templatelayout.h
@@ -104,13 +104,9 @@ if (property == "year") {
} else if (property == "dives") {
return object.year->selection_size;
} else if (property == "min_temp") {
- const char *unit;
- double temp = get_temp_units(object.year->min_temp, &unit);
- return object.year->min_temp == 0 ? "0" : QString::number(temp, 'g', 2) + unit;
+ return object.year->min_temp.mkelvin == 0 ? "0" : get_temperature_string(object.year->min_temp, true);
} else if (property == "max_temp") {
- const char *unit;
- double temp = get_temp_units(object.year->max_temp, &unit);
- return object.year->max_temp == 0 ? "0" : QString::number(temp, 'g', 2) + unit;
+ return object.year->max_temp.mkelvin == 0 ? "0" : get_temperature_string(object.year->max_temp, true);
} else if (property == "total_time") {
return get_dive_duration_string(object.year->total_time.seconds, QObject::tr("h"),
QObject::tr("min"), QObject::tr("sec"), " ");