Added ( finally ) the code to reduce depth on the planner

Added the code to reduce depth on the planner. Depth
cannot be lower than 40m and it also won't let the
user reduce if there's any point on the 'reduced' area.
the icon is ugly - we need an artist.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added button to reduce dive time on the planner.

Added a button and a method to reduce time on the dive
planner. The dive planner will not reduce below deco-time
and it will also not reduce below TIME_INITIAL_MAX.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Removed unused code.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added the current gas used on the planner

Added the current gas used on the planner, now it's a matter
of choosing the new gas, that will be done in the next commit.e

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Good code cleanup.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added a missing #UNDEF

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added the possibility to choose gases  in the planner.

Added the possibility to choose gases in the planner,
now the user should click on the name of the gas, a
popup window will appear, asking the user to choose
what gas he wants for that ascent / descent.

now we need to hook that up with the createDecoStops
method that calculates the decompression.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fix crash in DiveComputerList::addDC() when importing from DM4.

DiveComputerList::getExact() created a temporary QList with the
DiveComputerNodes matching a specific model. A pointer to a node in the
list was returned, which becomes invalid when the list goes out of scope
and gets destroyed. Causing a crash when the model strings are compared
later.

Instead of using contains() and creating a temporary list, we can just
use an iterator, which should be both faster and safer.

The crash is easy to trigger with DM4 imports, but can probably be
triggered in other cases too.

Similar problem with DiveComputerList::get().

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Support more than one event of the same type in Qt tooltip.

Since the tooltip text was used as key in the map, two events of the
same type, close to eachother, would cause one of them to not be
removed.

Since ToolTip::removeToolTip() isn't used, we don't need a QMap and can
use a QList instead, so all tooltips are properly cleared.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix " begin" and " end" for events in plot.

QObject::tr() has source string as first argument and disambiguation as
second argument. Currently the events shows "Starts with space!" instead
of " begin" or " end" after the event name.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Print: improve table printing by using QTableView

The current QTextDocument implementation is slow due to
HTML parsing. By using QTableView with QAbstractTableModel
we boost the performance of the table print drastically.
This patch completely replaces the old solution.

There is a hidden QTableView widget which is populated
with all data and rendered using a QPainter attached to
the printer device.

A couple of new classes are added in models.h/cpp
that handle the table print model and these are then used
in printlayout.h/cpp.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Clean up code to remove false messages about errors in Eclipse

Imported the subsurface project into Eclipse to try and pull apart
how it all works together. Added an include for profile.h and some
brackets around a condition, but didn't make any functional changes
(I hope). These 2 changes should be purely cosmetic.

Signed-off-by: Benjamin Fogel <benjaminfogel@yahoo.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Delte the temporary dive from the divelist after calculating deco.

This bug manifested itself as too long deco obligation when moving
waypoints to later and then back to earlier times as all intermedite
versions were created as dives in the divelist (and the saturation of
these "previous dives" was taken into account.

It is not entirely clear to me how the dive will be permanently added to
the divelist once ok is pressed: One could in createDecoStops allocate
struct dive from the heap rather than from the stack and return a pointer
to it and which is then added to the dive list upon pressing ok.

[Dirk Hohndel: add include file to make this compile]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Crude hack to stop the build from failing without asciidoc

This could be made much more elegant. For now it serves its purpose.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
ifdef out includes when we build without gtk

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use maxx from graphics context for time calculation.

Fixes #128.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>