aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
AgeCommit message (Collapse)Author
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>
2015-01-01Avoid divide by 0 errorGravatar Krzysztof Arentowicz
Avoid crash when moving mouse to left side of the plot when showing mean depth Signed-off-by: Krzysztof Arentowicz <k.arentowicz@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30Make the moving mean depth line workGravatar Tomaz Canabrava
It's a bit jumpy, but works. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30Add a new signal to send the current time/depth of the mouse posGravatar Tomaz Canabrava
As the explanation says. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30Add the instantMeanDepth on SceneGravatar Tomaz Canabrava
But nothing is hoocked yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30Move stuff to protected on DepthLineGravatar Tomaz Canabrava
I wanna use some of it on the InstantMeanDepthLine Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30Set data model for the MeanDepth lineGravatar Tomaz Canabrava
This way we can poke around data for the mean depth line. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30Add skeleton for the instant mean depth lineGravatar Tomaz Canabrava
This class will hold the visible line of the mean depth for the time 'now' Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30Add the runnimg_sum data to the data model to be displayed on the profileGravatar Tomaz Canabrava
Without this nothing would be displayed. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30Add the gradient factor on the tableGravatar Tomaz Canabrava
It was impossible to guess what this column was just by looking at it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30Add text for the heart beat data on the tableGravatar Tomaz Canabrava
This was missing on the UI and it was really hard to guess what it was. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>