This changes the divedatapoints and functions that deal with them.
It changes plan_add_segment(), create_dp(), gasToStr(), and tankInUse() to
consume gasmix instead of o2/he.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is step one of many to use gasmix instead of int o2/he.
Right now some of these changes look ridiculous because after changing a
few lines we immediately go back to o2 = get_o2(gas). The reason is that I
wanted to convert a hand full of functions at a time. So in this commit I
only change validate_gas(), get_gas_from_events() and get_gasidx() to use
a struct gasmix instead of int o2, int he.
This state builds and survived some mild testing. Let's continue on top of
that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead calculate this information on the fly, taking into account all
dive computers on the dive in questions.
There is one wrinkle to this - previously we abused the '.used' member to
make sure that a manually added cylinder didn't disappear the moment it
was added (think of the workflow: you add a cylinder, then you add a gas
change to that cylinder -> right after you add it it is unused and would
not be shown).
I am thinking that we might have to add the "manually_added" property to
the properties that we store in XML / git.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This reverts commit 7d42b53bba.
With the addition of the dive plan details widget we no longer want to
show the deco points in the dive planner points table.
Conflicts:
qt-ui/diveplanner.cpp
We want the disclaimer in the final dive that can be printed, but it's
distracting when shown while planning the dive.
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>
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>
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>
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>
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>
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>
Allow to both create the full default dive or ownly the descent and bottom
part (so the planner can deal with the ascent).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This correctly enables the planner on the new profile,
but it doesn't triggers the correct paint on the canvas.
[Dirk Hohndel: remove other remnants of the disabled planner as well]
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Gas consumption calculation fixed. Pressure difference still needs cylinder size to be set.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We use mod calculations on multiple places, so make a separate helper
from it with proper types.
The "clumsiness" of defining a local variable to pass into the function
and out from it comes from the discrepancies in how c and c++ handles
initializations of variables in a struct.
Thanks goes to Tiago and Linus for pointing me in the right direction.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[Dirk Hohndel: combined two commits into one and cleaned up some
whitespace issues]
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code removed was already ported to the New Profile.
We managed to clean quite a bit. huhhy
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The new profile code handles the resizing of the profile area in order to
accomodate the depth and time of the dive much more intuitively - the old
manual buttons to do so are no longer needed.
This also removes a few other unused methods.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code is not ported to the new profile, but from what I
can understand from it, it doesn't need to be. The purpose
of this code was to setup the correct colors and strings
for the current mouse position, we already do this on the
Profile in a different way, on the Notification Area.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit makes the planner actually work. There ar still
a few edges, but oh, joy - the new Profile gave a very unexpected
and nice addition to it - Grab the last handler of the initial
dive, and move it to the right, or get any handler, and move it
to the bottom to see what I mean.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a itemChange method, that emits a 'changed'
signal when the handler is moved. I'll use that signal on
the profile to call the correct method.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
All code that was removed already is working on the New Profile,
The code that's behind #if 0 means that it still needs to be ported and
because of some removal, it was not possible to keep it compiling (mostly
the removal of the Ruler class, that is the Axis, on the new profile).
The rest of the code that's untouched - most probably will keep that way.
The DivePlannerPointsModel is correct and well done, no need to change
that, only the Graphics part.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
But it doesn't move the handlers yet, and when you confirm it you also
must click on the dive to select it or the profile will show garbage.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A signal can connect to another signal, so I removed a slot that had the
sole purpose to call another signal and replaced that with a direct call.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>