aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
AgeCommit message (Collapse)Author
2015-01-27diveplotdatamodel.cpp: use space before sensor indexGravatar Lubomir I. Ivanov
the manual uses "Sensor 1:", not sure if it breaks anything. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-26Change mean depth/s to mean depth @ sGravatar Tim Wootton
Mean depth/s sounds too much like a rate of change but this referers to instantaneus mean depth at a time. Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-26Heartrate sounds better than heart beatGravatar Tim Wootton
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-24Fix crash with empty dive listGravatar Dirk Hohndel
Don't access current_dc unless there is a valid current_dive. Fixes #817 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-24Avoid overprinting of cylinder presssure labels for CCR divesGravatar willem ferguson
This patch takes the cylinder pressures of CCR dives and prints them in a non-overlapping way. Remaining issue: When the dive profile is made taller by dragging the window or the appropriate slider far down the screen, the labels move further apart; similarly, when the profle is made flat/shallow by dragging the window edge or appropriate slider up, the labels get close to each other and start to overlap. There are quite a few lines of additional code going into the patch. This is primarily because separate provisions for when po2 > p(diluent) or vice versa. In addition, I could not determine the size of the text characters which would allow much more precise placement of text. This is because the .scale member of the text is private and not available in the methods involved in printing the labels. However, the height of the vertical scale of the cylinder pressure graph can be determined [e.g. vAxis->maximum()]. This helped a lot to get the positioning of the text more or less correct. While the results of the patch is not perfect, It contributes significantly to make the profiles of Poseidon dives more readable. Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-24Correcly look at all relevant dive computer structuresGravatar Dirk Hohndel
When calculating maxima for a dive, we need to take data from all existing dive computer structures plus potentially also a fake dive computer structure that is just passed in in order to create a meaningful profile. Commit 86c961614bfa ("Actually walk all dive computers, don't just claim to do so") missed that second case and no longer took the fake_dc into account, breaking the display of dives that don't have samples. Reported-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-24Don't show previous dive computer textGravatar Dirk Hohndel
There were situations when the last text was still shown. E.g. when the current file was closed and then a new dive was imported from CSV. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-23Code cleanup: CCR setpoint and o2 sensor visualisationGravatar willem ferguson
This patch does some cleaning up of the code that provides visualisation of CCR o2 sensor and o2 setpoint data. It reduces the number of conditional evalauations that are required and it improves the readability of these parts of the code. Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-21CCR option: display o2 sensor dataGravatar willem ferguson
This patch creates the possibility of viewing the individual sensor values when the po2 button on the profile toolbar is activated. This follows exactly the procedure for optionally displaying the setpoint values while viewing po2. A checkbox in the preferences panel determines whether sensor information is shown. By default it is set to OFF. When checked, and the po2 button is activated, sensor1 values are shown in grey, sensor2 in blue and sensor3 in brown. Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19Actually walk all dive computers, don't just claim to do soGravatar Dirk Hohndel
If the first dive computer had pressure samples, but the second one (and no higher one) did, then we would draw a flat horizontal line for the tank pressure graph (but lable it with the correct pressures). This routine that is hunting for the actual maxima and minima does have to really go through all dive computers, not just "this one and up". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19Fix extreme sluggish profile over timeGravatar Tomaz Canabrava
Whoa, this deserves a good explanation. Everytime that the mouse moved in add / plan mode, or anytime a new dive was displayed on the profile, this method would be called and connect the dataModel to the modelChanged method. This added the slot in a call-vector that the fired signal would call, adding one call to the Slot per add / plan mouse move (about 20x/s) or each time a new dive was displayed. Quickly filling the vector with more than 200 - 300 calls to this same Slot. The fix is to only connect one time. this made the add / plan mode *so* much smoother... :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-18Fix build: add missing #includesGravatar Thiago Macieira
qt-ui/profile/profilewidget2.cpp:1351:10: error: invalid use of incomplete type ‘class QDebug’ qt-ui/printlayout.cpp:141:27: error: variable ‘QPointer<ProfileWidget2> profile’ has initializer but incomplete type In commit f9ceff009b35 ("Clean up the header files") things got broken for an as of now unreliesed future version of Qt. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-18Move the heart rate graphGravatar Joakim Bygdell
Move the heart rate graph down to the same space as the tissue saturation graph so that it does not overlap with temperature or partial pressures. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-18Clean up the header filesGravatar Dirk Hohndel
Lots and lots and lots of header files were being included without being needed. This attempts to clean some of that crud up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Cache the complex items to give us a boost of speedGravatar Tomaz Canabrava
This cache give us a huge gain in performance, going from 17% moving the mouse frenetically to 9%, wich is quite acceptable. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Fix memleak of QGraphicsRectItemGravatar Tomaz Canabrava
We used to create a new QGraphicsRectItem everytime a Pixmap changed. Since I'm pretty sure I deleted every bit of the PictureItem before setting a new one, no leak was due, but this version is safer. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Only update text if something changedGravatar Tomaz Canabrava
We were calling this even if we didn't really change anything and paths are expensive to paint. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Fix the colors - brush wasn't being set anymore.Gravatar Tomaz Canabrava
Also a bit of code cleanup. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Reduce the amount of new/delete when setting a new text on DiveTextItemGravatar Tomaz Canabrava
We were recreating the PathItems (one for the outline, other for the real text) for every call to setText. This was a very un-smart move. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Reduce the refresh rate of the toolTipItem to 25fps.Gravatar Tomaz Canabrava
This reduces a lot of CPU time and makes the overall use of the tooltip a breeze. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Honor prefs.anim_speed on the ToolTip animationsGravatar Tomaz Canabrava
The tooltip animation had a fixed animation speed, this patch honors the anim_speed on the preferences, and also disables the animation completely if the speed == 0. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Reduce the number of calls to boundingRectGravatar Tomaz Canabrava
There are a few calculations that go on boundingRect that can be avoided if we simply store the result. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Fix the colors of the rectangleGravatar Tomaz Canabrava
Correct pen and brush set. the ToolTip now is correctly rounded, translucent and happy. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Implement the paint method to draw the rounded rectangle.Gravatar Tomaz Canabrava
The rectangle is now correct, but the collors are still wrong. I'm tracking that down - most probably I've set the wrong pen or brush ( or both ) somewhere. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Remove the background and the separatorGravatar Tomaz Canabrava
Those items were used to fake the background of the path item but since the rectangle can be painted with a border and a fill, this is uneeded. The rect is still ugly. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Inherit from QGraphicsRectItem instead of QGraphicsShapeItemGravatar Tomaz Canabrava
a rectangle is *much* faster to paint than a simple ShapeItem, so this is a safer choice. We still need to create the paint method so we can use the correct roundness for the rectangle. Currently it's white with a 1px solid line - terrible. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15Reduce the amount of calls to create the background on the ToolTipGravatar Tomaz Canabrava
We were deleting / recreating the graphics background item for *every* mouse movement. Now we are just creating the painter path; no more allocations / desalocations, adding, removing from the scene. This should make things a tiny bit faster. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15Reuse the entry tooltip item and do fewer calls for each mouse moveGravatar Tomaz Canabrava
While analizing the code for the mouse movement I've discovered that we did a lot of uneeded things: Set the color, the pen, the size of a fixed-colored line, twice. We also deleted-newed the same Pixmap / Text for every mouse movement so now we reuse the 'entryToolTip' that consists of a huge line and a pixmap, and after that we add the other tooltips that are not static Also, reduced a lot the number of calls to expand() (that did a lot of math). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15Do not set the rectangle if it's the sameGravatar Tomaz Canabrava
Strangelly, this method was being called even if the rectangle was the same, so we deleted everything and recreated everything again. tsc tsc. Some more improvement is needed but we are getting there. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15Only update the rectangle if it changedGravatar Tomaz Canabrava
Very often the rectangle of the ToolTip doesn't need to change but we were calling and firing an animation for it for *every* mouse movement, even when we didn't really needed it. Now it will only fire something if the rectangles are indeed different. From my tests we reduced the number of calls to the animatior by about 20% using a real divelog as test. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15Do not free the membuffer, reuse itGravatar Tomaz Canabrava
This is an attempt to make fewer calls to alloc functions when the mouse is moving. We were creating a membuffer, filling it (malloc / realloc), then freeing it just after use. but we could simply hold that allocated area and reuse it again. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15Speed Improvemens: fewer calls to mapFromScene / mapToSceneGravatar Tomaz Canabrava
We did three cals to mapToScene / mapFromScene on the mouse moveEvent at the ProfileWidget2 where we only needed to call one in the common case and two in the worst case. This doesn't really help in terms of speed (unless you have a really old cpu) but since it's code that gets called *very* often, it seemed a reasonable thing to do. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15Fix memory leakGravatar Tomaz Canabrava
The QPainter and the QPixmap were being created but never freed. A QPixmap and a QPainter don't need to be created by new, they can be safely created on the stack. So, create them on the stack, pass them via const-reference and use them correctly. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15Major speedup when moving the mouse in the profileGravatar Tomaz Canabrava
After looking with great care at the result of the mouse movement on the profile, and also playing a bit with callgrind I've found out that one thing that we were doing wrong was the way we looked at the items in the scene, by calling scene()->items with Qt::ItemIntersectsShape, our shapes are very complex curves with thousends of points and we have lots of them. and it usually doesn't matter because *most* of the time we are getting the tooltip information from 'get_plot_details_new', so no accessing to items was necessary. By changing the access from Qt::ItemIntersectsShape to Qt::IntersectsItemBoundingRect we had a speedup of almost 500x in a section of code that's very important, and the good thing, nothing bad happened because one of the only things that we are using this code is to get information from the events, not the curves. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-14Remove instantMeanDepthLineGravatar Cristine Guadelupe
Take instantMeanDepthLine out of the code. We have the moving average line plus the exact data in the information overlay. Signed-off-by: Cristine Guadelupe <cristineguadelupe@me.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10Refactor dctype -> divemodeGravatar Robert C. Helling
... and repair a failed rebase (sorry). Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09Repair minor bug in CCR setpoint graphGravatar Willem Ferguson
Correct minor malfunction with CCR setpoint display. It was showing even when the po2 display was turned off. This patch ensures that the setpoint graph only shows when the po2 toolbar button is activated (and in addition the appropriate checkbox in the Preferences). Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07profile: don't show instantMeanDepth for printModeGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Fix potential crashGravatar Dirk Hohndel
Commits 0de3bc845237 ("Display CCR setpoint values on the po2 graph") and 65eed80e3730 ("Don't always show the setpoint graph") didn't take into account that current_dive could be NULL and therefore accessing current_dc could crash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-05Give oxygen a proper colour in the tankbarGravatar Joakim Bygdell
Oxygen should be representad by its own solid green colour not the yellow/green of nitrox. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-05Don't always show the setpoint graphGravatar Dirk Hohndel
We need to use the same conditional here as we do earlier in the code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-05Display CCR setpoint values on the po2 graphGravatar Willem Ferguson
When a CCR dive is viewed and the toolbar button for PO2 is activated, both the PO2 (green line) and the O2 setpoint (red line) are shown. This allows evaluation of the PO2 in the CCR loop with respect to the pre-configured O2 setpoint. The setpoint graph can be disabled from the Preferences/Graphs tab by checking the appropriate checkbox. Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-05Various capitalization fixesGravatar Joseph W. Joshua
Fix various discrepancies in the capitalization format, as we are using 'down format' for titles and actions. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-04Close two compiler warnings about reorderingGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-03Extend SAMPLE_EVENT_GASCHANGE2 to have cylinder index in 'flags' fieldGravatar Linus Torvalds
A value of zero (which is the normal legacy one) remains "unknown", but the divecomputer backend can now give both gasmix and cylinder number this way. Currently only the EON Steel backend does that, but it should be easy enough to extend others too. Also, fix the user-visible cylinder numbering in the cylinder change tooltip to use a human-friendlier one-based numbering (ie first cylinder is "cyl 1", not "cyl 0") Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-02Fix gaschange tooltip informationGravatar Linus Torvalds
The code tried to look up the cylinder index from the Qt data models, which was not only horribly confusing, but was also buggy. I think the index ends up being off by one when the first cylinder change is hidden (because it's at the beginning of the dive), but I can't make heads or tails of that crazy code, so there might be something else going on. Just remove all the crazy code, and use the event data directly. Which gas the gasmix and the (potential) explicit cylinder index already. It's much more straightforward, and it just automatically gets the right end result whether some other event is hidden or not. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-01Make the moving mean depth line a less obnoxious colorGravatar Dirk Hohndel
The red made it stand out way too much. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-01Whitespace cleanupGravatar Dirk Hohndel
Quite a bit of wild white space going on... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-01Get rid of mean depth lineGravatar Krzysztof Arentowicz
Flat mean depth line (whole dive, not the instant one) is redundant as we now have a much more useful mean depth graph. Signed-off-by: Krzysztof Arentowicz <k.arentowicz@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-01Plot mean depth dataGravatar Krzysztof Arentowicz
As we already have running depth sum values for each sample why don't just plot running average depth graph. Signed-off-by: Krzysztof Arentowicz <k.arentowicz@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>