diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-12-13 13:05:30 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-12-17 13:03:56 -0800 |
commit | 2239ffe13c1babcae7a0822c83ab8d0f23317358 (patch) | |
tree | a10a0f3959c5fe1fd96e9f4c8df42b223cde2ed1 /desktop-widgets/templatelayout.cpp | |
parent | bdf990d40eaeb5f329dfbd67a7e64187538de9f9 (diff) | |
download | subsurface-2239ffe13c1babcae7a0822c83ab8d0f23317358.tar.gz |
printing: remove YearInfo structure
This is a wrapper around "stats *" used to pass statistics
through Qt's weird metatype system. Not needed anymore.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/templatelayout.cpp')
-rw-r--r-- | desktop-widgets/templatelayout.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp index c69d24b29..7d29b20dd 100644 --- a/desktop-widgets/templatelayout.cpp +++ b/desktop-widgets/templatelayout.cpp @@ -144,8 +144,7 @@ QString TemplateLayout::generateStatistics() stats_summary_auto_free stats; calculate_stats_summary(&stats, false); while (stats.stats_yearly != NULL && stats.stats_yearly[i].period) { - YearInfo year{ &stats.stats_yearly[i] }; - state.years.append(year); + state.years.append(&stats.stats_yearly[i]); i++; } @@ -448,36 +447,36 @@ QVariant TemplateLayout::getValue(QString list, QString property, const State &s } else if (list =="years") { if (!state.currentYear) return QVariant(); - const YearInfo &object = *state.currentYear; + const stats_t *object = *state.currentYear; if (property == "year") { - return object.year->period; + return object->period; } else if (property == "dives") { - return object.year->selection_size; + return object->selection_size; } else if (property == "min_temp") { - return object.year->min_temp.mkelvin == 0 ? "0" : get_temperature_string(object.year->min_temp, true); + return object->min_temp.mkelvin == 0 ? "0" : get_temperature_string(object->min_temp, true); } else if (property == "max_temp") { - return object.year->max_temp.mkelvin == 0 ? "0" : get_temperature_string(object.year->max_temp, true); + return object->max_temp.mkelvin == 0 ? "0" : get_temperature_string(object->max_temp, true); } else if (property == "total_time") { - return get_dive_duration_string(object.year->total_time.seconds, gettextFromC::tr("h"), + return get_dive_duration_string(object->total_time.seconds, gettextFromC::tr("h"), gettextFromC::tr("min"), gettextFromC::tr("sec"), " "); } else if (property == "avg_time") { - return get_minutes(object.year->total_time.seconds / object.year->selection_size); + return get_minutes(object->total_time.seconds / object->selection_size); } else if (property == "shortest_time") { - return get_minutes(object.year->shortest_time.seconds); + return get_minutes(object->shortest_time.seconds); } else if (property == "longest_time") { - return get_minutes(object.year->longest_time.seconds); + return get_minutes(object->longest_time.seconds); } else if (property == "avg_depth") { - return get_depth_string(object.year->avg_depth); + return get_depth_string(object->avg_depth); } else if (property == "min_depth") { - return get_depth_string(object.year->min_depth); + return get_depth_string(object->min_depth); } else if (property == "max_depth") { - return get_depth_string(object.year->max_depth); + return get_depth_string(object->max_depth); } else if (property == "avg_sac") { - return get_volume_string(object.year->avg_sac); + return get_volume_string(object->avg_sac); } else if (property == "min_sac") { - return get_volume_string(object.year->min_sac); + return get_volume_string(object->min_sac); } else if (property == "max_sac") { - return get_volume_string(object.year->max_sac); + return get_volume_string(object->max_sac); } } else if (list == "cylinders") { if (state.currentCylinder && property == "description") { |