The dive list will be changed to an always-sorted list where one can
use binary search.
However, this makes some tests fail, because they only use parse_dive(),
which doesn't do any sorting.
To fix this future problem, sort the tables before performing the tests.
This provides a more realistic setup, as in the actual application,
the dive list will always be sorted on import.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
As noted in a comment introduced in fe074ccad1, the profile test
should probably best be run using the default preferences. This
wasn't done back then, because the reference data assumes a (bogus)
setting of modO2 of 0.
This commit runs the test using the default preferences and updates
the reference data accordingly.
This is in preparation of changes to the preference system, where
the preference structure initializes itself to the default values.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Fix loading of the negation of filter conditions. Unlike other
conditions that are persisted as `<key>="<value>"`, this is persisted
to git as `negate`.
This fix remediates this for all cases where the condition has already
been saved to the cloud storage.
Saving to XML takes a different approach and indicates negated
conditions with `negate="1"`, making it identical to all other
attributes. The question is if this approach should be implemented in
addition to the above fix, in order to unify the storage format.
Fixes#4246.
Signed-off-by: Michael Keller <github@ike.ch>
- add correct setting of the water type drop down for the dive shown
initially after program start;
- change salinity to have 3 decimals in planner, to make it consistency
with the log.
Fixes#4240.
Reported-by: @ccsieh
Signed-off-by: Michael Keller <github@ike.ch>
Fix an issue introduced in #4148.
Essentially the refactoring missed the fact that in the imperial system
tank size is tracked as the free gas volume, but in the metric system
(which is the one used in most of Subsurface's calculations) tank size
is tracked as water capacity.
So when updating a tank template tracking imperial measurements, the
given (metric) volume in l has to be multiplied by the working pressure,
and vice versa.
This also combines all the logic dealing with `tank_info` data in one
place, hopefully making it less likely that this will be broken by
inconsistencies in the future.
Fixes#4239.
Signed-off-by: Michael Keller <github@ike.ch>
Update the information on the available versions of Subsurface in
README.
Also update the documentation to reflect the renaming of `INSTALL` to
`INSTALL.md`.
Signed-off-by: Michael Keller <github@ike.ch>
Fix some runtime warnings when running the mobile build caused by
binding loops and deprecated handler syntax.
Signed-off-by: Michael Keller <mikeller@042.ch>
The roles DIVE_IDX and SELECTED_ROLE were used for the old selection
system and removed in b8e7a600d2.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
For reasons unknown to me, the profile test is executed with a
weird locale, resulting in wrong formatting.
By setting the locale manually to "C", the tests start to work.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
After the Mac QT upgrade to 5.15.13 google maps stopped working because a debug plugin was built and not deployed. This changes forces a release build. It may or may not be the best alternative, but if nothing else it's a starting point for discussion with people who know more about qmake than I do.
Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
- show the correct gasmix in the profile;
- make gases available for gas switches in the profile after they have
been added;
- persist gas changes;
- add air as a default gas when adding a dive.
This still has problems when undoing a gas switch - instead of
completely removing the gas switch it is just moved to the next point in the
profile.
Signed-off-by: Michael Keller <github@ike.ch>
testplan.cpp had a subtle bug since converting from a fixed-size
cylinder table to a dynamic cylinder table.
As noted in equipment.h, pointers to cylinders are *not* stable
when the cylinder table grows. Therefore, a construct such as
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
can give dangling cyl0 and cyl1 pointers. This was not an issue
with the old table code, since it had a rather liberal allocation
pattern. However, when switching to std::vector<>, the problem
becomes active.
To "fix" this, simply access the highest index first. Of course,
this should never be done in real code! Therefore, add a
comment at each instance.
Quickly checked all other get_or_create_cylinder() calls and
they seemed to be safe.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Add the gas description to the label on pressure graphs to disambiguate
if multiple identical gasmixes are shown.
Also move the label to the right, where the end pressures will typically
be more spread out than the starting pressures.
Signed-off-by: Michael Keller <mikeller@042.ch>
logfile_name was converted to std::string. Assigning a strdup()ed
string to it will leak memory.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The last use of these functions was removed in ae299d5e66.
And that's a good thing, because snprintf-style interfaces
make zero sense in times of variable-length character
encodings.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
A long standing issue: the dives_to_add, etc. tables need to be
manually freed. This kind of problem wouldn't arise with proper
C++ data structures.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
- standardise the naming;
- use it consistently;
- apply the 'samples < 50' only when putting manually added dives into
edit mode - everywhere else manually added dives should be treated as
such;
- do not show a warning before editing a manually added dive in planner.
Signed-off-by: Michael Keller <github@ike.ch>
Remove the workflow for building an ubuntu 14.04 Docker image. This is
no longer needed since the AppImage is now built on 16.04.
Signed-off-by: Michael Keller <github@ike.ch>
Improve the warning shown to the user when closing the application wile
in the planner. We now allow the user to directly discard the planned
dive, save it into the dive log, or cancel the operation altogether.
If they save into the dive log, or if they modified the dive log before
starting the planner, a second warning about the unsaved dive log
changes will be shown.
Signed-off-by: Michael Keller <mikeller@042.ch>
Suppress errors in the 'Add Artifact Comment' workflow if there are no
artifacts produced by the pull request workflow - this gets rid of
follow-on error messages when a pull request workflow encounters a build
error.
Signed-off-by: Michael Keller <mikeller@042.ch>
Error introduced in da7ea17b66: the INFO() and ERROR() macros
pass stdout instead of the format string as first parameter
to report_error(). Ooooops. How did this ever pass the
compile tests!?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>