When switching to / from plan mode, we switch to show either the dive plan
detail widget, or the dive list widget.
So far this widget does nothing. This just makes sure it's there.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Staring at the stack trace it seems that it gets into an infinite
recursion when trying to recalculate after being alerted to a change on
the ruler. I cannot recreate this here (not on Linux, not on Mac), but
here's a random attempt to prevent the issue: simply refuse to recalculate
the ruler while in Add or Plan mode.
Crude, but might show us if this really is the issue. Otherwise it's easy
enough to revert this change. The qDebug() in there should tell us if
people on a Mac do indeed see this even without moving the ruler around in
Add or Plan mode.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Otherwise the change to the Cylinder widget would trigger a recreation of
the dive in an inconsistent state.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was introduced in commit fc13361079 ("Don't crash if we try to save
a empty plan") - but it doesn't seem to make any sense. It is perfectly
reasonable for the diveplan to have no datapoints at this spot - we are
just about to call createTemporaryPlan() which will fill those datapoints
from the mode.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The planner would offer an text-editor if the user double
clicked it's remove column. forbidding that.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Besides not deleting them, we shouldn't offer the icon for it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch forbids deletion of the Deco Stop from the
QTableView that holds the model.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We need to create them, even if we don't display ( only because it
was a pain to correctly track them from the model ) - so, hide them
if it's not entered by mouse, but a deco one.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When switching from PLAN or ADD mode to PROFILE, we
kept the dive handlers visible, not anymore.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way we avoid trying to create a dive from the plan while the plan
references the cylinder that has just been changed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is a little bigger than I usually prefer, but it's all
somewhat interconnected.
- we pass around the cylinders throughout the planning process and as we
create the plan we calculate the gas consumption in every segment and
track this both in the end pressure of the cylinder and over time in
the samples
- because of that we no longer try to calculate the gas consumption after
being done planning; we just use what we calculated along the way
- we also no longer add gases during the planning process - all gases
have to come from the list of cylinders passed in (which makes sense
as we should only use those gases that the user added in the UI or
inherited from a the selected dive (when starting to plan with a dive
already selected)
With this patch I think we are close do being able to move all of the
planning logic back into the planner.c code where it belongs. The one
issue that still bothers me is that we are juggling so many dive
structures and then keep copying content around. It seems like we should
be able to reduce that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Make the infobox invisible in planner (it really doesn't provide a lot of
useful info while planning a dive and more likely gets in the way).
Make the calculated ceiling always visible in planner and add mode.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Exporting the raw dive list into JSON format for later viewing with html
and js files. Also some worldmap code organizations.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't want to do this when calling plan() from createTemporaryPlan() -
we only want to record the dive at the end of createPlan().
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of even trying to keep one around (which then could cause all
kinds of trouble) we now always delete it at the end of the planner.
So simply always recreate one when starting the planner (and make sure
that the staging dive has always been cleared out, first).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we first ADD a dive and then PLAN a dive, stagingDive first was an
alias to the current_dive (for ADD) - we need to make sure that when PLAN
is started, a new dive is allocated.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the stagingDive is just an alias for the current_dive (as it is in dive
ADD mode), there's no need to copy the cylinders; they are already there.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch correctly sets the state of the planner to "NOTHING"
after trying to edit a manually added dive.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch removes some inconsistencies that were happening on the add
dive / cancel actions. a bit of legacy code from the old system was still
in, which made things quite... EXPLOSIVE.
This fixes restoring the selection only if we have a selection and not
deleting the temporary dive twice.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Moved the connections between DivePlannerPointsModel and
MainWindow from inside the Planner class to the MainWindow.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If there was no current dive we didn't set up any cylinder at all which
was a bit awkward as we use AIR but have no cylinder corresponding to it,
which breaks assumptions elsewhere.
Instead we use either the default cylinder or make one up.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Duh. We had to reload the list (and make sure the internal data structures
are recreated as well) before restoring the selection.
I also switched to simply accessing the widget directly, instead of via
the dive_list() call.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There is still something seriously wrong here.
For now let's just not restore the selection and at least this prevents us
from crashing. But I still don't understand why it crashes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Looping over the individual dives will be very slow if there are many of
them, as the profile will try to render each of them in succession.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
for some reason the next selected dive is NULL after cancelling the
plan. I'm investigating.
This patch fixes the show of the empty profile and it also untangles
some parts of the code, keeping the mainwindow where it should belong
: the mainwindow.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This only partially works. If I start from an empty dive list, plan a
dive, then abort, there are still leftovers in the profile widget.
Hitting Ctrl-W clears that out. But it just runs the same cleanUpEmpty()
again...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On an empty dive list we would remember the new dive (which gets
auto-selected since it's the only dive) and then crash when we try to
restore that selection after cancel (in which case that new dive is gone).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We need to reset the editMode right away, otherwise all the changes to the
input field (when resetting the data after the user cancels) will cause
Subsurface to crash as current_dive will temporarily be NULL.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old way manually implemented a parser, where it could simply call a
regexp (or, in my case, a QChar) that will split the QString into many, to
find the beginning and end of the strings on the tags.
This patch also fixes a Qt5 off-by-one bug on the tag Visualization.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I'm sure canceling the plan when saving an added dive made sense at some
point for some reason. Right now it makes things crash, so let's not do
it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We were making things way too hard (and were doing things that don't need
doing, like clearing the DivePlanPointModel).
Currently we still crash after manually adding a dive or when canceling
a plan.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This still crashes when canceling the plan.
And doesn't display the correct dive profile until you switch to a
different dive and back.
And Keyboard focus is wrong.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As Tomaz suggested, I don't need to pass the information whether we are on
the planner into the function - it's part of the DivePlannerPointsModel
and therefore already knows.
Also, we want to make sure we actually use the gas that's in the first
cylidner of the staging dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This still crashes when you abort the plan.
And when you accept the plan, the profile stays stuck in PLAN mode.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The existing code had no chance of every working - on so many levels.
First unselect all dives, then extract data from a selected dive?
Set up the cylinder data (which didn't work), and then clear the data
again?
What the heck.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch paints the dive red if the user is breaking ceiling
on the planner - it's quite fast, it analizes the depth over the
max(tissue_1 .. tissue_16) and changes the color of the profile.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes the movements from the lines when added / removed
SO much better.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added a flag to only recalculate the axis when needed.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>