Commit graph

7147 commits

Author SHA1 Message Date
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
881803441e Save predefined SAC
When planning a dive, the gas consumption is based on a user configured SAC.
Thus we should use that SAC and not try to recompute it from samples.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17 08:18:08 +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
Dirk Hohndel
d8830ad31c Need to use qmake-qt4 for building Ubuntu 12.04 packages
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 19:55:22 -08:00
Dirk Hohndel
0ca8c54df1 Update Readme.ubuntu
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 19:48:11 -08:00
Dirk Hohndel
8077e420a6 Update README for 4.4 Beta 1
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 17:51:32 -08:00
Dirk Hohndel
400cc01c26 Add patch to the Ubuntu build process for 12.04
We need to build with Qt4 on 12.04.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 17:42:32 -08:00
Dirk Hohndel
e8c13fb737 Some updates to the ReleaseNotes
Doing this incrementally as we add features would be much smarter.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 14:49:02 -08:00
Dirk Hohndel
5e0abd8829 Finally deal with incrementing the serial number of the build
I know, I know. This should never have been hard coded.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 14:15:30 -08:00
Dirk Hohndel
90f931dabe Attempt to build for Ubuntu 12.04 as well
And fix a silly typo in the Debian/Ubuntu control file

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 13:02:52 -08:00
Guillaume GARDET
218a1a317e Documentation: Fix user-manual.txt indentation to comply to asciidoc format (also fix po4a translation tool usage)
This patch fix indentation for list item to comply to asciidoc format.
This also fix po4a translation tool usage.

Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-16 06:37:22 +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
Guillaume GARDET
dc7397b06e Documentation: Add initial support for French translation
Add initial support to French (fr) translation of user-manual.

Note that it is not perfect, since the po4a tool loose some list item
indexes during PO to ASCIIDOC conversion (see asciidoc warning messages
during user manual generation).

Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 09:02:29 +13:00
Guillaume GARDET
b4b08bdcc5 Add POT/PO infrastructure to translate user manual.
Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 07:34:17 +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
Dirk Hohndel
c9535b6547 Turns out the manifest doesn't allow a dash in the name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-14 10:46:21 +13:00
Dirk Hohndel
4187421221 Change the name of the Android app
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-14 09:34:18 +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
Dirk Hohndel
a0c52237ea Dive download UI: sort the dive computer dropdown
I could have sworn we did this at some point. The vendors are already
sorted, but the products for each vendor should be sorted, too.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-13 22:05:55 +13:00
Dirk Hohndel
af3dd1e835 Attempt a better layout for the download dialog
This seems to work well and provides a lot less wasted space.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-13 21:58:28 +13:00
Dirk Hohndel
578e9c22af Dive d/l selection UI: clear table when retrying
After a partial download (because the user hits cancel or because there
was an error, if the user hits Retry the list of dives downloaded so far
should be cleared because we will simply try to re-download the same dives
again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-11 07:46:21 -08:00
Dirk Hohndel
bccbdf8264 Don't use current_dc unless you know there's a current_dive
This will crash if for some reason current_dive is invalid.

And in general, when displaying information, we want to use the correct dc
in the displayed_dive, not the current_dc, which references the
current_dive...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-11 07:29:29 -08:00
Robert C. Helling
e219bc70f8 Refactor dctype -> divemode
... 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-10 17:27:25 -08:00
Robert C. Helling
bfe05b4340 Replot after changing divetype
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Robert C. Helling
7d8ecf8ec8 Add preferences field for default set-point
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Robert C. Helling
0f7f2195d5 Add setpoint events according to divetype
When changing to a CCR dive, add a setpoint change to the default setpoint
at the beginning of the dive. Otherwise add an explicit setpoint change to 0
.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Robert C. Helling
a478eb5711 Maintab combobox to set dive type
still needs some work

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Robert C. Helling
93eb386ba9 Prepare for PSCR calculations
Calculations for passive semi-closed rebreathers are pretty much like OC except
the pO2 is lower bey a certain (SAC dependent) factor. This patch introduces the
corresponding calculations in case dctype == PSCR which is so far never set and
there is currently no UI for these calculations. As pO2 is SAC dependent it takes
a certain attempt at getting it and drops to defaults from the prefs otherwise.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Robert C. Helling
d01c6c824b Rebreather type selector UI
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Dirk Hohndel
ac2c15e8cf Small adjustment to the Mac build instructions
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 16:58:08 -08:00
Dirk Hohndel
762f33bd13 Dive d/l UI: redo the states, the flow, the buttons
This is bigger and more invasive then I wanted, but it's hard to break it
down into smaller pieces. Here's what it does:

The former "Download" button becomes the "Download", "Cancel download" and
"Retry" button. So this button controls your interaction with the dive
computer.

The other two buttons are now purely "OK" and "Cancel" for the dialog.
"Cancel" discards what happened (much easier now that we download into a
different table), and "OK" adds the dives that were selected in our
selection UI (by default all downloaded dives) to the real dive_table.

And while redoing all this, I also redid some of the state machine
underlying the dialog. The biggest change that the user will see is that
partial downloads (after canceling or after an error) will still offer the
dives that were completely downloaded up to that point in the selection
menu.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 15:06:25 -08:00
Dirk Hohndel
f10b66237e If we can't find the dive, simply return no data
This seems better than forcing a crash or accessing random data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 15:06:25 -08:00
Dirk Hohndel
7357633905 Now use our table when downloading from the dive computer
We pass a different table to libdivecomputer (and the uemis code) and have
that table filled. And then we simply copy the dives from that table into
the real dive_table when the user accepts the download.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 15:06:25 -08:00
Dirk Hohndel
e43ea018fa Add a private table for downloaded dives
This still isn't actually used, just puts it in place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 15:06:25 -08:00
Dirk Hohndel
6f25713408 Add more infrastructure for a separate dive table
This will allow us to download the dives from the dive computer into a
separate table just for that purpose and not into the main dive_table.

I really dislike the code that's in place that dates back to the very
earliest code written for Subsurface. Dumping the dives straight into the
main dive_table seems really stupid to me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 15:06:18 -08:00
Dirk Hohndel
a92484e4ed Dive d/l selection UI: remove setData() method
Since we now track all clicks on the row, having the setData() actually
neutralized the action that we took on the clicked() signal.

Now you can select / deselect a dive, regardless where in the row you
click.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 12:42:09 -08:00