This converts the get_gas_from_events to a get_gas_at_time function that
actually maps our events to what cylinder and thus gas we are breathing
at that time.
[Dirk Hohndel: fixed to actually use the gas that was looked up
(and make things compile)]
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Get rid of unit type shortcut in planner. Also use "to" instead of "-" in ascent rate intervals.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds two changes
a) it uses rint() to make sure we don't truncate the displayed values
b) it moves the update of the displayed values into a helper function that
is also called whenever the settings change
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The values for drop_stone_mode, bottomsac, and decosac are typically the
kind of personal data specific to a diver that is unlikely to change
from one dive plan to the next.
This patch stores/restores them to/from the preferences file. For this,
it adds bottomsac and decosac to the prefs structure; drop_stone_mode
was already there, though not stored/restored.
Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- set application-wide locale from preferences
- use custom date format for display
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the code that saves and restores the dive planner
settings.
Fixes#608
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This causes all kinds of assumptions to go wrong - and it makes no sense.
Move the point to where you want it or cancel the plan.
Fixes#623
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit b0da8c2707 ("When adding a waypoint, use the gasmix of the
_next_ waypoint.") we default to air when adding a waypoint at the end of
the plan by double-clicking. That seems silly since we could instead
continue using the last gas.
I wasn't able to reproduce the "gas list disappears" problem in bug #623,
but I did get a silly air segment added which was equally wrong. Maybe I'm
lucky and this fixes the problem that Henrik sees as well...
See #623
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We signal a bailout to OC via setting the setpoint to zero. A setpoint
between 0.2 and 0 would be really wierd, but i couldn't figure out any
better way to keep the bailout deco planning.
Note:
The gas consumption of CCR dives are plain wrong, but this atleast lets
you plan your deco for a CCR bailout plan.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For the Set point spinbox, it was kinda hard just stepping by the
default 1.0, so setting it to step by 0.1 makes much more sense.
The int SpinBox got a step size parameter for consistency.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Based on Glance's idea on rewritting the Delegates, but
we don't need to redo the wheel as Qt already gives us
the correct Delegate, we just need to set some boundaries
on it before returning.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There is no reason to treat drop_stone_mode different from the rest of
the planner settings, so move it to our prefs structure.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch allows only non-negative depths in the divepoints table as
negative depths confuse the planenr/deco algortihm. The spinbox appearing
in the table should get a setMinimum(0) but I was not able to find the
correct way to implement that.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we have a dedicated dive that we use to display things, we can
simply get the information from the current dive and use it to setup said
displayed_dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was way too complicated because we used to edit a "live" dive that
was on the dive list. All we really need to do is systematically make
sure that all the widgets are in the correct state.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This corrects the logic of adding a waypoint actually meaning that
a previous segment is subdivided into two. Both new segments should
by default use the gas of the old one. Since the gas is stored
in the waypoint (divedatapoint) at the end, we need to use the _next_
gas.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add commented out options to subsurface.pro that enable debuging the planner.
Remove obsolete comment.
Clean up the selection tracking.
Force the re-sort of the divelist inside the reload instead of explicitly
calling it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the corresponding checkbox is checked the planner does interrupt
pure O2 deco after 12min for 6min on cylinder 0.
To make this work for air I removed the gasmix_is_null logic.
I guess that makes the planner feature complete for the next release.
[Dirk Hohndel: trivial merge into latest master]
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This gets rid of the stagingDive and stops the constant adding and
removing of dives from the divelist (that was an INSANE design,
seriously).
When adding or planning a dive all work is now done in the dedicated
displayed_dive.
Add dive mostly works - when the user clicks save the dive is added to the
dive list and selected.
Plan dive is mostly untested. It passed trivial "start planner, save"
testing so it's not entirely broken, but I'm sure there's more work to be
done there.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way we can safely copy around dives (specifically, copy the dive to
be displayed / edited into the displayed_dive).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes the "impossible to work with" planner with the mouse
now the dive will only grow and not shrink untill you release
the mouse.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When I moved the settings for SAC's from the planner to the plannerSettings widget
I forgot to move the corresponding methods from one class to the other.
This fixes the display of the gas consumption in the planner
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The checkbox is remembered as long as the program is still running, so
if you planned one dive with drop_stone_mode and saved/aborted and then
tried to plan another one we had a first "down" waypoint from
createSimpleDive and drop_stone_mode was also enabled.
This makes sure we don't add the first waypoint in createSimpleDive when
drop_stone_mode is enabled and lets that add a implicit first waypoint.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is my first attempt at grouping UI elements of the planner in a
sensible way.
It might still be sensible to combine the two bottom panes into one.
In addition there is a new field "altutude" which is sychronized with the
surface pressure as for planning we often know the altitude of the dive
site rather than the atmospheric pressure.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Spin boxes for pO2 are now hooked up to preference values. Adding new
cylinders (or changing their fo2) computes the MOD accordin to the current
value of decopo2. Note that chaning the limits for deco pO2 does _not_
automatically update the switch depth of all cylinders as those might have
been manually entered.
Furthermore, MOD has now to option of rounding to multiples of a given
depth. That is used for the automatic switch depth which are now always
multiples of 3m (so that EAN50 is switched to at 21m rather than 22m).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This enables so we can change the decent speed for drop like a stone
mode.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt didn't find the right function without the type there. This also gets
rid of the warning about that.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
That provides some UI elements that were recently introduced with function
of allowing the ascent rates of the planner to be configured by the user.
I tried to make it work both with senisble as well as with imperial units.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Most of my dives i plan i know it will just be full speed down a line in
the beginning and thus the planner can figure out that leg of the plan
by it self.
The config box added here isn't connected, because i saw that the other
planner boxes wasn't connected ether, so i left it in the same state as
they where.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Back in 6699e3ab ("Add print button to planner") unconditional printing
code was added. This puts that same code behind NO_PRINTING macro.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Lets just use pO₂ instead of PO2, ppO2, ppO₂, PO₂.
They all mean the same, but it's better to be
consistent
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QSpinBox is nice to see how different sac rate would affect our dive
plan.
"Hey, What would happen if I would be stressed and my sac goes up by 50%?"
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In planner mode, this replaces the globe with the dive plan and introduces
a new plannerSettingsWidget in the diveListPane. All new fields are still
disfunctional. This is WIP.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The planner has its own view of the gradient factors. So replacing those
with the ones set up for viewing dives in the preferences is wrong.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While planning we might change the gradient factors. Make sure they are
back to what's in the preferences when we're done planning.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>