aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/diveplanner.cpp
AgeCommit message (Collapse)Author
2019-05-17Implement height-to-pressure functions in plannerGravatar willemferguson
The units.h file has two functions to convert atm pressure to mbar and also to convert mbar to atm pressure. Implement these two functions in the planner. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-03-29Add UI element for final surface segment in plannerGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-01-13Planner: Add checkbox to force OC bailoutGravatar Robert C. Helling
This adds a checkbox for rebreather modes of the planner that force the ascent to be in OC mode. Before, one had to add a one minute last segment with the mode change but this is not practical when manually searching for the maximal bottom time given gas reserves. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-09-11core/settings: change bestmixend to int, to allow qml to workGravatar jan Iversen
depth_t is a good struct in C, but bad in QML. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-29Revert "desktop-widgets: remove QSettings from desktop-widgets"Gravatar Dirk Hohndel
This reverts commit 321a920a9873a3828a24c1b28cf8eb5fe1bff2cb. It appears that the load_xxx functions aren't called, so while the correct values are stored to the settings, they aren't retrieved. Let's revert while this gets fixed. Fixes #1609 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-25desktop-widgets: remove QSettings from desktop-widgetsGravatar jan Iversen
The variables referenced are moved into qPref in earlier commits so in general all QSettings calls are replaced by qPref*:: calls Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-15desktop-widget: remove SettingsObjectWrapper and update qPref callsGravatar jan Iversen
remove use of SettingsObjectWrapper:: remove include of SettingsObjectWrapper.h use qPrefFoo:: for setters and getters replace prefs.foo with qPrefXYZ::foo() where feasible (this expands to the same code, but gives us more control over the variable). Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08core: activate qPrefDivePlannerGravatar jan Iversen
remove DivePlanner from SettingsObjectWrapper and reference qPrefDivePlanner update files using SettingsObjectWrapper/DivePlanner to use qPrefDivePlanner this activated qPrefDivePlanner and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-13Code cleanup in diveplanner.cppGravatar Stefan Fuchs
Move a variable declaration and added some initialization. Added missing spaces. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-07-04Translations: unify gettextFromC::tr() and QObject::tr()Gravatar Berthold Stoeger
There were two catch-all classes for translations outside of class context. gettextFromC was used exclusively from C, but C++ used both, gettextFromC and QObject. Some of the string were even present in both. Therefore, unify to gettextFromC throughout the code base. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-18Change from gettextFromC::instance()->tr() to gettextFromC::tr();Gravatar Stefan Fuchs
Code cleanup. Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-06-18Use correct "tr" call for translating dive mode namesGravatar Stefan Fuchs
Correctly use gettextFromC::instance()->tr(); instead of a simple tr(); to translate the dive mode names. This goes on top of 0bc9edf855caf95e2d58ccaf704ceeda079e06f1 and finally makes the whole thing work. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-06-17Fix an error around translation of dive modes in the UIGravatar Stefan Fuchs
This fixes an mistake introduced in 3d1072f8862e4c329dc2678df52a24137b8d4704 Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-06-04Cleanup: fold core/helpers.h into core/qthelper.hGravatar Berthold Stoeger
helpers.h included qthelper.h and all functions declared in helpers.h were defined in qthelper.h. Therefore fold the former into the latter, since the split seems completely arbitrary. While doing so, change the return-type of get_dc_nichname from "const QString" to "QString". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-28Distinguish between user and internal divemode namesGravatar Robert C. Helling
The former should be translated but not those that go to xml/git. ... and fix capitalization of pSCR. Suggested-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Planner: Add combo box for dive mode selectionGravatar Robert C. Helling
I am not really sure what I am doing here but I copied code from the gas selection. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-03-02Choose water presets from a qcombobox in planner, custom value possibleGravatar Oliver Schwaneberg
Add a combo box for water types with defaults for fresh water, sea water and the EN 13319. All values taken from units.h, where EN 13319 was added beforehand. Custom values can be entered through a spinbox. Also changed "Salinity" in TapDiveInformation.ui to "Water type". Translation required! Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2017-12-30Reenable pressure interpolation in context menuGravatar Robert C. Helling
This fixes a bug reported by Willem that removing waypoints using the right click context menu makes the cylinder pressure lines partly disappear. The reason was that clicking a dive handler disables the pressure interpolation (and other things, controlled by shouldCalculateMaxdepth). This is turned on again upon the mouse release event. This event is not triggered when selecting in item from the context menu (like remove waypoint or gas selection) so we need to send it manually. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-24Simplify update of gflow and gfhigh values in the codeGravatar Stefan Fuchs
The more complex handling is no longer needed because: - Keyboard tracking for gfhigh/low UI fields was switched off here: 030c094854aeab4aaade523d7126728d9ce98a5b - GFhigh was limited to 40 here: 53fffe0ce3696de33ce4657e20d295e4a43e0fd9 Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01Disable plan variation in recreational modeGravatar Rick Walsh
Calculating variations when in recreational mode doesn't make sense, and can prevent variations from being calculated when switching back to Buhlmann or VPM-B modes. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-11-25Planner UI improvements: Enable/disable optionsGravatar Stefan Fuchs
Don't accidentally enable o2breaks option when entering planner in RECREATIONAL mode. Disable also label for min_switch_duration according to dive mode. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-04Disable o2 break option if last stop is not at 6m/20ftGravatar Stefan Fuchs
Disable the possibility to plan o2 breaks of option "last stop at 6m/20ft" is not set. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-04In planner for different deco modes enable/disable options correctlyGravatar Stefan Fuchs
Disable option "safety stop" for all deco modes other than "recreational". Disable also labels "reserve gas", "GF ..." and "VPM conservatism" correctly. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16Correctly name member function gasChange of DivePlannerPointsModelGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-07Remove disfunctional asc. rate signals and add disable keyboardTrackingGravatar Robert C. Helling
The connection wasn't working anyway since the signal comes without value while the slot wanted a value and thus only created a runtime warning. Turning of keyboard tracking means that when typing the number 123 the value change signal is not fired three times (with values 1, 12, and 123) but is only fired upon pressing enter or the spin box losing focus. We should add a similar setting to the depth, duration and runtime columns of the DivePlannerPointsModel but i have no clue how to do that. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-04Planner settings ascend and descende rate: Wire up UI elements correctlyGravatar Stefan Fuchs
Wire up the UI elements (QSpinBoxes) for ascend rates (4x) and descend rate (1x) correctly so that the profile and calculation is updated immediately after the value is changed (e.g. increased/decresed by 1) by clicking the QSpinBox arrows. Until now one had to click into the profile or change another planner preference first before the change became effective. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-09-20Add a checkbox to turn off plan variationsGravatar Robert C. Helling
... as those come with a performance penalty Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-27Random whitespace cleanupGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29Add SPDX header to desktop widgetsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-20Preserve dive mode when planning a diveGravatar Jan Mulder
Data such as cilinders and used gasses are populated fromn the currently selected dive when starting the planner. It is more logical to use the dive mode (OC, CCR, pSCR) of the currently selected dive as well. This commits changes this. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-24Fix double to int truncation in C++ codeGravatar Jeremie Guichard
Wfloat-conversion enabled for C++ part of the code Fix warnings raised by the flag using lrint Original issue reported on the mailing list: The ascent/descent rates are sometimes not what is expected. E.g. setting the ascent rate to 10m/min results in an actual ascent rate of 9m/min. This is due to truncating the ascent rate preference, then effectively rounding up the time to reach each stop to 2s intervals. The result being that setting the ascent rate to 10m/min results in 20s to ascend 3m (9m/min), when it should be exactly 18s. Reported-by: John Smith <noseygit@hotmail.com> Reported-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-11Merge branch 'master' of https://github.com/dje29/subsurfaceGravatar Dirk Hohndel
2017-03-11Add tooltip for add cylinder button in plannerGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-11Make depth conversion work for negative depthsGravatar Robert C. Helling
This is needed in the altitude pressure conversion as there negative altitudes are possible (for diving in the netherlands or the Dead Sea). Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-11Disable minimum gas calculation for recreational modeGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-11Minimum gas calculation - Calculations and UI parametersGravatar Stefan Fuchs
Add minimum gas calculation to planner output. Add the two UI parameters prefs.sacfactor and prefs.problemsolvingtime. Connect UI signals and slots for recalculation of diveplan. Disable minimum gas calculation if there was already a warning before. If minimum gas result is larger then cylinder start pressure give warning message instead of result. Add line break before pO2 warnings but only if warnings exist. Signed-off-by: Joachim Ritter <jritter@bitsenke.de> Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-08Change calls to rint into lrint avoiding conversion warningsGravatar Jeremie Guichard
Using gcc option "-Wfloat-conversion" is useful to catch potential conversion errors (where lrint should be used). rint returns double and still raises the same warning, this is why this change updates all rint calls to lrint. In few places, where input type is a float, corresponding lrinf is used. Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-07Enable bottom pO2 option also for recreational dives in plannerGravatar Stefan Fuchs
Bottom pO2 gas option in planner should be always enabled because also recreational dives can use nitrox and produce "high pO2" warnings. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-21Fixes cylinder table headers not translatedGravatar Jan Mulder
The cylinder table was constructed very ealy from the contructor of the planner, so early that the tr() functions are not registered. This fix instantiates the cylinderModel from the maintab (as it is done with, for example, the weightsModel) and lets the planner user this instantiated (and proper translating) cylinderModel. Fixes: #206 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-02-14Update altitude limits on unit changeGravatar Anton Lundin
The limits set in diveplanner.ui is intended for the unit set there, meters. If we move between units we need to update the limits to. This fixes #201 Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-06Rename prefs.deco_mode to prefs.planner_deco_modeGravatar Robert C. Helling
This is to avoid confusion with planner.display_deco_mode. When accessing the "current deco mode" use the decoMode() helper function. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-12-26Set surface pressure and salinity correctly when replanningGravatar Robert C. Helling
We need to initialize the UI elements accordingly. Fixes #1094 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-27Planner: connect emitDataChanged slot to ascent/descent rate editingFinishedGravatar Rick Walsh
Call the emitDataChanged slot when ascent and descent rate spinboxes lose focus. Without this connection, rates are not updated immediately after editing the value with keyboard numbers and hitting tab or enter. It is necessary to keep the valueChanged(int) connections, because editingFinished() is not triggered by changing the value with the arrows. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24Separate VPM-B conservatism preference for planner and profileGravatar Rick Walsh
Separate the VPM-B conservatism preference into diveplan.vpmb_conservatism for planning dives and prefs.vpmb_conservatism for profile ceiling display of saved dives. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24Rename conservatism_level to vpmb_conservatismGravatar Rick Walsh
Make the variable purpose less ambiguous Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Use the Settings to store the plannersettingsGravatar Tomaz Canabrava
Instead of settings things manually in the code. (btw, if we use lambdas the code can be quite smaller) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Organize the connect calls per object.Gravatar Tomaz Canabrava
Just to make it easy on the eyes. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Move preferences sync / initializationGravatar Tomaz Canabrava
Move Preferences sync / initialization out of the planner widget prerferences to the ObjectWrapper. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09Planner: update cylinder mixes and MND and MOD when prefs are changedGravatar Rick Walsh
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09Add function to calculate gas maximum narcotic depthGravatar Rick Walsh
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>