aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget
AgeCommit message (Collapse)Author
2018-05-07Fix CCR setpoint display bugGravatar Willem Ferguson
1) The connection for the display of CCR-setpoint o2SetpointGasItem was erroneous, being connected to partialpressuregasSettings. It is now correctly connected to technicalDetailsSettings. 2) The colour of the setpoint graph is changed from PO2_ALERT (red) to an orange colour in order to show setpoint in red only when it exceeds 1.6. This emphasises the visibility of red parts of the gas pressure graphs whenever gas limits are exceeed. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-07Planner: don't return static data in fake_dc()Gravatar Berthold Stoeger
fake_dc() used to return a statically allocated dc with statically allocated samples. This is of course a questionable practice in the light of multi-threading / resource ownership. Once these problems were recognized, the parameter "alloc" was added. If set to true, the function would still return a statically allocated dc, but heap-allocated samples, which could then be copied in a different dc. All in all an ownership nightmare and a recipie for disaster. The returned static dc was only used as a pointer to the samples anyway. There are four callers of fake_dc() and they all have access to a dc-structure without samples. Therefore, change the semantics of fake_dc() to fill out the passed in dc. If the caller does not care about the samples, it can simply reset the sample number to zero after work. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-03Profile: Fix crash on addition of dive to fresh logbookGravatar Berthold Stoeger
If there is no current dive, the macro current_dc returns NULL. This led to a null-pointer dereference. Reported-by: Martin Měřinský <mermar@centrum.cz> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-04-28Plot OC-pO2 graph for SCR divesGravatar Willem Ferguson
This commit allows plotting the OC-equivalent pO2 graph for PSCR dives. This happens in both the cases where there is no external O2-monitoring AND when there is external pO2 monitoring. The calculations are only done for PSCR dives and is achieved as follows: 1) Within plot-info create a pressure-t called OC_pO2 in profile.h and populate this variable with the open-circuit pO2 values in profile.c. 2) Create a new partialPressureGasItem ocpo2GasItem in profilewidget2.h and, in profilewidget2.cpp, initialise it to read the plot-info OC_pO2 values and enable its display by using the setVisible method. The diveplotdatamodel was also touched in order to achieve this. 3) Create a pref button that controls the display of OC-pO2 for SCR dives 4) Change the colour of the OC-pO2 grpah to orange 5) Change the connection of the crr_OC_pO2 signal to be appropriate 6) rename the OC_pO2 attribute to scr_OC-pO2 Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-04-09Profile: Conditionally compile pictures-vector on mobile.Gravatar Berthold Stoeger
This vector is not used on mobile and cause iOS compilation to fail. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-04-09Profile: On dataChanged() only update pictures that actually changedGravatar Berthold Stoeger
Only update those pictures of the DivePictureModel that actually changed. This will be useful once pictures are loaded incrementally. To do so, replace the pictures array by an array with stable ids. Before this commit, not-shown pictures are left out of the pictures array, which makes the mapping from DivePictureModel-ids to the picture array index non-trivial. Replace the QList<DivePictureItem *> by a std::vector<std::unique_ptr<DivePictureItem>> to ease memory management. Sadly, owing to COW semantics, QVector is incompatible with QScopedPointer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-19Profile heartrate: Nicer min/max values and tic distanceGravatar Stefan Fuchs
Correct a bug in finding the minimum heartrate. Use the minimum and maximum heartrate value to set min/max and tic distance for the heartrate axis in the profile. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-14Cleanup: consistently use qPrintable()Gravatar Berthold Stoeger
Replace constructs of the kind s.toUtf8().data(), s.toUtf8().constData(), s.toLocal8Bit().data(), s.toLocal8Bit.constData() or qUtf8Printable(s) by qPrintable(s). This is concise, consistent and - in principle - more performant than the .data() versions. Sadly, owing to a suboptimal implementation, qPrintable(s) currently is a pessimization compared to s.toUtf8().data(). A fix is scheduled for new Qt versions: https://codereview.qt-project.org/#/c/221331/ Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Use correct numeric format based on selected locale (Qt domain part)Gravatar Stefan Fuchs
This changes the numeric format of many values printed to the UI to reflect the correct numeric format of the selected locale: - dot or comma as decimal separator - comma or dot as thousands separator In the Qt domain the `L` flag is used case specific mostly in qthelper.cpp. Then the helper functions get_xxx_string() are used more consistently. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
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>
2018-02-22Remove space between pressure value and pressure unit in profileGravatar Stefan Fuchs
Bring one more value plus unit pair which is the pressure value printed in the profile in accordance with the coding style/UI style rule of not having a space between value and unit. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-02-17Coding-style: remove superfluous parenthesesGravatar Berthold Stoeger
Mostly replace "return (expression);" by "return expression;" and one case of "function((parameter))" by "function(parameter)". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-02Free various struct membuffer in different functionsGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-31profile: replot handles while planningGravatar Jan Mulder
The settingsChanged() function of the profile widget tries to be clever and tries to prevent not needed replots of the profile. I'm not sure this is very relevant in the first place as change of settings are almost instantly, with or without replot. It appears that replot is always executed when there are calculated ceilings visible. But without calculated ceilings a replot is "optimized out". This does, however, introduce dangling divehandles in PLAN/EDIT and ADD mode of the profile, when any setting that influences the y-axis is changed. The fix is trivial. Just force a replot in the PLAN/EDIT and ADD modes. Fixes: #1070 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-24Planner: print icd information at 0.1 resolutionGravatar Willem Ferguson
The gas fractions (in %) are now printed at a resolution of 0.1% and not at 0.01% as previously. The string in the info box that provides icd data is reformatted so that the info-box is as narrow as possible. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-01-24profile: fix weird disappearance of cylinder pressure lineGravatar Jan Mulder
The reason for this issue, and fix for this is very similar to commit b4d37e8ee. Just set both recalculate flags on a mouse release event, so that the cylinder pressure line is recalculated. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-21Profile info box ICD: Change format of ICD stringGravatar Stefan Fuchs
Change the format from (example!) ICD: ΔHe=-34% ΔN₂=3%<3% to ICD: ΔHe=-34% ΔN₂=+3%<+2.8% Change strings given to translation to less complex ones. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-21Only give ICD warning if pN2 increasesGravatar Robert C. Helling
as otherwise there are warning on the descent. The ICD line in the info box is generated for all gas switches with decreasing He content. Also change the presentation in the info box to align it with the notes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-21Show ICD in gaschange iconsGravatar Robert C. Helling
Add an exclamation mark in the gas change icons if the change violates our isobaric counter diffusion criterium. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-21Show ICD events data in infoboxGravatar Robert C. Helling
If a gas switch violates our ICD criteria, show this in the info box. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-12profile: fix garbled profiles after visiting the plannerGravatar Jan Mulder
See mentioned GitHub issue for the full issue, and images. The reason for this weird behavior is the existence of 2 flags in the profile code: shouldCalculateMaxTime and shouldCalculateMaxDepth. When exactly following the use case and test data as attached to the GitHub issue (a very short dive, shorter than most of the dives in the logbook), the shouldCalculateMaxTime flag never got back to its true status, causing the the time scale not to adapt to other dives when just clicking (or selecting) them from the dive list. The problem is fixed here by also setting the shouldCalculateMaxTime flag on manipulating wayppoints in the dive plan. Fixes: #1039 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-11Introduce helper function empty_string()Gravatar Berthold Stoeger
There are ca. 50 constructs of the kind same_string(s, "") to test for empty or null strings. Replace them by the new helper function empty_string(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Pictures tied to profile are not supported on mobileGravatar Jan Mulder
Move divepicturemodel.cpp to the desktop only category and deal with the (limited) fallout. We, currently, do not support dive pictures tied to the profile on mobile, so there is no use including this code. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10Un-tie plannner model from profile on mobileGravatar Jan Mulder
Do not pull in the DivePlannerPointsModel::instance as this is not used in the called function. We (currently) do not support deco computations on mobile, so trying to pull in any deco state from the planner is futile anyway. With this uncoupling, 6 more model files are not needed in mobile any more. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10Typo: Threshould -> ThresholdGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Typo: indice -> indexGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Replace CREATE_PP_GAS macro by member function in profilewidget2.cppGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Remove two arguments from ProfileWidget2::setupItem()Gravatar Berthold Stoeger
1) hAxis was always set to timeAxis 2) model was always set to dataModel Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Replace ADD_ACTION macro by member function in profilewidget2.cppGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Replace HIDE_ALL macro by template function in profilewidget2.cppGravatar Berthold Stoeger
This is easier to read and debug. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Remove unnecessary deletes in destructor of ProfileWidget2Gravatar Berthold Stoeger
All the deleted items were added to the scene, which takes "ownership" (a remarkably fuzzy concept in Qt) of these objects. In principle, deleting these items is a bug - even though it is handled gracefully. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Unused code: remove ProfileWidget2::isAddOrPlanner()Gravatar Jan Mulder
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10Unused code: DiveCartesianAxis::percentAt()Gravatar Jan Mulder
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10Unused code: remove DiveCartesianAxis::tickInterval() and tickSize()Gravatar Jan Mulder
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-29cleanup: Uninitialized scalar fieldGravatar Jan Mulder
CID 208332 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-29cleanup: Uninitialized pointer fieldGravatar Jan Mulder
CID 45172 And one non initalized member hAxis could be removed as it is not used. Surprisingly, Coverity did not see this. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18Implement different zoom levels for dive photos tabGravatar Berthold Stoeger
This implements different zoom levels for the dive photos tab as suggested by Stefan Fuchs <sfuchs@gmx.de> in #898. The zoom level can be changed using a slider or CTRL+mousewheel. Zoom levels range from a third of the standard thumbnail size to thrice the standard thumbnail size. Thumbnails are cached in maximum resolution and scaled down on the fly. Because the profile widget took its pictures from the photo list model, an extra picture copy with a fixed size had to be introduced. The UI is still a bit crude. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-15divepicturemodel: Reset start and end row for displayed_dive correctlyGravatar Stefan Fuchs
Correct way of using indices for rowDDstart and rowDDend. Reset rowDDstart and rowDDend at beginning of updating dive pictures. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13Fine tune the position of pictures in the profileGravatar Stefan Fuchs
Start a new column a little bit earlier otherwise it will get difficult to fit a high number of pictures. Don't put more than ~16 pictures in one column. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13Dive pictures show pictures of all selected divesGravatar Stefan Fuchs
In the dive picture tab show pictures of all selected dive. But at the same moment take care that in the profile only pictures from displayed_dive are displayed. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01Prevent redundant replanningGravatar Robert C. Helling
Planning dives is heavy on CPU, so better be sure we only do it when needed. In particular, when moving around dive points, we only want a new plan once per move and not three times (triggered at various points in the chain of events). This should significantly improve planner snappiness. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Control growth of time axisGravatar Robert C. Helling
While dragging waypoints around, don't grow the time axis according to dive duration (including deco stops) as this can explode too easly resulting in an effectively unresponsive planner. Rather grow it only (slowly) when a dive handler is moved to the right 10% of the profile. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Dive picture handling: Re enable multi select, improve mouse eventsGravatar Stefan Fuchs
Some improvements for the dive picture tab and dive pictures in profile: - Bugfix mouse event in profile: Only Left-click will open picture - Bugfix mouse events in picture tab: - Re-enable context menu (Windows bug mainly) - Re-enable multi select in a nice way - Only double-left-click will open picture Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-30Use better aliases for icons.Gravatar Martin Měřinský
Icon aliases were complete mess. Some icons had alias some didn't. Named with underscores vs. hyphens vs. camelCase. Lower vs. upper case. "ICON" prefix vs. suffix vs. nothing. With vs. without filename suffix. Some didn't make sence. Eg. mapwidget-marker-gray (I can see, it's grey, but what does it represent?) Some were duplicated, eg warning vs. warning-icon. Some were name after widget, which is wrong. Do not reinvent wheel. Use widely used naming scheme close to Freedesktop Icon Naming Specification. This will enable usage of common icons from current set in the future. Thus Subsurface will fit nicely to GUI. This changes icon aliases to one, easy grep-able style. Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-29Revert "Use consistent aliases for all icons."Gravatar Dirk Hohndel
This reverts commit 92e9c6606f6ef3ad16d2e31f9f9a8f5fa14f2c1a.
2017-11-29Use consistent aliases for all icons.Gravatar Martin Měřinský
Icon aliases were inconsistent mess. Underscores vs. hyphens vs. camelCase. With vs. without filename suffix. Lower vs. upper case. "icon" suffix vs. prefix vs. nothing. Some were duplicated, eg warning vs. warning-icon. Some icons didn't have alias at all. This changes all icon aliases to one, easy grep-able style which complies to Freedesktop Icon Naming Specification (Guidelines). Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-25Fix toggling of partial pressure graphsGravatar Berthold Stoeger
When toggling the display of the partial pressure graph, the graph was either not shown correctly or unnecessary ticks were left in the graph. Calling the settingsChanged() method of the profileYAxis object solves the problem by initializing the ticks according to the selected graphs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25In strings change tank to cylinderGravatar Stefan Fuchs
Change the word "tank" to "cylinder" or "cyl." in two occurences. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-25Hand planner variables to profileGravatar Robert C. Helling
Pass the planner state struct to the profile computation so it can use deco_time and first ceiling to display VPM-B ceiling. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-23Fix obscure display bug in profile widget, where heat map wasn't shownGravatar Berthold Stoeger
Fixes an obscure bug, which happened under very specific circumstances. Precodition: fresh program start and neither of the partial pressure graphs, nor the heat maps are shown. User clicks on heat map icon. Bug: The heat map is not shown at the bottom of the graph. The fix consists in replacing two percentageAxis->setLine() calls by precentageAxis->animateChangeLine() calls. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>