summaryrefslogtreecommitdiffstats
path: root/qt-models/yearlystatisticsmodel.cpp
AgeCommit message (Collapse)Author
2019-11-09Core: dynamically allocate the result of get_gas_used()Gravatar Berthold Stoeger
get_gas_used() returns the volume of used gases. Currently, an array with MAX_CYLINDERS is passed in. If we want to make the number of cylinders dynamic, the function must use an arbitrarilly sized array. Therefore, return a dynamically allocated array and free it in the caller. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-03-19Cleanup: make argument to YearStatisticsItem constructor a referenceGravatar Berthold Stoeger
The LGTM checker complained about passing large objects. Instead of passing pointers, keep the old semantics and pass a reference. This is more idiomatic C++. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-03-18Profile: pass by reference rather than by value for large structGravatar Robert C. Helling
Addresses LGTM.com suggestion. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-12Display statistics by depth and temperature in Yearly statisticsGravatar Doug Junkins
Create a label for each line added for the depth and temperature statistics buckets Add line to statistics widget for each bucket to be displayed Signed-off-by: Doug Junkins <junkins@foghead.com>
2018-12-17Show average max depth in yearly statisticsGravatar Robert C. Helling
this was requested in #1854 and I think this suggestion makes sense Fixes #1854 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-10-07Statistics: only consider selected dives in HTML export statisticsGravatar Berthold Stoeger
If only selected dives were exported into HTML, the statistics would nevertheless cover all dives. A counter-intuitive behavior. Fix by adding a selected_only flag to calculate_stats_summary(). Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-07Statistics: remove global state / calculate only when neededGravatar Berthold Stoeger
Statistics were calculated into global variables every time the current dive was changed. Calculate statistics only when needed and into a structure provided by the caller. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-14Fix compilation problemGravatar Dirk Hohndel
Never commit a change you didn't test. Oh well. Sorry. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-14Add Q_OBJECT macro to two more classesGravatar Dirk Hohndel
These also showed up as concerns when creating translation strings. Adding them thankfully didn't create new strings, but not having them potentially leads to incorrect runtime behavior. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-01Cleanup: make DiveTripModel a global objectGravatar Berthold Stoeger
DiveTripModel (the model describing the dive-list) was destroyed and recreated on every reset of the list. This seems excessive. Instead - in analogy to most other models - make it a single global object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-04Cleanup: fold core/helpers.h into core/qthelper.hGravatar Berthold Stoeger
helpers.h included qthelper.h and all functions declared in helpers.h were defined in qthelper.h. Therefore fold the former into the latter, since the split seems completely arbitrary. While doing so, change the return-type of get_dc_nichname from "const QString" to "QString". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-14Rename enum dive_comp_type to divemode_tGravatar Robert C. Helling
...as the usuage is not anymore about a computer but a momentary dive mode. Rename the end indicator as well. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Core: remove dive.h from files that don't need itGravatar Dirk Hohndel
Of course, quite a few of them indirectly get it through other header files. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-02-24Use temperature_t for temperatures in struct stats_tGravatar Stefan Fuchs
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>
2017-05-26Creation of dive duration string and surface interval stringGravatar Stefan Fuchs
Update the function to create the dive duration string in a way that it can be used also in info and stats tab and added some more flexibility. Changed layout for <1h freedives to "0:05:35" (w/o units) or "5:35min" (with units and :) or "5min 35sec" (with units with space). Add a new function to create the surface interval string. Completely remove old function get_time_string() and get_time_string_s(). Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-29Add SPDX header to Qt modelsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
Having subsurface-core as a directory name really messes with autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an autocomplete conflict and also was inconsistent with the desktop-widget name for the directory containing the "other" UI. And while cleaning up the resulting change in the path name for include files, I decided to clean up those even more to make them consistent overall. This could have been handled in more commits, but since this requires a make clean before the build, it seemed more sensible to do it all in one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07Silence more warningsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-24Show only as many stats as there are DC typesGravatar Miika Turkia
After reserving only the required amount of data for stats_by_type, we showed an extra DC type on the statistics (no more extra space filled with 0 at the end of the buffer) Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-18Add dive type to statistics windowGravatar Miika Turkia
This adds dive type based division to the "yearly statistics" window. Thus people can see the stats from individually from OC, CCR, PSCR and freedive. See #949 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move the YearlyStatisticsModel to qt-modelsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>