aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.h
AgeCommit message (Collapse)Author
2014-11-12Support different salinity in plannerGravatar Anton Lundin
Depth is often mentioned in a length unit, but what we care about is pressure. When diving in fresh water the pressure is lower than the same depth in salt water. This adds support for using different salinities in planning. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04Offer to save to a copy in replan modeGravatar Robert C. Helling
When replannig a dive, offer another button that creates a new dive rather than overwriting the old. This should help in creating several versions of a planned dive (longer/shorter, deeper/shallower etc). Note that this makes dives that start at the same time not influcence each other's deco. Also, only the first of a row of simultaneous dives contributes to the tissue loadings of later dives. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19Planner: correctly free divedatapointsGravatar Dirk Hohndel
Simply setting the pointer to NULL leaks memory. And that C++ recursive two function implementation... oh boy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19Planner: bring sanity to the SAC rate handlingGravatar Dirk Hohndel
The old implementation was... let's call it creative. This tries to actually get things right instead of using magic. Don't pretend that double values are ints. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05Don't recalculate plan automatically with low GFHighGravatar Dirk Hohndel
While it's nice to have immediate response to gradient factor changes, there is an oddity that very low GFHigh values can cause infinite decompression if the last stop is at 6m. Robert fixed this and now errors out of deco after 48 hours, but if the user simply wants to edit their GFHigh from (for example) 75 to 70 and deletes the '5', we really don't want to trigger a recalculation for GFHigh of 7... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-03Update altitude properly when changing unit systemsGravatar Robert C. Helling
We need to change the displayed numeric value of the altitutde and not just the unit suffix when changing unit systems. Fixes #681 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17Planner: correctly deal with units in Ascent/descent ratesGravatar Dirk Hohndel
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>
2014-07-15Save and restore Dive Planner SettingsGravatar Tomaz Canabrava
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>
2014-07-09Move drop_stone_mode setting to prefsGravatar Anton Lundin
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>
2014-07-06UI restructure: remove the backupDive we no longer needGravatar Dirk Hohndel
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>
2014-07-03Planner: Add backgas breaksGravatar Robert C. Helling
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>
2014-07-03UI restructure: use displayed_dive for add dive and plan diveGravatar Dirk Hohndel
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>
2014-06-30Only replot the dive if maxDepth > oldMaxDepth on plan / add mode.Gravatar Tomaz Canabrava
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>
2014-06-29Fixed SAC in plannerGravatar Robert C. Helling
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>
2014-06-28Planner: implement sane way to set the start time of the planned diveGravatar Dirk Hohndel
This uses the same widgets we use on the maintab. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-26Headers cleanup.Gravatar Tomaz Canabrava
Too much noise on the headers, this commit remove uneeded headers when they are uneeded. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-26Rearrange planner UI elementsGravatar Robert Helling
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>
2014-06-25Make pO2 settings functional in plannerGravatar Robert C. Helling
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>
2014-06-25Hook up UI elements for ascent rates to plannerGravatar Robert C. Helling
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>
2014-06-24Drop like a stone mode in plannerGravatar Anton Lundin
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>
2014-06-20planner: Switch to QSpinBox for SACGravatar Anton Lundin
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>
2014-06-12Planner: New plannerSettingsWidgetGravatar Robert C. Helling
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>
2014-06-04Planner: don't redo the plan after partial edits of GFlow/highGravatar Dirk Hohndel
In most cases this wouldn't really matter, but when planning very deep or very long dive with corresponding very long deco times, calculating the deco takes long enough to make this notable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03Add print button to plannerGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-02Optionally strip diveplan to bare minimumGravatar Robert C. Helling
There are new check-boxes to modify the look of the diveplan in the notes. The old behaviour appears with "verbatim display", others are shorter, runtimes, stoplengths and transitions being optional. Also round to full meters and minutes to remove optical clutter. To be done: Remember these setting in the config. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-02Fix addStop to work as slot againGravatar Dirk Hohndel
In order to call this as slot it needs to have defaults for all arguments. So we need to change the gasmix into a pointer - which is actually better as this allows to easily pass a NULL pointer when we want to continue to use the previous gas. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Convert plot_gas_value to gasmixGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01More conversions to gasmixGravatar Dirk Hohndel
addStop, addGas and createSimpleDive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Next step to using gasmix instead of o2/heGravatar Dirk Hohndel
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>
2014-05-31Revert "Show the calculated deco stops in the planner table"Gravatar Dirk Hohndel
This reverts commit 7d42b53bba235894668ed1f2da3f5d17cd97b9c5. 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
2014-05-29Show the calculated deco stops in the planner tableGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Planner: set up a cylinder, even if no current dive is selectedGravatar Dirk Hohndel
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>
2014-05-27Planner: use the gas in the first cylinder for initial planGravatar Dirk Hohndel
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>
2014-05-26Planner: Don't include the ascent in the default diveGravatar Dirk Hohndel
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>
2014-05-24Remove leftovers from the planner.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Port the KeyPress actions to the new profile.Gravatar Tomaz Canabrava
[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>
2014-05-24Remove a ton of code.Gravatar Tomaz Canabrava
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>
2014-05-24Remove the depth / time increase and decrease functions.Gravatar Tomaz Canabrava
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>
2014-05-24Remove unused code.Gravatar Tomaz Canabrava
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>
2014-05-24Remove code already ported to the new profile.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Make the planner actually work.Gravatar Tomaz Canabrava
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>
2014-05-24Change how the handler handlers itself.Gravatar Tomaz Canabrava
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>
2014-05-22Gratuitous whitespace changesGravatar Dirk Hohndel
I keep trying to get to consistenct. Completely hopeless. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Good code cleanup on the old DivePlanner code.Gravatar Tomaz Canabrava
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>
2014-05-22Profile now correctly displays the planned dive.Gravatar Tomaz Canabrava
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>
2014-05-22Code Cleanup: connections can be made between signals.Gravatar Tomaz Canabrava
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>
2014-05-08When starting the planner, copy cylinders from currently selected dive.Gravatar Robert C. Helling
This way, the user can save dives containing sets of "standard cylinders". Selecting one of those prepopulates the gas list for the planner. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Planner: Change when we recalculate decoGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17Fixed mismatched connectionsGravatar Lakshman
Fixed connections to call drawProfile() in diveplanner whenever cylinder table widget is edited. Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17Improvement for various bits of the plannerGravatar Robert Helling
Rewrite of the actual planner logic. Now ascend to the next potential stop depth. There the state is cached and we try to ascend to the next stop depth. If we hit the ceiling while doing that we go back to the cached state and wait there for a minute. Then we try again. Then loop. Converted all depth related variables from unsigned int to int. During planning, in a time step the current depth can temporarily be negative and comparisons of a negative int with an unsigned it have not the result I expected ( (int) -2 < (unsigned int) 3 turns out to be false). And we don’t really need the 32nd bit that unsigned buys us for depths. Deco stops are now shown in the same table as manually entered stops in boldface (I removed the second table to save screen estate). The gas shown in the table is still misleading as it means the gas used on the segment leading up to that event. The update of the profile only works partially upon changes in the list of available gases. Treatment of various gases is basically there but needs some more love. The ascent velocity is now provided by a function that takes the current depth as argument. Currently it always returns 10m/min but that will later be variable (and hopefully user configurable). The profile is not redrawn while deco is computed (avoiding an infinite recursion). The table got a new column for the duration of a segment while the old “duration” column was renamed “Runtime” to reflect what it actually shows. Currently, only the run time but not the duration are editable. All deco gases are used from the depth where their pO2 is 1.4bar. This should become more flexible. Calculation of the pressure drop in cylinders without configured volumes is suppressed. This solves a problem with the planner crashing when saving a dive where not all cylinders had been manually given a volume. [Short rant break: Treating 0/0 as air bites back at so many places. E.g. Cylinder data is initialized with memsetting the whole structures to 0. Then later suddenly this totally unconfigured cylinder is being treated as it would contain air. Maybe at some point this was a feature. But it lead to a naughty bug which took me over an hour to resolve. We should seriously reconsider this choice and better move to 209/0 being air if changing this everywhere is not too much trouble] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>