Fix enabling info widget when closing a dive

If the close action is triggered while there is no current dive (empty
history), the info widget is enabled. To avoid this behavior, we only
enable the info widget during update if the dive index is valid.

Signed-off-by: Alexandre Dupas <alexandre.dupas@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix crash when adding dive to empty dive list

Only look up the dive number of a previous dive if there is a previous
dive.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix crash when closing the data file

Only dereference the dive pointer if there actually is a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Hack to clear the date when no dive is displayed

This mostly happens with no XML file or when closing the current XML file.
Sadly the user still can click on the empty date field (even if nothing
else is active on the screen) and a date reappears.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Disable the info widget when no dive is selected

This solves the odd case when closing the data file that clicking in the
info widget caused the input fields to respond and the little warning icon
to show up.

Also some minor whitespace cleanup for readability.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Only load default file if no file is given on the command line

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix tab order for dive info edit

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't exit profile editor when hitting ESC in dive add mode

I'm sure there are more issues like this where we need to handle things
differently depending on whether we are planning a dive or adding a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Prevent nodes in planner / dive add profile edit to run past each other

I always disliked the fact that when you moved the handlers around you
could just 'run over' the neighbors. This also (as a somewhat intended
side effect) prevents vertical descents and ascents).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Whitespace fixes in dive planner

I know this may seem anal retentive... but it's driving me insane.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Support imperial measurements in dive planner / add dive

This was not as hard as I assumed it would be. I may still change the
horizontal dimension to be the more logical seconds instead of minutes,
but for now this achieves the main goal.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Correctly handle empty dive list after delete

Things need to be cleared out and disabled. But fixing this bug leaves
another issue - while the newly selected dive after a delete acts as if it
was selected, it doesn't show up as selected in the dive list.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove o2/he from plot_data and fix gas plot text

plot_data.o2 and plot_data.he was wrong for all dives, due to that
cylinderindex was set right first in populate_pressure_information, and
thus those two contained bogus information.
This makes the plot-text use cylinderindex-lookup as everything else.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Call refreshDisplay() after editing a dive

We now can change the dive date and the order of dives could have changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add "merge selected dives" to dive list popup menu

This is fairly straight forward. What I dislike is the check for the magic
number of "14 indeces". I'm sure there's a better way to tell if more than
one dive is selected...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Document MaxOSX DBUS workaround in the README

This documents the temporary workaround for the libmarblewidget (and
plugin) issues on MacOS in the README.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Much easier way to detect if more than one dive is selected

Instead of getting data from Qt just use our internal notion of the number
of selected dive to decide if more than one dive is selected (and
therefore if we need to show the 'merge dives' option in the context
menu).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Only offer to merge dives if they are consecutive in the divelist

You cannot merge dives if there is another, unselected dive "between"
them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Disable info widget when canceling 'add dive' for a first dive

One more corner case that we cover correctly.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added more wildcards to the Gitignore

Gitignore is now ignoring callgrind files and kdevelop
projects, this was annoying me.

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