Commit graph

20334 commits

Author SHA1 Message Date
Berthold Stoeger
729356e0b1 cleanup: fix typo in comment
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
742193a5e3 core: convert divesite.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
b24f37fb4f core: replace SHA1() function by SHA1_uint32()
The SHA1() helper function was only used when calculating a
SHA1 hash and taking the first four bytes of it as uint32.

Make that explicit by renaming the function into SHA1_uint32()
and directly returning an uint32_t.

Note that the usage in cochran.cpp is sketchy: it generates
a four-byte hash out of two-byte data. Why!?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
0b817e468a core: convert version.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
e3f6496f59 core: convert strtod.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
092035d883 core: simplify custom strtod() interface
The strtod_flags() function allowed for fine control of how to
parse strings. However, only two different modes were actually
used: ascii mode ("C" locale) and permissive mode (accept ","
and "." as decimal separator).

The former had already its own function name (ascii_strtod).
Make the latter a separatge function as well (permissive_strtod)
and remove all the flags rigmarole.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
628e2fe933 parser: remove int_or_float union & other small float-parsing cleanups
Owing to bitrot, this union only contained a float and therefore
is pointless. Let's remove it.

That makes the function name "integer_or_float()" non-sensical.
Call it "parse_float()" instead.

Moreover, change the output-arguments of "parse_float()" from
pointers to references, as null-pointers are not supported.

Finally, remove the "errno" check after "ascii_strtod()". As far as
I can tell, errno is not set in "ascii_strtod()" and using a global
variable for error-reporting it is an incredibly silly interface
anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Michael Keller
38a0050ac3 Export: Fix UDDF Export
Add a workaround to address a syntax error in the XSLT used to
export as UDDF.

Fixes #4275.

Signed-off-by: Michael Keller <github@ike.ch>
2024-08-12 08:42:10 +12:00
Michael Keller
793d9f20b6 Update libdivecomputer to latest on 'Subsurface-DS9'.
Signed-off-by: Michael Keller <github@ike.ch>
2024-08-04 19:56:13 +12:00
Michael Keller
009e8a32bb Fix Windows versioning as well.
Signed-off-by: Michael Keller <github@ike.ch>
2024-08-02 01:28:37 +12:00
Michael Keller
6c4bb6ddeb Fixed MacOS versioning as well.
Signed-off-by: Michael Keller <github@ike.ch>
2024-08-02 01:28:37 +12:00
Michael Keller
df4358d252 CICD: Use correct version information on pull request builds.
Use the version information detected in the manage-version action, as
the actual build is happening in the speculative post-merge branch,
resulting in a bogus 'commit distance' number.

Signed-off-by: Michael Keller <github@ike.ch>
2024-08-02 01:28:37 +12:00
Michael Keller
2b7900b68d CICD: Make Version Information SemVer Compliant.
Make the version information used throughout the application and build
process compliant with the SemVer specifications, so that it can be
processed with libraries.

Signed-off-by: Michael Keller <github@ike.ch>
2024-07-30 11:05:10 +12:00
probonopd
3c8ce37299 Reduce attack vector in artifact-links.yml
Pin action to git hash, https://blog.rafaelgss.dev/why-you-should-pin-actions-by-commit-hash

Restrict permissions for the GITHUB_TOKEN, https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

Signed-off-by: probonopd <probonopd@users.noreply.github.com>
2024-07-30 11:04:15 +12:00
Michael Keller
aadca7eeae Documentation: Remove Pointers to the Developer Mailing List.
Remove pointers to the developer mailing list from the README and
CONTRIBUTING pages, as it is no longer possible to join it due to
excessive brute force breakin attempts.
Add pointers to the user forum instead.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-07-30 11:02:25 +12:00
rmultan
b71bf0478d Add confuse to build dependencies for MacOS build
Signed-off-by: rmultan <multan.rafal.k@gmail.com>
2024-07-29 23:48:20 +12:00
rmultan
29138b98ae Fix build for android
Patch libgit2 build

Signed-off-by: rmultan <multan.rafal.k@gmail.com>
2024-07-29 23:48:20 +12:00
rmultan
ae734603b9 Fix MacOS build & update INSTALL.md
Fix build for Apple silicon Mac.
Update INSTALL.md with relevant
instructions.

Signed-off-by: rmultan <multan.rafal.k@gmail.com>
2024-07-29 23:48:20 +12:00
Michael Keller
6d43b8e334 From libdivecomputer: Add support for Mares Sirius.
Signed-off-by: Michael Keller <github@ike.ch>
2024-07-25 21:57:33 +12:00
Michael Keller
fc0a569cb6 CICD: Add Parameters to Android docker Build Script.
Add parameters to the docker build script for Android, to make it
possible to inject custom configuration when calling it from other
scripts.

Signed-off-by: Michael Keller <github@ike.ch>
2024-07-21 14:25:50 +12:00
Michael Keller
35556b9f43 Move to available MacOS runner version.
Signed-off-by: Michael Keller <github@ike.ch>
2024-07-15 11:56:01 +12:00
Michael Keller
d278461bcc Temporarily pull and use an undefined version of the AppImage tool.
Signed-off-by: Michael Keller <github@ike.ch>
2024-07-15 11:56:01 +12:00
Michael Keller
39ca2a1026 CICD: Update AppImage Workflow to Be Based on ubuntu 20.04 Image.
Update the AppImage workflow to be based on ubuntu 20.04 in order to
support the updated requirement of GitHub actions to run on node 20.

Signed-off-by: Michael Keller <github@ike.ch>
2024-07-15 11:56:01 +12:00
Michael Keller
b3ff706c5f Filtering: Usability Improvements to Filter Constraints.
Some improvements:
- for constraints where the condition is applied to any one of a list of
  items, show the condition as 'any X';
- when filtering for tags, do not include divemode as a 'tag' - this is
  hard to impossible for users to understand, and we do have a dedicated
  condition for the dive mode.

Signed-off-by: Michael Keller <github@ike.ch>
2024-07-07 12:20:31 +12:00
stevebuie
269e834546 Fix crash on mac os during download from new BLE computer
Added entry to change log for the fix.

Reported-by: Steve Buie <sbuie321@gmail.com>
Signed-off-by: Steve Buie <sbuie321@gmail.com>
2024-06-28 14:51:07 +12:00
stevebuie
8f4f8fe489 Fix crash on mac os during download from new BLE computer
Ensure that any bluetooth scan started (by changing the device name) in the
download-from-dive-computer dialog (desktop version) is stopped before the
download process is started up. Because the QT bluetooth discovery agent uses
a QTimer internally, it must be stopped from the same thread as it was started
from. The download process uses a different thread, so ends up crashing when
it tries to dispose of the timer from a different thread.

Reported-by: Steve Buie <sbuie321@gmail.com>
Signed-off-by: Steve Buie <sbuie321@gmail.com>
2024-06-28 14:51:07 +12:00
Berthold Stoeger
1b4111c1f8 tests: fix commit "work on sorted dive lists"
Commit 185b4678ff changed the parser-test to use sorted dive
lists. However, for the "new Seabear" data format test, the
sorting was done after comparison. Which is obviously silly.

Fix it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-06-21 16:51:32 +02:00
Berthold Stoeger
3257dbfc63 cleanup: remove unused function get_dive_id_closest_to()
The last caller was removed in e700920e8e.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-06-19 06:55:36 +02:00
Berthold Stoeger
185b4678ff tests: work on sorted dive lists
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>
2024-06-17 00:03:28 +02:00
Berthold Stoeger
0940ff23b9 tests: run profile test using default preferences
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>
2024-06-16 19:44:29 +02:00
Michael Keller
31fca0f676 Filter: Fix Loading of Negated Conditions from git.
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>
2024-06-15 22:49:44 +02:00
Michael Keller
b126fccb1b Desktop: Fix Inconsistencies in Handling of Salinity.
- 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>
2024-06-10 15:54:22 +12:00
Michael Keller
10fc3bfd47 Bugfix: Fix Incorrect Volumes Displayed for Tank Types.
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>
2024-06-09 11:15:59 +02:00
Berthold Stoeger
a8c9781205 cleanup: remove unused function create_and_hookup_trip_from_dive()
It seems that the last user was removed 5 years ago: ff9506b21?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-06-08 15:59:53 +02:00
Michael Keller
291ed9d7e3 Documentation: Update Information on Available Versions in README.md.
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>
2024-06-06 16:17:44 +12:00
Michael Keller
a39f0e2891 Mobile: Fix QML Warnings.
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>
2024-06-06 16:17:32 +12:00
Dirk Hohndel
d9f50bb8e0 add Ubuntu 24.04 / Noble Numbat to our builds
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-06-05 13:23:52 -07:00
Michael Keller
d1db85005b CICD: Remove Workaround for Broken ubuntu 16.04 Repository.
ATTENTION: Only merge this when CICD starts working (will need a rebase
to trigger a build).

Signed-off-by: Michael Keller <github@ike.ch>
2024-06-05 10:52:34 +12:00
Berthold Stoeger
e2d3a12555 cleanup: remove unused roles in DiveTripModelBase
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>
2024-06-05 09:16:32 +12:00
Michał Sawicz
568aeb7bce snap: drop candidate channel
Building directly into `stable` from the `current` branch.

Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-06-03 07:59:22 -07:00
Berthold Stoeger
ca5f28206b tests: make profile test work with non-C locales
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>
2024-06-03 07:41:47 +02:00
Michael Keller
adaa52bf9b Desktop: Fix Undo for Gaschanges on Manually Added Dives.
Fix the undo functionality for gaschanges edited on manually added
dives.

Pointed-out-by: @bstoeger
Signed-off-by: Michael Keller <github@ike.ch>
2024-06-02 11:38:21 +02:00
Michael Keller
692ec9ee5c Update libdivecomputer to latest on 'Subsurface-DS9'.
Signed-off-by: Michael Keller <github@ike.ch>
2024-06-02 16:33:19 +12:00
Michael Keller
c2c5faeaad Add the change for MacOS builds with Qt6 as well.
Signed-off-by: Michael Keller <github@ike.ch>
2024-06-02 09:42:14 +12:00
jme
88acef7f0f release build google maps
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>
2024-06-02 09:42:14 +12:00
Michael Keller
32cd52869b CICD: Fix the AppImage Workflow.
Work around an upstream version inconsistency by pinning the versions in
our build.

Signed-off-by: Michael Keller <github@ike.ch>
2024-06-02 01:35:29 +12:00
Berthold Stoeger
3d96642b8d smartrak: remove copy_string() that makes little sense
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-06-01 14:43:33 +02:00
Michael Keller
c5546fb52f Cleanup: Optimise String Handling.
Cleanup of the sub-optimal string handling in #4222.

Signed-off-by: Michael Keller <github@ike.ch>
2024-06-01 14:43:03 +02:00
Michael Keller
f65afaf5d2 Desktop: Fix Gas Editing for Manually Added Dives.
- 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>
2024-06-01 23:22:40 +12:00
Berthold Stoeger
9243921cbb test: fix subtle bug in testplan.cpp
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>
2024-05-31 22:50:49 +02:00