Add threaded processing of image pixmaps

This code adds threaded processing of a batch of images. It uses the
QtConcurrent implementations to call a function repeteadly using
MAX_THREADS (Qt gets that for us) and returns a list of it.

This call is blocking, so while the pixmaps are being scaled in threads,
it will wait for all scalling to be done.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Switch more functions to use gasmix type

This time it's get_gas_string().

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Switch verify_gas_exists to take gasmix argument

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Change add_plan_to_notes() to operated on gasmix

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
More cleanup for planner.c

Remove unused variables and make the ifdef'ed out debug code work again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
More conversions to gasmix

addStop, addGas and createSimpleDive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Override the MinMaxAvgWidget tool tips for the depth instance.

Add new methods to the MinMaxAvgWidget class to allow us to override the
default tooltips of its min and max icons, and then uses these methods to
make the tooltips for the Stats tab Depth instance more descriptive.

See #521

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Create simple non-thread-safe "gasname()" function

Every single user of the get_gas_name() function wanted to just use the
result to create a message or printout, and that made the interface a bit
cumbersome.

This adds a "gasname()" wrapper that returns a static buffer with the
result in it, which is neither pretty nor thread-safe, but is a much
simpler interface to work with.

Our dive planning isn't multi-threaded, so nothing should care.

[ This also converts a few open-coded gasname debug printouts to use the
  helper function, resulting in prettier printouts and less code ]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove is_air() and convert its users to gasmix

Also make gasname() and get_gas_string() global functions (which allows us
to delete code elsewhere).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Convert plot_gas_value to gasmix

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Rename two C++ methods to the more typical CamelCase

Silly little change. Whatever.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix addStop to work as slot again

In order to call this as slot it needs to have defaults for all arguments.
So we need to change the gasmix into a pointer - which is actually better
as this allows to easily pass a NULL pointer when we want to continue to
use the previous gas.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Optionally strip diveplan to bare minimum

There are new check-boxes to modify the look of the diveplan in the notes.

The old behaviour appears with "verbatim display", others are shorter,
runtimes, stoplengths and transitions being optional.  Also round to full
meters and minutes to remove optical clutter.

To be done: Remember these setting in the config.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Planner: warn about high pO2

If the user entered part of the plan exceeds a pO2 of 1.6, include a
warning about that in the notes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Planner: fix typo that broke tank pressure tracking

Oops, that's embarrassing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Rewrite dive edit logic

The existing code took an odd approach. It tried to change all selected
dives whenever the user edited a field, and kept all this backup data in
case the user rejected the edits.

This code takes the opposite approach. Only edit a copy of the selected
dive and then when the user accepts it, edit all the dives and when the
user rejects the edit simply redraw the screen (as all the "real" data is
still unchanged).

This not only saves quite a bit of code, it should be much easier to get
correct.

Admitedly this code will need quite a bit more testing to make sure it
works as intended, but as far as I can tell it already gets more scenarios
right than the previous implementation.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a picture_list struct

Add a picture_list struct that will hold all the pictures relative to a
dive. Before we used to hold events for the pictures, but an event is a
much bigger struct so this will save a bit of memory, and we will also
stop to use magic flags and special treatment for pictures on the dive
profile.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add stubs for the main methods that will operate on pictures.

add, remove, get count, and picture_load_exif_data.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a FOR_EACH_PICTURE macro and the code for picture_count.

Add the FOR_EACH_PICTURE macro and the code for picture count.
This uses C99 - but I will keep it like this and wait for dirk
to scream at me.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix compilation of the Qt Concurrent code.

Forgot to add qt concurrent on the .pro file, sorry.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>