aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/diveplanner.cpp
AgeCommit message (Collapse)Author
2020-10-26cleanup: fix deprecated QFlags useGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-03planner: limit depth and time of segments to sane valuesGravatar Berthold Stoeger
Using non-sensical depth and times for segments in the planner may lead to an unresponsive UI. Therefore limit depth to 1000 m/3300 ft and time to 100 h. Limiting of depth is done in settingsChanged() since it has to adapt to the user changig their preferred units. Fixes #2762. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-13Disable SAC factor setting for CCR divesGravatar Robert C. Helling
The SAC factor is only used for minimal gas calculations which don't make sense in the CCR context. Additionally, make bailout stop for at least minimum switch time or problem solving time. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-05-04Add conneciton for display variations checkboxGravatar Robert C. Helling
...this gat lost at some point. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-02-11Planner: don't filter cylindersGravatar Berthold Stoeger
In the planner we used to filter out "unused" cylinders as in the equipment tab. It is unclear whether that makes sense or can even easily be reproduced, since such cylinders have to come from an imported dive. To be on the save side, let's not do this. Replace the CylindersFilteredModel introduced recently by a plain CylindersModel. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-11Planner: make cylinder-model subobject of planner-modelGravatar Berthold Stoeger
The cylinder-model had an instance() function, but actually there were two cylinder models: one used by the equipment tab, one used by the planner. This is misleading. Therefore, remove the instance() function and make the cylinder-model a subobject of the planner-model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-11Cylinders: Add CylindersModelFilteredGravatar Berthold Stoeger
When the show_unused_cylinders flag is not set, the cylinder tables in the equipment tab and the planner should not show unused cylinders. However, the code in CylindersModel is fundamentally broken if the unused cylinders are not at the end of the list: The correct number of cylinders is shown, but not the correct cylinders. Therefore, add a higher-level CylindersModelFiltered model on top of CylindersModel that does the actual filtering. Some calls are routed through to the base model (notably those that take indexes, as these have to be mapped), for some calls the caller has to get access to the source model first. We might want to adjust this. For filtering, reuse the already existing show_cylinder function and export it via CylindersModel. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06Cleanup: don't initialize DivePlannerPointsModel at startupGravatar Berthold Stoeger
The whole point of having X::instance() functions is to solve the infamous "Static Initialization Order Fiasco": When having global objects in different translation units, their order of initialization is undefined. Thus, when these objects access each other one cannot guarantee the correct order of initialization. The X::instance() functions generate the objects on first use. DivePlannerPointsModel has such an instance() function. However, for convenience(?) in diveplanner.cpp we find the global variable static DivePlannerPointsModel* plannerModel = DivePlannerPointsModel::instance(); Thus, the DivePlannerPointsModel constructor is run before main(), negating the whole purpose of the instance() function. Let's remove this line to avoid hard-to-debug startup issues. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04Cleanup: remove capture-all lambda clausesGravatar Berthold Stoeger
These were forgotten the last time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04Cleanup: rename plannerShared to PlannerSharedGravatar Berthold Stoeger
Usually, we use PascalCase (i.e. camelCase with a capital letter at the start) for class names. For consistency, let's do it here as well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31Remove plannerShared::instance()Gravatar Berthold Stoeger
This class contains only static functions (i.e. it does not contain any state). There does not seem to be a reason to have an instance of that class. Therefore, remove the instance() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-25diveplanner: add surface_segment to plannersharedGravatar jan Iversen
Add surface_segment to plannerShared and then update desktop-widgets. Signed-off-by: jan Iversen <jan@casacondor.com> desktop-widgets: use plannerShared for surface_segment Change getter/setter for surface_segment to plannerShared, in order to share the conversion with mobile diveplanner Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25dive planner: correct bottomsac/decosac calc.Gravatar jan Iversen
Move conversion cuft <-> liter from desktop-widget/diveplanner.cpp to plannerShared, to facilitate the same results in mobile diveplanner Use Backend for bottomsac/decosac and update to check for switch LITER <-> CUFT Add bottomsac/decosac to QMLinterface. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25mobile-widgets: correct error in connectGravatar jan Iversen
connect to set_o2narcotics missed an & but the compiler did not complain (which it usually does). Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25diveplanner: call planner model directly for simple variables.Gravatar jan Iversen
Variables without conversion, do not need to pass plannerShared (due to the QML interface). Simple variables do not pass plannerShared, but diveplanner in desktop-widgets and qmlinterface in mobile-widgets call the implementation directly. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-24mobile: move dive planner notes access to pure interfaceGravatar jan Iversen
Make notes rates available to QML through the Backend interface. Remove the corresponding variables from plannerShared. Getters are from prefs. while setters are linked to diveplan model. Remark: signals from qPrefDivePlanner is used, because the diveplanner model sets qPrefDivePlanner but do not issue special signals. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20qt-models: add suffix Display to unit system aware asc/desc settersGravatar jan Iversen
Change ascent/descent setter function names to set_<name>Display to show the value is prepared for displaying (common for desktop and QML). Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20desktop-widgets: use set/get asc/desc rates in diveplannermodelGravatar jan Iversen
The spinboxes are already connected to diveplannermodel set_ functions, remove second connect to plannerShared. Change get functions to use diveplannermodel. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-07desktop-widgets: add comment why last SIGNAL/SLOT is not convertedGravatar jan Iversen
The last SIGNAL/SLOT cannot be converted due to a limitation in the new connect() syntax, it does not "understand" default parameters. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07desktop-widgets: replace connect() for CylindersModel.Gravatar jan Iversen
Replace SIGNAL/SLOT in favor of new connect() Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07desktop-widgets: replace connect() with parameter double.Gravatar jan Iversen
Replace SIGNAL() with QOverload<double>::of() to allow new connect syntax. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07desktop-widgets: convert last simple connect().Gravatar jan Iversen
Convert the last convert() statements, that can be converted just by changing the syntax. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07desktop-widgets: correct connect for QShortcutGravatar jan Iversen
Replace syntax for connect of QShortcut. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07desktop-widgets: correct QDateTime connect()Gravatar jan Iversen
Change connect() to new syntax for QDataTime. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07desktop-widgets: change rebreathermode to use new connect()Gravatar jan Iversen
Replace SIGNAL/SLOT with QOverload. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: change connect() for triggered(bool)Gravatar jan Iversen
Change connect for QAction::triggered(bool) to new syntax. Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: change connect() for valueChange(int)Gravatar jan Iversen
Change connect for QSpinBox::valueChange(int) to new syntax. Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: change connect() for clicked/accepted/rejectedGravatar jan Iversen
Change connect for QAbstractButton::clickedto new syntax. Change connect for QDialogButtonBox::accepted/rejected to new syntax. Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: remove double connect.Gravatar jan Iversen
No need to connect ui.display_variations to the same signal/slot twice. Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: change connect() to new type for toogledGravatar jan Iversen
Change connect for QAbstractButton::toogled to new syntax. Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: correct typeGravatar jan Iversen
correct SLOT was sec_bottomsac(double), which is not reported as an error. correct to set_bottomsac(double) Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: correct set_min_switch_duration connect.Gravatar jan Iversen
correct SLOT was set_min_swich_duration()(int), which is not reported as an error. Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: set_bailout -> set_dobailoutGravatar jan Iversen
correct name mistake in connect() Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: set_verbatim_plan should go through plannerShared.Gravatar jan Iversen
Adjust connect() to use plannerShared, avoiding parameter convert problem. Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: remove use of QSignalMapper.Gravatar jan Iversen
QSignalMapper gives a warning that it is depreciated, and the doc. states that using a lambda function is more efficient. Replace use of QSignalMapper. Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06desktop-widgets: replace QSignalMapper for set_deco_modeGravatar jan Iversen
QSignalMapper had a parameter convert problem, when mapping to set_deco_mode in plannerShared. Use lambda function in connect to avoid parameter convert problem. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-26plannerShared: replace notes variables to plannerSharedGravatar jan Iversen
Replace display_runtime display_duration display_transitions verbatim_plan display_variations Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26desktop-widgets: replace variables to plannerSharedGravatar jan Iversen
Use plannerShared setter to update the variables in qPref. This will also signal the cylindermodel to calculate a new bestmix. variables: bottompo2 decopo2 bestmixend Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26desktop-widgets: replace o2narcotic from plannerModel to plannerSharedGravatar jan Iversen
Use plannerShared setter to update o2narcotic. This will also signal the cylindermodel to calculate a new bestmix. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26desktop-widgets: replace variables from plannerModel to plannerSharedGravatar jan Iversen
variables bottomsac decosac problemsolvingtime sacfactor are not set in diveplanner.cpp, but instead signals a slot in plannerModel. change signals to slots in plannerShared Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26desktop-widgets: replace var plannerModel -> plannerShared convertedGravatar jan Iversen
variables min_switch_duration are not set in diveplanner.cpp, but instead signals a slot in plannerModel. and are read from plannerShared which includes a conversion change signals to slots in plannerShared change read from prefs. to plannerShared Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26desktop-widgets: replace vars. qPrefDivePlanner -> plannerSharedGravatar jan Iversen
change local doo2breaks to plannerShared and update connect. change signals to slots in plannerShared Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26desktop-widgets: replace variables from plannerModel to plannerSharedGravatar jan Iversen
variables drop_stone_mode, last_stop, switch_at_req_stop are not set in diveplanner.cpp, but instead signals a slot in plannerModel. change signals to slots in plannerShared Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26desktop-widgets: replace vars. qPrefDivePlanner -> plannerSharedGravatar jan Iversen
change local setBailout to plannerShared and update connect. change signals to slots in plannerShared Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26desktop-widgets: replace variables from plannerModel to plannerSharedGravatar jan Iversen
planner_deco_mode is not set in diveplanner.cpp, but instead signals a slot in plannerModel. reserve_gas is not set in diveplanner.cpp, but instead signals a slot in plannerModel. change signals to slots in plannerShared Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24build-system: move plannerShared to backend-sharedGravatar jan Iversen
WARNING: multi directory commit, needed to secure it builds. move the core/plannerShared.* to backend-shared. update CMakeLists.txt to include backend-shared lib in link process. update ios project to reflect new directory Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24diveplanner: desktop, remove no longer used slotsGravatar jan Iversen
Remove PlannerSettingsWidget slots, that are directed to plannerShared Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24diveplanner: desktop, connect signals direct to plannerSharedGravatar jan Iversen
Connect the signals for ascent/descent directly to plannerShared Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24desktop-widgets: use share meter/feet funcs. in diveplannerGravatar jan Iversen
change the settings variables using UNIT_FACTOR to use plannerShared instead. There are no changed functionality, it is simply removing calculations from the UI. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-05Desktop: don't connect to remove() slot of model from TableModelGravatar Berthold Stoeger
When connecting a model to the TableModel class, it would connect clicking on an item to the remove() slot of the model. This breaks the program flow implied by the undo code: Ui --> Undo-Command --> Model --> UI Moreover, the naming of the remove() slot is illogical, because clicks can also have different effects, as for example in the cylinder-table. Therefore, move the connect() call from TableModel to the callers. In the case of TabDiveSite, move the remove() function from the model to the TabWidget, where it makes more sense. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>