mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
928e7ed869
commit
95a23cf470
8 changed files with 48 additions and 49 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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"), " ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue