aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2021-04-02planner: set profile to planner state in main windowGravatar Berthold Stoeger
Remove mainwindow-access from the planner, by setting the profile to planner state in the owner of the profile, viz. the MainWindow. The MainWindow sets the application state to planner, so it seems legit that it also sets the profile state. This removes a further interdependency. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02desktop: remove check for editMode in maintabGravatar Berthold Stoeger
The accept / reject message is only shown in edit-mode, no need to check it. This is a step in simplification / removal of the edit mode. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02profile: display arbitrary diveGravatar Berthold Stoeger
So far the profile operated on the global displayed_dive. Instead, take the dive to be displayed as a parameter to the plotDive() functions. This is necessary if we want to have multiple concurrent profile objects. Think for example for printing or for mobile where multiple dive objects are active at the same time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02profile: don't check for stepping past maximum time / depthGravatar Berthold Stoeger
When moving a planner point with the cursor, nothing is wrong with extending the dive time by stepping beyond the current maximum. Same for depth. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02profile: fix logic in keyDeleteAction()Gravatar Berthold Stoeger
The code took care to not delete planner-points when no points are selected. However, it assumed that all selected objects are planner-points. But then it checked whether the selected object actually is a planner-point. So which is it? Remove the outter check for an empty selection. This makes things more logical and more robust, should there ever be other objects that can be selected. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02planner: remove displayed_dive from DivePlannerModelGravatar Berthold Stoeger
To remove global state, make the dive that DivePlannerModel works on a member variable. Pass the dive in createSimpleDive() and loadFromDive(). Moreover, this should pave the way to more fine-grained undo in the planner. Ultimately, the planner should not be modal. Attention: for now, the dive must still be displayed_dive, because of the convoluted way in which the profile and the planner work on the same dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02planner: move clearing of model into loadFromDive() functionGravatar Berthold Stoeger
Both loadFromDive() callers were clearing the model before calling loadFromDive(). Move the clearing into that function since it makes no sense to load into a non-cleared model. Apparently this changes the way that no-cylinder dives are treated and the code in ProfileWidget2::repositionDiveHandlers() must now explicitly check for that condition. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02cleanup: remove pointless cylinder model updateGravatar Berthold Stoeger
In DivePlannerPointsModel::clear(), the cylinder model is updated before it is cleared. This must be an artifact. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02planner: move same-time check to DivePlannerPointsModelGravatar Berthold Stoeger
There must not be two dive planner points at the same time stamp, as this violates the laws of physics (and internal assumptions). The corresponding test was done in the profile code at two different places with floating point arithmetics. This is a bad idea, because 1) code duplication 2) danger of rounding issues Instead, do this in one central point in the planner model and use integer arithmetics. Simply add a few seconds until a unique timestamp is obtained. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02profile: remove special casing of handle movingGravatar Berthold Stoeger
When moving the handle with the mouse, the old code tried to be smart about changing the active handle when crossing handles. To me this always felt weird and it was inconsistent with mouse-move. Theregore, simply do nothing special at all. The user should hopefully get an intiutive grasp of what's going on when moving one handler across another. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02profile: pass DivePlannerPointsModel at construction timeGravatar Berthold Stoeger
This model is only needed when in plan mode. To enable multiple profilewidgets at the same time (e.g. for the mobile app or for printing), make the pointer to DivePlannerPointsModel a member variable that is initialized at construction time. Moreover, allow passing null as the DivePlannerPointsModel, in which case planning will be disabled. This will be useful for simple printing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02profile: connect to DivePointsPlannerModel in separate functionGravatar Berthold Stoeger
The connection to the DivePointsPlannerModel was done in two distinct functions: setAddState() and setPlanState(), which means that these could easily get out-of-sync. Factor this out into a single function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02planner: implement move semantics in DivePlannerPointsModelGravatar Berthold Stoeger
When reordering the points, the DivePlannerPointsModel would not emit the appropriate move signals, but simply a data-changed signal over all elements. This obviously violates Qt's model/view API, though it is probably harmless. Let's do the right thing so that the frontend knows that the selected item changed place. Also, emit dataChanged only on the actually changed element, not all elements. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02profile: implement proper model/view semantics in ProfileWidget2Gravatar Berthold Stoeger
The ProfileWidget2 slots, which reacted to model changes were broken. They did not add / remove items at the changed positions, but arbitrarily at the end. Moreover, they assumed that only a single item was added / removed and thus violated the model/view API. This worked because the handles are completely reset after each operation and the model only ever touched single items. Nevertheless, this has to be fixed if we ever want finer grained undo. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02profile use unique_ptr to manage dive handler objectsGravatar Berthold Stoeger
Instead of manually deleting them (and the gases). Currently there is only one point where these are deleted, but if we implement proper Qt model/view semantics, this makes things less headachy. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02planner: fix removal of points from DivePlannerPointsModelGravatar Berthold Stoeger
The beginRemoveRows() function was fed erroneous values. It is a mystery why this didn't crash. In any case, deletion of multiple points did not work properly. Instead of trying to be fancy, remove each point one-by-one. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02planner: insert point at correct positionGravatar Berthold Stoeger
Instead of inserting the point at the calculated position, the DivePlannerPointsModel would append it at the end and then resort the vector. That's just silly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02cleanup: use proper model/view semantics in DivePlannerModelGravatar Berthold Stoeger
When clearing the model, use "beginResetModel/endResetModel" instead of "beginRemoveRows/endRemoveRows". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02cleanup: add DivePlannerPointsModel::addDefaultStop() functionGravatar Berthold Stoeger
When clicking on "+" in the planner, a default stop point was added using a signal/slot connection. This used the archaic string-based connect syntax, because it was realized with default parameters passed to "addStop()". Instead, add a "addDefaultStop()" slot, which passes the default parameters. Since all other callers do not use callbacks, unslotify "addStop()". The slot was the only user of the default parameters, so they can be removed alltogether. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02cleanup: constify DivePlannerPoints model accessor functionsGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02planner: unslotify two functions in DivePlannerPointsModelGravatar Berthold Stoeger
There are a few more candidates, but these conceptually really shouldn't be slots. getSurfacePressure() is an accessor and loadFromDive() initializes the model with a dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02printing: use sensible font-size in profilesGravatar Berthold Stoeger
The font-size in printed profiles is based on the size of the profile in the main window. This makes no sense. Why should changing the window size change the font-size on printouts? Matter of fact, when making shrinking the height of the window to its minimum, comical printouts are obtained (font way too big). Therefore use an arbitrary rule: Say that profiles 600 pixels high look reasonable and then scale up to the actual size on the printout. This may need some tweaking for high-DPI mode. But that seems not to be supported on desktop anyway? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-31mobile/user-manual: update date and versionv5.0.1Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-31Update translations from TransifexGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-31prepare for 5.0.1Gravatar Dirk Hohndel
Update README and ReleaseNotes. Also remove outdated workflow badge, add a couple new one, and hack around a rendering issue where the last character of longer workflow names gets overwritten by the status - which resulted in the arguably most important info (which Qt version) being hidden. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-31profile: fix color on pressure-itemGravatar Berthold Stoeger
The "in_planner" condition was inadvertently inverted in c6d78bc134 and therefore the wrong data was used to draw the line (density instead of SAC). Revert to original. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-31build-system: make ASAN builds easierGravatar Dirk Hohndel
This is a bit lacking sophistication (you need to remember to make clean before rebuilding when changing this option, etc), but it works well enough for my purpuses. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-31core: initialize dive selection after resetting the dataGravatar Berthold Stoeger
The dive selection was initialized during data-reset. However, this emitted a signal before all data-reset routines were run. Ultimately, this led to access-after-free in the statistics code. Instead, move the select_newest_visible_dive() signal from the divelist-model to the process_loaded_dives() function. There is no point in initializing the selection if the dive data is cleared after all. This change broke closing of the log, because the UI-selection was not reset. Therefore, when clearing the data, clear the selection before proceeding with clearing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-31stats: fix visibility check of the statistics tab on desktopGravatar Berthold Stoeger
Apparently, the visibility flag of the view is not inherited from the statistics widget. Therefore, the statistics is redrawn on every action even if not visible. Set the visibility explicitly in the show- and hide-events. This is crazy. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-24tests: fix incorrect relative path namesv5.0.0Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-24Add test for profile in VPMB modeGravatar Robert C. Helling
For some reason, this test seems not to run effectively, at least locally, I had to update the reference file. Added a check that indeed the file to be compared was successfully opened. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-03-24planner: fix deco calculationGravatar Berthold Stoeger
In 9bfc6d252, testing of the planner was changed to use the planner_ds parameter instead of a global variable. Unfortunately, two conditionals were inverted, leading to an erroneous ceiling calculation when in the planner. Restore the proper conditions. Moreover, instead of testing the planner_ds parameter, use the already existing in_planner flag, which is derived from said parameter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-24prepare for Subsurface 5.0 / Subsurface-mobile 3.2 releaseGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-24mobile: update version to 3.2.0Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-24Update Supported Divecomputers listGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-24Update translations from TransifexGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-24User manual: Create new cylinder typeGravatar willemferguson
Adds text and 5 images, detailing how to create a new cylinder type. This appears to be a perrenial problem, often appearing on the mail list. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-12Use PSCR gas when computing O2 toxicityGravatar Robert C. Helling
Both the calculations for CNS and OTU did not take into account the pO2 drop when using a PSCR. Furthermore, there was some unit confusion due to not using internal units. Reported-by: arosl Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-03-12Use QtBluetooth enums from their namespaceGravatar Andreas Buhr
For increased type safety, some enums have been changed to scoped enums in Qt 6.2, see https://codereview.qt-project.org/c/qt/qtconnectivity/+/337069 https://codereview.qt-project.org/c/qt/qtconnectivity/+/336678 This patch adapts subsurface to this change. Since C++11, enums inject their symbols in both their own and their parent namespace, so this patch can be merged right now. Signed-off-by: Andreas Buhr <andreas.buhr@qt.io>
2021-03-11documentation: gentle nudge back to standardized US-EnglishGravatar Dirk Hohndel
Just changing the two user manuals. This also includes a couple other spell fixes as well as one small adjustment regardinf IrDA support on Linux (which has been gone for a while now). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-11Update to desktop user manualGravatar willemferguson
Add section dealing with statistics restricted graphing. Add section dealing with lack of IrDA support on new OSs Do spell check of complete text. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2021-03-08parser: initialize picture variableGravatar Berthold Stoeger
When parsing "event 123" (?) a picture is added, without initializing the picture structure. Thus, a picture with a random gps location is added. Use the "empty_picture" initializer to avoid that. Fixes a Coverity warning. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-08stats: initialize InformationBox::width and height membersGravatar Berthold Stoeger
Fixes a Coverity warning. Good style anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-05statistics: don't divide by totalCount = 0 in pie chartsGravatar Berthold Stoeger
This silences a Coverity warning. In principle, this should never happen, since there are no slices if totalCount is 0. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-05profile: initialize DiveEventItem::dive to nullGravatar Berthold Stoeger
To simplify debugging, this should be initialized. Found by coverity. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-05stats: initialize PieSeries::radius to 0 in constructorGravatar Berthold Stoeger
This silences a Coverity warning. That what harmless, but it's probably good practice to initialize all members. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-03-01[gha] simplify LXD handlingGravatar Michał Sawicz
2021-03-01Max ceiling precisionGravatar Robert C. Helling
We used to round the ceilings for the individual tissues with %.1f but the maximal (and thus effective) ceiling only with %.0f. This makes no sense or be rounded up (to the conservative side). This commit shows also the maximal ceiling with higher accuracy. Reported-by: Peter Hübner Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-02-26[snap] use setup-lxd actionGravatar Michał Sawicz
The Snapcraft action unnecessarily tries to migrate things. Signed-off-by: Michał Sawicz <michal@sawicz.net>
2021-02-26Get O2 right in bailout modeGravatar Robert C. Helling
When doing OC bailout from a CCR dive, there could still be pO2 sensor readings but those are not valid. This fixes a problem noticed by Justin Ashworth. Signed-off-by: Robert C. Helling <helling@atdotde.de>