aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/TabDiveStatistics.cpp
AgeCommit message (Collapse)Author
2020-11-03desktop: allow update of tab widget colors at run timeGravatar Dirk Hohndel
Adding a new virtual function to all of these classes may seem like overkill, but of course the idea is that likely we'd allow similar changes to all of them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26desktop: move MinMaxAvgWidget to TabDiveStatisticsGravatar Berthold Stoeger
This is its only user and the widget is scheduled for removal. Let's move it there temporarilly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-07statistics tab: use current_dive to decide whether user is freedivingGravatar Berthold Stoeger
This used the displayed_dive object. However, we now use current_dive to designate the currently displayed dive. Thus, use this instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-06desktop: update statistics tab when cylinders changedGravatar Berthold Stoeger
The cylinder-based statistics where not updated when an undo command edited cylinder data. Do so. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Cleanup: use quotation marks for non-system includesGravatar Berthold Stoeger
That's the idiomatic way of doing things. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Selection: move selection functions from divelist.c to selection.cGravatar Berthold Stoeger
Since we now have a selection.c translation unit, put the selection- related functions there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Core: remove MAX_CYLINDERS restrictionGravatar Berthold Stoeger
Instead of using fixed size arrays, use a new cylinder_table structure. The code copies the weightsystem code, but is significantly more complex because cylinders are such an integral part of the core. Two functions to access the cylinders were added: get_cylinder() and get_or_create_cylinder() The former does a simple array access and supposes that the cylinder exists. The latter is used by the parser(s) and if a cylinder with the given id does not exist, cylinders up to that id are generated. One point will make C programmers cringe: the cylinder structure is passed by value. This is due to the way the table-macros work. A refactoring of the table macros is planned. It has to be noted that the size of a cylinder_t is 64 bytes, i.e. 8 long words on a 64-bit architecture, so passing on the stack is probably not even significantly slower than passing as reference. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-26Undo: turn dive- and trip-fields into flagsGravatar Berthold Stoeger
The divesEdited signal sends the changed field as a parameter. Since some undo-commands change multiple fields, this led to numerous signals for a single command. This in turn would lead to multiple profile-reloads and statistic recalculations. Therefore, turn the enum into a bitfield. For simplicity, provide a constructor that takes classical flags and turns them into the bitfield. This is necessary because C-style named initialization is only supported on C++20 onward! Is this somewhat overengineered? Yes, maybe. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-26Undo: update statistics if dive changedGravatar Berthold Stoeger
On undo/redo, the dive statistics tab was not updated even if a selected dive was changed. Fix that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21If only one dive selected, only one temperature in stats tabGravatar Fabio Rueda
In stats tab, when only one dive is selected, on one stat, only average is shown, except temperature which 3 same temps for max, min and avg are shown. [Dirk Hohndel: fixed whitespace] Signed-off-by: Fabio Rueda <avances123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-15if only one dive, max depth show in average fieldGravatar Fabio Rueda
Signed-off-by: Fabio Rueda <avances123@gmail.com>
2019-04-12optimize selectedDivesGasUsed()Gravatar Rolf Eike Beer
-return the result instead of storing in a parameter, we now know that the list contains only those results that are generated in the function -allocate the result with the correct length right from the start -do not iterate over keys of a map and then do a map lookup to get the value but use an iterator that gives us both right from the start -remove one call alltogether as the results were not used there Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
2019-04-12get rid of some foreach and Q_FOREACH constructsGravatar Rolf Eike Beer
See https://www.kdab.com/goodbye-q_foreach/ This is reduced to the places where the container is const or can be made const without the need to always introduce an extra variable. Sadly qAsConst (Qt 5.7) and std::as_const (C++17) are not available in all supported setups. Also do some minor cleanups along the way. Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
2018-12-17Show average max depth in statistics tabGravatar Robert C. Helling
This makes more sense than average depth. The min entry is also about max depth for a dive. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-10-07Statistics: un-globalize stats_selectionGravatar Berthold Stoeger
The statistics of the selected dives were calculated a) into a global objects and b) at a completely different place than where they're used. There's no plausible reason for either. There fore render into a caller-provided structure at the place of use. 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-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-11-27Use MAX_CYLINDERS consistentlyGravatar Stefan Fuchs
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-05-01Update translation and strings for gas usage in statsGravatar Stefan Fuchs
Giving the string " and " to transiflex seems to fail and/or it's highly possible that the translators make a mistake by translating it into "and" or " and" or "and ". Change the string to "and" and hard code the whitespaces before and after. Change O2 to O₂ in statistics. Translate "He" and "O2" in statistics. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-01Show min/max SAC in statistics only if different to average...Gravatar Stefan Fuchs
...and don't show a minimum depth in stats if there is only a single dive. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-29Add SPDX header to desktop widgetsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-26Hide avg max depth thingieGravatar Anton Lundin
We don't set it so just hide it. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-04-26Always set min/max sac in statistics tabGravatar Anton Lundin
It just looks weird when they aren't set, just because you only selected one dive. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-04-06Break down MainTab into smaller classesGravatar Tomaz Canabrava
Maintab is one of our most complex classes, and it's something I'm not actually proud of. But it currently works and the idea of splitting it was in my head for quite a while. This is the third or fourth tentative of splitting it, and this time I let the most complex part of it untouched, the Notes and Equipment tab are way too complex to untangle right now on my limited time. A new class 'TabBase' should be used for any new tab that we may create, and added on the MainTab (see the new lines on the MainTab constructor). Also, Extra Info, Information, Photos and Statistics where ported to this new way helping reduce the number of lines and functions on the MainTab quite a bit. Overall this is a step in the right direction for the future. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>