Commit graph

3006 commits

Author SHA1 Message Date
Dirk Hohndel
c3614424f9 Correcly look at all relevant dive computer structures
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 86c961614b ("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-24 07:07:02 +12:00
Dirk Hohndel
6aee901f6f Don't show previous dive computer text
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-24 06:54:16 +12:00
willem ferguson
4487e13e15 Code cleanup: CCR setpoint and o2 sensor visualisation
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-23 21:41:28 +12:00
Miika Turkia
5ac5619a77 Set the known import selection for Seabear import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-23 06:31:47 +12:00
Miika Turkia
2e77e710a0 Use proper sample headings for Seabear CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-23 06:31:38 +12:00
Miika Turkia
a4c3e9cdc0 Use correct case for string matching on CSV import
As the string was changed in our CSVApps array, we must change it here
as well.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-22 21:49:15 +12:00
Miika Turkia
f8b9d61b92 Fix string that is used as XML tag name
We use the human readable name here as XML tag name so it cannot contain
spaces. Note that currently some of the names can have spaces in them as
they are special cases and not used as XML tag name.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-22 21:49:03 +12:00
Miika Turkia
ffdb78a3dc Fix order of CSV field separators
Unfortunately we are referencing these separators with index, so they
need to be on same order as used in XSLT files.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-22 21:48:57 +12:00
Miika Turkia
c1f716614f Special handling of Seaber CSV files
These files contain a bit of extra data before the actual CSV part, so
we need to skip there to show sensible information to users.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-22 21:48:44 +12:00
Anton Lundin
e8b02d3b2a Add a QProgressDialog to auto-ostc3-firmware
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-21 17:04:52 +12:00
Anton Lundin
724170f4b6 Connect the progress events to the progress bar
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-21 17:03:24 +12:00
Anton Lundin
ba525df766 Use a progressbar in the configure dc dialog
This switches from a couple of labels in the dialog to a progress bar,
to later being able to use it to provide better user experience.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-21 17:03:18 +12:00
willem ferguson
a700be3207 CCR option: display o2 sensor data
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-21 17:00:18 +12:00
Robert C. Helling
2923329e8e UI for pSCR preferences
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-20 22:38:52 +12:00
Dirk Hohndel
86c961614b Actually walk all dive computers, don't just claim to do so
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-19 21:52:08 +12:00
Dirk Hohndel
1b3c776358 While editing the coordinates we need to compare to the displayed_dive
Comparing to the master dive only made sense when we immediately modified
a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 21:03:42 +12:00
Dirk Hohndel
f448bfd574 Hide the old flag when editing a location on the map
This ONLY hides the old flag if the current dive is the only dive on that
location (which seems to make sense).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 17:39:31 +12:00
Dirk Hohndel
803d390044 Show a flag when editing a location on the globe
Since we don't modify the dive list, the new flag wouldn't show up until
we accepted the change - that's not user friendly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 17:39:31 +12:00
Dirk Hohndel
df46b85ee1 Don't just change the location when double clicking on the globe
Instead be consistent with other parts of the code and put us in editing
mode so the user can accept / reject the change.

See #800
Fixes #801

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 17:38:17 +12:00
Dirk Hohndel
83018619d6 Always updated the coordinates from the displayed_dive
That's why it's called the displayed dive...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 17:17:01 +12:00
Tomaz Canabrava
ecf4d18b41 Fix extreme sluggish profile over time
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-19 16:25:13 +12:00
Tomaz Canabrava
5a1be7620b Only update the "add dive profile / plan dive" 20x/s
We were updating the dive quite a lot of times, we really didn't need to.
This will help, but not fix, the issues with plan / add dive.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 16:22:08 +12:00
Thiago Macieira
f5726ffa9d Fix build: add missing #includes
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 f9ceff009b ("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-18 21:26:53 +12:00
Joakim Bygdell
76e3a10f08 Move the heart rate graph
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-18 21:26:06 +12:00
Dirk Hohndel
f9ceff009b Clean up the header files
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-18 21:25:59 +12:00
Tomaz Canabrava
e0280048bc Cache the complex items to give us a boost of speed
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-17 10:41:18 +13:00
Tomaz Canabrava
c9499baf22 Fix memleak of QGraphicsRectItem
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-17 10:41:07 +13:00
Tomaz Canabrava
947010991d Only update text if something changed
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-17 08:54:11 +13:00
Tomaz Canabrava
d2c5770ae1 Fix the colors - brush wasn't being set anymore.
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-17 08:54:00 +13:00
Tomaz Canabrava
a6e95511a6 Reduce the amount of new/delete when setting a new text on DiveTextItem
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-17 08:53:26 +13:00
Dirk Hohndel
abddb3ecb9 Make Facebook support a config option
By default it is turned off, turn on by calling qmake with
CONFIG+=FBSUPPORT.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17 08:43:49 +13:00
Robert C. Helling
0d619d569b Planner rebreather mode
Do the switching based on the index rather than the string (which is
translatable!).

Update set-points when turning on/off CCR mode (remeber: the rebreather
mode is stored in two places: the divemode and implicitly in the setpoitns.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17 08:18:48 +13:00
Robert C. Helling
f2939dd991 Minor PSCR fixes
Update O2 metabolsim rate and adopt default gas switch depths to
pSCR oxygen drop.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17 08:17:29 +13:00
Tomaz Canabrava
ac40c458fa Reduce the refresh rate of the toolTipItem to 25fps.
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-17 08:07:14 +13:00
Tomaz Canabrava
67865a86be Honor prefs.anim_speed on the ToolTip animations
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-17 08:06:33 +13:00
Tomaz Canabrava
85909ca28d Reduce the number of calls to boundingRect
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-17 08:05:48 +13:00
Tomaz Canabrava
85a3cbf8af Fix the colors of the rectangle
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-17 08:05:01 +13:00
Tomaz Canabrava
12dd46c140 Implement the paint method to draw the rounded rectangle.
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-17 08:04:37 +13:00
Tomaz Canabrava
48a23b9b3c Remove the background and the separator
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-17 08:04:08 +13:00
Tomaz Canabrava
deafa40d34 Inherit from QGraphicsRectItem instead of QGraphicsShapeItem
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-17 08:03:18 +13:00
Tomaz Canabrava
054521d3a1 Reduce the amount of calls to create the background on the ToolTip
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-15 14:47:44 +13:00
Tomaz Canabrava
6a1a6c82bf Reuse the entry tooltip item and do fewer calls for each mouse move
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-15 14:46:57 +13:00
Tomaz Canabrava
3169ec8dc9 Do not set the rectangle if it's the same
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-15 14:28:25 +13:00
Tomaz Canabrava
806d984107 Only update the rectangle if it changed
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-15 14:26:35 +13:00
Tomaz Canabrava
54898b15ff Do not free the membuffer, reuse it
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-15 14:23:46 +13:00
Tomaz Canabrava
501f72c697 Speed Improvemens: fewer calls to mapFromScene / mapToScene
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-15 07:24:13 +13:00
Tomaz Canabrava
db4ffd0b70 Fix memory leak
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-15 07:23:48 +13:00
Tomaz Canabrava
633dd64d2f Major speedup when moving the mouse in the profile
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-15 07:20:35 +13:00
Cristine Guadelupe
2b19341609 Remove instantMeanDepthLine
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-14 12:24:57 +13:00
Joseph W. Joshua
25fc828458 Ignore QWebView in Android
Ignore QWebView instances in the preferences dialog when compiling under
Android, as QWebView is not yet supported under Android.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-14 07:49:24 +13:00