Compare commits

...

1349 Commits

Author SHA1 Message Date
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 b8e7a600d2d2a30f7e0646fc164ab6e57fd4782f.

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
Michael Keller
d27451979d Profile: Add Gas Description to Disambiguate.
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>
2024-05-31 22:50:09 +02:00
Berthold Stoeger
e7d486982f core: remove put_format_loc()
This was replaced by C++ functions in ae299d5e663c.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-05-31 18:55:47 +02:00
Michael Keller
5b941ea34e Mobile: Fix Build Warnings.
Fix build warnings from building functions not used in the mobile
version.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-30 11:54:51 +02:00
Michael Keller
56f1e7027f Documentation: Update INSTALL and Convert it to Markdown.
Update the instructions for the Windows build and convert the file to
markdown.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-30 14:22:16 +12:00
Berthold Stoeger
64d4de4a1b fix memory leak
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>
2024-05-29 10:03:41 +12:00
Berthold Stoeger
e39b42df53 cleanup: remove disfunct add_cloned_weightsystem_at()
Clearly, a development artifact.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-05-29 09:33:23 +12:00
Berthold Stoeger
398cc2b639 cleanup: remove localized snprintf() functions
The last use of these functions was removed in ae299d5e663c.

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>
2024-05-29 09:33:23 +12:00
Berthold Stoeger
2776a2fe48 import: fix memory leak when importing dives
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>
2024-05-27 20:11:37 +12:00
Michael Keller
1aa5438b2d Cleanup: Improve the Use of 'Planned dive' and 'Manually added dive'.
- 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>
2024-05-25 20:13:45 +02:00
=Michael Keller
ecc6f64d10 Cleanup: Improve Connection Handling in Profile.
- improve naming;
- remove unneeded disconnects.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-25 16:31:04 +02:00
=Michael Keller
8c14fb971c Update livdivecomputer to latest on 'Subsurface-DS9'.
Signed-off-by: Michael Keller <github@ike.ch>
2024-05-25 08:54:53 +12:00
Dirk Hohndel
6bdfee080d Merge remote-tracking branch 'origin/translations_translations-subsurface-source-ts--master_de_DE' 2024-05-21 08:04:37 -07:00
Dirk Hohndel
21269183bf Merge remote-tracking branch 'origin/translations_translations-subsurface-source-ts--master_pt_PT' 2024-05-21 08:04:17 -07:00
=Michael Keller
245f8002a8 CICD: Remove Workflow to Build ubuntu 14.04 Docker Image.
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>
2024-05-20 09:56:01 +12:00
=Michael Keller
c3d807802d Desktop: Fix Finding Reported by Coverity.
Signed-off-by: Michael Keller <github@ike.ch>
2024-05-18 14:07:15 +02:00
Michael Keller
a66bdb1bf5 Planner: Improve Exit Warning.
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>
2024-05-17 16:44:04 +12:00
Michael Keller
b579342639 Cleanup: Remove 'context' Reference from Logging Defines.
Remove the reference to `context` from the defines used for logging, as
this is not used.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-16 16:39:48 +02:00
Michael Keller
888704e816 CICD: Have the Artifact Comment Workflow Suppress 'No Artifacts' Errors.
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>
2024-05-15 13:29:25 +12:00
Berthold Stoeger
6880937838 core: fix INFO() and ERROR() macros in core/serial_ftdi.cpp
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>
2024-05-15 09:19:05 +12:00
Michael Keller
d018b72dab CICD: Fix Signing of Android CICD Built Packages.
Fix the signing of Android .apk packages when they are build in CICD.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-14 15:21:05 +12:00
Michael Keller
b3d6920de4 CICD: Remove Environment Dumping in Artifact Comment Workflow.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-14 13:36:26 +12:00
Michael Keller
912badadd4 CICD: Restrict Artifact Comment Workflow to only Run on Pull Requests.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-14 13:35:12 +12:00
Michael Keller
1c0fe2fa1f Fix GitHub Workflow definition.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-14 12:53:10 +12:00
Michael Keller
48ef4b3a01 CICD: Debug GitHub Workflow Webhook
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-14 12:06:51 +12:00
Michael Keller
22082bd60a CICD: Fix Coverity Scan Workflow.
Change the ordering of steps so that git is installed before the
checkout is performed.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-14 10:57:04 +12:00
Michael Keller
be1b80ea8a CICD: Fix the AppImage Workflow.
Fix the workflow by removing the dependency on node 20, which is not
supported in Ubuntu 16.04.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-13 14:54:49 +12:00
Michael Keller
e81b42d533 Add environment variable required to be able to use the GitHub CLI.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-13 12:55:09 +12:00
Michael Keller
dd50ab0106 Fix incorrect script references.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-13 12:39:09 +12:00
Michael Keller
0d6b572a9f Fix script permissions.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-13 12:32:07 +12:00
Michael Keller
21f64134b7 Fix custom action YML.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-13 12:17:13 +12:00
Michael Keller
7bf40d659c Fix custom action.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-13 12:13:41 +12:00
Michael Keller
6ae2844f24 CICD: Fixup Merge Build Workflows on master.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-13 11:07:05 +12:00
Michael Keller
447f9709f7 CICD: Fixup Merge Build Workflows on master.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-13 10:46:33 +12:00
=Michael Keller
4ae6c0bbc4 CICD: Add Workflow to Pin the Generated Artifacts.
Signed-off-by: Michael Keller <github@ike.ch>
2024-05-13 10:19:59 +12:00
=Michael Keller
6fc8310705 CICD: Improve Workflows.
Make multiple improvements to the existing workflows:
- create a shared custom action to deal with version number tracking
  and generation;
- use this action to add the branch name to the version for pull
  request builds;
- create a shared workflow for all debian-ish builds to avoid re-use
  by copy / paste;
- remove potential security risks by eliminating the use of
  pre-evaluated expressions (`${{ ... }}`) inside scripts;
- update outdated GitHub action versions;
- improve the consistency by renaming scripts acording to have a `.sh`
  extension;
- improve naming of generated artefacts for pull requests to include
  the correct version.

@dirkh: Unfortunately this is potentially going to break builds when it is
merged, as there is no good way to 'test' a merge build short of
merging.
We'll just have to deal with the fallout of it in a follow-up pull
request.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-13 10:19:59 +12:00
Berthold Stoeger
e20ec9248c core: fix leak when clearing dive log
46cf2fc0867 fixed a bug where clearing of a divelog, such as the one
used for import, would erase dives in the global(!) divelog.

However, the new code used the function clear_dive_table(), which
only cleared the table without unregistering the dives. In particular,
the dives were not removed from the trips, which means that the trips
were not free()d.

This reinstates the old code, but now passes a divelog paremeter
to delete_single_dive() instead of accessing the global divelog.
Moreover, delete dives from the back to avoid unnecessary
copying.

An alternative and definitely simpler solution might be to just
add a "clear_trip_table()" after "clear_dive_table()".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-05-13 08:58:03 +12:00
Berthold Stoeger
8769b1232e planner: initialize currCombo.ignoreSelection
I am not sure what this does, but it should be initialized before
it is tested.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-05-12 13:23:21 +02:00
Berthold Stoeger
d061a54e3d planner: fix gas selection
The lambda that created the list of gases took a copy not a
reference of the planned dive. Of course, that never had its
gases updated. Ultimately this would crash, because this sent
an index of "-1" on change.

Fix by
1) Using a reference to the dive, not the copy
2) Catch an invalid "-1" index (by Michael Keller <github@ike.ch>)

Fixes #4188

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-05-12 13:23:21 +02:00
=Michael Keller
306dad575c CICD: Update the AppImage Build to Use ubuntu 16.04.
Update the linux AppImage build to use ubuntu 16.04, and simplify it to
a single workflow running on a vanilla docker image.

This still uses the upload-artifact@v3 Action that will be EOL in
November 2024, because v4 relies on node 20 which has an unmet glibc
dependency in ubuntu 16.04. But this workflow can be updated to run on
ubuntu 18.04 by a simple search / replace and disabling some 16.04
specific PPAs.

@dirkh, @probonopd: I have moved this here from #4183 to be able to
review and discuss it without the noise of the workflow cleanup.

The workflow now also publishes the AppImage as an artifact on pull
request builds, available under Checks / Details / Summary.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-12 13:52:12 +12:00
Michael Keller
331d6712c6 CICD: Move MacOS / iOS Build Qt Resources into GitHub.
Move the Qt resources required for the build for MacOS and iOS into
GitHub, into their own repositories. This removes the need to publish
them on an external file server and download them from there for every
build.
It will also make it easier for contributors to update these resources
if needed.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-12 10:19:24 +12:00
Michael Keller
f4e61aa5dc Import: Make Directory Selectable when Importing .fit Files.
In the 'Download from dive computer' dialogue, make it possible to
select the source directory for the import.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-11 12:52:05 +12:00
Michael Keller
528532572f Planner: Fix Editing of Plans in Multi-Divecomputer Dives.
Currently editing of planned dives that have been merged with actual
(logged) dives only works if the 'Planned dive' divecomputer is the
first divecomputer, and this divecomputer is selected when clicking
'Edit planned dive'. In other cases the profile of the first
divecomputer is overlaid with the profile of the planned dive, and the
first divecomputer's profile is overwritten when saving the dive plan.
Fix this problem.

Triggered by @SeppoTakalo's comment (https://github.com/subsurface/subsurface/issues/1913#issuecomment-2075562119): Users don't like that planned dives show up as their own entries in the dive list, so being able to merge them with the actual dive after it has been executed is a good feature - but this wasn't working well until now.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-11 12:51:45 +12:00
=Michael Keller
a83349015a CICD: Improve the GitHub Actions for Linux.
Do a few things:
- add a build for Debian trixie (as discussed in #4182);
- add a build for Ubuntu 24.04;
- rename the build definitions to match the build names;
- update the artifact uploads to use a non-deprecated version of the
  action, and name the artifact appropriately;
- remove a stale workflow file.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-11 12:51:33 +12:00
=Michael Keller
8627f6fc4a Desktop: Add Auto-sizing to the Extra Info Table.
Add auto-sizing to the extra info table - resize the columns so that all
rows are shown in full whenever the data is updated.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-08 08:26:56 -07:00
Michael Keller
5bad522390 Update livdivecomputer to latest on 'Subsurface-DS9'.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-08 12:34:31 +12:00
Richard Fuchs
edb771e8e6 uemis-downloader: convert strings to std::string
Convert some C-style strings in uemis-downloader.cpp to std::string.
This has the side effect of fixing builds on Debian Trixie, which
currently fail with the (rather silly) error:

/build/subsurface-beta-202405060411/core/uemis-downloader.cpp: In function 'char* build_ans_path(const char*, int)':
/build/subsurface-beta-202405060411/core/uemis-downloader.cpp:290:32: error: '%s' directive output between 0 and 12 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=]
  290 |         snprintf(buf, len, "%s/%s", path, name);
      |                                ^~
......
  529 |         ans_path = build_filename(intermediate, fl);
      |                                                 ~~
cc1plus: some warnings being treated as errors

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2024-05-07 22:34:00 +12:00
=Michael Keller
17d83acdab Documentation: Add Instructions for Using Qt 5.15.13 on MacOS.
Add instructions for using Qt 5.15.13 on MacOS, which seems to have
better support for Apple silicon.`

Provided-by: jme <32236882+notrege@users.noreply.github.com>
Signed-off-by: Michael Keller <github@ike.ch>
2024-05-07 18:43:26 +12:00
=Michael Keller
133354d51d CICD: Update Qt Version Used in the MacOS Build to 5.15.13.
Update the version of Qt that is used in the CICD build for MacOS to
5.15.13. This version is showing promise for building binaries that work
on Apple silicon.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-07 18:43:26 +12:00
Michael Keller
46cf2fc086 Import: Fix Application Hang when Cancelling the Download Dialogue.
Fix a bug causing the 'Download from dive computer' dialogue to hang
when the user attempts to cancel the dialogue after successfully
downloading one or more dives.

Fixes #4176.

Signed-off-by: Michael Keller <github@ike.ch>
2024-05-05 19:15:26 +02:00
Michael Keller
5ac1922d84 Cleanup: Improve (Android) Build Scripts.
Add a script for building the Android APK in the docker container.
Also make some improvements to the Windows build scripts, and update the
documentation for both builds.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-05-06 00:45:51 +12:00
Michael Keller
3153a139b3 Update livdivecomputer to latest on 'Subsurface-DS9'.
Signed-off-by: Michael Keller <github@ike.ch>
2024-05-04 01:41:51 +12:00
Michael Keller
e65c7cedc8 Refactoring: Improve Naming of FRACTION and SIGNED_FRAC defines.
Make it more obvious that the FRACTION and SIGNED_FRAC defines return a
tuple / triplet of values.

Fixes https://github.com/subsurface/subsurface/pull/4171#discussion_r1585941133

Complained-about-by: @bstoeger
Signed-off-by: Michael Keller <github@ike.ch>
2024-05-02 20:36:26 +02:00
Berthold Stoeger
32a08735c3 profile: fix string formating in profile.cpp
ae299d5e663cd672d1114c3fe90cf026b9ab463e introduced a format-
string bug by splitting a format-string in two and splitting
the arguments at the wrong place.

The compiler doesn't warn in this case, because the format-
string is passed through translate(...).

This should have crashed, but for some reason didn't, at least
on Linux.

Fix the arguments.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-05-01 20:39:59 +12:00
Michael Keller
af6caa6fa2 Import: Improve Error Logging.
Add logging of the libdivecomputer return code for errors. Also, switch
logging of errors in the background thread to callback based logging to
make it visible.

Signed-off-by: Michael Keller <github@ike.ch>
2024-04-30 12:26:18 +12:00
Michael Keller
f3c7dcf9c9 Desktop: Fix 'planned' and 'logged' Filters.
Fix the filters for planned (i.e. has at least one dive plan attached)
and logged (i.e. has at least one dive computer log attached) dives.
Also refactor the respective functions for improved readability.

Signed-off-by: Michael Keller <github@ike.ch>
2024-04-30 12:25:31 +12:00
Michael Keller
bb00a9728f Cleanup: More Fixes for Problems Reported by Coverity.
Fix the problem another way as Coverity was still not happy with it.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-04-28 23:44:16 +12:00
Michael Keller
a2cd621819 Update livdivecomputer to latest on 'Subsurface-DS9'.
Signed-off-by: Michael Keller <github@ike.ch>
2024-04-28 18:52:19 +12:00
Michael Keller
d92777a3ff Packaging: Cleanup Windows Build Scripts.
Do some housekeeping and cleanup on the build scripts for Windows:
- remove Windows 32bit builds as support for this has been removed from
  the mxe container;
- fix some warnings in the smtk2ssrf installer configuration;
- sanitise the output colour of the smtk2ssrf build script;
- add a docker based build script for the Windows installers;
- remove outdated and deprecated documentation and scripts.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-04-26 07:42:59 -07:00
jme
e09a134a3f Delete desktop-widgets/preferences/preferences_dc.ui
Remove preferences "Dive Download" window.    Delete all dive computers no longer needed now that they can be deleted on the import window.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-26 08:14:16 +12:00
jme
aecb4f5005 Delete desktop-widgets/preferences/preferences_dc.h
Remove preferences "Dive Download" window.    Delete all dive computers no longer needed now that they can be deleted on the import window.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-26 08:14:16 +12:00
jme
358b9186bf Delete desktop-widgets/preferences/preferences_dc.cpp
Remove preferences "Dive Download" window.    Delete all dive computers no longer needed now that they can be deleted on the import window.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-26 08:14:16 +12:00
jme
12ae3d4e96 Update preferencesdialog.cpp
Remove preferences "Dive Download" window.    Delete all dive computers no longer needed now that they can be dleted on the import window.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-26 08:14:16 +12:00
jme
34926f1325 Update CMakeLists.txt
Remove preferences "Dive Download" window.    Delete all dive computers no longer needed now that they can be dleted on the import window.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-26 08:14:16 +12:00
Michael Keller
da8509d29b Cleanup: Actualise README.md
Actualise the status badges in README.md, and remove the outdated
reference to the current release.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-04-26 01:14:23 +12:00
Michael Keller
9deef235e2 Cleanup: Fix new Findings in Coverity Scan.
Fix some findings in a Coverity scan in `core/planner.cpp` and
`core/profile.cpp`, that were reported as new after the changes
in #4126 (likely because of the rename from .c to .cpp).
Results: https://scan4.scan.coverity.com/#/project-view/60459/13160

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-04-24 10:15:53 +02:00
Berthold Stoeger
e7a6de3894 core: use std::string instead of strndup()
Allows us to remove the strndup.h header. This code will be
even more simple, once core is fully converted away from C-strings.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
177a1a6706 make format-warnings hard compile errors
Code such as `report_info("msg: %s", i)` may crash if `i` is
not a string type. To avoid such problems make format-warnings
hard compile errors.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
556ecd5a9b core: use C++-primitives for g_tag_list
The old code was leaking memory. Use std::unique_ptr<> for
ownership management.

This is still very primitive and divetags are kept during
application lifetime. There should probably be some form
of reference counting. And the taglist should not be global,
but attached to the divelog.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
b320942343 Replace remaining qDebug()s by report_info()
The only case left is in android.cpp, though that is only compiled
when compiling the full desktop app on Android. I.e. never. So
don't bother for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
8867edffe8 Replace qDebug() by report_info() in profilewidget2.cpp
Remove those that are commented out, since this part of the code
will not be ported to QtQuick. So why bother?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
991b72d4ff Replace qDebug() by report_info() in core/cloudstorage.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
47254d91e0 Replace qDebug() by report_info() in qt-init.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
9923d49624 Replace qDebug() by report_info in qthelper.cpp
To do so replace QStrings by std::strings in ui-language code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
9febfdd084 Remove diabled debugging output in subsurfacewebservices.cpp
Why bother with commented out code?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
8677d1f325 Replace qDebug() by report_info() in downloadfromdcthread.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
6dd5ec296d Convert qDebug() to report_info() in testing code
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
4de109bbf1 Replace qDebug() by report_info() in bluetooth code
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
d83da05f8d Replace qDebug() by report_info in checkcloudconnection.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
b6439e0420 Replace qDebug() by report_info() in smtk-import
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
ab7218d543 Use report_info() instead of qDebug in mobile code
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
2c2ad1e5c9 user report_info() instead of qDebug in main() functions
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
4af2ec88bd Use std::vector<string> instead of QStringList in main()
In an effort to convert core to C++ structures.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
c6cd10a43f core: make getCloudURL() return an std::string
Let's use std::string in the core. Notably, I'd like to make
the numerous main() functions mostly independent of Qt. Some
things will have to remain, such as argument parsing, of course.

This changes the API: instead of returning an error code and
taking a pointer to the actual return-value, return an
std::optional<std::string>> that is set if the function succeeds.

Returning an empty string in the error case might be simpler,
but oh well...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
8e106b0449 core: replace qDebug() by report_info() in subsurface-helper.cpp
Start unifying debug output.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
da7ea17b66 cleanup: replace fprintf to stderr by report_info()
Let's try to unify debugging output!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
b097c0a44f core: port errorhelper.c to C++
Use the C++-version of membuffer.

This fixes two memory leaks: report_info() on every(!) invocation
and report_error() before the error callback is set.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
ec0bc2d06c cleanup: replace MIN and MAX macrors by standard versions
In C++ files, replace MIN and MAX by std::min and std::max,
respectively. There are still a few C files using these
macros. Convert them in due course.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
b89029353f import: use C++ primitives in smartrak.cpp
Makes memory management more palatable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
14cfb17c1a import: compile smartrak.cpp as C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
157b52aa6e tests: make git-storage test more robust
The code was crashing if it couldn't reach the cloud, because then
info.repo is NULL. Skip the test if that happens.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
322c3b55e6 core: add compile time format check to format_string_std
Had to rewrite the thing, because gcc's warnings don't work
with templatized var-args. Since there is no string-format.cpp
and I didn't want to inline it, moved it to format.cpp.

String formatting is distributed around at least four
headers: membuffer.h, subsurface-string.h, format.h
and format-string.h. This really should be unified!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
a123589efb core: convert git_info to std::string
Quite a bit of fallout in users of this structure.

Conveniently, since git-access.cpp is now C++ we can move
some helpers from the monstrous qthelper.cpp to git-access.cpp.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
ae299d5e66 profile: use C++ string functions to format plot data
This may appear a bit ominous, as it doesn't generate a string,
but a vector of strings (one for each line). However, that is
in preparation for the QtQuickification of the profile, where
the text-items take such a list.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
422f693f5b core: port tag.c to C++
Let taglist_get_tagstring() return an std::string, since all callers
are C++ anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
84b7ffafd2 core: use C++ versions of membuffer in add_to_string
Avoid explicit calls to free().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
e65ba50c1a core: use C++ constructs in save-html.cpp
Since this is the only caller, onvert the get_file_name() function
to return an std::string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
82ba236859 core: port save-html.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
177b03958c core: port worldmap-save.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
bd3f9b107e planner: turn TIMESTEP macro into integer constant
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
15b17a0aca planner: turn error argument of add_plan_to_notes() into a boolean flag
This used to have multiple values, but is currently only checked for
true/false. Reflect that in the type.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
b542a39a00 planner: turn UNIT_FACTOR macro into function
No apparent reason why this is a hard-to-read macro.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
9a052cd089 planner: move decotimestap to diveplannermodel.cpp
The deco timestep is a parameter to the plan() function. There
seems no need to define this as a global macro. Probably some
code reshuffeling artifact.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
4db19d6284 planner: use std::string in plannernotes.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
8b51ff7ded core: add locale aware formatting function to std::string
We had locale aware formatting functions that generated QStrings.
Create an alternative that creates std::string, since we want that
in the core.

This commit is unfortunate for two reasons:
- The function is called "casprintf()" for analogy with the QString
  version. However, the non locale aware function is called
  "format_string_std()" for analogy with "format_string()".
  Ultimately these names should be unified. Probably, once there
  are no membuffer users left.
- This does UTF-16->UTF-8->UTF-16 roundtrips. The core formatting
  functions should render UTF-8 and only convert to UTF-16, in
  the UI layer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
fe68870079 planner: use std::vector instead of malloc() in planner.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
f69686d429 planner: encapsulate deco state cache in a struct
Removes memory management pain: the struct cleans up when it
goes out of scope.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
77e8c3655e core: compile planner source files with C++
Another relatively easily converted part of the code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
jme
bd31efa821 Update downloadfromdivecomputer.cpp
Remove lines setting "current" computer to computer1.  

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
80eff1d6e2 Update downloadfromdivecomputer.ui
Per suggestion, use QFrame and trashcan icon.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
74b1648fcc Update downloadfromdivecomputer.h
Change DDC<n> to DeleteDC<n>

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
7fb0e9e59e Update downloadfromdivecomputer.cpp
Changed DDC<n> to DeleteDC<n> and hide set visibility for new Qframe

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
d59bd1831a Update downloadfromdivecomputer.cpp
Added delete dive computer buttons.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
f05808fded Update downloadfromdivecomputer.h
Added delete dive computer buttons.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
1692e48163 Update downloadfromdivecomputer.ui
Added delete dive computer buttons.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
Michael Keller
375b08857c Desktop: Remove Unneeded Special Case for MacOS.
Since the removal of this special case for MacOS was confirmed to be
working in the case of building with bluetooth support in #4120, we should
probably remove it from the code used when building without bluetooth
support as well.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-04-21 13:13:18 +12:00
Michael Keller
d49092ac70 CICD: Add Script to Find the Changeset ID for a CICD Release Number.
Add a script that finds the changeset ID in the subsurface repository
that a given CICD release was built from.
The option '-c' can be used to check out the changeset, if one is found.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-04-20 10:46:28 +07:00
Michael Keller
ee8b37cc6e Import: Fix Info Logging.
Avoid logging the expected outcome (success) at info level.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-04-19 15:31:34 +12:00
jme
77281f8bfe Update downloadfromdivecomputer.cpp
If Bluetooth isn't enabled, don't clear non Bluetooth address.    There was an earlier concern that USB mount point shouldn't be preserved because they may change.   This behavior is different on a Mac where the USB serial mount points tend to be persistent.   Michael tested this on Linux and suggested on saving the mount points for Linux and Windows.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
6b11457ddd Update downloadfromdivecomputer.cpp
Based on Michael's suggestion, added code to refine enableBluetoothMode. 

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
8a20509861 Update downloadfromdivecomputer.cpp
Removed blank lines - forgot that blank lines without a continuation \ would break the macro.    Embarrassing to say the least.   I need to figure out how to upload tested code into git.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
334a357c19 Update downloadfromdivecomputer.cpp
Removed the MacOs specific code and added comment explaining why ui.device.Text must be set before the ui.bluetoothMode change handler runs.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
1973d7c881 Update downloadfromdivecomputer.cpp
Preserve bluetooth address if we have it (don't rescan) and for MacOS save the mount point if we have it.     As best as I can tell, the mount points for USB devices do not change on MacOs regardless of the USB port being used.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
a5575f43a3 Update downloadfromdivecomputer.cpp
Per Michael's suggestion, use isBluetoothAddress as check before skipping Bluetooth scan. 

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
ffce4bc097 Update downloadfromdivecomputer.cpp
another space that should have been a tab.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
5980db073a Update downloadfromdivecomputer.cpp
Replaces spaces with tabs and corrected misplaced braces (embarassing...).

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
4dcc9210a9 Avoid unnecessary bluetooth device address scanning.
When switching from a non-bluetooth computer to a bluetooh computer an unnecessary bluetooth scan may be forced.   This patch will avoid the scan if the bluetooth device address is known.



Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
Berthold Stoeger
f4b35f67f6 Don't "untranslate" cylinder names
As far as I can see there are no translation strings for the
cylinder names, so there is no point in translating them back.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-16 08:56:49 +12:00
Berthold Stoeger
0d011231e6 desktop: unglobalize ComboBox-models
The combo-boxes (cylinder type, weightsystem, etc.) were controlled
by global models. Keeping these models up-to-date was very combersome
and buggy.

Create a new model everytime a combobox is opened. Ultimately it
might even be better to create a copy of the strings and switch
to simple QStringListModel. Set data in the core directly and
don't do this via the models.

The result is much simpler and easier to handle.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-16 08:56:49 +12:00
Berthold Stoeger
de313bd01a mobile: save changes from main event loop
When autosync to cloud was enabled, the old code would crash,
because it synced to cloud from a signal handler, which executed
the main loop when checking the cloud connection, which deleted
the object which was causing the original signal. Or something
like that. See discussion in #4119.

To avoid such problems, send a signal via a 'QueuedConnection'
from QMLManager to itself. The slot will be called once the
signal handler terminates and the main event loop retakes
control.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-04 13:57:00 +02:00
Berthold Stoeger
2172e18298 mobile: pull undo/redo notification text up
When changes need saving, the notification text was set quite
deep in the calltree in "saveChangesLocal()". I don't know why
this was put so deep in the call tree. In any case, it prevents
asynchronous saving of the data. Therefore, pull it up to
chnagesNeedSaving().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-04 13:57:00 +02:00
Berthold Stoeger
dd466d2d48 statistics: improve formatting of date axis in day-mode
In January it would just show the year for every day. That's
silly. Show the year only for Jan 1st.

Moreover, it would never show the month, because day-of-month
is counted from 1 (whereas month-of-year is counted from 0).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-31 14:20:14 +02:00
Berthold Stoeger
916c88ded9 mobile: fix undo/redo
The signals of the undo-stack can only be connected after it
was initialized. One of those cases where I would have preferred
a crash over a warning message. The mobile version is extremely
noisy!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-31 14:19:44 +02:00
transifex-integration[bot]
176ee1ac9c
Translate subsurface_source.ts in pt_PT
100% translated source file: 'subsurface_source.ts'
on 'pt_PT'.
2024-03-30 16:39:17 +00:00
Berthold Stoeger
83fa38b3b4 cleanup: remove unused function parse_display_units()
This was added in d9b39efeb7998392524ff2197683aef50246c6ab,
but never used as far as I can see...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-26 17:00:38 +01:00
Berthold Stoeger
2bf7432a94 cleanup: remove unused macros in qmlmanager.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-25 21:41:57 +01:00
Berthold Stoeger
c53cdf039b cleanup: remove unused global variable filesOnCommandLine
Last user was removed in 0a92823af64c76b165ddd2c1bddadd01a5fc6b56.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-25 07:09:05 -07:00
Berthold Stoeger
29d71eb85e cleanup: remove picturedir_string()
This seems to be dead code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-25 06:49:35 +01:00
Berthold Stoeger
2c490fcbbb desktop: take an std::string in MainWindow::setCurrentFile()
This fixes a crash condition when opening the cloud from
desktop: The old code passed a NULL pointer that was then
assigned to an std::string, which is not supported.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-25 06:45:36 +01:00
Michael Keller
6aca76c342 Import / Export: Remove Unsafe XML Handling Options.
Remove the options to expand entities and so continue when encountering invalid /
malformed XML, as both of these can be exploited by supplying
maliciously crafted XML.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-03-24 19:01:05 +01:00
Berthold Stoeger
92c3837f6e cleanup: remove unused taglist functions
No users of taglist_added() and taglist_contains().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
5ac64ab2cd cleanup: replace Q_FOREACH and foreach by range base for
Q_FOREACH and foreach are anachronisms.

Range based for may cause a performance regression: it can
lead to a copy of shared containers (one reason why Qt's
COW containers are broken). However, as long as there is no
user noticeable delay, there is no point in analyzing each case.
And also no point in slapping an 'asConst' on every container
that is looped over.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
41cb916060 core: turn existing_filename into std::string
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
37f2207f94 printing: pass current filename to dialog
Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
3a1122048b core: make logfile_name and dumpfile_name std::string
To avoid memory management woes. These shouldn't be global
variables, but let's fix that later.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
64419f2b19 dive download: pass current filename to dialog
Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
981352646c computer configuration: pass current filename to dialog
Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
2e067c89dd cleanup: Make ConfigureDiveComputerDialog::closeEvent() private
There is no subclass of ConfigureDiveComputerDialog, so there
seems no reason for protected members.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
8733828380 computer configuration: use value semantics for DeviceDetails
The memory managements for DeviceDetails was very sketchy.
First of all, sharing a pointer to a structure between threads
seems like a recipe for disaster. Secondly, the structure was
a QObject and when first generated included in the (silly)
Qt object tree, but when generated in the threads it was not.
Clearly, this leaks.

Instead, use value semantics and use local copies of the
structure. I didn't go full length and use std::move to
move the data, because this doesn't work through signals
(which are the wrong abstraction here, but OK) and secondly
I didn't have time to analyze whether the caller still
needs the data after passing it down to the worker thread.

To be able to pass an object through signals, the class
has to be registered in the Qt MetaType system. Super
ugly, but fine for now. Ultimately, this whole thing should
probably be replaced by futures, co-routines, or whatever.

Moreover, this removes the prefix from  number of "m_*"
function parameters. By convention, "m_" marks member
variables, which function parameters are not.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>

make DeviceDetails a metatype

So that we can pass it as value through the signal/slot system.
(squash with original commit)

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Michael Keller
322c1b56b2 CICD: Add smtk2ssrf Build to CI.
Add a build job for smtk2ssrf to the GitHub action for ubuntu jammy.

Signed-off-by: Michael Keller <github@ike.ch>
2024-03-19 20:20:33 +01:00
Michael Keller
8b0b3cba3c CICD: Add Downloader Build to the CI Pipeline.
Add a build for subsurface-downloader to the CI pipeline. The artifact
is currently not used, but this will ensure pull requests breaking the
downloader are spotted before they are merged.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-03-19 20:20:33 +01:00
Richard Fuchs
2533909337 core: fix downloader builds
Downloder builds pull in show_computer_list() from
downloadfromdcthread.cpp, but it's declared as extern "C". With 76c2069f
having converted subsurfacestartup.c to .cpp, we can remove the extern
"C"

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2024-03-16 18:21:52 +01:00
Michael Keller
1508d305b8 Desktop: Add Country to the Fields Indexed for Fulltext Search.
Add 'Country' to the fields that are indexed for fulltext search - this
seems to be a quite intuitive choice as 'Country' is also a field that
is available in the dive list view.

Fixes #4134.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-03-16 17:23:24 +01:00
Michael Keller
8a5009786e Fix Translation Error in Android Build.
Same as iOS.

Signed-off-by: Michael Keller <github@ike.ch>
2024-03-16 13:32:02 +13:00
Dirk Hohndel
153bcdec42 fix incorrect Italian localization on iOS
Stupid cut and paste error...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-03-15 07:50:29 -07:00
Michael Keller
e6ff3f7537 Cleanup: Fix Problems Raised by Coverity Scan.
Opportunistically fix some problems newly raised by a recent Coverity
scan.

Not touching any of the string memory allocation issues as this is being
handled by the move towards C++ strings.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-03-14 11:42:09 +13:00
Berthold Stoeger
3229d1e3a1 preferences: replace macro by local function
No apparent reason for having this as a hard-to-read macro.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-13 13:17:01 +13:00
Berthold Stoeger
857148efd6 preferences: replace SIGNAL/SLOT by function pointers
This give compile time checking. In fact, one of the connections was
not working (currentIndexChanged(QString) doesn't exist in newer(?)
Qt versions).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-13 13:17:01 +13:00
Berthold Stoeger
8980d61786 core: replace SSRF_INFO macro by report_info()
The point of this macro is unclear. It just calls report_info()
anyway...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-12 10:31:07 -04:00
Berthold Stoeger
bfbf4934dd core: enable compiler warngings for report_error and report_info
printf() is a horrible interface as it does no type checking.
Let's at least use the compiler to check format strings and
arguments. This obviously doesn't work for translated strings
and using report_error on translated strings is dubious. But OK.

Had to convert a number of report_error() calls to supress
warnings.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-12 10:31:07 -04:00
Berthold Stoeger
fcf0bda042 core: move report_info and SSRF_INFO to errorhelper.h
qthelper.h is an absolute monstrosity and it is unclear what
report_info and SSRF_INFO have to do with Qt.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-12 10:31:07 -04:00
Dirk Hohndel
d653cec7a4 ensure locale language info lands in the applog
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-03-11 11:30:14 -04:00
Dirk Hohndel
8f50c9c1b3 Improve automated language handling
This mimics the code added in commit cf990b0f39 ("preferences: choose language
code with one '-'") and adds some debugging for the mobile case - some people
are being presented with Subsurface-mobile in Korean for some reason.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-03-11 11:30:14 -04:00
Berthold Stoeger
c7a929a8a8 Correctly initialize string in core/device.cpp
When initializing a string with multiple characters, first
comes the length, then the size. Not the other way around.

Fixes #4127.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-11 20:20:18 +13:00
Berthold Stoeger
8b5812bc2c profile: fix uninitialized variable in DivePercentageItem
Fix bug introduced in 505e4e47eb.

Nobody complained, so not clear if that was user visible.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 17:59:32 +01:00
Berthold Stoeger
cf990b0f39 preferences: choose language code with one '-'
On initialization, the old code searched for the first language
code containing a '-'. However, my Qt version gives de-Latn-DE
as the first entry. That messed up the preferences code: it
didn't recognize that entry. Thus, simply opening and closing
the preferences switched the language to Bulgarian.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-09 22:11:11 -05:00
Berthold Stoeger
889ca23999 cleanup: automatically determine array size in load-git.cpp
There was a pattern of code like
match_action(line, state, dive_action, ARRAY_SIZE(dive_action));

The doubling of the array might cause copy & paste errors, where
only one array is replaced.

Therefore, determine the length of the array with (hopefully
easily understood) template tricksery.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
6bf8cbfe46 core: avoid pointless copying in git parser
When iterating over the converted strings of a line, the
first entry of the array would be popped off, leading to
a full copy of the remaining array.

Instead, use an index in the parser state.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
885ff44c56 core: directly generate std::strings in git parser
The converted strings were stored in a membuffer and later
converted to std::strings. Generate an std::string directly
to avoid unnecessary copying.

Ultimately, when the core structures are converted to
std::string, there should be no copying of the string data
at all (unless formatting is applied or small string
optimization kicks in, of course).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
6b054318e0 core: convert parse_mkvi_value() and parse_mkvi_key() to C++
This was a particularly funny one: It trampled on and then
restored the buffer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
cca4c8cae5 core: return std::string from get_dive_date_c_string()
Had to convert uemis-donwloader.c to C++. Lot's of
non-const clean code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
203ff8b2e6 core: port string handling in divecomputer.cpp to C++
Replace formatstring() by the C++ version.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
ad7530f7bb core: use std::string for dummy hash value in parser
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
affcbddbb0 core: use std::string to format battery extra data
Create a format_string_std function that works like format_string,
but does return a std::string instead of a strdup()ed C string.

Make it a global function to be used in other parts of the code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
e6321a1305 core: turn extra_data key/value pair in parser to std::string
Less troublesome memory management.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
92a1a08b21 core: remove alloc_filter_preset() and free_filter_preset()
All users of that are now C++ and don't need these helpers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
cf7c54bd56 core: turn a memblock in the parser to std::string
This avoid memory-management troubles. Had to convert a few
of the parsers (cochran, datatrak, liquivision) to C++.
Also had to convert libdivecomputer.c. This was less
painful than expected.

std::string is used because parts of the code assumes
that the data is null terminated after the last character
of the data. std::string does precisely that.

One disadvantage is that std::string clears its memory
when resizing / initializing. Thus we read the file onto
freshly cleared data, which some might thing is a
performance regression. Until someone shows me that this
matters, I don't care.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
2f4dbf1848 core: make get_sha() return std::string
This was crazy: it returned a local static buffer, i.e. was
inherently non-reentrant.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
2f3d8d83f5 core: port printGPSCoordsC to return std::string
Less memory management hassle.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
119fe908c7 core: port filterpreset.cpp to std::string
Less memory management hassle.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
2e1d852e36 core: convert filter_constraint_data_to_string to C++
Return an std::string to avoid memory management headaches.

While doing that, convert time.c to C++ so that
format_datetime directly returns an std::string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
898ecd2df5 core: make fp_get_data return an std::string
No need for manual memory management.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
8d96b7557d core: convert parser_state to C++
Add constructor, destructor and use std::string for memory
management of text data.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
5e466d91f0 core: convert core/import-*.c to C++
import-csv.c was crazy with implicit (const char *) to (char *)
conversions!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
83b0c1da40 core: convert parse-xml.c and parse.c to C++
This was very annoying, because the old code was not const-clean
at all and trampled all over buffers. This makes the new code
pretty messy for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
a133c6c4db mobile: turn testqml into a std::string
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
9509eb6876 divetripmodel: explicitly convert char * to QString
The automatic conversion from char * to QVariant failed to
compile for me. Let's hint that this should be interpreted
as a string. No idea, why this happens for me, but apparently
not on CI.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
43ec3fc1d9 core: use std::string in load-git.cpp
Make the memory management easier to follow. I feel that the old
code was leaking left and right, but not sure because it was so
intractable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
114513493b core: use std::string in parser state of git loader
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
a1826f77da core: turn saved_git_id into a std::string
Simplifies memory management. Think about unglobalizing this,
once everything is in C++ so that we can put an std::string
into struct divelog.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
c05be40bfd core: convert load-git.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
d803e42314 core: convert file.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
a032d9c979 core: convert save-xml.c to C++
This includes using the C++ version of membuffer. There appears
to not have been a leak, because the buffer is freed in
flush_buffer(), but usage was somewhat inconsistent and hard to
follow.

Also, convert some string handling to std::string to avoid free()
madness.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
76c2069fa8 core: port subsurface-startup.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
f1012283a0 core: turn a few string helpers into C++
get_changes_made(), subsurface_user_agent() and normalize_cloud_name()
are only called from C++.

Avoids having to manually free the returned value and is therefore
more robust against leaks.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
924b23ed56 core: convert git-access.c to C++
Had to make sha.h compatible with C++.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
b0438ad1dd core: use C++-style memory management for struct dir
The code is now much easier to check for memory leaks,
since there are no explicit free()s. Yes, memory is not
released immediately, but that should be of no concern.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
371b155922 core: convert core/save-git.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
148775f418 core: convert sample.c to C++ and add default constructor
This changes default behavior when creating a sample struct
in C++ code: it is now initialized to default values. If this
ever turns out to be a performance problem, we can either add
additional constructors or use special functions that do
not initialize memory, such as make_unique_for_overwrite.

This removes non-standard (respectively >C++20) constructs,
namely designated initializers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
c27e093ebd core: replace dynamic arrays in dive.cpp by C++ constructs
Avoid error-prone malloc/free pairs. This uses somewhat
obscure constructs to stay as close as possible to the
original C code. Notably, it uses mostly unique_ptr<T[]>
which doesn't store the length of the array, because the
length is supposed to be known.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
52e6a098aa core: convert dive.c to C++
Long term project: convert core to C++ so that we can
use higer-level constructs, notably std::vector<>.

This does not change any code - only fixes compile issues.

Mostly casting of (void *) to the proper type. Also designated
initialization of the sample struct had to be rearranged.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
096e49e15b core: make translate() accessible from C++
In the core, we usually want C strings, not QStrings. Therefore,
make translated C strings directly available from C++.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
transifex-integration[bot]
0ea287cc2c
Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-03-09 16:14:26 +00:00
transifex-integration[bot]
8c861f749f
Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-03-09 16:07:59 +00:00
transifex-integration[bot]
f1bd5dc051
Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-03-09 16:07:04 +00:00
transifex-integration[bot]
d64986415c
Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-03-09 16:06:38 +00:00
Dirk Hohndel
649ed8a9ae Merge remote-tracking branch 'origin/translations_translations-subsurface-source-ts--master_ca' 2024-03-08 15:16:23 -08:00
Dirk Hohndel
569c5520af Merge remote-tracking branch 'origin/translations_translations-subsurface-source-ts--master_nl_NL' 2024-03-08 15:15:53 -08:00
Dirk Hohndel
5dc4c5855b Merge remote-tracking branch 'origin/translations_translations-subsurface-source-ts--master_en_GB' 2024-03-08 15:15:18 -08:00
Dirk Hohndel
af8f67ed5f Merge remote-tracking branch 'origin/translations_translations-subsurface-source-ts--master_de_DE' 2024-03-08 15:14:38 -08:00
Berthold Stoeger
9d2bd425e1 core: fix memory leak in tables code
The function clear_*_table frees all elements of the table.
However, persumably as a performance feature, it kept the
memory of the table itselt (i.e. it only reset the number of
elements but kept the capacity).

That is fine if the table is reused later. However, this
function was also used when freeing the table and this
would leak the table memory.

This commit frees the table memory. An alternative would
be to have separate clear_*_table and free_*_table functions.
But let's wait with that until we port the table code to C++.
Then this will be "automatically" fixed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-07 07:55:23 -05:00
transifex-integration[bot]
4b1a6f8824
Translate translations/subsurface_source.ts in ca
100% translated source file: 'translations/subsurface_source.ts'
on 'ca'.
2024-03-04 01:40:49 +00:00
transifex-integration[bot]
6c2b126c8e
Translate translations/subsurface_source.ts in ca
100% translated source file: 'translations/subsurface_source.ts'
on 'ca'.
2024-03-04 01:40:34 +00:00
Berthold Stoeger
805cd550f2 cleanup: fix memory leak
get_local_dir() returns the copy of a c-string. It therefore
has to be free()d.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-03 14:59:31 -08:00
Berthold Stoeger
a4091189b0 cleanup: use proper size when allocating string
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-02 19:21:59 +01:00
Berthold Stoeger
ef5859437a cleanup: remove ominous pointer calculation
Firstly, why calculate something when the next statement is a return
anyway.

Secondly, the calculation subtracts two completely unrelated pointers.

This must be some code reshuffling artifact.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-01 12:28:52 -08:00
Michał Sawicz
96470227d5 snap: fix grade determination
Determine grade based on whether we actually managed to check out the
buildnumber.

This assumes that the tree is clean for building a stable snap (one that
can be published to candidate and stable channels).

Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-03-01 09:03:28 -08:00
Berthold Stoeger
cb3e21c443 cleanup: remove unused data and bogus UNUSED in libdivecomputer.c
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-01 07:57:34 -08:00
transifex-integration[bot]
9d3498f01e
Translate subsurface_source.ts in nl_NL
100% translated source file: 'subsurface_source.ts'
on 'nl_NL'.
2024-02-29 19:58:56 +00:00
transifex-integration[bot]
afcff5da2b
Translate subsurface_source.ts in nl_NL
100% translated source file: 'subsurface_source.ts'
on 'nl_NL'.
2024-02-29 19:57:24 +00:00
transifex-integration[bot]
10d95531ff
Translate subsurface_source.ts in en_GB
100% translated source file: 'subsurface_source.ts'
on 'en_GB'.
2024-02-29 12:23:40 +00:00
Michael Keller
cedccbc340 Import: Update the libdivecomputer Submodule.
Update the libdivecomputer submodule.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-02-28 15:38:48 +13:00
Michael Keller
3ccd7e4bc7 Import: Add Support for New Dive Computer Models Supported by Libdivecomputer.
Add support for the new dive computer models that have been added in the
latest version of libdivecomputer.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-02-28 15:38:48 +13:00
Michael Keller
f495c4f002 Import: Update libdivecomputer to the Latest Version.
Update `libdivecomputer` to the latest upstream version.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-02-28 15:38:48 +13:00
Miika Turkia
4642f12e29 Divelogs.de integration update
Adding temp support for divelogs.de import/export.

Adding export of divecomputer model to divelogs.de export

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2024-02-27 15:44:32 -08:00
Michał Sawicz
c3aa505f2b snap: fix grade-setting
> variable 'grade' can be set only once.

Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-27 06:52:45 -08:00
Berthold Stoeger
bf5510e5a6 cleanup: remove bogus forward declaration of inexistent structure
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-02-27 13:14:34 +01:00
transifex-integration[bot]
8e023717f7
Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-02-24 22:09:16 +00:00
Dirk Hohndel
0cb5273766 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-02-24 10:30:02 -08:00
transifex-integration[bot]
bca8eabcec Translate subsurface_source.ts in bg_BG
100% translated source file: 'subsurface_source.ts'
on 'bg_BG'.
2024-02-24 10:30:02 -08:00
transifex-integration[bot]
5ab5bc51cd Translate subsurface_source.ts in es_ES
100% translated source file: 'subsurface_source.ts'
on 'es_ES'.
2024-02-24 10:30:02 -08:00
transifex-integration[bot]
36a76e015f Translate subsurface_source.ts in es_ES
100% translated source file: 'subsurface_source.ts'
on 'es_ES'.
2024-02-24 10:30:02 -08:00
Dirk Hohndel
4b0fe3bc38 mobile: show incorrect cloud password state
While the startup flow should make it obvious when a user is not
correctly logged into the cloud, we still do see fairly frequent
situations where a user has an incorrect password on a mobile device and
is confused about why their data isn't syncing with their PC. Now this
is clearly shown in the main menu.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-02-23 20:12:12 -08:00
Berthold Stoeger
fac006148f profile: make event hiding persistent across change of dive
Currently, the "hide event" status is lost when switching dives.
Save it in the event struct instead to make it persistent.

In the future we might save this information to the log file.
Then this should be integrated in the undo-system.

This commit also makes the "unhide events" menu entry more
fine grained: It now differentiates between individual
events and event types.

Note this adds an additional field to the event structure.
There is a "deleted" field that is used internally for
book-keeping, but probably should be removed. Not touching
this at the moment as long as this is C-only code. When/if
switching to C++ we can make the event linked list a table,
which will make this much simpler.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-02-23 09:46:16 -08:00
Berthold Stoeger
4783e85b59 cleanup: fix typos in comments
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-02-23 09:46:16 -08:00
Berthold Stoeger
4422dbb52b events: make event severity explicit
Currently the event type code uses libdivecomputer's flags
to differentiate between events. Make this explicit and extract
the event severity.

The reason is that later we want to be more explicit about showing/
hiding events and thereto we must format the name of events.

Moreover, this encapsulates the complexities of extracting
the severity in the event code (that used to be in the profile
code).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-02-23 09:46:16 -08:00
Berthold Stoeger
6ad7e577f1 core: pass event to event_type functions
Instead of passing name / flag pairs to event_type functions,
pass a pointer to the event. This hides implementation details.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-02-23 09:46:16 -08:00
Berthold Stoeger
d3c9cb14bf core: rename eventname.* to eventtype.*
This structure is used to hide events of a certain type.
The type was inferred from its name, but now includes flags.
So event_type is more appropriate.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-02-23 09:46:16 -08:00
Dirk Hohndel
7a74a6c426 enable Korean translations for Subsurface and Subsurface-mobile
A great thank you to Wonchan Lee!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-02-19 14:46:48 -08:00
transifex-integration[bot]
4877c5d99a Translate subsurface_source.ts in ko_KR
100% translated source file: 'subsurface_source.ts'
on 'ko_KR'.
2024-02-19 14:46:48 -08:00
transifex-integration[bot]
2ba04c71f1 Translate subsurface_source.ts in ko_KR
100% translated source file: 'subsurface_source.ts'
on 'ko_KR'.
2024-02-19 14:46:48 -08:00
transifex-integration[bot]
9416d9e684 Translate subsurface_source.ts in ko_KR
100% translated source file: 'subsurface_source.ts'
on 'ko_KR'.
2024-02-19 14:46:48 -08:00
transifex-integration[bot]
aa975d2d2c Translate subsurface_source.ts in ko_KR
100% translated source file: 'subsurface_source.ts'
on 'ko_KR'.
2024-02-19 14:46:48 -08:00
transifex-integration[bot]
8d353beecf Translate subsurface_source.ts in ko_KR
100% translated source file: 'subsurface_source.ts'
on 'ko_KR'.
2024-02-19 14:46:48 -08:00
transifex-integration[bot]
3df5a5f16d Translate subsurface_source.ts in ko_KR
100% translated source file: 'subsurface_source.ts'
on 'ko_KR'.
2024-02-19 14:46:48 -08:00
transifex-integration[bot]
aa96ab452b Translate subsurface_source.ts in ko_KR
100% translated source file: 'subsurface_source.ts'
on 'ko_KR'.
2024-02-19 14:46:48 -08:00
Michael Keller
a946dc323b Mobile: Add Input Validation and Conversion for Gradient Factors.
Add input validation and input conversion for the gradient factor
settings.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-02-17 12:36:15 +13:00
Dirk Hohndel
704b26ff1e Mobile: improve GFLow/High settings UI
- move the spinbox closer to the senter
- improve sizing and spacing of the spinbox
- hide it when we aren't showing the calculated ceiling

Also address an odd whitespace issue.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-02-14 18:57:41 +13:00
Michael Keller
31d1755efd Mobile: Fix Cloud Synch Status Management.
Fix how the cloud synch status is handled - currently the preference is
used incorrectly, switching cloud synch off when it should be on.
Also hide the 'Manual cloud synch' button when no cloud credentials are
stored, and don't show the 'manual synch' popup when auto synch is
enabled.

Signed-off-by: Michael Keller <github@ike.ch>
2024-02-12 16:47:46 -08:00
Michael Keller
1309064873 Profile: Reinstate Hiding of Events by Type across Dives.
Reinstate the hiding of events by event type across
all dives in the log. This was unintentionally removed in #3948.
Also change the event type to be specific to name and severity, and fix
bug causing 'Unhide all events' to not show when only individual events
were hidden.

This still leaves the inconsistency that hiding of similar events is
persisted across the switch between dives, but hiding of individual
events is lost when switching dives, which is mildly confusing.

Follow-up to #4092.

Signed-off-by: Michael Keller <github@ike.ch>
2024-02-12 12:27:59 +01:00
Michael Keller
8181048611 CICD: Add GitHub Action File for Documentation Processing.
Also add an appropriate branch condition to the actions building
docker images.

Signed-off-by: Michael Keller <github@ike.ch>
2024-02-10 09:32:31 -08:00
Michael Keller
618e38151a CICD: Automate Processing of the Documentation.
Automate processing of the documentation to ensure it is processable.
Also fix some bugs in the existing input files for the documentation and
re-enable linting.

Signed-off-by: Michael Keller <github@ike.ch>
2024-02-10 09:32:31 -08:00
Dirk Hohndel
4197faf1b7 update documentation processing
- fix typo in Makefile
- remove unmaintained Russian translation
- try to fix incompatibilities with current asciidoc version
- update processed files

Unfortunately I wasn't able to figure out one error that stops the linting of
the mobile manual from succeeding - as a result I turned of linting for now
(that's the '-L' flag that was added to a2x)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-02-08 13:26:39 -08:00
Dirk Hohndel
5250a86277 delete ancient FAQ
This file hadn't been touched since 2017.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-02-07 15:00:56 -08:00
Dirk Hohndel
fbbbbb997e build-system: sort Usage message and add missing options
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-02-07 15:00:56 -08:00
Berthold Stoeger
02055ba067 planner: fix crash when planning with surface interval
The planner uses a one-past-end pseudo cylinder for marking the
surface interval outside of water. This overflowed arrays in
setup_gas_sensor_pressure().

See #4086. Note: contains a second unrelated crash report.

As a band-aid allocate bigger arrays. But obviously, the proper
fix is to not generate invalid gas-change events.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-02-07 12:19:04 -08:00
Michael Keller
129cbf8d95 Documentation: Add Missing Image in CONTRIBUTING.md
Add an image missing in CONTRIBUTING.md.

I found this version from 2015 in the wayback machine. ;-)

Signed-off-by: Michael Keller <github@ike.ch>
2024-02-07 08:41:18 -08:00
Michael Keller
345f0570a5 Mobile: Add 'Contribute' link.
Add a link to the 'Contribute' page to the mobile app.

Signed-off-by: Michael Keller <github@ike.ch>
2024-02-06 23:40:58 +13:00
Michael Keller
df1974a244 Mobile: Fix Configuration of Ceiling Display.
Fix the configuration of the deco ceilings in the mobile version:
- make the settings work;
- remove reading of the dive computer ceiling from git;
- hide the gradient factor in the profile when the calculated ceiling is
  not shown;
- when the calculated ceiling is disabled in the settings, disable
  editing of the gradient factor.

Signed-off-by: Michael Keller <github@ike.ch>
2024-02-06 11:58:49 +13:00
Michał Sawicz
2036c68972 snap_usns: fix snap configuration
Bad dictionary.

Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-05 07:04:29 -08:00
transifex-integration[bot]
34011b4fb1 Translate translations/subsurface_source.ts in ca
100% translated source file: 'translations/subsurface_source.ts'
on 'ca'.
2024-02-04 15:42:48 -08:00
Dirk Hohndel
2413821080 add clarification about sources to the nightly build release notes
Closes subsurface/nightly-builds#1

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-02-04 15:42:48 -08:00
transifex-integration[bot]
19f329a76e Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-02-04 15:42:48 -08:00
transifex-integration[bot]
cf30c685a6 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-02-04 15:42:48 -08:00
Dirk Hohndel
63f4761a13 build-system: add helper script to sign CICD macOS builds
This once again is reasonably specific to the way I have things set up but
might help someone else trying to figure out how to get things done.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-02-04 15:33:32 -08:00
Michael Keller
aad0063c46 Mobile: Fix Link to the Online Manual.
Replace the link to the online manual to the post-website-revamp URL.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-02-04 14:59:55 -08:00
Michael Keller
1ce385b363 Desktop: Add Button and Link to 'Contribute' Page.
Add a button that opens the 'Contribute' page to the 'About' dialogue,
to encourage more users to start to contribute.

Requires https://github.com/subsurface/new-website/pull/36 to be
deployed to have a valid link target.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-02-04 14:50:18 -08:00
transifex-integration[bot]
323dda672c Translate subsurface_source.ts in nl_NL
100% translated source file: 'subsurface_source.ts'
on 'nl_NL'.
2024-02-04 11:26:59 -08:00
transifex-integration[bot]
5ae6972a80 Translate subsurface_source.ts in nl_NL
100% translated source file: 'subsurface_source.ts'
on 'nl_NL'.
2024-02-04 11:26:59 -08:00
Michał Sawicz
e234f16073 snap: refresh interfaces
`unity7` is replaced now with the more appropriate `desktop` and
`desktop-legacy` interfaces.

Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-04 11:07:27 -08:00
Michał Sawicz
ddfc676a92 ci: drop "Linux" prefix
Following the convention.

Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-04 11:07:27 -08:00
Michał Sawicz
a57c26ccd4 ci: bring back snap builds for master
That's what populates the ccache cache 🤦

Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-04 11:07:27 -08:00
Michał Sawicz
eb555b25d5 ci: refresh snap ci patch
Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-04 11:07:27 -08:00
Michał Sawicz
d4a4ecfa99 snap: build on base: core22
Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-04 11:07:27 -08:00
Michał Sawicz
a6ac4f4599 snap: fix CI patch
Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-03 19:23:10 -08:00
Michał Sawicz
b9cf51bfad snap: don't use git for subsurface source
We miss the dummy release files otherwise.

Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-03 19:23:10 -08:00
Michał Sawicz
e2ca662502 snap: rebuild candidate, too
Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-03 19:23:10 -08:00
Michał Sawicz
d04c9785b6 snap: use the rolling release version
Signed-off-by: Michał Sawicz <michal@sawicz.net>
2024-02-03 19:23:10 -08:00
Michael Keller
9cdb9f7989 CICD: Add a File Containing the Release Title to CICD Releases.
Add a file containing the release title (derived from the pull request
title / commit message) to CICD releases - this is so that it will be
able to pick this up by the process updating the release pages on our
webserver, and show a list of the last few changes for each release.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-01-31 15:18:21 -08:00
Michael Keller
94a7ba9097 Desktop: Fix the Generation of <switchmix> Elements in the UDDF Export.
Fix the generation of <switchmix> elements in the UDDF export.
Also change the ids of gasmixes to include the helium fraction, and
fractions of a percent, in order to make UDDF export suitable for
technical diving.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-30 04:21:11 -08:00
Dirk Hohndel
6318a983eb remove Ubuntu Lunar as build target (EOL)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-29 15:11:33 -08:00
Richard Fuchs
330fd2309b downloader: call Command::init()
Otherwise we may end up crashing in Command::execute() due to null
undoStack.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2024-01-28 12:00:32 -08:00
Richard Fuchs
1952d1c187 downloader: check for parsing failure
Don't continue if the dive log could not be loaded. Otherwise we end up
writing out an empty dive log.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2024-01-28 12:00:32 -08:00
Richard Fuchs
0ee5c8f03a downloader: use global divelog object
The save_dives() function saves dives from the global divelog object.
Use the same object when calling parse_file() so that we don't end up
with an empty output log file.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2024-01-28 12:00:32 -08:00
Richard Fuchs
caf2f8c102 core: return error from parsing failure
If the XML document could not be parsed then `root_element` will come
out as NULL. Check this before trying to dereference it.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2024-01-28 12:00:32 -08:00
Michael Keller
fb41999c73 Mobile: Fix Gradient Factor Preference Setting.
Fix the persisting and use of gradient factor preferences for dive
profiles in the mobile version.
Also rename the mobile backend gradient factor settings to make it
obvious that they are used by the (not currently enabled) planner.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-27 20:55:32 -08:00
Dirk Hohndel
a59d033278 fix annoying typo in Copr workflow
This prevented the release from being pushed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-27 20:12:33 -08:00
Dirk Hohndel
21095b18fc enable creating current releases for Ubuntu and Fedora
While for the other platforms we can simply copy our binaries (maybe
after signing them), for Fedora and Ubuntu we have to trigger fresh
builds.

The most logical way that I could think of to do this was to push the
same commit corresponding with the intended current release into a
branch named 'current' and have that trigger Copr and Launchpad builds
that post into our release repos.

So 'master' keeps moving forward, keeps creating new build numbers.
At some point we pick a build number that we want to be the next
'current' release. We then update the current branch to the commit that
corresponds to that build number and push the current branch which
triggers new builds in the correct repos on Copr and Launchpad.

This commit removes the silly 'push' argument from the make-package
scripts (after all, they are used to push those packages to the
respective build services) and instead use the branch name as argument
to those scripts - allowing us to pick which repo to push into.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-27 19:36:47 -08:00
Robert C. Helling
4fdaf3e8de Downloader: Install perl modules and set up environment
Signed-off-by: Robert C. Helling <helling@lmu.de>
2024-01-27 15:38:41 -08:00
transifex-integration[bot]
301059c6c9 Translate subsurface_source.ts in en_GB
100% translated source file: 'subsurface_source.ts'
on 'en_GB'.
2024-01-27 09:27:55 -08:00
transifex-integration[bot]
a0b8574beb
Translate subsurface_source.ts in es_ES
100% translated source file: 'subsurface_source.ts'
on 'es_ES'.
2024-01-27 06:56:51 +00:00
transifex-integration[bot]
129a7fbf59
Translate subsurface_source.ts in es_ES
100% translated source file: 'subsurface_source.ts'
on 'es_ES'.
2024-01-27 06:52:02 +00:00
transifex-integration[bot]
3cc5ec5c50
Translate subsurface_source.ts in es_ES
100% translated source file: 'subsurface_source.ts'
on 'es_ES'.
2024-01-27 06:51:17 +00:00
transifex-integration[bot]
3b20cda602
Translate subsurface_source.ts in es_ES
100% translated source file: 'subsurface_source.ts'
on 'es_ES'.
2024-01-27 06:50:12 +00:00
Dirk Hohndel
9779ac3661 Update translation source strings
[skip ci]

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-26 12:57:11 -08:00
transifex-integration[bot]
62cc7ad69b Translate translations/subsurface_source.ts in ca
100% translated source file: 'translations/subsurface_source.ts'
on 'ca'.
2024-01-25 18:16:08 -08:00
Dirk Hohndel
3eb5ea9adf desktop: add password reset to cloud preferences
This must be the number one support request we get. I can't believe we never
thought of adding a button to do this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-25 10:42:48 -08:00
Michael Keller
84e8937787 Documentation: Restructure the 'CONTRIBUTING.md' Page.
Restructure 'CONTRIBUTING.md' to show the different ways to contribute
more clearly, and to add a specific section about joining the
contributors' community.

[skip ci]

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-01-23 17:29:23 -08:00
Robert C. Helling
e794efaba6 Allow for more O2 sensors
The Divesoft Liberty has four O2 sensors. So far, we had a hard coded
limit of three sensors and crashed with a failed assert when we
encoutered more than three. This allows for up to
MAX_O2_SENSORS which is currently 6. The voting logic is adapted
accordingly: We sort the values and we keep deleting the values that
differ more than 20% by value from the closest. This follows what
Shearwater implements on their computers.

In some of the import/export functions the value is still hard
coded to 6 thanks to explicit field names.

Signed-off-by: Robert C. Helling <helling@lmu.de>
2024-01-23 19:24:53 +01:00
Richard Fuchs
e00e1bb9f7 Downloader: fix segfault
With no files given and no config present, the downloader segfaults due
to empty `files`. Print a message instead.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2024-01-23 10:08:21 -08:00
Michael Keller
05ef933ff7 CICD: Move Windows Build to New Container.
Move the GitHub Action that builds the Windows artefacts to use the new
subsurface/mxe-build:3.1.0 container.
Also rename references to the old container in scripts and
documantation.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-24 00:05:26 +13:00
Michael Keller
89506d9782 Update libdivecomputer to latest on Subsurface-DS9.
Signed-off-by: Michael Keller <mikeller@042.ch>
2024-01-23 11:10:02 +13:00
Dirk Hohndel
bd1763680e Ubuntu: remove obsolete dependency
It appears that this dependency is no longer provided (as of Mantis), but also
no longer needed (as a build without it appears to completed). Let's see if
that fixes our Mantis build issue.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-21 13:37:33 -08:00
Michael Keller
c1bfded4a7 CICD: Add GitHub Action to build the Windows (MXE) Builder Docker Image.
Add a GitHub action that builds the docker image to run builds for the
Windows (MXE) version of Subsurface.
Also update the MXE image Dockerfile to the latest version of MXE, and
add a patch to use a current version of mdbtools.
Configure GitHub actions that do not build docker images to not trigger
on changes to the contents of `scripts/docker/`.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-20 21:30:12 -08:00
Simeon
eea75fc1c4 Removed section about GPS recording from user-manual
The GPS tracker functionality was removed from Subsurface-Mobile a while ago. This commit changes the documentation to reflect the current state of the Subsurface-Mobile application.

Reported-by: Simeon Geiger
Signed-off-by: Simeon Geiger <simeon.geiger@gmail.com>
2024-01-20 09:38:22 -08:00
Simeon
24c1cb5b09 Update to use AUTOMOC
When trying to build the integrated user manual,
the linker stopped with the error message "undefined reference to vtable ...".
This is a subtle bug, connected to the qt preprocessor MOC.
Adding "set(CMAKE_AUTOMOC ON)" to the desktop-widgets/CMakeLists.txt fixed the problem.

For more information, see:
https://github.com/bincrafters/community/issues/466
https://cmake.org/cmake/help/latest/prop_tgt/AUTOMOC.html

Signed-off-by: Simeon Geiger <simeon.geiger@gmail.com>
2024-01-20 09:38:22 -08:00
Jason Bramwell
9e2f7571f9 Removing reference to qt5-default for Raspberry Pi
Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
2024-01-20 08:04:38 -08:00
Michael Keller
6dd5922d15 CICD: Improve the Android Docker Image Build.
Introduce proper reuse of intermediary stages in the multi-stage build.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-19 16:14:35 -08:00
Berthold Stoeger
bef21ff5eb code consistency: replace qMin/qMax by std::min/std::max
We use the latter pretty consistently, so let's remove the few
left instances of the former.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-17 14:23:19 -08:00
Berthold Stoeger
429230ced1 saving: fix resource leak found by coverity
fp_get_data() returns a copy of a string that must be freed.
Fix this in save-git.c. The analogous function in save-xml.c
has already been fixed. However, change the code to be more
idiomatic: since we own the pointer, make it "char *" instead
of "const char *". Then we don't have to cast on free().

Ultimately, we really should change string manipulation code
to C++.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-17 14:23:19 -08:00
Berthold Stoeger
91e4fb4769 cleanup: more Coverity silencing
Mostly irrelevant std::move() stuff of copy-on-write Qt objects,
a few real bugs, a timestamp_t downconversion and some codingsyle
adaptation.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-17 14:23:19 -08:00
Berthold Stoeger
35ff6eea35 desktop: block signals when setting combobox-indexes
On the InformationTab a signal is emitted when programatically
setting the index of the dive mode combobox which in turn then
edits the dive.

Usually not a problem, because the editing code realizes that
the value is not changed. It is however a problem when multiple
dives are selected.

Therefore, block the signals when setting the index. Same for
the other comboboxes on the same page.

Fixes #3960.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-16 14:52:36 -08:00
Berthold Stoeger
bdade9e499 planner: initialize subobject of PlannerWidgets in correct order
The DivePlannerWidget was initialized before the planner models.
However, it attaches these (non existing) models to the comboboxes.
That can't work. Initialize in correct order.

Fixes #4014

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-16 14:22:16 -08:00
Berthold Stoeger
13b894a756 gases: fill result of isobaric_counterdiffusion() on early return
If prefs.show_icd is false, this function does nothing, but
the output parameter is checked by the calling function
DiveEventItem::setupToolTipString().

Let's reset the strucvture to 0.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-16 14:22:16 -08:00
Michael Keller
4bab38b8df CICD: Make it Possible to Run CICD Builds in a Fork.
Use the project name to resolve the target repository to create the release in.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-01-15 19:53:54 -08:00
Dirk Hohndel
2db8b51eed build-system: missed one release note mention without .md
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-15 17:42:03 -08:00
Michael Keller
6c8afabedf CICD: Improve the Release Note Generation
Use .md suffix to get the files displayed as markdown.
Ignore generated artefacts.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-01-15 17:32:57 -08:00
Berthold Stoeger
249b82f6dc pictures: make delta-time a 64-bit int
When adjusting picture times, the offset in seconds is stored in a
32-bit int. Make it a 64-bit int. Sounds crazy, because why would
you want to move the pictures by more than 70 years?

Well, suppose it is the year 2039, for some strange reason your
camera was set to unix epoch and you want to adjust the pictures
to current time.

Ok - that's a far-fetched scenario. The real reason is that this
hopefully silences a Coverity warning and avoids integer casting.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-15 15:11:36 -08:00
Berthold Stoeger
8a3a0edb83 cleanup: silence std::move()-related Coverity warnings
Unfortunately Coverity doesn't understand that most Qt data
structures are copy-on-write. It's a mis-feature of Qt, but
it is the way it is. Thus, passing by value is not an issue.

Out of ca. 25 warnings only two were legit. Let's silence
the others by either std::move()ing or passing by reference,
as would be idiomatic C++, which Qt is not.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-15 15:11:36 -08:00
Alexander Wilms
ac0d44bccf Update AppStream metainfo
Add more information to metainfo file and update it to the AppStream 1.0
standard

* Added screenshot caption, more URLs and a <launchable/> tag
* Replaced <developer_name/> with <developer/>

Now the file conforms to the AppStream 1.0 specification

Signed-off-by: Alexander Wilms <f.alexander.wilms@gmail.com>
2024-01-14 15:59:29 -08:00
Alexander Wilms
c92ebd1f3b Change AppStream metainfo file extension and path
The legacy /usr/share/appdata/*.appdata.xml path has been superseded by
/usr/share/metainfo/*.metainfo.xml

https://freedesktop.org/software/appstream/docs/chap-Metadata.html#spec-component-location

Signed-off-by: Alexander Wilms <f.alexander.wilms@gmail.com>
2024-01-14 15:59:29 -08:00
Berthold Stoeger
798e426926 cleanup: fix enum in profile.c
There are two enums related to the type of dive.
There is the global

enum divemode_t {OC, CCR, PSCR, FREEDIVE, NUM_DIVEMODE,
                 UNDEF_COMP_TYPE};

and the anonymous

enum {AIR, NITROX, TRIMIX, FREEDIVING} dive_type;

in struct plot_info.

In profile.c FREEDIVE (of divemode_t) is assigned to dive_type.
This only works because by chance(?) FREEDIVE and FREEDIVING are
the fourth element of each enum.

Fix this. C truly is a bad language when it comes to types
(very weak) and namespaces (non existing).

Contains whitespace fix.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-13 09:14:32 -08:00
Dirk Hohndel
1b7daeee22 CICD: improve release notice
This should make it clearer what the various files are. I wish we could sort by
file extension.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-12 14:17:39 -08:00
transifex-integration[bot]
4aafc304a1 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
fb567fe00b Removing subsurface_source.ts in de_DE
99% of minimum 100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
8173ebaf36 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
6d120cde59 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
bbd810367a Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
55c751e219 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
f4186dc076 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
e81a2b480f Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
21b5a58eda Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
ff82441946 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
2450080725 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
bdf40f02f3 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
8c60657ec8 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
d6d65fa673 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
c6f3a5bd47 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
transifex-integration[bot]
ef47d03478 Translate subsurface_source.ts in de_DE
100% translated source file: 'subsurface_source.ts'
on 'de_DE'.
2024-01-12 13:14:29 -08:00
Salvador Cuñat
5bae033f07 [scripts - docker] Fix build instructions
Current instruction to get the installer out the container will fail
with bash complaining about cp being a binary. Then would fail too
because subsurface-installer.exe doesn't exist any more.

Proposed instruction should work.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2024-01-10 21:10:31 -08:00
Dirk Hohndel
7d918aeef1 CICD: gracefully handle non merge pushes
Also improve the spacing of the merge text a tiny bit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 19:24:36 -08:00
Dirk Hohndel
9bf79c460a CICD: don't increment build number for pull requests
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 19:24:01 -08:00
Dirk Hohndel
eb4f3121bc CICD: clean up the noisy scripts
This all is way too verbose now that it apparently is working.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 19:14:25 -08:00
Dirk Hohndel
2f464c114d CICD: attempt to read file content in GH yaml
It is very strange that in some yaml files the $(<release-version) construct
works just fine, but in others it evaluates to an empty string, even though the
file is there an has the correct content.

Attempting to get more debugging info and also use a different expression to
extract the information.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 17:13:53 -08:00
Dirk Hohndel
8fb504941e the path confusion is vert annoying
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 16:58:08 -08:00
Dirk Hohndel
c2acdafcdf build-system: fix the APK filename for release upload
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 16:58:08 -08:00
Michael Keller
506a96f1f6 CICD: Fix GitHub Actions.
Fix the setting of environment variables in the android build.
Also fix a typo in the AppImage build.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-01-10 13:44:06 -08:00
Dirk Hohndel
53f6d1d606 build-system: remove pointless assignment
Suggested-by: Michael Keller <github@ike.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:44:06 -08:00
Dirk Hohndel
5b2d1a4506 build-system: get the buildnr file from the right directory
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:44:06 -08:00
Dirk Hohndel
ca5f7fa4bf build-system: correctly test that branch was created
That '-b' was exactly the wrong thing to do here...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:44:06 -08:00
Dirk Hohndel
744257149f build-system: push to origin instead of explicit URL
Otherwise we don't use the embedded credentials and the push fails.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:44:06 -08:00
Dirk Hohndel
9aa9bec914 build-system: use GitHub Actions outputs
Tempting as it is to think this is just like bash - yaml isn't bash at all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:44:06 -08:00
Dirk Hohndel
c0c447a5b6 build-system: don't discard the get-or-create-build-nr script output
That was the whole point of the previous change.
Also, run the build number creation on a pull request as well (at least for a
while) so we don't need to create new releases in order to test that part of
the process).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:44:06 -08:00
Dirk Hohndel
30efede730 build-system: small changes for better debugging
In order to make it easier to see what's happening inside get-atomic-buildnr.sh
write the result to a file that can be read by the caller. Not quite as
elegant, but hopefully more practical to see what's going wrong when no new
build number is created.

Make sure that post-releasenotes is successfull by actually posting a release
artifact (apparently the gh release action otherwise quietly fails).

Try to ensure we find the Android APK when uploading to the release.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 11:54:44 -08:00
Dirk Hohndel
c33e05c1d4 build-system: create release notes only once
Some experimentation showed what should have been obvious. The release
information is additive. So it's enough if ONE of the actions creates release
notes, all the others can simply add additional release artifacts.

To make this more obvious, this commit creates a new action that does nothing
but create the release notes and publish the release. Since it really doesn't
do anything else, it's likely to be the quickest to complete, but that doesn't
matter - the last action that has a body or body_path in the gh-release action
determines the release notes. And we now have exactly one action that does so.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 09:17:49 -08:00
Dirk Hohndel
14e715be6e build-system: assemble release notes using gh CLI
Instead of using a thirdparty action and painfully passing things around,
simply use the GitHub CLI (gh) and assemble the release notes on the fly.

This makes for much simpler and much easier to maintain code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-09 17:14:42 -08:00
Michael Keller
867d31bcbc Another Fix for the android Action.
Signed-off-by: Michael Keller <github@ike.ch>
2024-01-10 07:25:23 +13:00
Michael Keller
deab622c3e CICD: Fix the android Action.
Fix the android action.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-10 07:17:05 +13:00
Dirk Hohndel
13603a0878 build-system: avoid output that confuses the script
The get-or-create-buildnr.sh script writes a nice message to stdout which is useful
when using it interactively - but it broke the scripting; so redirect that output.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-08 21:38:38 -08:00
Dirk Hohndel
4f077ef00e build-system: fix incorrect path to helper script
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-08 18:01:03 -08:00
Dirk Hohndel
7286a76233 build-system: simplify GitHub Actions
Move both code and the release note text into files that can be shared between
multiple actions.

This should make the actions smaller and easier to read and since this is used
in several actions it should make things much easier to maintain.

In order to test this without too much unnecessary noise, this commit only
changes the android workflow - the others will be changed in a later commit
once his has been tested and works (again, this can really only be tested by
merging the PR into master).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-08 17:51:54 -08:00
Dirk Hohndel
f1ac55d322 build-system: replace repetitive GH Action code with script call
This is now much easier to maintain.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-08 17:51:54 -08:00
Dirk Hohndel
4527abe936 build-system: helper script for atomic build number
This way we don't have to replicate the same code in several .yml files for
GitHub Actions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-08 17:51:54 -08:00
Dirk Hohndel
2f587bb9a8 iOS: crash fix: don't try to deallocate IosShare
We have a strange crash on exit on iOS and this looks like the likely culprit.
And since it happens at app exit, I'm not too worried about leaking memory...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-08 16:17:45 -08:00
Michael Keller
e247d4cb3c CICD: Improve the Text for CICD Releases.
- add a note about the artifacts being added asynchronously
- add the commit message

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-08 03:14:01 -08:00
Michael Keller
b5efaf661c CICD: Improve Location of Scripts for the Android Build Environment.
Move around the scripts required for the setup of the build environment
for android to satisfy docker's requirement of locality.
This allows the removal of an extra copy step, and avoids the creation
of extra artefacts, while still providing the same functionality.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-08 23:05:44 +13:00
Michael Keller
ec83e157e9 Fixed android build GitHub action.
Signed-off-by: Michael Keller <github@ike.ch>
2024-01-08 20:16:46 +13:00
Michael Keller
d867701233 Update GitHub action to include signing.
Signed-off-by: Michael Keller <github@ike.ch>
2024-01-08 19:46:37 +13:00
Michael Keller
1eed75c599 Docker Build Changes.
Signed-off-by: Michael Keller <github@ike.ch>
2024-01-08 19:46:37 +13:00
Michael Keller
6f260bdfaf CICD: Add APK Signing for the Android CICD Pipeline.
Add signing of the android APK to the scripts used by the CICD pipeline.
Also update the example for running these scripts locally, and add the artefacts generated by doing so to .gitignore.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-08 19:46:37 +13:00
Dirk Hohndel
d066241ad8 iOS: use M.m.p short version and M.m.p.b full version
All version information has to be integers, but at least the full version
allows a fourth digit which we can increment for local commits.

Update the plist fragment and script accordingly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-07 17:46:26 -08:00
Dirk Hohndel
5fcfe5298a remove CICD release warning
I guess the version change worked better than expected. So we should be able to
drop the warning.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-07 17:46:26 -08:00
Dirk Hohndel
61169151a0 create a fresh version file on every build
Don't just append to the existing file.
This was incorrect for both iOS and Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-07 17:46:26 -08:00
Dirk Hohndel
0a46068501 remove app uuid
This hasn't been used on the backend in a long time (and appears to get
stripped out on several platforms). No point in keeping it around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-07 16:01:55 -08:00
Dirk Hohndel
ef35c3e8cb update copyright year and version details
While the update to the copyright year really isn't required, it just looks
better.

By using the canonical instead of the git version in user visible strings we
are creating more consistency in how we refer to the version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-07 16:01:55 -08:00
Michael Keller
7d751a8160 Re-activated the GitHub action to build and publish the docker image.
Signed-off-by: Michael Keller <github@ike.ch>
2024-01-06 20:16:57 -08:00
Michael Keller
8e8c69f749 Added git configuration for the new CICD build setup.
Signed-off-by: Michael Keller <github@ike.ch>
2024-01-06 20:16:57 -08:00
Michael Keller
e8dd3389a7 CICD: Update the android Build Docker Image.
Update the android build docker image:
- rebase on ubuntu 22.04;
- add tooling required to sign APKs;
- changes to make the container re-usable;
- change to a multi-stage build to keep the image size smaller;
- generic improvements to the Dockerfile

Also update the example script for how to use the container.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-06 20:16:57 -08:00
Michael Keller
62ca2d5b85 CICD: Ignore Artefact from CICD Versioning
Ignore the `nightly-builds` directory added by the versioning scripts
for the new CICD builds.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-06 13:22:26 -08:00
Dirk Hohndel
2a7628483e don't quote globs...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 12:33:31 -08:00
Dirk Hohndel
c4cb913426 adjust Launchpad package make script to new version logic
Also address some shellcheck issues.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 11:42:26 -08:00
Dirk Hohndel
5075e7f127 adjust Copr package make script to new version logic
Also address some shellcheck issues.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 11:42:15 -08:00
Dirk Hohndel
de8dc87ecf reorder Copr yaml
We need to have git setup before trying to get the build number.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 11:19:35 -08:00
Dirk Hohndel
aea2f36de2 rename variable in get-version script
Yeah... that looks better. Thanks @mikeller.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 10:55:24 -08:00
Dirk Hohndel
7b59749bcb Add warning about changes to release announcement
This SHOULD work - but of course I can't test it until I try.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 10:55:24 -08:00
Dirk Hohndel
62477d8c65 Complete redesign of Subsurface version numbers
- for now all versions start with v6.0
- CICD builds use the monolithic build number as patch level, e.g. v6.0.12345
- local builds use the following algorithm
  - find the newest commit with a CICD build number that is included in the
    working tree
  - count the number of commits in the working tree since that commit
  - if there are no commits since the last CICD build, the local build version
    will be v6.0.12345-local
  - if there are N commits since the last CICD build, it will be
    v6.0.12345-N-local
- test builds in the CICD that don't create artifacts simply use a dummy release
  in order to not incorrectly increment the build number and also not to waste
  time and resources by manually checking out the nightly-build repo for each of
  these builds.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 10:55:24 -08:00
Dirk Hohndel
8a2dd8db74 Finally remove some of the Travis related scripts
These haven't been used in many years.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 10:55:24 -08:00
Dirk Hohndel
fe4c602117 minor cleanups to get-or-create-build-nr script
Deal with shellcheck warnings and make the script less noisy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 10:55:24 -08:00
Dirk Hohndel
504a9b6efe use our monotonic buildnr for the Android builds
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 10:55:24 -08:00
Dirk Hohndel
fa8db5f3f7 change format of nightly build release numbers
They are now the four digit version dash build nr
So major.minor.patch.commitsSinceTag-buildNr

This makes it easier to correlate the release name and a specific manually
built version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 10:55:24 -08:00
Dirk Hohndel
58fb49f243 retire the mobile version
Both Subsurface and Subsurface-mobile will share the same version number moving
forward.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-06 10:55:24 -08:00
Dirk Hohndel
60f1deb116 fix iOS simulator builds
With this hopefully the GitHub Action will pass again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-02 20:47:32 -08:00
Dirk Hohndel
b67aebd462 recreate a working iOS device build
The current XCode and Qt 5.15.2 (the newest version that we can use due to Kirigami
and the lack of binaries for the later open source releases of Qt 5.15) have some
issues. Work around those.

Also, don't create fat armv7/arm64 binaries anymore for iOS - there are no supported
armv7 devices anymore.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-02 20:47:32 -08:00
Michael Keller
de5311033c Planner: Increase CCR Setpoint Precision to 0.01.
Increase the precision of the setpoint that can be specified per planned
leg of the dive to 0.01 mbar.
Some rebreather models (APD Inspiration) support this precision for
setpoint setting.

Motivated-by: https://groups.google.com/g/subsurface-divelog/c/pD5gYlG5szI/m/G8_as4TyBwAJ
Signed-off-by: Michael Keller <github@ike.ch>
2024-01-02 10:28:30 -08:00
Dirk Hohndel
8992ca629d add Ko-Fi as sponsorship option
Documentation about all this on GitHub is a bit confusing.
I'm not entirely sure that this is the way to go. But I can't try
until this gets merged into master.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-29 14:20:52 -08:00
Dirk Hohndel
3e82973361 some explanations for the different servers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-29 14:20:52 -08:00
Dirk Hohndel
f4cac010ae additional git error info
I ran into this a couple of times where the debug output didn't seem to
make any sense until I understood that libgit simply didn't give me
detailed error info.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-29 14:20:52 -08:00
Dirk Hohndel
7792e227da add two more cloud servers to the rotation
This is not a great way to load-balance, but it works and doesn't require
high end hardware on the backend.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-29 14:20:52 -08:00
Michael Keller
b3d2a8cdcb Build system: Fix Local Build Script for android.
Change the name of the `GITHUB_WORKSPACE` environment variable in the
android build script to `OUTPUT_DIR`, which is more intuitive when the
script is used for local builds.
Also test if the variable is defined before attempting to use it as the
target of the build output.

Signed-off-by: Michael Keller <github@ike.ch>
2023-12-19 00:00:54 +13:00
transifex-integration[bot]
733ffb787a Translate translations/subsurface_source.ts in ca
100% translated for the source file 'translations/subsurface_source.ts'
on the 'ca' language.
2023-12-17 16:41:10 -08:00
Salvador Cuñat
a8e3cd97cd Do not try to import SLG file format 1000
This is the oldest format I know for SmartTrak databases. Probably the
first one.  It just supports one tank, only air/nitrox and the format of
the database is dramatically different from the other two formats known
to me.
It has different tables, and the "Dives" table differs a lot from newer
versions.
I don't think it's worth to give support for this format, as newer
versions of SmartTrak software automatically comvert the oldest format
to newer one.  Thus, finding a lot of this format files is not expected
except from some corner cases of users who had not updated their
SmartTrak software for years now.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2023-12-16 17:51:47 -08:00
Salvador Cuñat
e3a32f7e92 [smtk-import] Move to current mdbtools github repo
Original mdbtools developer gave up the project some time ago, and it's
continued with his permission in a forked repo:
	https://github.com/mdbtools/mdbtools.git

There was a nasty bug in libmdb, triggered under some rare circustances,
that is solved in the new repo which is, BTW, under current
development.

Move our scripts to the new repo and set our working version to the
latest release tag, currently, "v1.0.0"

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2023-12-17 11:05:32 +13:00
Michael Keller
3d902864ed CICD: Don't generate build number for pull requests.
Prevent attempts to generate a build number for pull request builds as
they will fail due to the lack of permissions on the
`subsurface/nightly-builds` repository.

Signed-off-by: Michael Keller <github@ike.ch>
2023-12-17 09:05:31 +13:00
Dirk Hohndel
fa609a9e9b Fix workflow issue caused by backwards incompatible component
Thanks to @probonopd for suggesting this fix.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-15 13:48:49 -08:00
Dirk Hohndel
0edb1c71d8 don't try to create a version on pull requests
The necessary keys to do so aren't available (and of course we don't try
to post a release on pull requests, anyway).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-15 13:48:49 -08:00
Dirk Hohndel
57b355b314 Merge branch 'CICD-updates'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-12 09:29:13 -08:00
Dirk Hohndel
94c47f64ac create script to determine build number
What a pain. It turns out that github.run_number is counting the number of
times a specific workflow has been run - but that's different for different
workflows, so using that won't get us a single tag with all the corresponding
build artifacts.  And sadly I can't find a simple atomic way to increase a
GitHUb repo variable, so I came up with this somewhat convoluted dance, using
the the fact that a push to an existing brach that isn't a fast-forward will
fail.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-11 13:44:41 -08:00
Dirk Hohndel
b63b286f2e remove tag creation in Windows workflow
This is being rewritten as we speak - and right now this prevents
the Windows workflow from running.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-11 06:43:18 -08:00
Michael Keller
a38d83af24 CI/CD: Update codeQL versions. 2023-12-11 06:40:22 -08:00
Michael Keller
b84e06ae42 CI/CD: Fix 'Snap USNs' Action.
Fix the 'Snap USNs' action.
According to https://bugs.launchpad.net/lazr.restfulclient/+bug/2041407
the an incompatibility is introduced by the move from python 3.11 to
3.12, and a workaround is to pin the version to 3.11.

Signed-off-by: Michael Keller <github@ike.ch>
2023-12-11 06:40:22 -08:00
Michael Keller
5ad75e81c3 Mobile: Add Warning About Delay for Initial Synch.
Add a warning to the initial login screen telling the user that the
first synchronisation can take a few minutes.
Fixes a misunderstanding pointed out in a recent post in the Subsurface
mailing list.

Signed-off-by: Michael Keller <github@ike.ch>
2023-12-11 23:17:14 +13:00
Dirk Hohndel
3da943dc8a better release notes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-10 17:23:54 -08:00
Dirk Hohndel
d76354c48c switch Android and Windows to do nightly builds
This way our ongoing releases will be in their own repo.
Also, use a nicer date format (at least I think this looks nicer).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-10 17:23:54 -08:00
Dirk Hohndel
841c100a1e remove redundant Homebrew dependencies
Those are provided by the default image - so let's list only the ones that are
net new.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-10 17:23:54 -08:00
Dirk Hohndel
dee49979d1 publish the result in the nightly-builds repo
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-10 17:23:54 -08:00
Dirk Hohndel
d2f2f22dc1 don't build the macOS version twice on GitHub
We need some additional options when building the package, so let that script
handle the details and use the generic build script mainly for the dependencies.

Also let's not mix building for testing and building the DMG - just so I can
stay somewhat sane.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-10 17:23:54 -08:00
Dirk Hohndel
3a98b8a722 more macOS build fixes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-10 17:23:54 -08:00
Dirk Hohndel
b070b32e93 latest libftdi requires confuse
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-10 17:23:54 -08:00
Dirk Hohndel
f5c1f7204a use current version of libftdi1
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-10 17:23:54 -08:00
Dirk Hohndel
2ffba35d45 Build a macOS DMG in a GitHub Action
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-10 17:23:42 -08:00
Jef Driesen
c572148ab6 Always rebuild when local changes are present
Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-12-10 15:56:44 +13:00
Jef Driesen
19dd25c71c Get the SHA1 when no tag is present
The 'git describe' command finds the most recent tag instead of the
SHA1. When trying to build from a repository without any tags, for
example in a fork, this causes the build to fail.

Use the '--always' option to fallback to the SHA1 in case no tag is
present.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-12-10 15:56:44 +13:00
Dirk Hohndel
e26dd30165 remove references to the test branch
This was useful as it helped to more quickly iterate through tests, but long term
isn't what we want.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 18:10:32 -08:00
Dirk Hohndel
1d150b106d create the APK with an apk build
Using the apk that is built as a side effect of an aab build does not work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 17:39:32 -08:00
Dirk Hohndel
6bbade9845 only create releases on push
Pull requests can be triggered by anyone - we should not publish code
that comes in through pull requests to either GitHub releases or
Launchpad, Copr, etc.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 10:10:26 -08:00
Dirk Hohndel
f0ef8b51fc Fix Android APK renaming
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 09:53:25 -08:00
Dirk Hohndel
e95fbb7279 adjust upload globs
Hopefully this will deal with all future naming changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 04:14:22 -08:00
Dirk Hohndel
f252af1dd1 prevent the 'latest' tag from messing with our version
We need to use git describe in a way that only refers to vX.Y.Z style tags.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 04:00:32 -08:00
Dirk Hohndel
c609bc9446 more logical naming for the Android apk
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 03:27:54 -08:00
Dirk Hohndel
c0c361f40f more logical naming of Windows artifact
And make sure the latest tag ends up on the right sha.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 02:57:30 -08:00
Dirk Hohndel
2d63591ab8 build Windows artifact with new container
This should get us a current version of Qt and many other newer libraries.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 01:47:27 -08:00
Dirk Hohndel
9cfe656342 update MXE build container
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 01:33:08 -08:00
Dirk Hohndel
2463b315bb Create GitHub release with Windows artifacts
This is using the outdated existing build container. Updating that one should
be next on the todo list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 01:33:08 -08:00
Dirk Hohndel
cc5a5a22bd add Android .apk to release from GitHub Action
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-07 01:33:08 -08:00
Dirk Hohndel
b0228b51ed launchpad build: link against dynamic libgit2 system library
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
b05d15933f add Fedora COPR to the README
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
41b5bbb226 add Launchpad PPA build
Could it be this easy? There's no way it's this easy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
243d6bfd2b stop building our own libgit2 for Ubuntu
It's embarrassing that we kept doing this for so long. Debian and Ubuntu
have had new enough versions of libgit2 for a very long time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
8e212c0858 Fedora Rawhide builds fail without stdlib include
Implicit declarations of malloc, free, atoi, and others are considered an
error now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
8bf8f18962 trigger Fedora COPR build from GitHub
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
8192379a84 update INSTALL for Debian Bookworm
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Micha WERLE
c612641517 fix: actually default bottom gas to air
If there are no gas mixes returned by libdivecomputer, we need to default to air. The previous commit would have defaulted to pure oxygen.

Signed-off-by: Micha WERLE <micha@michaelwerle.com>
2023-11-21 22:30:45 +13:00
Micha WERLE
4842344bc1 feat: extend bottom gas instead of last mix
During code review, an argument was made to use the bottom gas mix as
the mix to fill additional tanks with instead of the last mix reported
by the dive computer.

This change implements `get_deeper_gasmix` which compares two gas mixes
and returns the one with the lower MOD. This comparison does not perform
actual MOD calculations but only performs a  relative oxygen and helium
content comparison.

Instead of saving the last gas mix and assigning it to additional tanks,
a `bottom_gas` mix is saved and assigned instead.

Signed-off-by: Micha WERLE <micha@michaelwerle.com>
2023-11-21 22:30:45 +13:00
Micha WERLE
d0b95f9401 refactor: revert questionable optimisation
Reverted "optimisation" based on code feedback.

Firstly, it's implementation-defined whether or not a stack frame is created for sub-scopes, secondly any optimisation is questionable regardless, and thirdly it was felt that it makes the code harder to understand.

Signed-off-by: Micha WERLE <micha@michaelwerle.com>
2023-11-21 22:30:45 +13:00
Micha WERLE
c7171179b3 Core: extend last gas mix instead of defaulting to air.
Instead of defaulting to air when we run out of gas mixes to assign to
cylinders, use the last gas mix provided by the dive computer.

If no gas mixes are provided at all, then default to air.

This prevents Subsurface from "inventing" gas mixes which are not
reported by the dive computer. It also works very nicely with a sidemount
configuration where the dive computer typically reports two cylinders but
only a single gas mix.

Signed-off-by: Micha WERLE <micha@michaelwerle.com>
2023-11-21 22:30:45 +13:00
Dark Dragon
5c2e4c395b Fix AppStream ID
See https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html\#tag-id-generic

Signed-off-by: Dark Dragon <darkdragon-001@web.de>
2023-11-07 08:50:28 +13:00
Dirk Hohndel
ede732418b build-system: use gcc 10 for MXE builds
It's unclear if this will be enough to use gcc 10 by default when building
Subsurface using this container.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-11-06 07:56:05 +13:00
Jef Driesen
1abf400c63 Return the actual libdivecomputer error code
The divecomputer_device_open() function tries all supported transports
one by one, and exits as soon as one is opened successfully. When the
end of the function is reached, the DC_STATUS_UNSUPPORTED error code is
returned.

The annoying side effect is that the actual error code returned by the
transport is ignored and changed into DC_STATUS_UNSUPPORTED. This is
very confusing while troubleshooting download problems.

Fixed by initializing the error code to DC_STATUS_UNSUPPORTED, in case
no transport is available for trying, and returning the last reported
error to caller.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-11-05 06:54:40 +13:00
Jef Driesen
2a3c0d981f Add BLE detection for the Aqualung i330R and Apeks DSX
Add the Aqualung i330R and Apeks DSX model numbers to the Pelagic
pattern table. These two models also use a new BLE service UUID.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-11-04 23:03:09 +13:00
Jef Driesen
0d69758cac Add support for the Divesoft BLE service
The UUID of the Divesoft BLE service needs to be added to the list of
known services. It's a 16-bit UUID that gets detected as a standard
service and is ignored otherwise.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-11-04 23:02:54 +13:00
Michael Keller
07a028b14d Desktop: Simplify the get_dive_gas() function.
Remove branches that are always taken or make no difference, as proposed in
https://github.com/subsurface/subsurface/pull/3974#pullrequestreview-1674178375.

Signed-off-by: Michael Keller <github@ike.ch>
2023-10-20 17:16:05 +02:00
Anton Lundin
8d3f2e4ca6 Add another test for formatDiveGasString
This adds a test for the bug just fixed, where we have a trimix gas and
nitrox/air with less o2 than the trimix.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
94164bb8fa Correctly update mino2
When we've already seen a trimix gas, of we after that see a nitrox gas
with less o2, it shouldn't update the mino2 state.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
5444a6b65d Remove unnecessary QString
I thought it would solve the unicode issues I had, but it was
unnecessary.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
a681ff3410 Add even more tests for formatDiveGasString
Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
bba0da589b Add tests for formatDiveGasString
This adds tests for formatDiveGasString to ensure it produces the
expected results in some scenarios.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
725b70e64c Correctly find min o2 in get_dive_gas
When the import from a dive computer gives you 100% as the first gas,
the get_dive_gas never finds which gas had the lowest o2 percent.

This fixes the logic to find the lowest o2 percent in any dive cylinder
list.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
8f4b6cfcb9 Ignore not used cylinders in get_dive_gas
Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
fea074986a Ignore oxygen cylinders in get_dive_gas
It looks kinda strange that all CCR dives have a dive gas ..100%, so
rather than showing it as the dive gas used, just ignore cylinders
with usage flagged as oxygen.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
b6111714b3 Use horizontal mouse wheel for zoomed panning
Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-13 21:41:41 +13:00
Anton Lundin
bfe61b2dff Add dive mode as possible column
Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-13 08:32:27 +13:00
Jef Driesen
c7b7c3f691 Add support for the new Ratio bluetooth name
The new Ratio iX3M 2 models use "RATIO-" as the prefix in the bluetooth
name instead of "IX5M".

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-10-07 23:30:27 +13:00
Richard Fuchs
3c5f22ac25 Fix certificate_check_cb() return value
libgit documents the return value of callbacks.certificate_check[0] as
0 for success and <0 as failure. Returning 1 for success (kind of)
works because some parts of libgit[1] check for <0 return values and
only treat those as errors, but the function actually calling the
callback (check_certificate) treats anything non-zero as error[2] and
ends up setting a spurious error message with a return value of 1.

[0] https://libgit2.org/libgit2/#HEAD/group/callback/git_transport_certificate_check_cb
[1] https://github.com/libgit2/libgit2/blob/maint/v1.5/src/libgit2/transports/httpclient.c#L1054
[2] https://github.com/libgit2/libgit2/blob/maint/v1.5/src/libgit2/transports/httpclient.c#L785

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2023-10-06 11:58:36 +13:00
Dirk Hohndel
c5feae126b truly switch to focal as oldest supported Ubuntu release
Thanks to @mikeller for catching my oversight here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-09-26 21:13:05 -07:00
Dirk Hohndel
947c2e704f remove unsupported versions and add newer ones
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-09-26 21:13:05 -07:00
Michael Keller
7165660a45 Fix Invalid Action Version Specification in Check USNs Workflow.
Fix Invalid Action Version Specification in Check USNs Workflow.

Signed-off-by: Michael Keller <github@ike.ch>
2023-09-27 07:42:49 +13:00
Michael Keller
aa9f3843eb Fix Deprecation Warnings in 'Check USNs' Workflow.
Fix deprecation warnings for actions using a deprecated version of node.
Also switch to a fixed version of the environment in order to avoid
future deprecation warnings.

Signed-off-by: Michael Keller <github@ike.ch>
2023-09-26 23:17:09 +13:00
Michael Keller
c78c91fb66 Switch to the 'Unofficial Coverity Scan' Action.
Signed-off-by: Michael Keller <github@ike.ch>
2023-09-26 23:16:36 +13:00
Michael Keller
70aefd4db4 Fix coverity Scan Workflow.
Update the virtual machine to run on Ubuntu 22.04 ('latest' at the time
of writing).

Signed-off-by: Michael Keller <github@ike.ch>
2023-09-26 23:16:36 +13:00
Jef Driesen
97a76a6615 Report an error if enabling notifications fails
If enabling the notification fails, receiving data packets is not
possible. Instead of silently ignoring this fatal problem and trying to
continue, report the error back to the caller.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-09-14 09:52:29 +12:00
Robert C. Helling
81f35c1ecf Properly handle the planner state
This does two independent things:

It sets the planner state early enough so the appropriate
default profile for the planner is created (without
safety stop).

Upon cancelling the planner, it resets the profile widget
to profile more (rather than planner) as otherwise upon
the next change into the planner the planner model is
not properly initialized.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2023-09-12 06:48:33 +02:00
Robert C. Helling
83e7f537fb Text versions of Subsurface icon
To be used on Subsurface merch, this introduces versions
of the Subsurface icon with the program's name and web
address.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2023-08-16 12:11:23 +02:00
Michael Werle
fae68b7a68 fix: merge_pressure does not calculate starting pressures correctly
The existing logic correctly calculates the minimum (ie, ending) pressure, but not the maximum
(ie starting) pressure.

For example, 2 tanks A and B with manual pressures (same tank on subsequent dives, which were
then merged):
A: 205 - 84
B: 83 - 55

When merging the starting pressures, the call is : merge_pressure(205, 0, 83, 0, false)

The final comparison is:
  if(false && 205 < 83) return 205;
  else return 83;

-> So 83 is returned even though 205 should have been.

Signed-off-by: Michael Werle <micha@michaelwerle.com>
2023-08-09 14:35:32 +02:00
Michael Keller
26f20b805d Desktop: Consider Severity when Hiding Events.
When events are hidden in the profile, only hide events with the same
name and the same severity (flags).
From discussion in https://github.com/subsurface/libdc/pull/54.

Signed-off-by: Michael Keller <github@ike.ch>
2023-08-04 01:11:12 +12:00
Michael Keller
b324849d0c Housekeeping: Update libdivecomputer Submodule.
Update `libdivecomputer` submodule to the latest version.

Signed-off-by: Michael Keller <github@ike.ch>
2023-08-03 00:08:59 +12:00
Michael Keller
8f0380fd05 Equipment: Fix 'used' Gas Selection for CCR Dives.
Fix how gases are marked as 'used' and kept from being deleted in the
equipment tab for CCR dives.
It does not make sense to treat the (arbitrary) first gas in the list
with a usage type of 'diluent' or 'oxygen' as 'used' and prevent the
user from deleting it. Dive computers report the initial diluent and
any other diluents used through a 'gaschange' event, so the actually
used diluents are already picked up as part of gaschange event based
logic.
Also clarify the selection of the first diluent used as a default if no
gaschange events exist.
Also fixed the test data - gases that have a pressure change should be
included in the profile if they do not have a gas change recorded
against them by other dive computers, even if they are oxygen.
A secondary problem shown by this is that the pressure change is not
applied to the profile - the pressure is currently shown as constant on
the start pressure. But this is for another pull request.

Signed-off-by: Michael Keller <github@ike.ch>
2023-07-25 12:05:51 +12:00
Michael Keller
5fae7ce7a0 Equipment: Include Unused Tanks in Merge if Preference is Enabled.
Include unused tanks in merges of multiple logs into a single dive if
the 'Show unused cylinders' preference is enabled.
Also rename the preference (in code) to `include_unused_tanks` to
reflect the fact that it is already used in more places than just the
display (exporting, cloning dives).
Simplified the cylinder model to make forced inclusion of unused tanks
dependent on use of the model in planner.
Leaving the persisted name of the preference as `display_unused_tanks`
to avoid resetting this for all users - is there a good way to migrate
preference names?

Signed-off-by: Michael Keller <github@ike.ch>
2023-07-25 11:19:03 +12:00
Michael Keller
cb6f768865 Equipment: Mark Gas Mixes Reported as 'inactive' as 'not used.
Mark gases that are reported as 'inactive' by the dive computer as 'not
used' in the Equipment tab.

Requires https://github.com/subsurface/libdc/pull/52.

Signed-off-by: Michael Keller <github@ike.ch>
2023-07-23 18:55:20 +02:00
Michael Keller
5e293689fd CI: Disable Broken Ubuntu bionic Build.
Disable the build, as this has not been working for some time, and is
creating a distraction.

Signed-off-by: Michael Keller <github@ike.ch>
2023-07-23 15:48:00 +12:00
Rafael M. Salvioni
8f8f901aa8 Check "hasDCSalinity" is null in updateWaterTypeWidget()
Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-07-14 19:47:34 +12:00
Michael Keller
5511cd13d7 Add forcedFirmwareUpgradeSupported to supportedDivecomputers.
Signed-off-by: Michael Keller <github@ike.ch>
2023-07-11 07:30:49 -07:00
Michael Keller
4ac27e3c71 Desktop: Load the Dive Computer List in 'Configure Dive Computer' Dynamically.
Load the dive computer list in the 'Change Settings on Dive Computer'
dialog dynamically.
Also incorporate suggestions from
https://github.com/subsurface/subsurface/pull/3925#issuecomment-1595784076.

Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Michael Keller <github@ike.ch>
2023-07-11 07:30:49 -07:00
Rafael M. Salvioni
695c37499a Core: Fix bug salinity and pressure values in mbar <-> depth conversion
The conversion between mbar and depth sometimes uses DC's salinity, sometimes user's salinity. By other hand, it uses surface pressure given by user in calculation.
This fix try to standartize this values, using them from same source.

Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-07-11 13:26:24 +12:00
Rafael M. Salvioni
1e082affdd Fix salinity combo/icon when DC doesnt have salinity info
Today salinity combo is editable if one of these rules matches: The dive was manually entered or if salinity edition is allowed in preferences.
However we can have cases that dives were downloaded but its doesn't have salinity info.

This fix considers if there's a DC salinity info to decides combo edition and if salinity change indicator will be showed or not.
If DC doesn't have salinity, the UI behavior is the same of a manual dive

Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-07-09 20:36:46 +12:00
Michael Keller
90e5de8357 Mobile: Make Cloud Auto Synch Status Easier to Understand.
Add an explicit checkbox to the 'cloud auto synch' status toggle in the
mobile 'Dive Management' menu in order to make it more intuitive to
understand.
This isn't super pretty, but I think it will improve the usability. A
prettier way to achieve this will be to redesign the `ic_cloud_off.svg`
/ `ic_cloud_done.svg` in order to make them intuitively recognisable as
unchecked / checked checkboxes.
Example of a support request caused by confusion from the current
implementation: https://groups.google.com/g/subsurface-divelog/c/9X-hTt9NFlE/m/ZcqtdOOhBQAJ

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-26 07:54:48 -07:00
Michael Keller
e260780c9d Export: Fix Cylinder Pressures in CSV Export.
Fix the cylinder pressures in the CSV summary export. Only show
pressures derived from `pressure` attributes in samples for the first
cylinder. Add support for showing pressures derived from `pressure0` ...
`pressureX` attributes.
Also cleaned up unit conversions, and changed tabs to spaces.
From discussion in
https://github.com/subsurface/subsurface/pull/3906#issuecomment-1575980882.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-25 16:24:52 -07:00
Salvador Cuñat
5d708c0d92 Build script: Qt has tagged versions currently
It looks like Qt company has LGPLed versions tagged wich simplifies
things a bit while building, e.g. 5.15.3 current workaround matches
"v5.15.3-lts-lgpl" tag.

Background: Debian Sid is currently at Qt 5.15.8 which is impossible to
build from scratch with current script as only a few git versions are
tagged in the script format "v5.15.8".

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2023-06-25 09:47:56 -07:00
Michael Keller
ce67c8b902 Desktop: Add a Button to Hide the Infobox in the Dive Profile.
Add a button that allows the user to hide the infobox with statistics
about the point in the dive under the mouse cursor in order to be able
to see the full dive profile unobstructed.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-25 14:40:23 +02:00
Michael Keller
b5007bde67 Desktop: Regroup File Menu Entries.
Regroup the file menu entries to give the dynamically generated
'recently opened files' their own section.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-17 20:19:35 +02:00
Michael Keller
bceb367dc3 Cleanup: Use Correct Naming for Private Members.
Rename inconsistently named private members introduced in #3923.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-17 17:18:35 +02:00
Michael Keller
b0d5b23227 Desktop: Add Meaningful Error Messages for libdivecomputer Dump.
Add meaningful error messages when creating a libdivecomputer dump. In
particular show if creating a dump is not supported on the dive computer
that is used.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-17 12:06:34 +02:00
Michael Keller
a0cb6ad6d7 Desktop: Remove Unused Class Members.
Remove unused class member variables in
`profile-widget/diveprofileitem`.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-16 15:49:40 +02:00
Michael Keller
700bba7e30 Desktop: Use Persisted Device Information for Dive Computer Configuration.
Use the dive computer / device information that was persisted when
previously downloading dives or configuring the dive computer in the
dive computer configuration dialog.
Also rename 'Connect with bluetooth' and 'Cancel' buttons in the dialog
to make them more consistent with what they do.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-12 12:40:44 -07:00
Michael Keller
35d88fa6ce Build: Fix build warning on MacOS.
Fix a build warning for an unused variable.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-12 08:04:30 -07:00
Berthold Stoeger
3939cc8da2 core: use range based for and std::string in enumerate_devices()
Just because now we can...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-06-03 12:54:24 +02:00
Berthold Stoeger
81cd91f78b core: more std::[w]string conversions in windows.cpp
No free()in necessary means less convoluted control flow.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-06-03 12:54:24 +02:00
Berthold Stoeger
a3f540fe34 core: fix warnings in windows.cpp
The compiler was (correctly) complaining about a const char *
to char * conversion.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-06-03 12:54:24 +02:00
Berthold Stoeger
540cba07f3 core: use C++ std::strings for default directory and filename
The memory management and string concatenation was hard to follow.

Since the mobile files ios.cpp and android.cpp were already
converted to C++, let's do the same for Unix, Windows and MacOS.

Simply store the default directory and filename in a function-level
static string. Thus, it will be initialized on first call and
freed on application exit. Since the std::string data is
guaranteed to be contiguous and zero-terminated, it can be used
from C code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-06-03 12:54:24 +02:00
Michael Keller
7771b444a1 Build system: Fix Windows Build Script.
Fix a bug preventing the `mxe` symlink from being created.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-01 07:04:50 -07:00
Michael Keller
4c193d7bdf Desktop: Rework the Summary CSV Export XSLT.
Rework of the XSLT used to generate the Summary CSV export:
- fixed a bug causing invalid CSV to be generated for double quotes
  (`""`);
- changed quoting and escaping to be compliant with RFC 4180;
- changed output to contain information for all cylinders for all dives
  (instead of limiting the number of cylinders to howevermany are used
   for the last dive);
- added an index to the cylinder data headings;
- changed unit designators to use `[]` instead of `()`;
- some minor improvements to the XSLT.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-31 20:11:39 +03:00
Michael Keller
a127c4ac63 Mobile: Make Gradient Factor Range Consistent with Desktop.
Change the range to be 10 to 150.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-30 16:21:41 +02:00
Michael Keller
50438b0456 Mobile: Fix Editing of Gradient Factors
Fix the issue that Gradient Factors cannot be set to 100 in the mobile
version. This is done by changing the edits from a text box to a spin
edit, which seems to be a better match for numerical values.
As a side effect this also solves the issue that the keyboard for the
text edit is not properly displayed when settings are opened when dive
details are already on the page stack.

Fixes #3911.

Reported-by: @gbetous
Signed-off-by: Michael Keller <github@ike.ch>
2023-05-30 16:21:41 +02:00
Michael Keller
5d7f294407 Desktop: Rework Setting of Custom Date / Time Formats.
Rework the setting of custom date / time format preferences:
- fix bug causing case changes if custom format case insensitively
  matches a drop down entry;
- fix invalid format examples in tooltip;
- update URL for the format documentation;
- add support for quoted literals to the format validity warning.
From discussion in
https://github.com/subsurface/subsurface/issues/3849#issuecomment-1481239270.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-30 11:24:37 +02:00
Michael Keller
6002387d7b Desktop: Add Multi-Tank Support for Profile Ruler.
Add support for tracking the gas usage across multiple tanks to the 'bar
used' and SAC values shown for the profile ruler.
The following rules are implemented:
- a tank is considered 'used' if at least one bar has been consumed;
- only used tanks are taken into account for calculations;
- 'bar used' is only shown if all tanks used have the same (or unknown)
  volume;
- SAC is only shown if all tanks used have a known volume.

Fixes #3902.

Reported-by: @pabdakine
Signed-off-by: Michael Keller <github@ike.ch>
2023-05-30 11:21:12 +02:00
Michael Keller
62c2e9f07c Libraries: Update libdivecomputer.
Update libdivecomputer to include the changes from the libdivecomputer
v0.8.0 release:
- Divesoft Freedom and Liberty support
- A couple of iostream abstraction layers: a new 'packet layer' and a
  HDLC layer, moving code from low-level dive computer downloaders to
  generic iostream layers.
- misc minor updates

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-28 14:13:29 -07:00
Michael Keller
7ee5b10810 Desktop: Remove 'renderSVGIcon' methods.
Remove `renderSVGIcon()` and `renderSVGIconWidth()`, as QPixmaps can be
loaded directly from SVG, and support scaling.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-28 14:11:37 -07:00
Michael Keller
2ef6cd89cc Desktop: Use SVG directly for icons.
Use SVG files as source for icons where they exist, and remove the
respective PNG artefacts generated from the SVG files from the
repository.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-28 14:11:37 -07:00
Michael Andreen
9e95746797 profile: Fix so min pressure is not always 0
Signed-off-by: Michael Andreen <michael@andreen.dev>
2023-05-23 13:12:48 +02:00
Michael Andreen
7217506072 profile: Use all sensors to scale the pressure graph
It's possible for the first sensor to start with a pressure
significantly lower than other sensors.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2023-05-23 13:12:48 +02:00
Berthold Stoeger
a7889d1f4e cleanup: fix typo: verboseEnabebled -> verboseEnabled
Not really relevant, because it only affects debugging output.

But shows why I dislike weakly typed, non-compiled languages.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-05-20 20:07:22 +02:00
Michael Keller
9e059be4ca Android: Improve build instructions
Improve the build instructions for Android. Provide a complete script
for building in a re-usable container.
Also changed the Android packaging README to markdown.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-20 07:49:30 -07:00
Michael Keller
2aa13ea9d7 Desktop: Add mergeing into the selected dive site.
When editing a dive site in the 'Dive sites' view, add a context menu
entry to allow mergeing of the displayed dive site into the dive site
seleted in the 'Near dive sites' list.
This merge has the opposite direction of the existing 'Merge into
current site' function, which can simplify the workflow when maintaining
a large number of dive sites, as the facilities to sort dive sites in
the 'Dive sites' view does not have a way to sort by location or
proximity.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-20 07:24:39 +02:00
Michael Keller
84d9d0abe7 Desktop: Fix incorrect use of 'free()'.
Use 'xmlFree()' to free memory returned by libxml.
Follow-up to #3900.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-19 10:51:02 +02:00
Michael Keller
d7bfb9d61e Desktop: Fix memory leak during XSLT transformation.
Fix a memory leak occurring during XSLT transformations.

Fixes #3899.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-18 16:44:15 +02:00
Michael Keller
361baeda01 Fixed CSV parsing tests.
We now parse CSV and not TSV files.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-18 10:31:31 +03:00
Michael Keller
1bd7806dcf Desktop: Change 'CSV summary dive details' output from TSV to CSV.
Change the output formato for the Export / 'CSV summary dive details'
from TSV to CSV, to make it consistent with the menu item name, and with
the other 'CSV' export function.
This was changed to TSV by @mturkia in
6c82578540,
but I could not find any discussion as to why.
Also removed replacement of the field separator in any fields, as,
according to the CSV RFC (https://datatracker.ietf.org/doc/html/rfc4180)
this is not required as long as the fields containing separators are
enclosed in quotes, and any quotes within the fields are doubled up.
Tested with a fairly large log file, and importing into Google Sheets is
working fine for the output produced.
Also made capitalisation of the Export menu items consistent.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-18 10:31:31 +03:00
Berthold Stoeger
cf95c3bd82 cleanup: remove unnecessary string duplication
I don't understand why the functions must be called on a copy
of the string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-05-02 09:35:01 +02:00
Michael Keller
15bf145f14 Desktop: Fix build for Qt6
This seems to be needed to make the build work with Qt6, which is needed for M1 based Macs.

Signed-off-by: Michael Keller <github@ike.ch>
2023-04-26 07:14:07 +02:00
Michael Keller
e60baff940 Desktop: Fix bug when synching to the cloud
Fix a bug introduced in 8cd451fc338da275f66b15181894e37621698109 causing
an error to be thrown every time trying to do 'Save to cloud storage'.

Signed-off-by: Michael Keller <github@ike.ch>
2023-04-21 15:18:49 +02:00
Berthold Stoeger
a8d2b2ff70 divelog: fix erroneous use of std::move()
This has to be applied to the object, not the pointer to the object.
Fixes a double-free crash introduced in 8cd451f.

Alternatively, we could use std::swap() for C++98 charm and perhaps
better readability for people unfamiliar with C++11. Nowadays,
std::move() is more idiomatic though. Shrug.

Reported-by: Michael Keller <github@ike.ch>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-18 13:15:50 +02:00
Michael Keller
a38ea971a0 Import: Add option to sync time on dive computer download
Add an option for users to sync the dive computer time with the PC time
every time dives are downloaded.
Obviously this will only work on dive computers that have time
synchronisation support in libdivecomputer, for other computers a notice
is logged.
The selection for this option is persisted as a preference.

Signed-off-by: Michael Keller <github@ike.ch>
2023-04-17 07:56:02 -07:00
Berthold Stoeger
cb410fe1ba cleanup: don't define empty inline constructor
Just use the constructor of the parent class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
e70e3082c9 planner: remove getRebreatherMode() from planner-model
There was this completely weird loop that the planner-widget would
call the planner-model to get the current rebreather mode, which
would then access the dive in the planner widget. Just keep those
things in the planner widgets.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
1fb9d6236b planner: initialize dive selection mode in constructor
There is no point in repopulating this regularly, as the
content does not change.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
4c02d1c279 planner: get rid of global displayed_dive variable
Allocate the dive in the planner. This is all a bit convoluted
and needs more cleanup.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
b5682369f8 planner: remove global model instances
The only user of the DivePlannerPointsModel and the
GasSelectionModel is the planner. Let's keep these models
there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
3dd09b31e3 planner: move repopulation of models to planner
The gas and dive-type models were repopulated in the
diveplanner model. The former are used in the planner.
However, the latter is also used outside of the planner,
when editing non-planned dives. Thus the former shouldn't
be repopulated by the latter, but by the code that needs
it.

Side note: repopulating the dive-type model seems to
make no sense whatsoever since the values never change,
but let's keep it for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
d51589b9a7 printing: don't access displayed_dive in printing code
To phase out this global variable, avoid access of displayed_dive
in the printing code. This is used when printing a plan. Instead,
when in plan-mode, pass the planned dive to the printing code
as a single dive to be printed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
80df790efc desktop: remove EditPlannedDive application state
The last user of that state was removed in 9bbd8b8169480f12.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
d65f2f422c planner: access divemode (a.k.a. rebreathermode) from model
The mode was accessed via the global `displayed_dive`. In an effort
to remove globals, access it via the DivePlannerPointsModel instead.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
c5d6e0f44f core: make owning pointers a top-level features
The undo-code uses owning pointers based on std::unique_ptr to
manage lifetime of C-objects. Since these are generally useful,
move them from the undo-code to the core-code. In fact, this
eliminates one instance of code duplication.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
5b1557ccb1 core: don't clear displayed_dive when clearing data
displayed_dive used to contain the currently displayed (as in
shown on the profile) dive. However, now it is only a "scratch"
dive used by the planner and initialized every time the planner
is started. There is no point in clearing this dive when clearing
the dive data. In fact, the dive should probably be cleared when
the planner finishes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
cad80e5a53 selection: move current dc logic to profile widget
The current dc global makes no sense on mobile. Therefore,
move the logic of the currently displayed dive computer
to the profile widget and remove the dc_number global
variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
19baae449d tab-widgets: pass current dive computer to delegates
Don't access the global current_dc, but pass it to the sensor and
tank-use delegates, when the current dive or dive computer changes.
The same pattern is already realized for the tank and weight models.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
32de8a1387 tab-widgets: make delegates subobject
The dive-equipment tab has a number of "delegates" for editing
tanks sizes, etc. Instead of allocating them, make them subobjects.

The main point here is that, in an upcoming commit, the sensor
delegate will have to be accessed to change the current dive computer.
So far it didn't have a name and therefore was hard to access.
By making it a subobject it also gets a name.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
6f03fc9689 selection: remove current_dive and dc_number access from tabwidgets
An attempt at limitting accesses to the globals current_dive and
dc_number. These globals do not make sense on mobile.

The parent widget of the tab-widgets remembers the currently
displayer dive and dive computer and the individual widgets
access these values from there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
8cd191c271 desktop: store pointer to parent in tab-widgets
Make it possible for the individual tab-widgets to access the
parent widget. In principle this could have been done by
downcasting the pointer returned by parent(), but this makes
it explicit.

The goal here is to store information on the selection,
current dive, etc. without repeating it in every subwidget.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
cded7ef5fe selection: pass down selection to tab widgets
On selection change, pass down selection (including current
dive and dc) to the tab widgets. Ultimately, this should
remove access to global variables. A number of new accesses
are marked as TODO. They shall be removed in due course.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
908da77863 selection: rename selectionChanged() to divesSelected()
The signals/slot names for dive selection changes were a mess.
Unify on divesSelected(). Firstly, selectionChanged() is a Qt
thing. Secondly, it is consistent with tripSelected().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
de2c4d93e0 map: fold selectionChanged() into setSelection()
This was very weird: a setSelection() call was always followed
by a selectionChanged() call, though sometimes in convoluted
ways. Notably, the formed was called by the DiveListView, the
lattern then by the MainWindow.

Let's just merge these two functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
72a15c46d9 selection: move dive selection, current dive and dc through signals
To reduce access of global variables.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
616dbd9671 selection: send selection signal from selectionChanged()
In DiveListView user actions (select-all, key-press,
mouse-release) were intercepted to send the selection-changed
signal if the selection changed.

However, with the recent cleanups, this can be done
directly from selectionChanged(), since in all cases (at
least the ones I tested), the part of the function that
is responsible for manual selection changes is called
only once.

This avoids quite some complex code flow.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
018be753c3 selection: avoid recursion in divelist selection code
When manually selecting a trip, the selectionChanged()
virtual function was manually selecting the dives of the
trip and thus ultimately recurse into itself.

So far this seems to work OK, but better to avoid this
recursion by setting the programmaticalSelectionChange
flag.

I'd like to send the selection-changed signal directly
from selectionChanged() and this recursion would lead
to double signals.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
8581e213ed selection: trickle down trip selection
The trip selection code was an awkward layering violation.
Whereas dive selections due to dive undo-commands trickled
down via DiveTripModel-->MultiFilterSortModel-->DiveListView,
for trip editing, the DiveListView directly intercepted the
TripEdited signal.

Instead, mimic the dive-selection code. This is a bit longer
but more consistent and logical. The undo/redo of trip changes
is now also a "programmatical" change of the selection.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
9ccb940a1b list models: include current dive in selection signal
After sending a selection-change signal, there follows a current
dive changed signal. Combine these two into a single signal, since
usually the current dive is changed when the selection is changed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
832398180c planner: remove dc_number access from models
Instead of accessing the global dc_number from the
DivePlannerPointsModel and the CylinderModel, pass them
in the respective initialization functions.

The dc_number global might not make sense on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
d057af43b4 undo: pass divecomputer number to EditProfile command
Don't access the global variable dc_number, which might
not make sense on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
297befc6f8 undo: pass divecomputer number to EditSensors command
Don't access the global variable dc_number, which might
not make sense on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
996f85771a selection: remove select_dive() and deselect_dive() functions
These were not optimal, because they would recalculate the current
dive and divecomputers for every invocation.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
1f453094a9 selection: don't call deselect_dive() from delete_single_dive()
delete_single_dive() is one of those remnants from before the
undo-code. Now it is only called in two contexts:

1) When clearing the whole dive log.
2) When importing dives from the cloud on mobile.

In the first case, the selection is cleared before deleting
the dives.

In the second case, let's just do the same.

Thus, we can remove the last call to the deselect_dive()
function that does some complex calculations concerning
the current dive and divecomputer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
487974ea91 selection: avoid select_dive() and deselect_dive calls in dive list
Each of these calls recalculates the current dive and divecomputer.
Instead, collect the dives to be selected/deselected and (de)select
them at once.

This needs some code refactoring in the core, because we need a
function that
1) doesn't send a signal by itself.
2) doesn't clear the trip-selection.

This contains some reorganization of the selection functions
signatures: The filter code is the only caller that keeps the
selected dive and the only caller that cares about whether the
current dive changed. So let only the function that keeps the
selected dive return whether the current dive changed.

It's all very fragile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
6df1c62dfc filter: set dive selection at once
For each selected dive that is hidden by the filter,
unselect_dive() was called, which led to a recalculation
of the current dive and divecomputer.

Instead, collect all deselected dives and deselect them
at the end. Thus, these calculations are performed
only once.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
9f455b1457 selection: move current dive and divecomputer to selection.cpp
This tries to encapsulate the management of the current dive and
divecomputer in the selection code. The current dive is alreay
set by setSelection(). Add a new parameter to also set the
current divecomputer. If -1 is passed, then the current
computer number is remained. This will allow us to audit the code.
Because for now, the whole "current dive computer" thing seems
to be ill-defined.

This fixes a bug: the dive-computer number wasn't validated
when making a new dive the current dive. The new code has some
drawbacks though: when selecting a whole trip, the validation
will be called for all dives in the trip and thus the dive computer
number will depend on the dive with the lowest amount of dive
computers in the trip. This will need to be fixed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
b56b7abcf5 core: use divelog struct in downloader code
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-14 21:20:23 +02:00
Berthold Stoeger
a2845ece82 cleanup: use range based for in download code
This removes a constant describing the length of the array.

The enumerated_range code had to be adapted, because the
interaction of C-type arrays with the C++ typesystem is mad.
With C-type arrays, one has to pass a reference to std::declval.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-14 21:20:23 +02:00
Berthold Stoeger
b61732da42 core: remove autogroup global
Use the flag in the divelog structure, since this will be saved
in the dive log.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-14 21:20:23 +02:00
Berthold Stoeger
aa34afc3f7 cleanup: remove ARRAY_SIZE macro from header
It is only used in a single source file, so no point having
it in a (non-generic) header.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-14 21:20:23 +02:00
Berthold Stoeger
59d678b5b1 cleanup: use range based for instead of loop with index
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-14 21:20:23 +02:00
Berthold Stoeger
7d5c6be188 core: use divelog struct in git parser state
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-14 21:20:23 +02:00
Berthold Stoeger
40275ea56b core: use divelog struct in parser state
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-14 21:20:23 +02:00
Berthold Stoeger
8cd451fc33 core: use divelog in importDives() and process_imported_dives()
Instead of a long argument list.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-14 21:20:23 +02:00
Berthold Stoeger
9c253ee6c5 core: introduce divelog structure
The parser API was very annoying, as a number of tables
to-be-filled were passed in as pointers. The goal of this
commit is to collect all these tables in a single struct.
This should make it (more or less) clear what is actually
written into the divelog files.

Moreover, it should now be rather easy to search for
instances, where the global logfile is accessed (and it
turns out that there are many!).

The divelog struct does not contain the tables as substructs,
but only collects pointers. The idea is that the "divelog.h"
file can be included without all the other files describing
the numerous tables.

To make it easier to use from C++ parts of the code, the
struct implements a constructor and a destructor. Sadly,
we can't use smart pointers, since the pointers are accessed
from C code. Therfore the constructor and destructor are
quite complex.

The whole commit is large, but was mostly an automatic
conversion.

One oddity of note: the divelog structure also contains
the "autogroup" flag, since that is saved in the divelog.
This actually fixes a bug: Before, when importing dives
from a different log, the autogroup flag was overwritten.
This was probably not intended and does not happen anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-14 21:20:23 +02:00
Dirk Hohndel
eebb47ec22 Update libdc to address build issue
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-03-29 11:25:35 -07:00
Dirk Hohndel
ad8aa988f0 Merge branch 'add_ostc4_force_firmware_update' of https://github.com/mikeller/subsurface
together with the libdc change this should now work

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-03-29 10:36:29 -07:00
Dirk Hohndel
1e3427c7cd Update libdc
- Add option to force overwrite firmware for OSTC4

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-03-29 10:35:21 -07:00
Robert C. Helling
e27653374d Add printing option for page orientation
Strangely enough, half of the infrastructure was
already there, it just wasn't hooked up to a UI
element

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2023-03-28 21:08:37 -07:00
rafsalvioni
2f4b415e91 Saves default sea water salinity in log
Some DCs only report water type, without salinity level. Subsurface
fixes most of these cases using default levels, but when the type of water
is Sea/Salt, this fix was not saved.

This causes a bit confusion, mainly if the user defines own salinity level.

Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-03-28 20:51:36 -07:00
Michael Keller
9da7ec4828 Desktop: Fix use of bluetooth address for remembered dive computer.
Fix a bug causing the bluetooth address not being used when downloading
from a 'remembered' dive computer if the device selection is populated.
This specifically excludes MacOS, as 'remembering' bluetooth connections
does not seem to be working there as per
https://github.com/subsurface/subsurface/pull/2158#issuecomment-508933672.
I am not super sure why we are _not_ trying to use the 'remembered'
device if the device selection is populated (`ui.device->currentIndex()
== -1`) - maybe this should be clarified in a comment?

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-28 20:51:07 -07:00
Berthold Stoeger
31cf991afe cleanup: remove pointless idle comment in string-format.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-03-28 20:39:02 -07:00
Berthold Stoeger
264adacba1 cleanup: move formatting of gas type to string-format.cpp
Since the only caller was C++ code, this can be done in
C++ code, which removes memory-management headaches.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-03-28 20:39:02 -07:00
Michael Keller
468c1d8d61 Desktop: Fix time format in dive planner.
Make the time edit respect the configured time format. Also make the
date and time format change when the preferences are changed.

Fixes #3849.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-28 20:37:21 -07:00
Michael Keller
f05ec222ff Documentation: Add topic titles to CONTRIBUTING.md
Add titles for the individual topics covered in CONTRIBUTING.md. One
advantage of this is that it makes it possible to link to individual
topics when providing feedback on pull requests.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-28 20:25:40 -07:00
Andrei Rybak
4946a112b3 CODINGSTYLE.md: use inline monospace formatting
Format keywords, classes, string examples, etc. in prose of
CODINGSTYLE.md using `inline formatting` with single backticks.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-03-26 18:48:03 +02:00
Andrei Rybak
35f0a6af3b CODINGSTYLE.md: use dashes instead of hyphens
Similarly to commit 062533d0a (CONTRIBUTING.md: use dashes instead of
hyphens, 2023-01-14), replace hyphens in prose of CODINGSTYLE.md with
dashes to make the rendered Markdown a bit nicer.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-03-26 18:48:03 +02:00
Andrei Rybak
e130add0c5 CODINGSTYLE.md: fix sample for container iteration
The `for` loop in the sample iterates over `serviceUuids`, but the only
other statement in the sample assigns variable named `l`.  Fix the name
of the variable in the assignment to be the same as in the loop.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-03-26 18:48:03 +02:00
Andrei Rybak
b59b18bfff CODINGSTYLE.md: fix list item indentation
Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-03-26 18:48:03 +02:00
Andrei Rybak
7e74dcccca CODINGSTYLE.md: fix paragraphs in list items
Without an blank line, the pseudo-headers of list items are not
separated from the next paragraph.  An example is rendered as:

    * variable declarations In C code we really ...

instead of intended:

    * variable declarations

      In C code we really ...

Add missing blank lines between paragraphs inside list items and in
between list items to fix the intended rendering.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-03-26 18:48:03 +02:00
Andrei Rybak
4e1206d975 CODINGSTYLE.md: fix indentations in samples
Samples of code in CODINGSTYLE.md are wrapped in triple-backticks to
render them as blocks of code.  For code blocks that are indented within
a list item, Markdown renderer of GitHub treats the leading tab as if it
was four spaces.  Rendered code blocks are formatted in a way that
contradicts the code style written down in prose.

Replace leading tabs in indentation with spaces in blocks of sample code
to render them correctly in Markdown lists.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-03-26 18:48:03 +02:00
Michael Keller
324fbfa685 Desktop: Add option to force overwrite firmware for OSTC4.
In order to support development of the open source firmware of the
OSTC4.
Requires changes in libdivecomputer.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-18 00:11:08 +13:00
Michael Keller
5b263a8f4e Desktop: Add notes column to dive list table.
Add a column for dive notes to the dive list table.
The column is disabled by default.
As requested in
https://groups.google.com/g/subsurface-divelog/c/PEFre85Ek1M.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-16 17:53:20 +01:00
Michael Keller
d44787a0b3 Desktop: Fix units displayed for 'Near dive sites' range.
Fix a bug causing the wrong units (m) to be shown on the Dive site
management view if imperial units are as the system default.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-02 20:58:21 +01:00
Michael Keller
ffc9502535 Desktop: Disable 'search' button if the vendor does not support it.
Disable the 'search dive computer' ([...]]) button in the 'Import from
dive computer' window if searching is not supported by the currently
selected vendor.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-01 15:37:56 +01:00
Michael Keller
b9b47092c1 Desktop: Fix bug in diveplan for CCR dives with multiple segments.
Fixes a bug reported in
https://groups.google.com/g/subsurface-divelog/c/8N3cTz2Zv5E:
When planning a CCR dive with multiple segments, the textual dive plan
was showing a non-existent gas change with bogus data.  The first part
of the fix is uncluttering of the message printed: Since this change is
_after_ the current diveplanpoint the data needs to come from `nextdp`
and not `dp`.  The second part is that the message is not printed any
more if the current and the following segments have been manually added:
According to comments in the code the change should only be printed on
the segment _before_ the change if this segment is an ascent segment
that is followed by a manually entered segment.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-01 15:35:55 +01:00
Robert C. Helling
c47e28fa29 Dive mode for surface intervals
Divers breath air in open circuit mode during surface intervals,
not with their CCR.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2023-03-01 15:33:22 +01:00
Michael Keller
9aed18451a Desktop: Fix planner for CCR dives with first segment on OC.
Fix a bug that results in dive plans outside of the configured risk
profile being produced when planning a CCR dive with the first segment
set to open circuit.
`d->dc.divemode` is already set in `setRebreatherMode`, which is
sufficient, and congruent with the setting of other dive parameters,
like `diveplan.gflow`.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-01 15:19:40 +01:00
Michael Keller
cb5bc68c59 Desktop: Fix the number of progress steps in the OSTC4 download steps.
Changed the maximum number of steps for the progress bar to match the
number of steps that exist.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-26 21:31:27 +01:00
Dirk Hohndel
576595bb11 Merge branch 'translations_translations-subsurface-source-ts--master_en_GB' of github.com:subsurface/subsurface
Pull in the en_GB updates - calling that a translation seems like an
overstatement
2023-02-22 15:20:20 -08:00
Dirk Hohndel
3330f9001c Merge branch 'translations_translations-subsurface-source-ts--master_ro_RO' of github.com:subsurface/subsurface
Romanian translation
2023-02-22 15:20:07 -08:00
Dirk Hohndel
43da660220 Merge branch 'translations_translations-subsurface-source-ts--master_pt_PT' of github.com:subsurface/subsurface
Portuguese translation
2023-02-22 15:19:52 -08:00
Dirk Hohndel
a85abbedf6 Merge branch 'translations_translations-subsurface-source-ts--master_nl_NL' of github.com:subsurface/subsurface
Dutch translation
2023-02-22 15:19:38 -08:00
Dirk Hohndel
df6ec04e48 Merge branch 'translations_translations-subsurface-source-ts--master_es_ES' of github.com:subsurface/subsurface
Spanish translation
2023-02-22 15:19:23 -08:00
Dirk Hohndel
c438bce468 Merge branch 'translations_translations-subsurface-source-ts--master_de_DE' of github.com:subsurface/subsurface
German translation
2023-02-22 15:19:07 -08:00
Dirk Hohndel
12e6f219c9 Merge branch 'translations_translations-subsurface-source-ts--master_ca' of github.com:subsurface/subsurface
Catalan translation
2023-02-22 15:18:50 -08:00
Dirk Hohndel
fc1eab3fc8 Merge branch 'translations_translations-subsurface-source-ts--master_bg_BG' of github.com:subsurface/subsurface
Bulgarian translation
2023-02-22 15:18:23 -08:00
transifex-integration[bot]
4192cf2737
Apply translations in ro_RO
translated for the source file 'translations/subsurface_source.ts'
on the 'ro_RO' language.
2023-02-22 09:24:27 +00:00
Dirk Hohndel
e11c196a6a Update libdivecomputer
Merge upstream updates from Jef Driesen:

 - Deepblu Cosmiq+ support has been merged upstream

 - Oceans S1 support has been merged upstream

- Various new models supported: Cressi Donatello, Scubapro G2 TEK, new
  Excursion v6+ firmware.

- misc core changes, most notably supporting a new annoying specialized
  binary format for decomode, because Jef still can't deal with
  strings.

- lots of small details

(all the work done by Linus - I'm just adding this to Surface)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-02-20 12:02:25 -08:00
transifex-integration[bot]
ddb96efa87
Apply translations in nl_NL
translated for the source file 'translations/subsurface_source.ts'
on the 'nl_NL' language.
2023-02-20 19:22:02 +00:00
transifex-integration[bot]
7ffe4c67ef
Apply translations in bg_BG
translation completed for the source file '/translations/subsurface_source.ts'
on the 'bg_BG' language.
2023-02-20 09:19:42 +00:00
transifex-integration[bot]
30ca55be12
Apply translations in de_DE
translation completed updated for the source file '/translations/subsurface_source.ts'
on the 'de_DE' language.
2023-02-20 07:39:07 +00:00
transifex-integration[bot]
5aaafd1728
Apply translations in en_GB
translation completed updated for the source file '/translations/subsurface_source.ts'
on the 'en_GB' language.
2023-02-19 22:45:31 +00:00
transifex-integration[bot]
5069cda05a
Translate /translations/subsurface_source.ts in ca
translation completed for the source file '/translations/subsurface_source.ts'
on the 'ca' language.
2023-02-19 20:34:03 +00:00
transifex-integration[bot]
8766827c17
Apply translations in es_ES
translation completed for the source file '/translations/subsurface_source.ts'
on the 'es_ES' language.
2023-02-19 12:16:05 +00:00
transifex-integration[bot]
9867ff1ec5
Apply translations in pt_PT
translation completed for the source file '/translations/subsurface_source.ts'
on the 'pt_PT' language.
2023-02-19 11:22:43 +00:00
Dirk Hohndel
6b272ac3aa build-system: add Ubuntu kinetic (22.10)
That's been out for a while... oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-02-18 21:59:54 -08:00
Dirk Hohndel
2f29380ae2 build-system: attempt to fix transifex.yml syntax
Annoyingly I seem to only work with this if it's in the master branch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-02-18 19:22:19 -08:00
Dirk Hohndel
867ef10736 build-system: attempt to fix transifex.yml syntax
Annoyingly I seem to only work with this if it's in the master branch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-02-18 19:19:16 -08:00
Dirk Hohndel
8a56896c4b build-system: add GitHub Transifex integration
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-02-18 15:38:45 -08:00
Dirk Hohndel
32c63f57ab Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-02-18 15:12:44 -08:00
Berthold Stoeger
3f2e4e8b16 cleanup: replace Q_FOREACH by range-based for in profile code
With Qt-containers, this might be a small pessimization, because
it might lead to a deep copy. This can be "fixed" by
   for (const Type &item: qAsConst(container))
But frankly, I don't care. Ultimately it is probably best to
replace the Qt containers by standard containers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-02-17 06:46:46 -08:00
Berthold Stoeger
4128fec1ea profile: register event names on creation of events
The event names were registered in add_event(). However,
the undo system did not use that function, but add_event_to_dc(),
which takes an already allocated event.

That gave the following unfortunate situation:

Load a log without setpoint changes.
Add a setpoint change.
The setpoint change event type now was not registered and
therefore couldn't be hidden.

Admittedly, a subtle bug, but still a bug. Fix by registering
event names on event creation.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-02-17 06:46:46 -08:00
Berthold Stoeger
0d3c9954f4 profile: redo eventname handling
The eventname handling code was splattered all over the place.
Collect it in a single source file and use C++ idioms to avoid
nasty memory management. Provide a C-only interface, however.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-02-17 06:46:46 -08:00
Michael Keller
ab7b9329c0 Standardised how divedatapoints are created.
Changed the way dive data points for OC cylinders to be added to the
dive plan are created in `createTemporaryPlan()` in
`diveplannermodel.cpp`. This now uses `plan_add_segment()` like all
other places where dive data points are added, in particular the planner
tests.
This also allowed for `create_dp()` to be made static.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-17 10:53:04 +01:00
Michael Keller
ec0c6833a0 Fix invalid bailout gas choice when planning a CCR dive.
Fixes a bug reported in
https://groups.google.com/g/subsurface-divelog/c/8N3cTz2Zv5E:
When planning a CCR dive with OC bailout, the diluent gas may be chosen
as the first OC bailout gas, despite being set up with a use type of
'diluent', and likely not being available for open circuit breathing.
`best_first_ascend_cylinder` is now initialised to an invalid value
(instead of the first cylinder, which may or may not be a diluent
 cylinder), and its subsequent use is guarded by a validity check.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-17 10:49:24 +01:00
Berthold Stoeger
eb5d4f2a15 desktop: fix multi-dive editing of cylinders
3629a87 changed the handling of cylinders in multi-dives edit.
Not only should the cylinders be the "same", but also at the
same position. The code did not check whether the edited dives
even had that many cylinders, leading to a null-pointer
dereference.

Check whether the cylinder exists before comparing it.

Fixes #3578.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-02-10 20:09:34 +01:00
Michael Keller
b4af03751d Improve accuracy of the 'unlikely dive gas' warning.
Change the values supplied in the warning to be fractions. This is what
is actually reported by libdivecomputer. The currently used thousandths
are hard to interpret for users, as they are only used internally in
Subsurface.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-09 05:18:56 -08:00
rmorris
a1a834568a Correct paths, to allow libmtp to build
Signed-off-by: rmorris <rmorris@rkmorris.us>
2023-02-09 05:17:23 -08:00
Michael Keller
40fc037aa4 Fix handling of gas type for CCR dives.
Fix bug introduced in #3576: On CCR dives cylinders listed as open
circuit bailout by the dive computer need to be set to `OC_GAS`.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-09 10:51:39 +01:00
Michał Sawicz (Saviq)
8fe5564059 ci: bring Snap USNs back
Ref. https://bugs.launchpad.net/snapstore-server/+bug/2004008

While that gets resolved, ignore the extra packages when checking for
security notices.

Signed-off-by: Michał Sawicz (Saviq) <michal@sawicz.net>
2023-02-08 07:48:34 -08:00
Berthold Stoeger
7b44689c8e parser: fix char-not-found checks in import-csv.c
These were two weird and clearly wrong constructs of the
type "if (iter && iter + 1)", where iter is a pointer. This
is always true at best and undefined at worst. Another
instance was removed in 096de0efd01e.

The original code probably wanted to check whether the
found character was the last character in the string.
But that likewise seems to make no particular sense in
this context. Therefore, just remove the second part of
the boolean expression.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-02-07 23:43:04 +01:00
Michael Keller
1e3d378ad9 Cylindermodel: Improve editing of tank use
Use the drop down for editing the tank use in the gas list in both the
equipment tab and the dive planner.
The tank use column is now available in the equipment tab for all dives
and not just CCR dives, as 'not used' is a valid entry in both cases.
However, if the current dive is an OC dive, only 'OC-gas' and 'not used' are
shown.
There still seems to be a problem that in some cases, when opening the
planner after selecting an existing CCR dive the drop down in the
planner does not list CCR gas uses - for some reason `displayed_dive`
does not seem to be updated correctly on opening of the planner. But I have not been able to
reproduce this consistently, and changing 'Dive mode' fixes this.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-07 14:20:29 +01:00
Kim Delmar
1ed995aa7a html export: update CHANGELOG.md
Signed-off-by: Kim Delmar <62100831+KimDelmar@users.noreply.github.com>
2023-02-05 14:32:09 +01:00
Kim Delmar
3c771e2ee2 html export: fix diveguide display
Signed-off-by: Kim Delmar <62100831+KimDelmar@users.noreply.github.com>
2023-02-05 14:32:09 +01:00
Michael Keller
de4cad22b6 Desktop: Clarified the Dive Computer Firmware Update Message.
Clarified the message that is shown when a newer dive computer firmware
version is available, informing the user that
using an older firmware version may result in problems when using
Subsurface, as discussed in #3568.
This is currently only supported for Heinrichs-Weikamp dive computers.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-03 13:37:52 +01:00
Michael Keller
a92ee1e05d Refactoring: Use core functions to find gasmixes in TankItem.
Small refactoring to use `get_gasmix_at_time` from `core` in `TankItem`
to find the first gasmix used during a dive.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-03 08:24:56 +01:00
Michael Keller
72c40a18c2 Desktop: Fix brightness configuration for OSTC4
The Heinrichs Weikamp OSTC4 introduced an additional
'Cave' brightness level that is dimmer than all existing ones.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-03 08:22:13 +01:00
Michael Keller
321c8d92dc Improvement: Show gases as diluent by default for CCR dives.
Instead of adding all gases read from a dive computer as part of a dive
log as 'OC-gas', add gases as 'diluent' if the dive has a dive mode of
'CCR'. This creates consistency with the ppO2 for CCR dives being
tracked as sensor readings or a fixed setpoint, and not as the ppO2 of
the current gas ad depth.
A follow up question from this is whether gas use in the cylinders list
on the Equipment tab should be user editable. This seems to be
inconsistent at the moment, with gas constituent percentages downloaded
from the dive computer being editable, but gas use not.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-01 21:26:48 +01:00
Michael Keller
ada32f999e Cleanup: Remove 'data' field from 'DeviceDetails'.
`device_data_t data` in DeviceDetails has never been populated since it was first
added, and consequently is not used. This is confusing, especially as certain
fields inside `device_data_t` have been added directly to `DeviceDetails` in the meantime (e.g. `firmwareVersion`).

Separated from #3568 as per
https://github.com/subsurface/subsurface/pull/3568#pullrequestreview-1274995287.

Signed-off-by: Michael Keller <github@ike.ch>
2023-01-31 10:54:39 +01:00
Michael Keller
7ecc4c7034 Cleanup: Fix typos in comments.
Fixed some typos in comments.
Separated from #3568 as per
https://github.com/subsurface/subsurface/pull/3568#pullrequestreview-1274995287.

Signed-off-by: Michael Keller <github@ike.ch>
2023-01-31 00:03:06 +01:00
Dirk Hohndel
0ccb762a09 build-system: disable the daily Snap build for now
Apparently these currently end up in a rebuild loop.

Suggested-by: Michał Sawicz <michal@sawicz.net>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-01-27 09:25:55 -08:00
Michał Sawicz (Saviq)
a21cddc69a snap: use version: git
Snapcraft can determine the version from git on its own.

Signed-off-by: Michał Sawicz (Saviq) <michal@sawicz.net>
2023-01-19 10:37:48 -08:00
Michał Sawicz (Saviq)
e335c7a20d snap: fix GitHub Action warnings
`set-output` is getting deprecated, so need to move to newer ways.

Signed-off-by: Michał Sawicz (Saviq) <michal@sawicz.net>
2023-01-19 10:37:48 -08:00
Michał Sawicz (Saviq)
76c4b76027 snap: refresh for ubuntu-latest being 22.04
Signed-off-by: Michał Sawicz (Saviq) <michal@sawicz.net>
2023-01-19 10:37:48 -08:00
Martin Splitt
1b5de2d33b Update CHANGELOG.md
Signed-off-by: Martin Splitt <martinsplitt@google.com>
Signed-off-by: Martin Splitt <splitti@google.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-01-19 06:56:52 -08:00
Martin Splitt
30c5dfce00 HTML export: make element ids more consistent
Signed-off-by: Martin Splitt <martinsplitt@google.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-01-19 06:56:52 -08:00
Martin Splitt
02f4eb6904 HTML export: rename divemaster references to diveguide
This fixes the search in the web export.

Signed-off-by: Martin Splitt <splitti@google.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-01-19 06:56:52 -08:00
Berthold Stoeger
d7ca0c7253 planner: avoid out-of-bounds access
When exiting the loop, stopidx is 0, which means that if there
are no stoplevels, stoplevels[stopidx + 1] generates an
out-of-bounds access. Instead, suppose a stop at 3m or 10ft.

Suggested-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-01-19 14:26:00 +01:00
Berthold Stoeger
687f65bf77 planner: avoid out-of-bound access when initializing the planner
For dives with many samples (i.e. logged dives), samples are merged.

I'm not exactly sure how this code works, but it does an
out-of-bound access in some cases. Avoid that by a simple
check.

That said, I wonder if this downsampling is a good idea. A user
reports that they have logged dives marked as manually added dives.
We now load them into edit mode, which means a significant loss
of information.

Perhaps we should consider dives with more than 100 samples as
non-manual dives?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-01-19 14:26:00 +01:00
Berthold Stoeger
063a20a406 desktop: pass dive list to ShiftTimesDialog
Users report that the ShiftTimesDialog does not work on Mac and
Windows. Apparently, get_first_selected_dive returns NULL, which
should not be possible because the dialog is only created when
dives are selected. Very omninous.

Get the selected dives in the caller and pass them down. This
bug at least should not happen anylonger. Perhaps now the
dialog does not show at all, but that will narrow down the
root cause of the problem.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-01-18 15:42:47 -08:00
Andrei Rybak
f45379e97c CONTRIBUTING.md: update link to transifex.com
URL https://www.transifex.com/projects/p/subsurface/ now redirects to
https://explore.transifex.com/.  Update the link to

    https://explore.transifex.com/subsurface/subsurface/

which is the landing page for Subsurface on transifex.com.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
a8eaa3e391 CONTRIBUTING.md: link to CODINGSTYLE.md
File `CodingStyle` was renamed to `CodingStyle.md` in 0ceb7e01d (Convert
CodingStyle file to Markdown notations, 2018-04-14) and then to
`CODINGSTYLE.md` in 4ef1e9cb2 (documentation: coding style.,
2019-12-25).  However, a link to the file in `CONTRIBUTING.md` wasn't
updated.

Fix the dead link to the coding style guidelines in `CONTRIBUTING.md`.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
5de9c2b30b CONTRIBUTING.md: capitalize "Git"
Git's own documentation consistency capitalizes the word "Git" in prose.
Follow its example and capitalize the word "Git" in prose of file
`CONTRIBUTING.md`.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
4996d90d53 CONTRIBUTING.md: emphasize image caption
Markdown doesn't have a syntax for image captions.  While we could use
table syntax (an extension in GitHub's flavor of Markdown) to align the
caption more clearly with the image, it wouldn't be very readable in
plain text and Markdown renderers that don't have such an extension.

Reduce confusion of readers by makimg the caption of the gitk screenshot
formatted differently than the surrounding paragraphs.  Use emphasis
syntax for that.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
43cdcd0c4b CONTRIBUTING.md: link to "imperative mood" inline
Replace raw URL to English Wikipedia article about imperative mood with
an inline link.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
1cc6981b62 CONTRIBUTING.md: use paragraph breaks consistently
Replace hard-line break (rendered in HTML as a `<br />` tag) between two
paragraphs in `CONTRIBUTING.md` with an paragraph break (blank line) for
consistency with the rest of the document.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
8f7abb2581 CONTRIBUTING.md: add a blank line before a list
List of code areas in `CONTRIBUTING.md` immediately follows the previous
line.  While GitHub's Markdown parser doesn't mind, some Markdown
parsers don't consider it a list.  Add a blank line between the list and
the preceding paragraph to ensure that the list is rendered correctly in
more Markdown renderers.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
bec625eb01 CONTRIBUTING.md: format filenames in monospace
Wrap filenames in paragraphs in `CONTRIBUTING.md` in backticks to render
them in monospace font.  Fix an accidental double space before the
reference to `CHANGELOG.md`, while we're here.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
b607140a2a CONTRIBUTING.md: format command example in monospace
Replace double quotes around `git commit --amend` command example in
`CONTRIBUTING.md` with single backticks to format it in monospace font.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
be1c5b574b CONTRIBUTING.md: use block syntax for prose examples
Use Markdown block syntax for the example of a commit message instead of
hard-line breaks with double spaces at the end.  Such formatting
separates it from the other parts of the text in `CONTRIBUTING.md` and
makes the wrapping at 74 characters easier to understand with monospace
font.  Do the same to the examples of `CHANGELOG.md` entries.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
4899a04505 CONTRIBUTING.md: use block syntax for commands
Replace combination of Markdown inline code syntax (single backticks)
and its hard-line break syntax (double space at end of the line) in file
`CONTRIBUTING.md` with block syntax (four-spaces-wide indentation) and
paragraph breaks (empty lines) for examples of commands to run to make
them look nicer and easier to read in plain text.  Add a missing colon
before the `format-patch` example, while we're here.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Andrei Rybak
062533d0ac CONTRIBUTING.md: use dashes instead of hyphens
Make `CONTRIBUTING.md` look a tiny bit nicer when rendered by replacing
double hyphens with en-dashes.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
2023-01-17 08:09:33 -08:00
Dirk Hohndel
763ce015ff update libdc
garmin: relax string parsing sanity checks

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-01-02 17:01:53 -08:00
Dirk Hohndel
31277daa71 Update libdc
Add parsing of the CCR setpoint information for Garmin Descent computers

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-12-05 21:09:14 -05:00
Dirk Hohndel
7e43943541 GitHub actions: adjust to Ubuntu 22.04 builds
The qt5-default package was dropped (and isn't needed anymore).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-11-26 11:42:25 -08:00
Doug Junkins
d537e16cb1 macOS: support newer SDKs
Update to match Xcode command-line-tools SDKs from 10.X to 16.X

Signed-off-by: Doug Junkins <douglas.junkins@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-11-26 11:40:51 -08:00
Dirk Hohndel
520be78fa8 cleanup: use better connect syntax
This should be used everywhere by now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-11-25 15:20:47 -08:00
Berthold Stoeger
f27ff65970 statistics: don't use DrawTriangleFan and DrawLineLoop modes
For some reason (use of OpenGL?) with Qt6 these modes fail for me.

Needless to say, I consider this API change a very unfriendly
behavior.

Replace these modes by DrawTriangleStrip and DrawLineStrip.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-19 15:07:07 -08:00
Berthold Stoeger
c62b837b12 statistics: don't import QtQuick in StatsView QML file
This include prevented the statistics from loading for me on Qt6.
And it appears to be unnecessary.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-19 15:07:07 -08:00
Berthold Stoeger
5bd5ff2c2d statistics: fix zero-range on value axis
The code that calculates the bounds of the value axis was broken
when all items had the same value. In that case, increase the shown
range explicitly. It doesn't really matter how much the range
is increased, because all items will be at the center of the graph.

Also, don't overwrite the "decimal" value of the class. That was
just weird.

Fixes #3544.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-19 15:06:22 -08:00
Berthold Stoeger
cf70a25be4 statistics: remove old unused statistics code
This never came to be - no point in carrying it around.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-19 15:03:30 -08:00
Berthold Stoeger
5525344594 git: don't access global dive site table
When loading a git repository, dive sites where loaded into the
global dive site table, not the local table. Apparently, nobody
ever tried to import a git repository into an existing divelog
(as opposed to opening it in the application). Because that would
have probably given funky results.

Remove this access of a global variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-15 14:15:11 -08:00
Berthold Stoeger
2112bd8e08 build-system: make -build-with-qt6 work
-build-with-qt6 did not work for me, because the flag is
ignored when selecting the qmake executable. It would find
the system-wide qmake executable, which is Qt5 and then
decide to build with Qt5.

When the flag is set, try to search for a Qt6 version of
qmake first. On Ubuntu based distros this seems to be
qmake6

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-15 14:08:37 -08:00
Robert C. Helling
741099bdbb Show correct gas density in CCR mode
When collecting the data for the infobox, we have
already computed the current partial pressures of the
breathing gas taking into accoutn the divemode. Use
those rather than fractions (which for CCR mode are
those of diluent) to compute the gas density.

Reported-by: Pietro Tranquillini <p.tranquillini@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-11-08 10:43:47 -08:00
Dirk Hohndel
46365b3199 Merge remote-tracking branch 'origin/bstoeger-range'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-11-08 08:13:27 -08:00
Dirk Hohndel
01a25edf82 Update to latest libdc
- uwatec smart: allow bigger BLE packets
- Garmin: attempt to parse big endian FIT files from the Garmin website

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-11-08 08:11:07 -08:00
Berthold Stoeger
4bbe5646a5 cleanup: remove unused declarations in planner.h
Most of these declared non existing functions or pointers.
One [get_gas_idx()] was only used in one source file and
doesn't have to be globally accessible

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-01 12:12:19 +01:00
Berthold Stoeger
691d9e86de cleanup: implement index_of() and index_of_if() generics
Search the index of an item in a container. Compare by
equality or a lambda. The lack of these have annoyed me for a
long time. Return the index of the first found element or
-1 if no element found.

Currently, only supports random-access operators. Might be
trivially changed for forward iterators.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-31 19:35:15 +01:00
Berthold Stoeger
d3867af1b9 profile: clear dive pointer when clearing profile
Try to avoid stale pointers when resetting the dive data.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 15:02:36 -07:00
Berthold Stoeger
e0e21cab3d profile: reverse plotting and showing of profile
When switching from "empty mode" (i.e. the subsurface logo is shown,
because no dive is selected), the profile is first shown by switching
to the appropriate tab and then plotted. However, the showing might
lead to a resize event and then to a crash with owing to stale dive
data. Therefore, reverse that.

Note that I never could reproduce that.

Reported-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 15:02:36 -07:00
Berthold Stoeger
9bca38afcf profile: recalculate profile info when switching from empty state
When the profile was to small, it would switch into empty state
and clear the plot info.

On resize events, the plot info is not recalculated.

This means that when making the profile extremely small and
then bigger, nothing is shown.

This may also happen on startup. The profile is rendered into
a 0x0 widget and then gets a resize event.

Therefore, remember when the profile is empty and force a
recalculation of the plot info.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 15:02:36 -07:00
Berthold Stoeger
df5bf728f9 cleanup: remove thumbnail conversion function
The chances that their are still users of the old thumbnail
format (i.e. all thumbnails saved in the hash file) are basically
0. If there are they will just get their thumbnails rebuilt
when opening the individual dives.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 22:06:17 +01:00
Berthold Stoeger
b63073e203 cleanup: use range based loops in model
There were a number of classical "for (i = 0; i < size; ++i)"
loops. Replace them either by plain range based loops if the index
is not used or by enumerated_range() loops.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 22:06:17 +01:00
Berthold Stoeger
727d519046 cleanup: use singleton pattern for getPrintingTemplatePath*()
Function-local statics are initialized on first invocation.
No point in extra logic.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 21:57:44 +01:00
Berthold Stoeger
f407f5269a cleanup: use std::size() instead of arithmetics
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 21:57:44 +01:00
Berthold Stoeger
e2338fe7e9 core: use range-based for loops in filterconstraints
This source file was looping over descriptors in a classical
"for (int i = 0; i < size; ++i)" loop.

However, the index is not really used, except for fetching the
actual elements.

Replace by range-based for loops. This prevents the potential
error of using the wrong size.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 21:57:44 +01:00
Berthold Stoeger
cea171ffd4 core: implement an enumerating iterator
In the printing-template code, we loop through a vector and
then determine the index of the current element by searching
the vector. This irks me.

Since looping over a collection with an index is a rather
common theme, implement an enumerating iterator that can
be used as in:
	for (auto [idx, item]: enumerated_range(v)) {
		...
	}

For now, use it for the above vexing case. Convert other
iterations of this theme later.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 21:57:39 +01:00
Berthold Stoeger
94641c510f core: create range.h header for range manupulation functions
The moveInVector() function was defined in qthelper.h, even
though it has nothing to do with Qt. Therefore, move it into
its own header.

Morover, since it is a very low-level function, use snake_case.
And rename it to move_in_range(), because it does not only
work on vectors, but any range with random-access iterators.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-30 21:16:00 +01:00
Berthold Stoeger
261f07dfa4 core: add make_manually_added_dc() function
For reasons of symmetry (there is a is_manually_added_dc()
function), create a make_manually_added_dc() function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-21 16:51:57 -07:00
Berthold Stoeger
f687e51d4b core: don't consider dives with many samples as manually added
This causes UI confusion. Notably we go into edit mode and
reduce the number of samples, leading to loss of information.

If someone really manually adds a dive with more than 50
samples, they should still be able to explicitly open the
dive in the planner.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-21 16:51:57 -07:00
Berthold Stoeger
9ced3a3a4d statistics: fix date ranges smaller than two days
The calculation of the range was broken, it resulted in
a to-value smaller than the from-value, owing to a
sign-mismatch.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-20 20:06:38 -07:00
Berthold Stoeger
56c91a46b6 statistics: add enough entries for date axis
We must add one more entries than there are days, because the
entries describe the values between histograms.

The root cause of the problem here is that a histogram axis
is misused for a continuous day-axis.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-19 14:35:15 -07:00
Berthold Stoeger
48659c3f7d statistics: fix display of month on continuous axis
tm::tm_mon is 0..11, not 1..12, so we have to add one for
display.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-19 14:35:15 -07:00
Berthold Stoeger
7d366b9afe statistics: properly initialized selected scatter items
Scatter items of selected dives were shown in blue when
changing to scatter mode. They should be yellow from the
start, not only when hovering over them.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-19 14:35:15 -07:00
Dirk Hohndel
7b5381b6de desktop: make time shift dialog show correct times
This got broken in commit 7417f865cd ("cleanup: un-singletonize
ShiftTimesDialog") and no one ever noticed.

We need to intitialize the when variable and set up the initial texts in
order for the time shift dialog to show the correct information. Doing
this in the ButtonClicked member (right before the dialog is destroyed)
makes absolutely no sense.

Fixes #3535

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-19 13:29:29 -07:00
Dirk Hohndel
c88d22462d core: better change message in git save
This rarely gets seen / looked at, but it can help make it easier
to understand what a user was doing when trying to restore dives
that were inadvertantly deleted.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-17 16:01:00 -07:00
Dirk Hohndel
cca21cf07f update latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-03 13:49:09 -07:00
Dirk Hohndel
6c9c59a2e0 Revert back to latest libdc
Embarrassingly, commit 8c644547fb ("mobile: fix reading of cache dir")
dropped updates to libdivecomputer which went unnoticed for quite a
while. This brings us back to the correct SHA.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-01 13:36:40 -07:00
Dirk Hohndel
98f1f670c4 Update README and ReleaseNotes for 5.0.10
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-01 13:28:49 -07:00
Dirk Hohndel
f2a96db687 Merge remote-tracking branch 'origin/bstoeger-mobile-dc' 2022-10-01 13:24:26 -07:00
Dirk Hohndel
bcbbda401e Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-01 09:56:34 -07:00
Berthold Stoeger
7c8dc016b5 mobile: flip through dive computers on mobile
UI fixed by Dirk.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-01 18:47:16 +02:00
Dirk Hohndel
d66376a8f3 build-system/windows: don't build the libmtp examples
We had that fail in the GitHub Action - but really, why would we build those in
the first place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-01 18:44:37 +02:00
Dirk Hohndel
eb101aab1f build-system: run iOS GitHub action on macOS 11
macOS 10.15 is deprecated on GitHub.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-09-23 12:13:06 -07:00
Dirk Hohndel
884dbc9d5e Merge remote-tracking branch 'origin/bstoeger-divesites' 2022-09-23 08:02:54 -07:00
Dirk Hohndel
eb59d426d1 Merge remote-tracking branch 'origin/bstoeger-gnome' 2022-09-23 07:58:06 -07:00
Dirk Hohndel
99e6e11c8c Merge branch 'sensor-index-fixup' of https://github.com/torvalds/subsurface-for-dirk 2022-09-23 07:57:05 -07:00
Berthold Stoeger
621a0a4e3a desktop: remember previous state when switching to dive site mode
The dive-site editing can be reached from two states: from the
dive view and the dive list view. It always jumped back to
the dive view.

Therefore, remember the state. Use a stack-like structure, so
that the feature can be used for the dive-site view as well.

This is a bit inconsistent, because for example the statistics
view does not remember the previous state and allows a direct
jump to a different state. That should be fixed at some point.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-23 15:50:50 +02:00
Berthold Stoeger
17033d0d83 desktop: make dive site list an independent widget
This used to be one of the tab-widgets, which was illogical
and caused confusion. Notably, erroneously clicking on the
tab header led to a reset of the dive selection.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-23 15:50:49 +02:00
Berthold Stoeger
86e3ceb0e9 cleanup: remove isGnome3Session function
This is only used for archaic distros.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-23 15:40:09 +02:00
Linus Torvalds
02f158b0c2 Fix the dc sensor index fixup
fixup_dc_sample_sensors() would make sure that any pressure sensor
indexes were in range of the cylinders by just clearing the pressure
data if the sensor index was larger than the number of cylinders in the
dive.

That certainly makes the sensor index data consistent, but at the cost
of just dropping the sensor data entirely.

Dirk had some cases of odd sensor data (probably because of an older
version of subsurface, but possibly due to removing cylinders manually
or because of oddities with the downloader for the Atomic Aquatics
Cobalt dive computer he used), and when re-saving the dive, the pressure
data would magically just get removed due to this.

So rewrite the sensor data fixup to strive very hard to avoid throwing
pressure sensor data away.  The simplest way to do that is to just add
the required number of cylinders, and then people can fix up their dives
manually by remapping the sensor data.

This whole "we clear the pressure data" was at least partly hidden by
two things:

 (1) in the git save format, we don't rewrite dives unless you've
     changed the dive some way, so old dives stay around with old data
     in the save until explicitly changed.

 (2) if you had multiple dive computers, and one dive computer does not
     have any pressure data but another one does, our profile will use
     that "other" dive computer pressure data (because often times you
     might have only one dive computer that is air integrated, but you
     still want to see the tank pressure when you look at other dive
     computers - or you have one dive computer give pressure data for
     your deco bottle, and another for your travel gas etc).

So those two facts hid the reality that we had actually cleared the tank
sensor data for Dirk's dive with the Atomic Aquatics dive computer,
because we'd still see pressure data in the profile, and the git data
would still be the old one.

Until Dirk renumbered his dives, and the data was rewritten.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-09-20 09:49:57 -07:00
Linus Torvalds
aa50be9cd5 Use the right type for sanitize_sensor_id()
It returned a 'uint8_t', which clashes pretty badly with NO_SENSOR being
-1, and turned it into 255.  That then ended up historically working,
because before commit 0c84f369c35b ("core: use int16_t for sensor-id")
we actually did that everywhere:

 #define NO_SENSOR ((uint8_t)-1)
 ...
    uint8_t sensor[MAX_SENSORS];

but that was changed to

 #define NO_SENSOR -1
 ...
    int16_t sensor[MAX_SENSORS];

and this helper type became wrong.

Just make it return 'int', avoiding any type narrowing issues.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-09-20 09:41:35 -07:00
Dirk Hohndel
b5889f0f3c Merge remote-tracking branch 'origin/bstoeger-profile' 2022-09-19 09:29:52 -07:00
Dirk Hohndel
13482a961d Merge remote-tracking branch 'origin/bstoeger-tabwidget' 2022-09-19 09:23:47 -07:00
Dirk Hohndel
bb3ddf521b mobile: update version to 3.4.8
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-09-19 09:18:34 -07:00
Berthold Stoeger
724af75722 desktop: disable extradata tab if no site selected
Owing to bit-rot, the extradata tab was not disabled if no dive
is selected. The reason was that there was an additional tab
(dive-computers) that should not be disabled. However that
tab was removed and now the extradata tab was not disabled.

Fix this, but note that there is another of these 'parasitic'
tabs, that should be removed, namely the dive-site tab.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-18 13:49:29 +02:00
Berthold Stoeger
24926f6031 profile: don't use displayed_dive to check whether dive changed
The profile replots if the mode of the currently displayed
dive changed. To do so, it compares the changed dive to
the displayed_dive. However, that is only used for planned
dives since quite some time.

Fix the check and make the replotting work again.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-17 19:51:53 +02:00
Berthold Stoeger
3abb82bfd5 map: don't explicitly reload the map from the mainwindow
The map listens to the reset signal by itself.

This avoids double reload of the map on open/close.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-15 12:16:32 -07:00
Captain Junk
fbb737e85b Update INSTALL
Add some additional info on getting the
FTDI drvier to recognize dive computers on
Raspberry Pi OS.

Signed-off-by: Captain Junk <captainjunk@gmail.com>
2022-09-15 12:16:07 -07:00
Linus Torvalds
3446dd5125 fix up sample sensor indexes before fixing up cylinder pressures
The cylinder pressure fixup depends on the sample sensors indexes having
been fixed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-09-12 16:58:59 -04:00
Robert C. Helling
77a5ca4234 For warnings, show icon in infobox
Render a warning sign in front of the event string
in the infobox. This is done in rich text.

Note: This shows the warning sign for all events,
not just warnings.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-09-12 19:30:31 +02:00
Captain Junk
d306ba9b38 Update INSTALL
Add instructions for building on Raspberry Pi OS (64-bit) Released
April 4, 2022.

Signed-off-by: Captain Junk <captainjunk@gmail.com>
2022-09-03 15:49:00 -07:00
Berthold Stoeger
50d83ab188 profile: show closed-hand cursor while panning
To give visual feedback.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-03 13:51:01 -07:00
Berthold Stoeger
edf2a2f4f4 profile: implement panning of profile
When zoomed in, the profile position was moved by hovering with
the mouse. What a horrible user experience. This is especially
useless if we want to implement an interactive profile on mobile.

Instead, let the user start the panning with a mouse click. The
code is somewhat nasty, because the position is given as a
real in the [0,1] range, which represents all possible positions
from completely to the left to completely to the right.

This commit also removes the restriction that the planner handles
can only be moved when fully zoomed out. It is not completely
clear what the implications are. Let's see.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-03 13:51:00 -07:00
Berthold Stoeger
0d92ef2835 cleanup: remove unused variable
A QVariant was initialized but never used.

While doing so, remove construct/assign pairs of a number of
QStrings. Directly construct the QStrings with the desired
values.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-03 13:49:02 -07:00
Berthold Stoeger
4a7ee872f3 cleanup: move minute formating to format-string.cpp
The get_minutes() function formats a time as m:ss
and returns a static C-string. Since all callers are
C++ anyway and transform directly into QString, let us
move this to the other string formatting function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-03 13:49:02 -07:00
Michael Andreen
1047937197 user-manual: Update documentation on fixing sensor data
Signed-off-by: Michael Andreen <michael@andreen.dev>
2022-09-03 13:38:34 -07:00
Michael Andreen
a39e69c497 Use combo box for moving sensor data
Also allow editing sensor on a cylinder with already attached sensor.
This will swap the sensor data with the cylinder that it is taking the
sensor data from, removing the need for adding an extra temporary
cylinder when swapping two sensors.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2022-09-03 13:38:34 -07:00
Dirk Hohndel
70e43d13a0 cleanup: show the correct build badges
This way the github.com/subsurface/subsurface no longer shows incorrect
build failures.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-31 21:32:38 +00:00
Linus Torvalds
34e169aace clean up logging, and add error reports to it too
The SSRF_INFO() macro is widely used, and there's a lot of confusion
about whether the newline at the end should be done by the SSRF_INFO or
be in the format string passed to it.  End result: we end up doing both,
and there are empty lines in the output as a result.

Clean this up by just using our existing 'strip_mb()' to strip any
whitespace at the end of the generated string, and then adding one final
newline when logging it.

Also, make sure to log our 'report_error()' messages, which apparently
only used to be showin in the red error bar on the display.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-31 13:58:34 -07:00
Dirk Hohndel
42da08df20 mobile: enable sharing via email
Instead of using the save file dialog (which creates a horrendous user
experience - and isn't even supported on Android), simply allow the user
to email the file in question to a recipient of their choice, e.g.,
themselves.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-31 13:58:22 -07:00
Dirk Hohndel
f144fa0a1b mobile: allow sharing files via email
This will allow the user of the mobile app to export dive and dive site
data from their mobile device without using the Subsurface cloud.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-31 13:58:22 -07:00
Dirk Hohndel
ead15f622a mobile: remove export as UDDF
The export functionality is horridly poorly implemented, and the UDDF export
isn't actually functional on mobile. And why would we support this in the first
place? That's not a reasonable expectation for the mobile app.

So let's just completely remove that and good riddance.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-31 13:58:22 -07:00
Dirk Hohndel
173093d314 Android: correctly check for empty path
The comparison against the empty string caused things to error out
when only one file was given.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-31 13:58:22 -07:00
Berthold Stoeger
6d77d814a8 parser: allow import of dive sites without UUID
Fixes #3493.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-31 13:56:04 -07:00
Berthold Stoeger
aa4b48f440 core: move floating point functions to own header file
This were in subsurface-string.h for unknown reasons.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-30 22:34:38 +02:00
Berthold Stoeger
61701509b0 core: replace IS_FP_SAME macro by inline function
No reason to keep this as a macro - a function is easier to
read, type safe and easier to debug. Moreover, give it the
more appropriate name "nearly_equal()". After all, it precisely
does NOT check floating points for equality.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-30 22:34:38 +02:00
Berthold Stoeger
5db4a95a26 core: don't use relative precision when comparing to 0
The FP_IS_SAME macro uses a relative precision to compare
floating points. This fails when comparing to 0. Therefore,
use an absolute precision in this case. Implement as an
inline function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-30 22:34:38 +02:00
Dirk Hohndel
2ae7f3cf6c Android: make support email API consistent with iOS
We have two different API endpoints. supportEmail() which adds the
default subject, recipient, and message body, and the generic
shareViaEmail() which takes all of these as arguments.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-30 11:55:54 -07:00
Dirk Hohndel
87387b7e7e mobile: send logfiles as attachments on iOS as well
This was added for Android a while ago, but now this works on iOS as well which
is a very welcome addition for the recipient of these support emails (i.e. me).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-30 09:18:06 -07:00
Dirk Hohndel
8164ca56ec iOS: add infrastructure to natively send email
This will allow us to send attachments, just like we do on Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-30 09:18:06 -07:00
Dirk Hohndel
0af410d6ce iOS: update minimum iOS version to 12.0
None of the tools we use work with older versions, anyway.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-30 09:18:06 -07:00
Dirk Hohndel
7801b0c28a build-system: small changes to the iOS build script
This makes it marginally easier to deal with debug builds and release builds in
parallel. The quick builds work most of the time, but not always.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-30 09:18:06 -07:00
Dirk Hohndel
0a4689c2e6 Ratio BLE detection fix
For Ratio dive computers we can't tell by the Bluetooth name which model it is.
There are BT only models and BLE only models. The failure case here was a user
on iOS (BLE only) with a BLE only dive computer which we didn't recognize
because previously we returned a BT only device (which isn't supported on an
iPhone), and the lookup won't return a valid descriptor if the transport needed
isn't available.

These days BLE is far more common, so return a BLE enabled name by default, but
try a BT only name just in case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-30 07:20:33 -07:00
Dirk Hohndel
8c644547fb mobile: fix reading of cache dir
For some reason the flag to exclude . and .. breaks this functionality.
It works just fine without that flag, so let's just remove it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-28 19:51:03 -07:00
Dirk Hohndel
d257a623fa mobile: update version to 3.4.7
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-28 19:51:03 -07:00
Berthold Stoeger
7d87815c69 cleanup: remove BOOST_FOREACH from list of foreach-macros
Not a single use of that and if there was - it should be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-28 13:34:13 -07:00
Berthold Stoeger
f3221c6965 cleanup: remove unused function set_dive_nr_for_current_dive()
Last caller was removed in a6fa6cdb41.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-28 13:34:13 -07:00
Berthold Stoeger
6a2b7cc924 cleanup: mark DiveListView::selectionChanged() as overridden
Other overridden functions of this class are marked as well,
so let's do it for this function for consistency reasons.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-28 13:34:13 -07:00
Berthold Stoeger
1b539af4ca cleanup: remove include of QLineEdit in DiveListView header
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-28 13:34:13 -07:00
Berthold Stoeger
7e9043a4ac cleanup: extend MAP_SUPPORT block
When there is no map support, selection of dive sites is suppressed.
There is no point in calculating the selected dive sites in this case.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-28 13:34:13 -07:00
Berthold Stoeger
5be01b04ed cleanup: remove unused function
The last caller of find_cylinder_index() was removed in
3629a87fcc. Also remove functions that where only called by
this function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-28 13:34:13 -07:00
Berthold Stoeger
70fbce46c7 cleanup: fix typos in comments
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-28 13:34:13 -07:00
Berthold Stoeger
acd385048a Prefer real data over planned
When a dive has both real dive computers as well as at
least a planned version (which is just another dive
computer with a special name), only use the data from
real dive computers for aggregate values like maxdepth,
dive time, average depth etc in order not to have
imagined data on the dive list, statistics etc.

Macro-magic-provided-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-08-25 13:38:12 -07:00
Berthold Stoeger
1c00f9f233 core: use free_dive() to free dive
One would think that calling free() on a dive structure, as the code
did in some places, would lead to a memory leak.

(Insert rant about C memory management.)

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-22 09:34:25 -07:00
Berthold Stoeger
252761498a liquivision: use uint32_t for event time
This is stored as uint32_t, so no reason to use the larger time_t.
It appears to be, after all, relative to the dive start.

Coverity was complaining about the down-conversion later in the code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-22 09:34:25 -07:00
Berthold Stoeger
cfa0c9c735 desktop: make DiveLocationModel entries "editable"
If the entries in the DiveLocationModel don't have their entries
set as editable, the auto-completion popup turns of composition
if such an item is highlighted (see Qt code in
/src/widgets/itemviews/qabstractitemview.cpp), thus disabling
composition of multi-key characters.

Therefore, set this flag. Seems weird, but what should we do!?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-22 09:20:45 -07:00
Berthold Stoeger
9455ca7061 desktop: set composition flag in dive site list
This is crazy: when view() is called, the dive-site-suggestion
popup (DiveLocationListView) clears its WA_InputMethodEnabled
flag. This makes key composition not work as long as the
popup is open.

Thus, when showing the popup, explicitly set the flag.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-22 09:20:45 -07:00
Michael Werle
881a9cac4e cleanup: fix compiler warnings in recently edited files.
Replace NULL -> nullptr
Remove spurious semicolon

Signed-off-by: Michael WERLE <micha@michaelwerle.com>
2022-08-21 18:53:35 -07:00
Michael Werle
efb1832db8 Map Short Names - add preference setting
Adds a preference setting in the "Default" settings tab to toggle whether
to display shortened names in the Map.

TODO: instead of using the generic "settingsChanged" signal, it would be much
more efficient to only update items based on the actual setting which was
changed.

Signed-off-by: Michael WERLE <micha@michaelwerle.com>
2022-08-21 18:53:35 -07:00
Michael Werle
3dbba5ae69 Map Short Names - display shortened names on the map.
Only the last component of the Site Name is displayed, otherwise the full
name is displayed. Site Name components are separated using slash (/)
characters.

For example, if the full dive-site name is
"Japan / Izu Peninsula / Atami / Chinsen-Aft" then only "Chinsen-Aft" is
displayed on the Map.

Signed-off-by: Michael WERLE <micha@michaelwerle.com>
2022-08-21 18:53:35 -07:00
Berthold Stoeger
c897edc13e parser: fix DLF import
In bc3b56a9690, the import of the dive mode was simplified,
by replacing an if-else-if chain by bit manipulations.
However, the bitmask was wrong: 0b00111000 is 0x38 not 0x30,
which means that "odd" dive modes were not recognized as such.

Bug found by coverity.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-20 14:31:39 +02:00
Dirk Hohndel
32bc034f41 mobile: add ability to delete cloud account
Apple store rules require this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-13 14:08:37 -07:00
Berthold Stoeger
941aaf5b65 desktop: let tag-widget completion popup accept composition events
Attn: horrible hack!

For some reason the completion-popup does not have the
Qt::WA_InputMethodEnabled flag set. Thus, if the popup is open
composition of characters breaks.

Therefore, when starting completion, explicitly set the flag
on the popup.

This is 100% not how this was intended, but seems to work for
now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-13 11:19:37 -07:00
Berthold Stoeger
803727395b desktop: improve composition on TagWidgets
The TagWidgets hook into the textChanged() signal to invoke
the word-completer. However, that signal is also emitted for
composition-keys, making composition impossible if the completer
decides that it should show some entries.

Instead, hook into the inputMethodEvent() function, where one
can test whether a real character was input.

Also, don't hook into cursorPositionChanged(), since that led
to an uncanny cascade of reparse() calls when editing text.

The UI experience is still rough as sometimes the completer
popup steals the focus and hinders further entry.

Also, this doesn't fix the location field, which is its own class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-13 11:19:37 -07:00
Dirk Hohndel
21eb108cfd update to latest libdivecomputer
Garmin: Don't require sub directories for fit files
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-06 14:18:22 -07:00
Linus Torvalds
05e1294be9 git parser: handle left-over multi-line quoted strings better
The git save format is designed to be entirely line-based, where all the
dive data is on individual lines that are independent.

That is very much by design, so that you can merge these files
automatically, and not worry about what it does to the context (contrast
this to structured files like JSON or XML, where you have multiple
levels of indentation, and the context of a line matters).

So the parser can just ignore any conflict markers, and parse everything
one line at a time.

Well, almost.

We do have *one* special form of multi-line context, where flowed text
(think things like dive notes) will have one "header line" that starts
the note, and then it can continue for several lines until the final
line that ends the quote.

In such a situation, the dive merging can result in a partially merged
string note, which has the ending line from one dive, and then continues
with more string data from the other dive.

That will confuse our parser mightily, because it will have seen the end
of the string, and parsed the rest of those string comments as garbage lines.

That part in itself is fine - the garbage lines won't pass as any real
data (because they don't start with a proper keyword), but while parsing
that garbage the *next* end of the string will be seen as a start of a
new string.

And *that* then confuses the git parser to think that the line after
that is now part of the string, and so it won't correctly parse the
non-string line that follows.

To give a more concrete example, the git dive data (here indented and
abbreviated) might look like this:

	suit "5mm long + 3mm hooded vest"
	notes "First boat dive.
		Giant-stride entry."
		Saw a turtle."
	cylinder vol=10.0l description="10.0ℓ" depth=66.019m

where the two notes from the two dives were

	notes "First boat dive.
		Giant-stride entry"

and

	notes "First boat dive.
		Saw a turtle."

respectively, and the merged result contained parts of both.

When we parse this, we will parse the 'notes' line as having the string

	First boat dive.
	Giant-stride entry

which is fine. But then the next line will be that

	Saw a turtle."

and now the ending double quote character on that line will be seen as
the beginning of a new string, and the cylinder information on the next
line will then be mixed up.  The resulting mess will be ignored, but in
the process the data on the "cylinder" line will basically have been
lost.

There are several ways to deal with this, but this particular fix
depends on the fact that we can recognize stale string continuation
lines: they are either empty (for an empty line), or they start with a
TAB character.

So to solve the problem with the mis-identified end quote, this
recognizes that we're in such a "stale left-over comment line" context,
and will just skip such lines entirely.

That does mean that when you have conflicts in dive note sections due to
having edited the dive concurrently on different machines, you may just
lose some of the edits.

But this way at least you shouldn't lose any other data due to the merge
conflict.

NOTE! We could try to improve on this by instead noticing that a "end of
multi-line string has a continuation entry on the next line", and just
say "ok, that wasn't a real end after all".

But that would be an independent thing anyway - this "ignore stale text
comment lines" logic would be required anyway, in case those stale text
comments ended up somewhere *else* than right after another text line.

So do this more important fix first.

Reported-by: Michael Werle
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-08-01 11:31:54 -07:00
Berthold Stoeger
d68fd2922c trivial: remove obscure division-assignment operator
In utc_mkdate() we find the interesting statement
        val = timestamp /= 60;
which not only calculates timestamp / 60, but also overwrites
timestamp with the new value. However, timestamp is never used
in the remainder of the function, because the whole point is to
switch to 32-bit types. Thus, replace the division-assignment
by a simple division operator to avoid head-scratching.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-01 11:30:53 -07:00
Dirk Hohndel
c554b57859 iOS: the SDK references APIs that we don't use
And the way this gets bundled into an iOS app means that we have to declare
permissions that we don't use because the SDK we use could use them. On some
level I can understand that logic, but in general... this is just dumb.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-01 09:49:18 -07:00
Dirk Hohndel
8a9359a03c mobile: update version to 3.4.6
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 12:12:02 -07:00
Dirk Hohndel
05ed2e70b5 build-system: impish is EOL
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 12:11:19 -07:00
Dirk Hohndel
8831a364ff update list of supported dive computers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 12:07:45 -07:00
Dirk Hohndel
067ed39503 build-system: try to hack around Qt 5.15.3 in Jammy
The Qt Company apparently didn't feel the need to have the correct
tags in all of the module directories. So this now has to manually
pick the correct SHA. What a pain.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Dirk Hohndel
8a6a03f89f prepare for 5.0.9 release
Update README and move CHANGELOG to ReleaseNotes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Dirk Hohndel
ec9829bbd6 build-system: move to Ubuntu Jammy
Impish is EOL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Dirk Hohndel
e92b1a5692 Update libdivecomputer
Merge upstream changes from Jef Driesen:
     - New dive computer support:
        - Ratio iX3M 2
        - Sherwood Amphos Air 2.0
     - Cleanups and fixes

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Dirk Hohndel
fd1b22a417 Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Jon Massey
53fa568b90 fix: translate email/pw warning
pass email/pasword format warning QString to translate method

Signed-off-by: Jon Massey <jon.massey@thedatalab.org>
2022-07-24 16:56:36 +02:00
Jon Massey
10b4cc9149 Improve UX for cloud email/password checking
State requirements for email address and
password format within cloud preferences UI

If email address or password entered in cloud
preferences, raise a warning within a
QMessageBox instead of the less-visible
report_error method

Signed-off-by: Jon Massey <jon.massey@thedatalab.org>
2022-07-24 16:56:36 +02:00
Berthold Stoeger
50ff94eb8f filter: normalize text of fulltext search to base letters
The liter symbol is written as 'ℓ'. To allow searching for
that, normalize unicode strings to their base letter. This
corresponds to the 'compatibility' mode.

We might also think about stripping diacritics.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-07-08 11:38:44 -07:00
Dirk Hohndel
4bac5dbb66 build-system: allow adaptive building without WebKit
This should avoid build failures on platforms where we don't know if
QtWebKit will be available or not.

The options for printing and user manual are awkward to work with. This
all needs to be cleaned up at some point. Right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-07 10:19:22 -07:00
Dirk Hohndel
21de82144a update libdivecomputer
Initial support for Shearwater Petrel 3 and Perdix 2

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 14:18:12 -07:00
Dirk Hohndel
eb1284683a core: add new Shearwater dive computer names
The code works ok falling back to just Perdix and Petrel 2, but
it looks confusing to the user to see an incorrect name in the
connection drop down.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 11:15:53 -07:00
Dirk Hohndel
e41d877e53 build-system: don't wait for copr builds
This really only matters for my build automation setup, but since I
build from the files in the repo... I have to push this into master.
Otherwise my build processes stall until the builds on the COPR site
finish. Which isn't useful.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 10:46:24 -07:00
Dirk Hohndel
76985d554f Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 10:38:44 -07:00
Dirk Hohndel
ee708a904c core: consistent naming of the new Aqualung i200C models
It's confusing to have the same name refer to two different models.
Unfortunately, that's what Aqualung is doing by simply changing the
model number and serial number, but not the external branding.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 10:28:29 -07:00
Dirk Hohndel
d0a4bc331c update to experimental libdc
Initial support for new version of Aqualung i200C

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 16:35:05 +00:00
Dirk Hohndel
49f69947e3 mobile: update version to 3.4.5
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-13 03:40:00 +00:00
Dirk Hohndel
7ff1683ec9 BLE: add newer model for Aqualung i200C
At least one user has an i200C that shows a GI.... serial number and
BLE name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-13 03:31:21 +00:00
Dirk Hohndel
9e1c04344b mobile: enable MAP_SUPPORT
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-13 03:30:01 +00:00
Dirk Hohndel
3629a87fcc Change semantic for editing cylinders for multiple dives
Instead of trying to find matching cylinders, trigger on the cylinder
number first and then only edit that n-th cylinder if it matches the one
in the current dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-09 16:29:03 -07:00
Dirk Hohndel
19b221d203 core: add missing properties to the dive merge
In a sign how few people use these additional properties AND use multiple
dive computers, this took a couple of years to get noticed... but yes, we
do need to merge those properties as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-08 13:29:37 -07:00
Dirk Hohndel
cf216ec9e4 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-05 16:42:08 -07:00
Dirk Hohndel
5ee1a4fe17 update libdivecomputer
Add support for the Seac Screen and Action
Add support for the Cressi Michelangelo

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-05 16:37:16 -07:00
Robert C. Helling
0f2cdd16dc Deal with negative variation times
When computing plan variations, deco can get shorter when
staying longer when the last step is actually already at
off gasing depth. FRACTION forces unsiged, so this introduces
a sign aware version of FRACTION that returns a sign character
in addition.

Reported-by: Patrick Naujoks <p.naujoks@me.com>

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-06-04 14:19:05 -07:00
Dirk Hohndel
404365c24a update libdivecomputer
Garmin: decode dive mode

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-01 08:56:47 -07:00
Vlad A
30a964c508 Added option to choose between different depth grid quantization schema.
This allows having 3m depth grid for metric users.

* All original properties ( named diferently ) were renamed to three_m_based_grid everywhere to be consistent.
* Plus other small changes requested during review.

Signed-off-by: Vlad A. <elf128@gmail.com>
Signed-off-by: Vlad A <elf128@gmail.com>
2022-05-21 17:29:40 -07:00
Dirk Hohndel
15f3918171 build-system: small fixes for Fedora copr build
The extra trailing 'dot' broke the cmake build on Rawhide.
This also tries to give more consistent Summary and Description text for
the Subsurface and Subsurface-test repos on copr.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-17 10:25:30 -07:00
Dirk Hohndel
c2f0a6f3e1 update libdivecomputer
Garmin: Handle file names in short format

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-14 11:09:40 -07:00
Dirk Hohndel
c1e7cd1428 build-system: consistently mark git directories safe
Even on platforms that don't have the new git version, yet.
And using the convoluted way to create an environment variable that should
point to our checked out tree in the GitHub Action. The more obvious ways
have resulted in failed builds for obscure reasons.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-14 10:28:56 -07:00
Dirk Hohndel
8ead205c8c build-system: initial spec file for Fedora copr build
This should allow us to automate builds using the Fedora infrastructure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-12 11:10:02 -07:00
Dirk Hohndel
df5c715afa build-system: work around git change in Fedora 35 build
Not sure why I didn't include that earlier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-12 11:09:12 -07:00
Jim Wobser
89c6015cde Handle Mulitple Seac Computers colliding during import
The Seac importer was getting samples based only on dive number,
which was causing samples from different computers but with the
same dive number to become interleaved.

To correct this, the SQL statement was updated to use the
dive_id to query for samples. The table schema uses dive_id
as a primary key, which will enforce uniqueness.

Additionally, deviceid is hashed from the the device_id string.

Reported-by: David Brebera <david.brebera@gmail.com>
Signed-off-by: Jim Wobser <james.wobser@gmail.com>
2022-05-12 11:07:03 -07:00
Michał Sawicz
ef0a6b7bee [gha] refresh linux-snap.patch
Signed-off-by: Michał Sawicz <michal@sawicz.net>
2022-05-07 14:49:17 -07:00
Michał Sawicz
c7242a37be [snap] refresh for core20 and add Wayland support
Signed-off-by: Michał Sawicz <michal@sawicz.net>
2022-05-07 14:49:17 -07:00
Robert C. Helling
34b61ad288 Use 10ft as deco step size in imperial units in profile
The calculation of the deco steps shown in the profile
infobox is somewhat independent of the planner. When
set to imperial units, the distance between deco stops
should be 10ft rather than 3m as 15m is only 49ft.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-05-06 14:17:29 -07:00
Linus Torvalds
bdeeba4a67 core: fix detection of used cylinders
The cylinder_with_sensor_sample() function only tests "do we have a mapping to
this cylinder for this sample". It also needs to test if there are any tank
pressure readings for that cylinder.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-28 12:30:10 -07:00
Dirk Hohndel
51590853eb build-system: macOS universal builds imply Qt6 builds
Qt5 doesn't support the m1.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-27 22:03:37 -07:00
Dirk Hohndel
efdc525a22 cmake: try harder to find the cmake modules we install
While I clearly recall that in the past the couple of cmake modules
that were installed when building the dependencies were found, in my
latest tests on macOS 12 with the latest cmake this seems to fail.

This seems like a cheap quick way to ensure that things behave as
expected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-27 22:03:37 -07:00
Dirk Hohndel
f0d819a842 build-system: fix building fat binaries on x86_64
It does seem a bit odd, but the arch command actually doesn't
return a reasonable architecture on macOS. So let's use the
uname -m command to get the right answer that makes this script
work both on an m1 and an Intel Mac.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-27 22:03:37 -07:00
Dirk Hohndel
e7ea951122 update INSTALL instructions for macOS
And tiny whitespace fixes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-27 22:03:37 -07:00
Dirk Hohndel
a73fd0ed60 cleanup: compile fix for latest Xcode
I'm not sure why these headers are needed here and nowhere else...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-27 22:03:37 -07:00
Dirk Hohndel
8d9730f74f core: avoid crash when merging dive with no cylinders
Arguably every dive should at least have one cylinder, but an imported
dive from divelogs.de might end up without one. Sadly, that breaks
assumptions that we make in the cylinder remapping.

To work around it, force at least on cylinder to be assumed in the merge
code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-24 08:00:36 -07:00
Dirk Hohndel
5a5188bc47 build-system: don't build against Qt6 by default
As some Linux distros start to ship both Qt5 and Qt6, it actually makes more
sense to build only against Qt6 when the user explicitly asks for it. Having it
preferred over Qt5 seems completely wrong in hind sight.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-23 12:35:54 -07:00
Dirk Hohndel
36c991a1b8 build-system: work around git change in coverity build
The git ownership issue strikes again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-22 21:32:50 +02:00
Linus Torvalds
dee13bf410 git access: save to local repository before doing remote access
.. at least if the local repository exists and can be opened.

If the local repo cannot be directly opened, we will still try to sync
with the remote first, but this way the *common* git save situation is
that we save locally before we then try to sync with the remote.

That means that if we have network problems, the save will happen before
we possibly hang due to really really slow networking.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-04-22 08:28:17 -07:00
Linus Torvalds
e33680c336 git access: add proper cleanup function for git_info
We had various random "free parts of the git info" left-overs from when
we passed down the git repo data ad-hoc.  Get rid of it, and replace it
with just doing a 'cleanup_git_info()' that does the final cleanup of it
all.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-04-22 08:28:17 -07:00
Linus Torvalds
96337dbbcf git access: rename 'check_git_sha()' function
That function name was incomprehensible.  What did it check? And what
did the return value mean?

So let's rename it to something that actually describes what it does,
and reverse the meaning of the return value while at it.

So now it's called 'remote_repo_uptodate()', and it returns true if the
remote repository branch has the same value as our 'saved_git_id'.

It's still a bit obscure, but at least within the context of the only
user, the code now makes _more_ sense than it used to:

        if (remote_repo_uptodate(fileNamePrt.data(), &info)) {
                appendTextToLog("Cloud sync shows local cache was current");

but maybe we could come up with even better semantics and naming, and
make it even clearer.

Requested-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-04-22 08:28:17 -07:00
Linus Torvalds
6f5783b203 git access: move git repo open from update_local_repo() to caller
We currently only have one single caller of update_local_repo(), and
instead of that caller checking whether the existing repo is a
directory, just make it open the git repository.

This avoids duplicate error handling and simplifies the code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-04-22 08:28:17 -07:00
Dirk Hohndel
ac70282193 macOS: build googlemaps plugin as fat binary
I couldn't make this to work as a single pass build, so we again do a dual pass
and manually assemble the dylib. This is then copied to a sane spot which
required another attempt to copy it in the CMakeLists.txt - which I added
comments to in order to make sense of the weirdness.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:39 +02:00
Dirk Hohndel
c41e2489a4 Qt6: update the connect calls for QNetworkReply
Because of the old connect syntax used the incorrect signal names weren't
caught at compile time. To switch to the new syntax we had to make two
functions pure virtual in the WebServices class - let's hope I got that right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:39 +02:00
Dirk Hohndel
e9b4d02d24 macOS: update package build script
The create-dmg script changed repo name - let's support either version.
On newer Macs the SDKs are elsewhere - let's look there, too.
Let's be far more flexible when finding SDK versions.
Let's not assume that we are linking against QtWebKit (we're not with Qt6).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
53e153e6d7 build-system: make CMakeLists.txt more consistent
We used two different ways to add to the end of a list. Let's stick with
the more idiomatic one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
256f58e723 build-system: remove obsolete warning
Apparently Qt 6.3.0 already fixes this problem, so... never mind.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
baf23fd681 macOS: use software backend by default with Qt6
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
7bd17a1784 macOS: add the ability to create fat binaries
This also does some cleanup for some of the variable names.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
a8f1fccd89 build-system: more Qt6 / QtLocation updates
This adds a flag to explicitly enable a build against maps, which is
only needed for Qt6 (as we always assume that Qt5 has maps installed).

It also includes a quick fix to fail gracefully if libmtp was already
patched.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
ea961edec8 Qt6: first steps towards map support
There is an initial build of the C++ classes that seems to work, but the QML
integration is still missing. Still, progress is being made.

Unfortunately with Qt6 we can't forward declare the MapLocationModel class (one
of the operators needs to be able to determine the size of the class), so we
need to include the header file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
2241a28499 build-system: make map support its own thing
Making this simply depend on Qt5 or Qt6 was short-sighted as work on QtLocation
upstream continues. Instead break this out as its own option.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
890f21bd58 whitespace cleanup
Random, I know. But it bugged me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
65ef08f167 git: remove file global is_subsurface_cloud
Just like the rest of the git repo related information, this is already
included in the git_info struct.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-17 22:14:34 -07:00
Linus Torvalds
7e632173e0 Collect and convert git repo data to 'struct git_info'
We have this nasty habit of randomly passing down all the different
things that we use to look up the local and remote git repository, and
the information associated with it.

Start collecting the data into a 'struct git_info' instead, so that it
is easier to manage, and easier and more logical to just look up
different parts of the puzzle.

This is a fairly mechanical conversion, but has moved all the basic
information collection to the 'is_git_repository()' function.  That
function no longer actually opens the repository (so the 'dry_run'
argument is gone, and instead a successful 'is_git_repository()' is
followed by 'opn_git_repository()' if you actually want the old
non-dry_run semantics.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-04-17 22:14:34 -07:00
Dirk Hohndel
acc4dc57af core: work around water temperature bug in Tecdiving DiveComputer.eu
It appears to send a first sample with a water temperature of 0 C. If the next
sample contains a more likely water temperature, overwrite the first one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-13 14:29:10 -07:00
Dirk Hohndel
514edfec07 build-system: work around latest GitHub Action issue
This suddenly started. A couple of build would fail because the git submodule
checkout fails because of directory ownership issues. Hopefully this will fix
it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-12 23:35:25 -07:00
Dirk Hohndel
795cf1bee2 libdc integration: correctly parse DC_FIELD_SALINITY response
libdivecomputer tries to be super careful in what it tells us. It only offers a
density value if that is something that the dive computer explicitly supports,
otherwise it just offers back a flag. We need to then update the density value
ourselves.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-12 22:29:17 -07:00
Dirk Hohndel
ecfbf2a9ba update libdivecomputer
- Genesis React Pro: fix serial number
- OSTC: use deco model instead of dive mode for deco model information

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-04 14:36:56 -07:00
Michael Andreen
be2bdb8650 undo: Clear undo stack on file close
The undo stack is only relevant to the dives that were loaded at the
time the command was executed. If a file is closed, by specifically
closing it or opening another file, then the undo commands will
reference dives that aren't available anymore. Clearing the undo stack
ensures that we don't crash or accidentally do some undefined
modifications to the currently open file.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2022-04-03 08:34:39 -07:00
Berthold Stoeger
ada4632ff1 profile: remove last dc_number access from profile code
dc_number is a global variable indicating the currently displayed
dive on desktop. It makes no sense on mobile, since multiple
profiles can be active at the same time. Therefore, the profile
code should not access this global, but use the dc number that
is passed in.

This removes the last access.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-04-03 08:29:05 -07:00
Robert C. Helling
96e825fb2e Allow more than one media file when importing from the web
To import media files from the web, increas the size of the
dialog box and allow several URLs separated by newlines.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-04-01 08:28:05 -07:00
Anton Lundin
bc2de35242 configure-dc: Add support for ostc3 Auto SP mode
Way back in time, in HwOS 1.86 a CCR mode was added which automatically
switched between setpoints based on depth.

This entry was never added in our system to configure the dc, and caused
the issue seen in #3304

This adds the Auto SP mode, to the dropdown, thus fixing #3304.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2022-03-28 13:46:37 -07:00
Dirk Hohndel
f1c1e0ccee prepare for 5.0.8 release
I forgot to clean up the CHANGELOG file for the previous release, and some of
the commits in this release were missing CHANGELOG entries.

This should make sense now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-27 17:41:24 -07:00
Dirk Hohndel
fe53644150 translations: fix Portuguese parent translation
I didn't pay attention and entered the wrong flavor of Portuguese as the
parent translation. The one for Portugal is complete and should be the
parent, back-filling the one for Brazil where needed.

Suggested-by: Christof Arnosti <charno@charno.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-27 17:11:05 -07:00
Dirk Hohndel
b3a55e145f Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-27 17:07:45 -07:00
Quentin Young
7136ee463c core: allow separators ,; after degree-style coord
Tweak the Lat/Long coordinate parser to allow coordinates of the form:

12.1049° N, 68.2296° W

The coordinate parser works by tokenizing coordinates one at a time.
Consequently it is invoked twice on user input to get latitude and then
longitude. Normally, after parsing the first coordinate, intervening
characters such as , or ; and any whitespace would be discarded from the
input before parsing the second coordinate. Prior to this patch, if the
coordinate format was in degrees followed by a sign (N is a sign in this
example), the parser would skip the bit of code that fast forwards past
any intervening separators and whitespace (, in this example). This
resulted in coordinates of this form not being accepted, because the
second parse would start with , 68.2296° W and reject this as an invalid
coordinate.

To rectify this, the bit of code that fast forwards past separators and
whitespace has been broken out from the tokenization loop and performed
as a final step after a single coordinate has been completely parsed and
validated. Doing it this way makes it independent of the state of the
tokenizer, so that the fast-forward code will always execute once a
coordinate has been successfully parsed.

I've also centralized the list of allowed separators into its own static
string; this is necessary as part of the patch but should also make
allowing additional separator characters between coordinates trivial in
the future, if needed.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2022-03-27 16:37:10 -07:00
Quentin Young
dbbb39e0f7 CODINGSTYLE.md: note that macros should be caps'd
Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2022-03-27 16:37:10 -07:00
Dirk Hohndel
9745f80431 translations: load parent language translations
Many language have country specific differences. We recognize different
flavors of English (US, UK (and South Africa)), German (Germany and
Switzerland), and Portuguese (Brazil and Portugal). For many other
flavors of the languages that we have translations for we have no
support and the way we hard-coded the fallbacks in the past was odd and
meant that in the cases where we do have two flavors, missing strings in
one weren't taken from the other (English as the default language being
the exception).

This tries to do a better job of recognizing some of those parent
languages and loading translators for them, first. Which means if we
then find a translator for the specific language (i.e., de_CH), strings
missing in that translation are next searched in the parent language
(de_DE), before finally providing the source language string (en_US).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-26 14:10:16 -07:00
Dirk Hohndel
0a8344e613 Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-26 07:54:04 -07:00
Michael Andreen
386a3a35bc profile: Plot sensor data from other dive computers
If the current dive computer doesn't have a sensor for the cylinder then
check if another dive computer has sensor data available and use that
for the plot.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2022-03-26 07:32:50 -07:00
Dirk Hohndel
a363ad0910 build-system: fix failing installer builds
Both for Windows and macOS the installers actually didn't work correctly.

It turns out that the nifty trick (which is the officially documented way of
doing this) for setting up Qt5 OR Qt6 doesn't actually set up all of the
variables correctly - at least not on Windows and macOS.

Instead of trying to figure out why that part is failing, I decided to simply
immediately re-run the find_package for Qt5 if we don't find Qt6.

In the Windows case there was an additional problem: A very subtle typo where a
Qt5 turned into a Qt (which alone would have broken things).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-23 19:43:40 -07:00
Dirk Hohndel
b4e56ebef1 Prepare for Subsurface 5.0.7 release
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-21 18:49:44 -07:00
Dirk Hohndel
370e2db64a Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-21 18:41:27 -07:00
Dirk Hohndel
2886104b1d mobile: allow date only when adding/editing dives
Apparently some people try to manually enter older dives where they don't
have data about the dive time and therefore want to only capture the dive
date.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-18 08:57:55 -07:00
Dirk Hohndel
ccda4f557c mobile: fix broken undo stack initialization
We would dereference the undoAction before the command infrastructure
was initialized which led to a crash in the mobile app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-18 08:57:55 -07:00
Dirk Hohndel
56068f51cb Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-18 08:57:55 -07:00
Dirk Hohndel
6b187e011f Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-18 08:57:55 -07:00
Berthold Stoeger
ba95edc2d2 statistics: switch themes on the mobile version
When changing the theme to a dark theme, also change the
statistics theme. The code is a mess, because it crashes
when setting the theme right at the beginning. Therefore,
there is a "theme has been set" flag. Also, this directly
accesses the ThemeInterface singleton object. I have no
time to fight QML, sorry.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
1cff14fa7f cleanup: replace function static variable by member variable
Global variables are evil. In this case not a problem, since
this is a singleton anyway. However, it is bad style and does
unnecessary thread synchronization.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
510f623c77 cleanup: remove unnecessary includes
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
144e81e8f8 statistics: make fonts themeable
Move the various font objects the the StatsTheme structure to enable
different font weights for different themes.

For the dark theme, switch to a bold font, because the thin white
font was barely visible.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
5f91c69f9c statistics: create themes on demand
Create the themes only when needed (singleton pattern). If
the themes should do more than colors, such as for example
fonts, it is not clear whether that can be done before main()
runs. By creating the themes on demand, the Qt UI should
be initialized in the constructors of the themes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Dirk Hohndel
7f1107408d statistics: add a rough dark theme
Some of the colors (like the bin colors or the highlight yellow) stay
the same, others are adjusted to fit better with a dark background.

This is far from perfect, but it's ok-ish.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
b5aac29cea statistics: collect colors in a StatsTheme class
To enable rudimentary theming, collect all colors in a new
theme class. The class has to be passed down to the various
items.

In general the items save a reference to the them in the
constructor. Alternatively, they might also just query
the StatsView everytime they need to access a color.
For now, it's hard the say what is preferred: a reference
per item or a function call per invokation?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Dirk Hohndel
56e02dbcc0 mobile: update version to 3.4.4
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-16 14:41:20 -07:00
Berthold Stoeger
8a544f74ec stats: make textures "global objects"
These were leaking. Instead register them as global objects,
so they will be deleted on exit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Berthold Stoeger
ee9344eccf desktop: make MainWindow a "global object"
Thus, we don't have to delete it explicitly on exit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Berthold Stoeger
16aa761e86 core: make the QUndoStack a "global object"
Thus, it will be freed before application exit.

Freeing it later led to crashes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Berthold Stoeger
8577b00cb7 core: add class that collects global objects to be deleted on exit
We have a prevailing problem with global QObjects defined as
static global variables. These get destructed after main()
exits, which means that the QApplication object does not
exist anymore. This more often than not leads to crashes.

In a quick search I didn't find a mechanism to register
objects for deletion with QApplication. Therefore, let's
do our own list of global objects that get destructed
before destroying the QApplication.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Dirk Hohndel
197ea2b655 build-system: update Ubuntu targets
Hirsute no longer accepts builds, but Jammy apparently does.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-16 11:00:59 -07:00
Dirk Hohndel
c94e2b5d3f build-system: switch submodule protocol
As of today, GitHub no longer allows the 'git://' protocol, so we need to
switch the submodule and our other references to cloning git repos to
'https://' instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-16 06:46:07 -07:00
Dirk Hohndel
af88d34227 build-system: updates to GitHub Actions
Hirsute is EOL, so we need to move to Impish.
Adding Fedora 35 allows us to do a simple test against Qt 6.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-14 17:36:55 -07:00
Michael Andreen
451be04400 Fix merge problem in EditSensors
Need to save the current dc as a member variable so we can apply redo
and undo to the correct dc later.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2022-03-14 09:34:16 -07:00
Dirk Hohndel
6354f97321 fix merge problem
I guess I get what I deserve.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 16:59:32 -07:00
Berthold Stoeger
ed83f6ce32 profile: only keep pointer to plot_info in ruler objects
Now this one was strange:

The ruler items keep a copy of the plot_info struct. However,
only a shallow copy is made (the actual plot data is not copied).
This means that the data is only valid as long as the source
plot_info is valid. But if that is guaranteed, we simply can
keep a pointer instead of the full object.

I wonder if it wouldn't be better still to keep a pointer to
the profile and query that for the plot info?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 15:08:01 -07:00
Berthold Stoeger
f9b9582a64 core: fold display.h into profile.h
The only things in display.h were profile related, so the
split between these two files is not comprehensible.
In fact profile.h includes display.h, because it needs the
struct defined therein. Let's just merge these two files.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
1496bbc314 core: move device related functions from display.h to device.h
It is ominous that these functions were declared in display.h.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
04241ebb9d core: remove select_dc() function
The only caller misused this function to get access to the
current divecomputer. Remove it, since selection of the
current divecomputer is handled by the MainWindow.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
e9aaab3c19 core: remove dc_number declaration from display.h
The global variable is already declared in dive.h

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
d5fafc0e44 core: remove current_dc macro
There were only three users of that. For now do it inline, but
we may think about a separate function, which is only available
on desktop.

Moreover, add nullptr-checks, even if they are not strictly
necessary.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
5b4d4813f2 profile: don't use global dc_number variable in profile
The profile knows which divecomputer it is plotting. No point
in accessing a global variable (which isn't even defined on
mobile).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
12406786f1 core: pass dc-number to update_event_name()
The dive was passed as an argument to update_event_name(), but
the divecomputer was derived from the global dc_number variable.
That makes no sense. Therefore, pass the dc_number as argument
and update the only caller (smtk-import).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
0c4be83b31 core: split proper divecomputer in split_divecomputer()
split_divecomputer() is passed a dive and a divecomputer number.
However, it accesses the currently visible dc!

This would be a nasty bug if it werent for the fact that it is
called when placing an undo command and there it is passed the
current dive and divecomputer anyway.

Nevertheless, fix this.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Dirk Hohndel
c2a7382b10 mobile: better scaling of profile items
With all the recent changes, some of the previous assumptions about the scale
of items seem to be no longer appropriate. Now that we are showing the icons in
the profile again on device it's quite obvious that they were way too big -
clearly we don't need the special scaling anymore.

Also implement a suggestion from Berthold to get slightly smaller fonts and
finer structures in the profile on mobile devices. This scaling of the DPR
seems to work well in my tests.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 15:06:13 -07:00
Dirk Hohndel
69cb33fd2e build-system: move profile specific icons into separate QRC
This way they are available in both mobile and desktop version.
Without this, the icons weren't shown on iOS and Android.

Fixes #3214

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 15:05:55 -07:00
Michael Andreen
dddec0a5b6 user-manual: Add section on moving sensors
Signed-off-by: Michael Andreen <michael@andreen.dev>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 15:03:24 -07:00
Berthold Stoeger
02ea3d59f6 profile: fix typo in color generating code
HSL and HSV are different things...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 14:58:34 -07:00
Berthold Stoeger
32d042e73e profile: mute a Coverity warning
CID 376698 was a false positive, but understandable.

It is very hard for Coverity to realize that current_dive
cannot be null if editedDive is not-null.

By replacing current_dive by originalDive, the alert
should go away, since the latter is not checked for null.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 14:58:30 -07:00
Michael Andreen
07313a015b Add test dive for sensor move functionality
This dive contains logs from two dive computer, Garmin Descent MK2i and
Suunto Vyper Air. These dive computers each has a wireless pressure
transmitter connected to them, attached to different cylinders.

When downloading the dives, both of these pressure sensors get attached
to the first cylinder. This is correct for the Garmin sensor, but not
the Suunto sensor, which should be attached to the second cylinder. The
pressure graph doesn't reflect the measured SAC rate.

To fix this, make sure that the Suunto log is visible and then in the
Equipment tab ensure that the Sensors column is visible. In the field for
the 2nd cylinder it will say "Select one of these cylinders: 0", this
shows that there is a sensor attached to the first cylinder. Change this
text to "0" and press enter, now the sensor will be attached to the 2nd
cylinder and the pressure graph will now show the measured SAC rate for
this cylinder.

Signed-off-by: Michael Andreen <michael@andreen.dev>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 11:26:05 -08:00
Michael Andreen
4e92cb2567 Maintain sensor index for uemis and liquivision
Previosuly they always used index 0 for the active sensor, use
add_sample_pressure instead.

Signed-off-by: Michael Andreen <michael@andreen.dev>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 11:26:00 -08:00
Michael Andreen
9b4263aa87 Allow editing sensors through equipment tab
Add a column to the equipment table that shows if a sensor is attached to a
tank, or which sensors would be available to attach to a tank that currently
doesn't have a pressure sensor associated with it.

Changing the sensor assignement can be undone.

This column is hidden by default as this is a somewhat unusual activity.

Signed-off-by: Michael Andreen <michael@andreen.dev>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 11:24:50 -08:00
Berthold Stoeger
ec96cbaab5 cleanup: remove maintab.ui
This file was so confusing: A tabwidget containing a layout
containing a tabwidget. This strange situation is probably
due to moving the multi-dive warning message.

Remove the file, there seems to be nothing of importance
in there. All the UI was moved to the individual tabs.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
357e115121 planner: update UI after having saved the dive
The UI was updated before storing the dive. This had a nasty
effect: the current dive was shown in the profile and if that
was a manually added dive, the DivePlannerPointsModel was
overwritten. Thus the planned dive couldn't be saved anymore.

There is a comment why the UI switch was done beforehand.
But in my tests, this didn't seem to be valid anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
1fbdc387c8 profile: properly initialize zoomedPosition
This was not set to zero in the constructor, making valgrind
go crazy. Rightly so.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
a41742ab4d profile: don't change background color in "edit mode"
From a user's perspective, the edit mode is not a different
application mode anymore. Therefore, don't change the background
of the profile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
fd35fbb349 desktop: prevent exit only in plan but not in edit mode
Currently, when the profile is in edit mode, the user can't
save, exit, plan a new dive and is requested to save the
current dive. However, this makes no sense anymore, since
the profile always switches to edit mode when showing a
manually added dive.

If the user has any unsaved profile changes, the usual
dirty checks of the undo-system apply.

Only show above behavior when in the planner. There it is
useful because, these are not included in the undo system.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
b1384b286f cleanup: remove redundant get_dive_dc() calls
In ProfileScene::draw(), the divecomputer was calculated
thrice. Remove the two redundant calls.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
dea58bd67c profile: automatically enter edit mode
The edit mode was hidden in a context-menu. With fine-grained
undo there seems to be no need to explicitly exit edit mode.

Therefore, always switch to edit mode when displaying a
manually added dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
63664061eb cleanup: replace empty TabBase constructor by using directive
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
a4dbe51aee cleanup: remove TabBase::enter/exitEditMode() functions
Since the edit mode was removed, these became unnecessary.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
152016d293 cleanup: break out the dive-notes tab
There was always this weird asymmetry that the "maintab" widget
is one of the tabs itself, whereas the additional tabs were
treated as extra-widgets. Turn the first tab into explicit
source files to make the distinction between container and
content clear.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:32 +01:00
Berthold Stoeger
2657ec9016 cleanup: remove MainWindow::refreshProfile()
This only calls MainWindow::showProfile(), so simply call
that directly.

Moreover make two "public slots" private member functions,
since these were only called locally.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
4c46a11ed1 profile: update profile in edit mode on undo
When the user undos/redos the profile should update even
when in edit mode. This is a bit more complicated than
anticipated:

1) We should not do the update when emitting an undo command
from the profile. But we *should* update if it is an undo
command from the maintab (change depth/time).

2) The divepointsplannermodel has to be reset. Side note:
the code is truly abysmal as it sends numerous changed-signals.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
5aa67c134b desktop: remove edit mode of maintab
This was only used for profile-editing, which is now managed
by the profile-widget.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
fce48367cd undo: more fine-grained undo of profile editing
Place undo commands for every change of the profile, not
only on "saving". Move the edit-mode from the mainwindow
and the maintab to the profile widget.

This is still very rough. For example, the only way to exit
the edit mode is changing the current dive.

The undo-commands are placed by the desktop-profile widget.
We might think about moving that down to the profile-view so
that this will be useable on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
c5c8bfec65 undo: switch to dive after replan / profile edit
It is confusing when undoing a command and nothing happens
in the UI. Therefore, switch to the corresponding dive when
undoing/redoing a replan or profile edit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
ea0c030770 undo: split replanDive and editProfile commands
These two actions were using the same command with a flag
controlling the name of the command, which is shown in
the undo menu.

However, the replanDive does much more (such as changing
the notes) and in the future we may want to be more
fine-grained with respect to profile editing. Therefore,
split these commands into two separate ones.

Moreover, make the editProfile command more flexible.
Pass an enum describing the action instead and also
a counter indicating how many points have been
moved or removed.

Finally, don't consume the input dive in the editProfile
command, because we will want to keep the original dive
while editing the profile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:32:22 +01:00
Dirk Hohndel
2368a183e1 Qt6: prevent QML object from being garbage collected
It appears that the QML object that is created when assigning the source
to the StatsView in the ui can be garbage collected and therefore
destroyed and re-instantiated without our knowledge. So instead of
trying to keep a pointer around, we end up looking up the object address
when needed.
We still ask the JS code to not garbage collect the object - but that
clearly isn't enough to prevent it from being destroyed when the parent
widget changes.

Without this fix opening the statistics will crash with Qt6.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
2ede1a4563 cleanup: replace deprecated methods
Sadly the replacements are new in Qt6.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
300248f446 Qt6: use the newer createCentral() API
This will cause us problems when using Qt6 on Android - but I don't see
this happening any time soon.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
240b2dc4df macOS: warn about harmless but annoying errors on M1 Macs
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
ddeafcfad5 Qt6: more QtLocation dependent parts in the CMakeLists.txt
These didn't really cause errors, but they were simply wrong to have there.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
eb1849d7ba Qt6: more CMakeLists.txt cleanup
We used yet another version dependent variable. This one is even weirder as it is
an undocumented one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
aad4282fc3 Qt6: fully define dive structure
With Qt the forward declaration fails as the export to QML for the statistics requires
the MOC code to be able to determine the sizeof(struct dive).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
41fd72c815 Qt6: small API changes
A member function had a minute name change.

The SceneGraphBackend is now set via a string argument, not a magic constant.
Thankfully that appears to be backwards compatible.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
c3cc3155fc Qt6: add include files to keep QVectorIterator working
The QVectorIterator is only available in Qt6 when you explicitly add the
include files.

Suggested-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
fc66352c3c Qt6: if we want the QString argument we need the TextChanged slot
I'm surprised this worked correctly in Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
5d506e4152 Qt6: move connection into C++ source
This no longer compiles when defined in the .ui file. But functionally this
should be the same and it should work on Qt5 and Qt6.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
63f0af201e Qt6: add required QFile header
This worked without that include in Qt5, but having it there doesn't hurt,
either, so instead of yet another conditional compile, let's just include it
everywhere.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
6700d617b8 Qt6: the help button is now opt in instead of opt out
This seems much more reasonable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
8b463ca158 Qt6: add missing includes
This class is only available via Qt5 compatibility and for that we need the
explicit include.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
3321904434 Qt6: deal with changed QtConcurrent::run API
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
f9b2d4fa25 Qt6: adjust for changed argument types
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
e61509b032 Qt6: deal with changes to window and layout geometry APIs
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
e29ecf2c9a Qt6: update to newer APIs for QDateTime
Fortunately, these were already available in Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
6f46238fc4 Qt6: Bluetooth API changes
Use the explicit QBluetoothUuid instead of just QUuid and deal with new
constants and signal names.
At least with Qt6 we no longer need the ugly QOverload hack.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
78361ef8e3 Qt6: deal with changes from QStringRef to QStringView
QStringRef is gone in Qt6 and mostly replaced by QStringView.  The one major
difference is that direct comparisons with string literals are no longer
possible.

Thanks to Thiago Macieira for helping me avoid more conditional compilation
here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
47d900bee5 Qt6: don't build MapWidget
Since Qt6 doesn't include QtLocation anymore, we can't build MapWidget.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
ce254bee57 build-system: update cmake to allow Qt5 and Qt6
Qt6 builds of course still fail, but now they are at least possible.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
c4319e3995 build-system: Qt6 so far is missing Qt Location
So don't try to find the private headers and don't try to build the googlemaps
map plugin.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
da3417123a build-system: take Qt6 into account
We should find qmake - but in case there's only a qmake-qt6 binary,
try to use that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
59fe2f3d7e cleanup: prevent distracing conversion warnings
We do want the -Wfloat-conversion warnings where they point out
potential bugs. But they are very distracting when they are triggered by
floating point literals (which the standard defines as double) passed to
a function expecting float arguments.

The fact that Qt6 changes the arguments to all these functions from
double to float is... hard to explain, but it is what it is. With these
changes, for the majority of cases we create inlined helpers that
conditionally compile to do the right thing. And in a handful of other
cases we simply cast to float (and accept that on Qt5 this then gets
cast back to double... for none of these cases the potential loss in
precision makes any difference, anyway - which likely is why the Qt
community made the decision to change the type of the arguments in the
first place).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
81ed23583e macOS: fix broken .pc file for libmtp
This has bugged me forever. The existing file creates a warning on every single
compiler invocation. I really need to figure out if I can get this fixed
upstream. But while I'm at it, I submitted it here to make it easier to spot
warnings in the build output.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
325addf385 cleanup: fix incorrect QFuture return value
I'm a abit confused why that didn't cause an error with Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
df610752c7 cleanup: don't add QKeySequence values
These should be handled as logical OR operations as they are bits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
9b3a9904b2 cleanup: remove duplicate connections in .ui files
These no longer compile with Qt6 - but they are already duplicated in C++ code,
anyway. So we can simply remove them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
cbad9607e8 cleanup: remove unused argument and private member
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
5dd3d1897f build-system: small cleanups for the CMakeLists.txt
Simply removing outdated things that will be in the way.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
e223cb3500 build-system: correctly build OpenSSL on ARM Macs
The OpenSSL configure script requires us to pass in the correct build spec.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
7dc3afba31 build-system: update to current OpenSSL version
This is required to compile it on ARM64 Macs (and of course also is
the right thing to do overall).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
3d72fba19f build-system: update libusb version
If we are building our own version of libusb, let's build a current one
(because current libmtp relies on that).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
540848cb66 cleanup: use already defined constant
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
39857ff717 macOS: remove unused Info.plist
This was confusing - the file in packaging macos hasn't been used since we
switched to building with cmake something like seven years ago.
Also add missing keys to the actual Info.plist skeleton.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Berthold Stoeger
f682b365a6 cleanup: remove unused MainTab::refreshDisplayedDiveSite()
The last user seems to have been removed in 3a3089770a5af9
and nobody complained.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-06 11:45:47 +01:00
Dirk Hohndel
75b2fcc4a4 user-manual: update the bundled html version
This is used if someone builds from source and doesn't have asciidoc
installed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-04 12:03:48 -08:00
Jason Bramwell
28a5442944 printing: add gas fractions to print template and user manual
Add additional exported values gasO2, gasHe and gasN2 to be available to the
print template.

Also add these to the user manual as well as document some other missing
variables like surge and chill.

Finally, remove references to Grantlee. While the print template still uses the
syntax that we inherited from Grantlee, we aren't actually using Grantlee
anymore.

Reported-by: Rahul Swaminathan <rahul.swaminathan@gmail.com>
Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-04 12:02:35 -08:00
Jason Bramwell
6454c6e6ea user-manual: include doumentation for meandepth print template
Reported-by: Rahul Swaminathan <rahul.swaminathan@gmail.com>
Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-04 12:02:30 -08:00
Jason Bramwell
a70eccea29 printing: make meandepth available to print templates
Adding additional exported value meandepth to be available in the print
template language.

A possible use of this would be

<td class="fieldTitle">
    <h1> Max / mean depth </h1>
</td>
<td class="fieldData">
    <p> {{ dive.depth }} / {{ dive.meandepth }} </p>
</td>

Reported-by: Rahul Swaminathan <rahul.swaminathan@gmail.com>
Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-04 12:02:28 -08:00
Dirk Hohndel
12e61e8c12 build-system: don't fail with multi-part path
If the CMAKE_PREFIX_PATH is a multi element path the old code failed
in very predictable ways. So instead simply fall back on the PATH to
find qmake.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-01 14:16:25 -08:00
Dirk Hohndel
f8eb5140e2 mobile/profile: fix scaling of profile for HDPI screens
For reasons I don't understand, the device pixel ratio was taken into account
twice. And as a result the transformation applied to the profile made us show
only the top left part of it - but enlarged (depending on the DPR).

This code fixes that problem by simply forcing the transformation used by the
painter to be the identity matrix. I worry that this could be wrong in some
situations, but for now it seems to fix the problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-01 14:16:25 -08:00
Dirk Hohndel
83d6143f97 Android: use shareFile for support email
This way we can have attachment of fairly arbitrary size (which should
be extremely useful for long libdivecomputer logs). This isn't quite as
intuitive as what we did before - the user needs to pick an email app to
share with), but that doesn't seem too bad - and also... this way they
can share logfiles via Dropbox or analyze them in other apps).

If the file share fails for some reason, we fall back to the old method
with passing the combined logs as body to the support message.

As an implementation detail this keeps the correct path for the app log file around
(this was stupidly overwritten before).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-01 14:16:25 -08:00
Dirk Hohndel
43ed2e1224 Android: use a sharable location for our files
The first location we should try is one that allows us to share files.
In theory this should work on every device, but we do have a few
fall-backs, just in case.

This also moves the Android specific include to the top which seems much
more standard.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-01 14:16:25 -08:00
Dirk Hohndel
aa41fbbf79 Android: add java code to share files
Android's sandbox makes us jump through hoops in order to share files
with other apps. We need to declare a file provider and use specific
paths where the files are located.

Then we have java code (I couldn't make it work as JNI) that takes the
filenames and creates content:// URIs for them and then hands those off
to a sharing activity that is provided by Android.

This can then be used to create attachments for support emails, or to
share the log files with other apps - both of which will solve the
annoying maximum log file length that we have with using the binder to
add the log file text to the message body.

This also finally replaces the 'compile' directive in build.gradle with
'implementation' - removing a warning that we've had for ages.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-01 14:16:25 -08:00
Dirk Hohndel
3b42aada18 core: avoid crash when reading corrupted git data
If a merge mishap creates inconsistent data for a dive in git storage,
where the dive references a dive site that no longer exists, the app
would crash when trying to open the cloud storage.

I don't think a NULL dive could ever happen, but this seems fairly cheap
insurance.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-28 14:31:19 -08:00
Dirk Hohndel
f7a2ad71ca Update libdivecomputer
Merge Jef's upstream into the Subsurface branch:

- support for new dive computers: Mares Pick Pro+, Deep Six Excursion,
  Crest CR-4, Genesis Centauri and Tusa TC1.

- support freedive mode on Mares Smart Air

- work with Oceanic dive computers regardless of whether they need the
  BLE handshake or not

- OSTC updates: support bigger BLE packets in newer versions, fix
  setpoint in SCR mode

- Shearwater updates: full dive mode parsing, correct timezone handling
  on Teric, support up to four transmitters on newer log versions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-28 14:16:05 -08:00
Berthold Stoeger
777a57356b profile: fix ESC in planner
When in the planner, ESC should cancel the plan.

However, when the user manipulates the dive-handles in the
profile and presses ESC, first nothing happens, then an obscure
message appears.

The reason is that ESC "shortcuts" are introduced in two places.

To fix this, remove the ESC shortcut in the profile (the planner
widget cancels the plan anyway) and replace all the shortcuts in
the profile with a simple override of the keyPressEvent().

The latter is not strictly necessary, but hopefully avoids further
complications with multiple shortcuts. And the code is easier
to follow too.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-19 10:47:49 -08:00
Dirk Hohndel
36af99591c bugfix: call fprintf() instead of printf()
This is an embarrassing oversight.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-15 14:26:43 -08:00
Berthold Stoeger
1ce42158f1 model: unify tooltip formating in DiveTripModel
The formatting of the tooltips describing the columns
was repeated in two functions. Infuriatingly, there were
to minor differences: "Max. CNS" vs. "Max CNS" and
one version understood "Country".

Break that out into a single function to avoid these
inconsistencies and to save a few lines of code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:37:16 -08:00
Berthold Stoeger
b3c58e7172 models: export dive guide in DiveTripModel
We might want to display that in the dive list.

Fixes #3382.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:37:16 -08:00
Berthold Stoeger
f4c85eec04 manual: change dive master to dive guide
For consistency with the application.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:35:43 -08:00
Berthold Stoeger
9e0712d5dc core: replace dive master by dive guide
In general, replace "dive master" by "dive guide".

However, do not change written dive logs for now. On reading,
accept both versions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:35:43 -08:00
Berthold Stoeger
889827aadb desktop: don't update notes field when executing command
User report: when switching focus between windows, the
cursor position gets lost. This is due to a note-edit
command being fired, which then overwrites the notes tab.

To prevent this, don't update the notes field when placing
a command. Moreover, generally don't update the dive
selection when placing a command as that also rewrites all
the values.

Should this be extended to other fields?

Fixes #3365

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:34:23 -08:00
Berthold Stoeger
1b8f3a06ec undo: add flag that indicates whether a command has been placed
In multiple places we have the problem that when an undo command
is executed, the corresponding value-changed signals are emitted,
which in turn updates the UI. This can have nasty UI effects, such
as the cursor position in the notes field being reset.

To avoid this, add a flag that indicates whether a newly placed
command is currently executed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:33:59 -08:00
Oliver Schwaneberg
04c5ab0e36 Uemis support: hack around the need to reconnect the Uemis Zurich
When the file system of the Zurich gets full, the only way to continue to
download from it, is to disconnect and reconnect the dive computer (which
resets the FAT file system that it emulates to 'empty').

This solution is rather hacky and weird because it does a hard count down in a
busy loop, but given the narrow use case, this may be acceptable.

This also adds support for the UEMIS_DIVE_OFFSET environment variable that
allows the user to skip dives on the device.

[refactored by Dirk Hohndel]

Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-15 09:31:35 -08:00
Berthold Stoeger
af0b061266 cleanup: fix uninitialized member issue
Coverity warning: divedatapoint::minimum_gas was not initialized
in DivePlannerPointsModel::addStop.

I don't know the meaning of that member variable and therefore
cannot tell if this was a real issue.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:30:43 -08:00
Berthold Stoeger
06d7ba082e cleanup: Fix a Coverity warning
Two pointers were checked against NULL and then both were
dereferenced if at least one was not NULL. Of course, this
should have been an and, not an or expression.

That said, this is a semi-false positive, since both pointers
are set in the constructor and therefore never can be NULL.
In principle, one could remove the whole check. Of course,
realizing that would require a global analysis by Coverity,
which I reckon it doesn't do.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:30:43 -08:00
Dirk Hohndel
ab8533eeaa update libdivecomputer
Add support for latest BLE hardware in OSTC dive computers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-14 12:42:33 -08:00
Dirk Hohndel
3710d44f81 build-system: add Markdown support to parse-descriptor.pl
This cleans up the script a little and makes it more flexible to add other
output formats; and adds Markdown as one such format.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-13 16:50:40 -08:00
Berthold Stoeger
5085793d9a cleanup: use setDive() in ProfileWidget::plotCurrentDive()
This removes a block of redundant code that was already broken
out into a helper function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-13 15:00:38 -08:00
Jef Driesen
3a77d15eef Add support for the new OSTC hardware
In the latest OSTC hardware, the Telit/Stollman bluetooth module has
been replaced with a u-Blox Nina B2 bluetooth module. The BLE
communication protocol remains roughly the same, except for a few minor
differences:

 - New UUIDs for services and characteristics
 - Only one common characteristic for Rx and Tx
 - Credit based flow control is optional
 - Credit value of 255 corresponds to a disconnect

[Dirk Hohndel: small edit to a comment]

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-31 12:28:32 -08:00
Miika Turkia
f8c794e11c DM5 import: Add dive mode support (OC and CCR)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2022-01-31 09:35:21 -08:00
Dirk Hohndel
f1740358a7 mobile: update version to 3.4.3
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-27 09:23:25 -08:00
Dirk Hohndel
5929b0786d Update README and ReleaseNotes for 5.0.6
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-27 09:21:14 -08:00
Dirk Hohndel
8bfc0ba27b Pull latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-27 09:11:58 -08:00
Berthold Stoeger
e8698d615b profile: call plotProfile() with correct parameters in draw()
The signature of draw() was changed to include "keepPlotData"
as an optimization.

The caller in draw() was not changed and now the plot data
is not recalculated, which means no plot data at all in
prints and exports.

The various boolean parameters should be replaced by flags.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-20 15:45:51 +01:00
Dirk Hohndel
50bf8705bc Sync translation strings with Transifex
The updates to the copyright year plus new strings introduced or moved
recently.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-17 14:24:41 -08:00
Dirk Hohndel
a4438c2d07 update copyright year...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-17 14:18:59 -08:00
Dirk Hohndel
542ed04a90 buildsystem: update translation script
Running this on a different system I found a few problems...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-17 14:18:59 -08:00
Berthold Stoeger
1af4032dad planner: properly keep track of cylinder count in model
In a40b40a the cylinder-hiding functionality was changed,
which made it necessary to keep track of the number of
cylinders. Ironically, that code was removed previously,
as it was redundant. The count was not readded to the
functions called by the planner, making editing of cylinders
in the planner impossible.

I wonder more and more if the models for planner and the
equipment tab should be changed. They are too different.

Fixes #3375

Reported-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-17 13:08:46 -08:00
Berthold Stoeger
ab830fcfd7 profile: fix tankbar
The logic has just been completely broken when implementing
zooming.

Fixes #3376

Reported-by: Anton Lundin glance@acc.umu.se

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-17 13:05:38 -08:00
Dirk Hohndel
b56eacbaec add two small libdivecomputer bugfixes
- Restore the original standard gravity factor for Uwatec/Scubapro dive computers
- Garmin: Fix gas change event parsing

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-10 13:42:13 -08:00
Dirk Hohndel
f6a1340a29 buildsystem: remove Ubuntu Groovy build
This GitHub Action started failing. Groovy was EOL'ed six months ago and
downloads from the Ubuntu servers of Groovy components are no longer
supported.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-04 19:50:05 -08:00
Dirk Hohndel
10d39e1b98 Android: build updates
Builds were failing because gradle tried to download libraries from
bintray. JCenter is shutting down in a few weeks.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-04 19:50:05 -08:00
Berthold Stoeger
db0f8ba045 statistics: add sort mode on mobile UI
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-04 11:14:24 -08:00
Berthold Stoeger
1e5191e33e statistics: add a sort mode for categorical bar charts
This was a user request: Sort bar charts by height of the bars.
Obviously, this can only work for categorical charts, not for
histograms.

The UI is a break from the old concept: the sorting is chosen
based on the chart, whereas for the rest of the features, the
viable charts are presented based on the binning, etc.

I found it confusing to have the possible charts be selected
based on sorting. I.e. if a non-bin sort mode is selected,
the histogram charts disappear. On the flip side, this would
be more consistent. We can change it later.

For value-based bar charts, there are three sort modes: by
bin, by count (i.e. number of dives in that bar) and by
value (i.e. length of the bar). This hopefully satisfies all
needs.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-04 11:14:24 -08:00
Berthold Stoeger
f76752ee03 cleanup: fix typos in comments in statistics code
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-04 11:14:24 -08:00
Dirk Hohndel
4fdbb116ef tests: fix integer constants
In TestUnitConversion we used casts instead of the more common suffix
designations to indicate the type of those integer constants.
Worse, in commit efab955d85 ("cleanup: make feet_to_mm signed") the
return type of feet_to_mm() changed, but the value it is compared to
wasn't adjusted in the test which caused some builds with more
aggressive compiler flags to fail.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-01-04 19:48:35 +01:00
Berthold Stoeger
efab955d85 cleanup: make feet_to_mm signed
Depths are pretty much universally stored using signed integers
(e.g. depth_t is signed int). For consistency, make feet_to_mm()
likewise return a signed value.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-02 13:51:07 -08:00
Berthold Stoeger
4f1034b605 cleanup: make a variable signed
The prev_time variable was defined as unsigned and mixed
with signed variables. gcc rightfully complains with -Wextra.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-02 13:51:07 -08:00
Berthold Stoeger
c43311614e cleanup: remove obsolete includes in core/device.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-02 13:51:07 -08:00
Berthold Stoeger
72ad4cedf5 cleanup: replace strcmp by std::string methods
Since these are std::strings anyway, there seems to be no point
in using the C-lib functions. YMMV, but to me that code is
distinctly more easy to parse.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-02 13:51:07 -08:00
Berthold Stoeger
66896ad7d7 cleaup: remove device::operator==()
The last user was removed when including devices in the undo
system.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-02 13:51:07 -08:00
Berthold Stoeger
c893d19ea4 cleanup: pass all parameters to weightsystem_t
With -Wextra, gcc/g++ complains that compound initialization
of weightsystem_t misses the auto_filled parameter. Add it.
For C++ code we might think about writing a constructor. However,
we use two versions: with and without copied string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-02 13:51:07 -08:00
Berthold Stoeger
d89ef3d906 cleanup: fix narrowing type conversion warning
In pscr_o2() the result of a double calculation was implicitly
converted to int, which resulted in a gcc warning.

Part of the expression was explicitly converted to int, but then
subtracted from a double.

Instead, do all the calculations in double and cast the final
expression to int. This is probably the prudent thing to do.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-02 13:51:07 -08:00
Berthold Stoeger
4458535265 profile: use unique_ptr to store DiveTextItems
Pure bike-shedding:
The DiveTextItems of the DiveProfileItems were stored as raw
pointers. Instead, store them as unique_ptrs, so that they
don't have to be explicitly deleted.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
cf1ad3d831 profile: add space at bottom of temperature graph
The temperature graph connected directly to whatever was below.
Thus, the lowest temperature often was not clearly seen.

Add a general "bottom border" space to the main chart features
and set it to two pixels for the temperature and zero pixels
for the rest. Might need some fine-tuning.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
3ae160857d profile: reformat timestamp labels
The timestamp labels may change their format on zoom from
"mm" to "mm:ss", depending on the zoom level. Since the
animation kept old labels, this meant that one can end up
with a mix of labels.

Therefore, always reformat the labels. Of course, this
means that the labels switch instantaneously from one format
to the other. This is in conflict with the whole idea of
"smooth" animation. Such a smooth animation could be realized
by adding a "format" flag to the Label structure and keeping
thus fading in/out labels if the format changes. Do we want
that?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
2645fa1495 profile: remove fast argument of create_plot_info_new()
This prevented calculation of the pressure data when dragging
planner handles. However, this lead to weird artifacts.

As an alternative, if this turns out to be too slow, we might
disable the plotting of the pressure curves instead.

That said, even on my super-slow fanless laptop, this performs
reasonably.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
352cdcc863 profile: fix crosshairs
In planner and edit mode, the cursor position is indicated using
crosshairs. They broke when changing to absolute scaling.

To fix them, remember the plot-area in the profile scene and
draw the crosshairs only inside this area (not on top of axes).
However, limit the position of the horizontal line to the
actual profile (dont paint inside the partial pressure, etc
graphs). The vertical line is painted above those graphs, so
that a timestamp can be related to partial pressure, tissue
loading, etc.

Also, set the z-value of the crosshairs. It was painted
inconsistently above some and below other chart features.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
26c6344e70 profile: remove two unneeded includes in profilewidget2.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7e4973c5b1 profile: don't show "base line" for axes without labels/grid
The axes are implemented by a line, which determines the
position. For axes without labels/grids this looks ominous.
For now, make the line invisible. But really, this should
be changed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
3579e36b7d profile: don't show 0m label
The old profile code didn't show the 0m label, because that
was cut off. This was lost when redoing the axis code.
Reimplement this. The code is very ugly: it recognizes the
depth axis by the fact that is the only "inverted" axis.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
725fda3cd1 profile: don't add excessive depth
The old get_maxdepth() function in profile.c was accounting for
two things:
- the partial pressure graphs
- rounding to sane value

Both are now taken care of by the profile itself. This leads to
excessive max-depths. Remove the code from profile.c.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
de71435c11 profile: clear the chart when there is nothing to display
This is a shouldn't happen situation, because we always
fake a profile. Let's handle it gracefully anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
ecd3334a1c profile: when clearing the profile, also reset the profile data
When hovering over the chart after the chart was cleared,
there were artifacts owing to the stale profile data.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
789eb2c620 profile: clear plot_info structure when freeing data
free_plot_info_data() frees the sample and pressure arrays
and accordingly sets the corresponding pointers to NULL.

However, it doesn't clear the element-count and thus leaves
the structure in an inconsistent state.

Clear the whole structure with memset(). I am not a fan of
doing so, but there are existing memset() calls in the
same source file, so let's keep it like that for consistency.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
564cbc797c profile: remove DivePlotDataModel
All accesses to the plot data are now directly to the core
structures.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7aacde3169 profile: remove ProfileScene::dataModel
All data access is now directly via the plot_info structure
owned by the ProfileScene itself.

Also removes DivePercentageItem::hColumn, which was an
artifact from the DivePlotDataModel.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
bdbcb1b7e3 profile: access the ProfileScene's plot_info
There were two plot_infos of the same dive: one owned by
ProfileScene and one owned by DivePlotDataModel. The latter
was (or at least should have been) a copy of the former.

Simply always access the plot-info which is owned by
ProfileScene anyway. That seems much less brittle. Why
risk some desyncing?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
6f2965c5af profile: access profile data directly
The profile was using a Qt-model to access its data. This means
routing everything through Qt's QVariants and lead to verbose
code such as

double prev_y = dataModel.index(i-1, vDataColumn).data().toReal();

Instead of storing a data-column and do access via a template,
simply store accessor functions. The code from above now reads as

double prev_y = accessor(data[i-1]);

This should also be distinctly faster for the ns-optimizers among
us.

Only one case was somewhat nasty to convert: The accessors for
the 16 tissues are now generated via a recursive template. Thanks
to C++17's constexpr if, such a template is pleasantly easy
to follow, though.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
11913e614c profile: don't derive ProfileItems from QObject
The intention was to use QObject slots for animations.
However, these animations never materialized. Should we
ever want to animate them, we might use the animation
object that is already used for cartesian axes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
6fa5e59994 profile: remove AbstractProfilePolygonItem::hDataColumn
This indicated the data of the horizontal axis. It was (obviously)
always the time axis. Remove.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
e0f44237cc profile: move max_gas() from DivePlotDataModel to ProfileScene
There is only one user of this - let's remove complex
interdependencies.

Note: there seem to be two independent plot_infos: in the
ProfileScene and in the DivePlotDataModel. To avoid behavioral
change, this keeps using the DivePlotDataModel's version.
In any case, this has to be unified.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
1df1f3d0b5 profile: remove DivePlotDataModel::dcShown()
The last user was removed in 2789bb05b1.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
f13768fe65 profile: fix instant logic
There was logic to disable animation when switching from "no dive"
to "show dive". However, that has bit-rotted away: the plotted
dive was set before plotting the dive and therefore the check
for "change from empty" did not work. Introduce an explicit
empty flag instead.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
e7b078a7fd profile: remove unused animation functions
A few animation function are not necessary anymore.
Remove them.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
5c5c0c4880 profile: redo animation of labels and grid lines
The old animation was weird: it would reuse the labels
based on the index, not on the value. Thus, with the
new scaling code, sometimes there was no animation at all,
if the value, but not the position changed.

Consider the values instead and let labels appear/disappear.
This makes things slightly more complex.

While changing this code, create our own animation-class.
Thus, we can avoid having the dive axes being QObjects.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
afb0978460 profile: shorten DiveCartesianAxis::posAtValue(qreal value)
This function was just needlessly complicated. For one, it
considered the position of the line, but that is never changed
since redoing the positioning code. Moreover, it does in
lots of lines what is a very idiomatic operation: a
one-dimensional affine transformation. Let's shorten the
actual calculation to two lines.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
8ff949650a profile: vertical center mean depth label
This label is put to the right of the corresponding curve,
so it should arguably be centered vertically. At least to
me this looks more natural.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
176a62f752 profile: improve calculation of the right border
The time axis might need some space and the average depth item
puts a formatted depth at to right of the profile. Consider
these when calculating the right border.

Since I found no way to turn of the average depth, this creates
a permanent border, which might or might not be a good thing.

Contains some refactoring of the label-size functions provided
by DiveTextItem.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
6b33c3e721 profile: better increments for the time axis
The usual increments (leading 1, 2, 4 or 5) don't look
natural for the time axis. Therefore special case the
time axis and to increments in 1, 2, 3, 4, 5, 6 or 12
parts of a minute or second.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
210660d057 profile: rewrite ProfileScene::pointOnProfile()
This function was used to check wether a screen-point
is located on the profile. Bizzarely, this was done by
transforming into local coordinates and checking
min/max value. Simply check the screen coordinates
directly. Moreover, make the function return whether
the point is inside the region, not outside the region,
to make logic more straight forward.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7df0adef64 profile: only show thumbnails in range
Hide thumbnails, which are out of the shown range. This became
necessary when converting to absolute scaling.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
6cc6fe4d91 profile: fix y-coordinate of picture thumbnails
When changing from relative to absolute scaling of the char
elements, positioning of the picture thumbnails was broken.

To emulate the old behavior, add a function to DiveCartesianAxis,
that allows positioning with respect to the axis on the screen.

To simplify tuning of the poctuire positions, name a few
constants explicitly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
51be326879 profile: don't recreate picture thumbnails on zoom / scroll
The picture thumbnails were recreated on every profile render,
even when zooming / scrolling. In that case, we should only change
the positions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
71629521b7 profile: don't recalculate plot-info when zooming / scrolling
This is a potentially expensive operation (e.g. interpolation of
pressure values), so don't recalculate the plot data for every
redraw.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
6dfc2da8d0 profile: use a flag variable in plotDive()
Positional bool parameters to control the rendering of the plot
have been a pain. We are down to one parameter (instant),
but more will be readded, so let's use the opportunity to
control rendering with a flags parameter.

Sadly, C++ has no reasonable way of defining flags that I know
of. Either the identifiers leak (enum), or can't be trivially
ORed (enum class) or are weakly typed (int). Let's just use an
integer for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
d3a2c40f52 profile: remove "changed" flag of DiveCartesianAxis
This prevented the axes from being redrawn on resize. It shouldn't
be necessary anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
b673355245 profile: don't check for printMode in ProfileWidget2
This widget is no longer used for printing, therefore these
tests are obsolete.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
685b7cb2a8 profile: no doClearPictures argument for ProfileWidget2::plotDive
All callers were passing the default value (false).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
01af4bcd00 profile: remove min/max entries from plot_data
These were the minimum and maximum of a 9-min window.
The profile now uses an adaptive peak-search, so this is not
used anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7ef0ae02a8 profile: implement adaptive depth markings
The old code used the maximum / minimum values of nine-minute
intervals to indicate maximum / minimum depths. This does not
work well when zooming, since the labels will get sparse.

Instead implement a primitive peak finding algorithm, that
searches for the deepest peak in the whole plot and then
repeats the procedure for the right and left sides, leaving
out a certain distance to the origninal peak. This is repeated
until there are no more peaks found.

Only peaks of a certain prominence are considered, which
conveniently gives us the valleys.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
efc89b9d9c profile: use dynamic distances between labels on chart
Use variable intervals for printing temperature and heart
beat labels. Obviously, so that the labels don't become
sparse on zooming, but also to make them not too crowded
on mobile / small screens.

This doesn't work for depth labels, because these labels
use data provided from the profile.c core that doesn't
know about the size of the chart.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
5c83fcd647 profile: attempt to port mobile-visibility code
There was a bunch of conditionally compiled code on mobile
that had special hiding/unhiding rules.

Try to unify that with the desktop code by introducing a
"simplified" flag. This certainly breaks and will have to
be finetuned. In particular, I can't test CCR dives, which
are treated specially on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
1a429d9b17 profile: don't plot event-icons outside of range
Do this by extending the isInteresting() function for
dive event items.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
a496ab016b profile: remove visibilityKey members of a few DiveProfileItems
There were no users.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
073059f5ab profile: clip DiveProfileItems
Avoid "overshooting" of the profile items by linearly clipping
the first and last segment to the boundaries of the time-axis.

Sadly, quite a lot of code, because every profile item is
slightly different.

In particular the pressure-segment handling was rewritten.
It now stores the begin and end of each segment to draw
the appropriate text items.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
56f6e5051f profile: fix displaying of gas pressures
Due to bit-rot the gas pressure and gas type were displayed on top
of each other. I don't understand the meaning of the old code
[log10(log10(axisRange))] (!). Therefore let's just add the height
of the label to separate the labels.

Probably needs some fine-tuning.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
85d1e1d199 profile: only plot visible range of tank info
This was a rather trivial change: simply pass in the first
and the last second to the plot function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
d97cc8d4d5 profile: remove TankItem::plotEndTime member variable
That variable was only used in a single function and
always reset at the beginning of the function. No point
in being a member variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
118700fd18 profile: pass [from,to] range to polygon plotting functions
Only plot the zoomed range. Currently this passes the sample
before and after the range, so it generally "overshoots" by
one sample in each direction. The plan is to do clipping
on the first and last polygon segment later on.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
c09382036f profile: don't use scene for zooming
We were using the QGraphicsScene machinery to zoom into the
plot. This not only zoomed into the dive, but into the whole
thing. In general, one couldn't see the axes anymore.

Instead, adjust the range of the time-axis according to the
zoom-level and position.

Of course, the code isn't adapted to that and the result
is comical. The chart features will have to be fixed
one-by-one. Oh joy.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7d3e246680 profile: explicitly reset zoomLevel when plotting a new dive
Currently, the zoomLevel is reset for every plotDive() call,
because the zooming is done via the QGraphicsScene. However,
this does not work well (e.g. axes are likewise zoomed) and
in the future a change of the zoom level will cause a replot.

Thus, remove the zoom-reset in plotDive() and do it explicitly
when switching dives.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7051bee7e1 profile: remove ProfileWidget2::zoomFactor member
This is a constant, no point in keeping it as a member variable.
Contains removal of a pointless #ifdef (guarding against mobile,
but code not compiled on mobile), a typo-fix in a comment and
replacement of Qt's idiosyncratic qreal by double.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
2f9c0c04b5 profile: replace orientation by inverted flag
There were two somewhat redundant flags for the axes: the position
(left, right, bottom) and the orientation (up-down, left-right, etc).

Replace the latter by an inverted flag: if true, the axis is
up-down or right-left, i.e. the opposite of what one would expect
for a normal graph.

Set the flag in the constructor and remove the setOrientation()
function.

Sadly, the code is a bit complex, because screen coordinates are
top-to-bottom. Who thought that would be a good idea?

Note: this also fixes the placement of the ticks of the time
axis.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
3a79f3e78a profile: set textColor in constructor of DiveCartesianAxis
There were virtual functions to calculate the label colors
based on the value of the label. However, these functions
only returned constant values. Therefore, just set these
in the constructors.

Thuse, a few virtual functions and derived classes can be
removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
ea59e5cf7a profile: remove DiveCartesianAxis::gridColor member variable
This was only used in the constructor to create the pen for
the grid lines. Not need to keep it around.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7bc90b6dfe profile: set visibility of text and lines in constructor
The visibility of axis text / lines is never changed, so set
in axis constructor.

Moreover, instead of rendering the lines/text and then setting
them invisible, do not render them if invisible.

The whole thing appears superfluous, since the proper way to
not show lines/text is to just not call updateTicks on the
axis. But in the future we might want to have axes with text
but no lines, so keep for now.

Since this means breaking out the text / line rendering
into their own function, we might rename some variables to
make them (at least somewhat) more clear.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
a7a7bd182e profile: special case time axis
Rounding the axes dimensions to "nice" number may have been a
good idea, but for the time-axis it feels weird.

Therefore revert the time axis to the previous behavior:
range is set according to the data. To differentiate between
time an other axes, use the position: the time axis is the
only axis at the bottom. Yes, that's ugly but pragmatic.

Since we have that flag also use it for the special casing
of the text-display. Spares us one virtual function dispatch.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
3e11c13100 profile: use sensible tick-intervals
The integers were simply rounded to integers, which might give
ugly intervals (e.g. multiples of 3). Use the code of the
statistics tab, with one modification: take care not to
use intervals below the given precision. The statistics work
differently: there, the precision is adjusted according to
the interval size, not the other way around.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
99c4741508 profile: avoid double recalculation of tick positions
The ticks were recalculated twice per plotDive() call:
1) When updating the position of the axes in updateChangeLine()
2) After setting the bounds in plotDive() via setBounds()

Remove the first instance. updateChangeLine() is called in
only one place [from plotDive()] and therefore, the recalculation
is always redundant. Moreover, rename the function to setPosition(),
since it doesn't do any animation at all.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
b0faf2e4b1 profile: remove DiveCartesianAxis::sizeChanged() signal
This was used to animate the position of the dive event items
when the size of the axis changed. However, that doesn't work
since quite some time. The axes size are changed when
 1) switching dives
 2) resizing the drawing area
In the first case, the dive event items are fully recalculated.
In the second case, animation speed is set to instant, since
resizing of windows is done continuously on any reasonably
modern desktop anyway. It might make sense on mobile, where
size changes are discontinuous, but there we use static
profiles anyway. Moreover, I checked a few applications and
none of them had animations when switching orientation of
my tablet.

Let's just remove this disfunctional thing and replace it
later, should someone complain.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
2c4e4b1e86 profile: move setting of gasYAxis bounds to plotDive()
The partial-pressure-axis was the only DiveCartesianAxis
child that had its own code to set the bounds. The bounds
of all other axes were set in plotDive().

For consistency, do this here as well. Thus, the whole
class can be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
0de40a85b7 profile: generalize tick generation
The number of ticks was generated for each axis with custom
code. This code was not aware of the size of the profile and
could result in overly dense or sparse ticks.

Generalize the generation of the ticks. For now, round tick
values to integers. In the future, try to use more "nice"
looking values as we do for the statistics tab.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
177df72d33 profile: unify formating of axis labels
Instead of a host of virtual functions, let the base class
(DiveCartesianAxis) do the formatting of the axis labels.
To do so, it needs to know how to convert the internal
representation (e.g. mm) into the displayed value (e.g. feet).
Moreover, this transformation has to be adapted when changing
the locale-setting, therefore do it for every plot() call.

The transformation itself cannot be a simple linear translation,
because we have non-absolute display units, namely °C and °F.
Thankfully affine transformations are enough though.

Only one custom formatter remains: the time axis. It might
be a good idea to remove the virtual function and do this
via a flag.

This is all done not so much for code simplification, but
because for a general layout of the axis labels, the
axis has to understand the values of the labels and not
only handle them as opaque texts.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
0e9eee0a7f core: return floating point from to_PSI() functions
Dive data are stored internally using integral types using
appropriately fine units (mm, mbar, mkelvin, etc.). These
are converted with functions defined in units.h for display
(m, bar, C, etc.). Usually floating points are returned by
these functions, to retain the necessary precision. There
is one exception: the to_PSI() and mbar_to_PSI() functions.

For consistency, make these functions likewise return floats.
This will be needed for the rework of the profile-axes.
The plan is to use the conversion functions to make the
axes aware of the displayed values. This in turn will be
necessary to place the ticks at sensible distances. However,
the conversions need to be precise, which is not the
case for the current to_PSI() functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
322e2baa8d profile: calculate maximum label sizes on construction
Instead of calculating the label sizes of the axes when
relayouting the chart, calculate them at construction time.

To do so, pass the digits before and after the decimal comma
to the constructor.

This is not so much an optimization thing, but rather an
first stab at more general label rendering. Time, of course,
will always be an exception. But hopefully the remaining
values can be done more generally.

Note that currently this code is a total mess. For example,
the labels for the temperature axes are not converted to
F if needed. And therefore also not shown. This will need
some major rethinking.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
f19ab2e4fd profile: set DiveCartesianAxis::fontLabelScale in constructor
This never changes, no need for the complexities of a setter
function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
4b9177c098 profile: remove DepthAxis constructor specialization
All this did was setting changed to true. Obviously an
artifact, since that is done in the constructor of the
base class anyway. Remove.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
89d9105209 profile: set minimum/maximum of axes with a single call
This is bike-shedding: Instead of two setMinimum()/setMaximum()
calls, use a single setBounds() call. A few axes (notably depth
and time) always have a 0 as lower bound. However, this will
change once there is a proper zooming functionality.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
0bef8167d2 profile: always update axis-positions when plotting dive
The placement of the axes was done independently of the
plotting, e.g. when settings changed. Presumably,
for performance reasons. However, since the axes may
depend on whether a dive has heart-rate data or not,
this simply is not viable. To make this work, one
would have to remember whether the previous dive
showed the heart-rate, etc. Not worth it - always
reposition the axes. It should not matte performance-
wise.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
a031f3444c profile: make DiveCartesian axis grayscale aware
I doubt that this is necessary, but since most of the rest
of the profile code passes "isGrayscale" to "getColor()",
do the same here for consistency.

To avoid storing the isGrayscale flag, just create the pens
at construction time and store those.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
2615ba02bb profile: remove DiveCartesianAxis::setColor() and setTextColor()
These functions had no users.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
ae1758d4cd profile: don't render mobile profile in printmode
There is no more reason to render the profile in printMode.
DPR is also supported in normal mode.

Moreover, don't scale the DPR down by fontScale. If we
have to scale down the fonts, we'll have to do this
differently without squeezing the rest of the profile
features.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
9c7974928b profile: indicate bookmark by pole of flag
The event-icons are positioned according to the top-left
corner (as is usual in computer circles). For the flag
icon it seems more natural to use the bottom of the pole.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
9740651e01 profile: save depth of event
The DivePlotDataModel was saved with every event to access the
depth. However, since the depth never changes, we can simply
save the depth instead.

Also, since we only need the model to access the plot_info,
pass the plot_info directly. As noted in a previous commit
message, I believe that Qt models are a very bad choice
for intra-application data transfer. They should only ever
be used to interface with Qt.

And since touching this code, pass duration_t instead of int
to depthAtTime() to make the callers less cluttered.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
9ddaf791ae profile: use binary search to find depth at event
Instead of looping over the whole data via the Qt model,
do a simple binary search. Yes, this is premature optimization,
but I had to.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
8d4d35ea69 profile: remove redundant timestamp lookup for DiveEventItems
When placing the event icons, the timestamp is looked up and
then, the depth is checked which repeats this operation.
Remove the first instance of this lookup, as it is completely
redundant.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
8a9ca5fcda profile: don't create "uninteresting" event icons
There is code to dynamically show/hide event icons of a certain
type. The same code is used to hide generally non-interesting/
redundant items.

Instead, don't even create these items. Yes, this is idle
premature optimization.

A loop over all created event icons to hide them can be
removed, because the icon is hidden anyway on construction
time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
9e831c5001 core: remove DPR from IconMetrics class
There is no user of this left, because the device-pixel-ratio
is now passed directly to the profile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
5f22de7ebe profile: remove special iOS DPR handling for event icons
On iOS there was special code to scale event icons with DPR
(device pixel ratio). However, that became redundant, when
printing started to also use DPR to scale the icons. Now,
on iOS icon sizes where multiplied twice with DPR.

Let's remove that and, if it is broken, try to fix it
at the correct place.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
1d58553864 profile: replace bookmark event icon PNG by SVG
This looks much better on print-outs. The remaining event icons
still need to be converted to SVG.

SVG created by Lubomir I. Ivanov <neolit123@gmail.com> and
made compatible with the Qt SVG renderer by BS.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
f7565c4a0f core: clear image before rendering SVGs
In renderSVGIconWidth() the image was not cleared, leading
to garbage backgrounds. This should have affected the video
icons. Apparently, nobody is using them..?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
f82ae2be7f profile: cache pixmaps for dive event items
For better scalability, we might replace the dive event icons
by SVGs. Since rendering SVGs is potentially very slow, cache
the pixmaps when the scene is generated.

Note: this does not yet do any SVG rendering, only the caching
of pixmaps.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
9e20cb5a49 profile: remove PERCENTAGE_* data from DivePlotDataModel
The profile now reads these percentages directly from the
plot info structure.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
505e4e47eb profile: reimplement DivePercentageItem
The tissue percentages were realized as 16 independent polygons.
That didn't work at all with the new absolute scaling.

Reimplement the item and blast it onto a pixmap. Not only is
this artifact-free, it also should (hopefully) be quite a bit
more efficient than painting numerous lines.

In contrast to the old code, this does access the plot_info
structure directly instead of using the model. Not so much
for performance reason, but rather to make things more robust:
We have a strongly typed language. Why would we shoehorn data
through the weakly typed QVariant and mess with wierd
index-arithmetics. Makes no sense to me. Qt-model have to
be used for interfacing with Qt. They are terrible for
intra-application data transfer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
24cf6709e3 profile: simplify get_maxtime()
This function has accumulated quite some cruft. It seems to add
additional space to make place for certain chart features
(e.g. the average depth text item).

However, it makes no sense to solve this here, as only the
profile knows how much place is needed to display these
features.

Therefore, basically revert this to the original version,
which simply returns the maximum time for long dives
and a threshhold for short dives that depends on the
zoomed_plot setting.

The result looks more reasonable to me, as there is no
(varying!) empty space to the right of the profile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
179df1bf80 profile: remove DiveCartesianAxis::tick_size
No user of that. Also remove the setter function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
8046a05e95 profile: merge plotDive() into draw() call
Rendering resets the size, which now recalculates the axes.
Therefore, plotDive() must be called. The callers were doing
the opposite: call plotDive() first, then draw().

To make it easier for the callers, present a single interface
that handles these subtleties.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
d0beae59f9 profile: start with "absolutizing" the profile layout
The chart items were laid out in relative terms with respect
to a fixed scene size (100.0, 100.0). This simply does not
cut it when resizing the chart. Why should the axes always
occupy the same fraction of the chart independent of the size.

Moreover, this led to basically unmaintainable code.

Resize the scene according to the viewport and do
absolute placement of the items. This breaks the layout,
but at least now we have a chance to fix things
somewhat reasonably.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
99284a88f7 profile: listen to deco-info-changed signal
The profile would reload for many settings-changed signals.
It didn't listen to the deco-info-changed signal, because
that had no effect (which seems to be a bug).

Since this flag should indicate whether the deco-info is
shown and therefore a change should replot the profile,
let's listen to the corresponding signal.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
41c23dcb22 profile: remove color parameter of DiveCartesianAxis::updateTicks()
The grid color is saved on construction, no need to pass a parameter.
Note that this fixes a bug where the color was passed as animation
speed. Ooops. That's what you get from weak typing.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
277b9234ab profile: pass position and gridColor on construction of axes
This is less hassle, than passing these around as parameters.
Note: The values are stored but not yet used ("position" has
not use yet and gridColor is still passed as parameter).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
766546fc19 profile: Add a DiveCartesianAxis::Position enum
To properly layout the axes, it is necessary to specify on
which side of the chart they are located.

There is already an "Orientation" enum. However, that gives
the direction (top-to-bottom, etc.), but not the position.
It might become obsolete in the future, since the direction
can also be expressed by setting min and max accordingly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
abadbb6783 profile: add DiveCartesianAxis::height()
This is needed to properly layout the axes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
15f20961c7 profile: render DiveTextItem onto a pixmap
The DiveTextItems were redrawn on every paint() call. This was
a prohibitively expensive operation (converting the text into
a path, drawing an outline, etc.), which was called numerous
times.

Instead, render the text only when changing into a QPixmap
and blit that pixmap in the paint() call.

This will make it possible to do absolutely positioned
DiveTextItems. So far they were placed relatively in
scene coordinates ranging from 0-100(!).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
04e0d96bae profile: set text and brush of DiveTextItem concurrently
The text and the brush are the two properties of text items
that change dynamically. To avoid complexities concerning
redrawing, set them concurrently instead of in two separate
calls.

Since setting one of the properties requires a full redraw,
there is no performance advantage in setting them individually.

This fixes a theoretical bug: the colors of axis labels were not
updated appropriately. However, it seems like value-dependent
labels weren't used anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
2ebe6e3684 profile: set alignment and scale of DiveTextItem at construction
Alignment and scale of DiveTextItems are never changed. Therefore,
pass them at construction time. This makes things much easier
if we want to cache the rendered text [currently the text is
rerendered at every paint() event].

This also removes the "parent=0" default parameter of the
constructor, because inadvertently leaving out the last argument
led to a subtle bug.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
5540471ce4 profile: remove text related code in DivePercentageItem
This never sets any text.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
8343691a38 profile: add height() member function to DiveTextItem
To layout the profile we need to determine the height
of texts. Add versions for a DiveTextItem and a static
function, which is passed the scale and dpr. The latter
is used to setup items, where we do not necessarily
have a text at creation time (e.g. the tankbar).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7dd9b65df0 profile: add width() function to DiveCartesian axis
To properly layout the profile we need to know the expected space
required by the vertical axes. In the general case, format the
the text "999". For the partial-pressure-axis, use "0.99".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
f713858ba4 profile: rename printFontScale to dpr (device pixel ratio)
The printFontScale is used to scale up fonts (and icons) when
rendering to high-DPI devices. With absolute scaling, this
will also be used to scale the size of different chart
regions, line thickness, etc. Therefore, give it an more
appropriate name. "Device pixel ratio", which is a well
established term, seems to appropriately describe the
concept.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
d28f4d5347 profile: don't compile ProfileWidget2 on mobile
Since there (currently) is no interactive widget on mobile, there
is no point in compiling it. This was a bit more complicated than
expected, since there were other source files (divehandler.cpp
and ruleritem.cpp) which reference ProfileWidget2 and therefore
need to be removed. Otherwise, the dreadful MOC produces unresolved
references.

We could now remove all the conditional compiles in
profilewidget2.cpp, but let's keep them for now. We might have
to readd a number of them later, when making the mobile-profile
interactive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
4fb2cc8267 profile: remove ProfileWidget::setPrintMode()
The print mode is passed on construction, not retroactively.
This function thus became unused.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
51dc5113c2 profile: for printing/mobile access ProfileScene directly
Instead of using the interactive ProfileWidget2, just
use the ProfileScene to render the profile for printing,
export and mobile. One layer (QWidget) less.

This removes all the kludges for handling DPR on mobile.
Thus, the rendering will now be off and have to be fixed
by redoing the scaling code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
84ebd1d67a profile: pass print-mode add construction of ProfileScene
Setting the profile and grayscale mode of the profile via
functions is from a time when the same profile widget was
used for printing and the UI. It is simpler to set the mode
when constructing the object and not deal with changes.

To prepare for this scenario, take the flag at construction
time. This still keeps the callers as-is. These will be
adapted later.

Logically, then the printFlag also has to be set in
DiveCartesianAxis at construction time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
1327043d6e profile: rectify animSpeed data flow
The cartesian axes use animSpeed to animate changes. Instead
of passing down the value to the respective functions, the
speed was stored in the ProfileScene and the axes would
access it there. Very messy. Let's just pass down the speed.

There still are back-references from the axes to the scene,
notably to place labels "outside" of the scene. Let's try
to remove them later.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
d19b095db1 profile: remove settings-changed slots in DiveCartesianAxis
The profile is fully redrawn anyway, there is no point in these
redundant slots.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
d9dcf9ef37 profile: move non-interactive chart elements to ProfileScene
This finalizes the split between interactive (ProfileWidget2)
and non-interactive (ProfileScene) parts of the profile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
bf12756819 profile: move printing-related variables to ProfileScene
Since the ProfileScene does the actual rendering, it needs
access to the "printMode", "isGrayScale" and "fontPrintScale"
variables. Move them down from ProfileView to ProfileScene.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
f8fbff9f7d profile: set profile-mode in ProfileWidget, not MainWindow
The mode of the profile (profile, edit, plan) was set in
MainWindow and ProfileWidget. For consistency move the one
setProfileState() call from MainWindow to ProfileWidget.
This removes a direct access to the profile-view and
therefore improves encapsulation.

Also, clear the profile, when no dive is shown to remove
any potentially dangling references.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
12fd102e4f profile: remove empty state from profile
This was moved to the desktop version. Enter the profile in
the constructor. Somewhat surprisingly, this seems to work.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
787a23f017 profile: implement "empty state" in desktop's ProfileWidget
The profile has an "empty state" showing the subsurface logo,
which is active when no dive is selected.

Switching to/from this mode is quite complex, because all the
chart features have to be hidden/shown, etc. Moreover, this mode
is not needed on mobile, where multiple ProfileWidgets can
be active at the same time and every dive has at least a
"faked" profile.

Therefore, implement this mode directly in the desktop
version of the widget. This makes the rescaling distinctly
less cumbersome. It is implemented using a QStackedWidget,
which switches between the profile and the logo.

This commit does not remove the empty state from the profile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
9f6e487790 profile: remove redundant parameter in setPrintMode()
Since using separate profile-instances for print/export,
we never exit print mode. Therefore, the mode parameter
can be removed. This is a preparatory commit for passing
the printMode at construction time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
db726862ae profile: move axes to ProfileScene
Part of separating the static (for printing, export) and
dynamic (UI) parts of the profile. This is still quite messy
with many direct accesses from the ProfileWidget.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
c8b3ac0f99 profile: move initialization code to ProfileScene
A first in a number of commits to move code from the profile
view to the scene.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
15342232ca profile: introduce a ProfileScene stub
This simply subclasses QGraphicsScene and is used as
a drop-in replacement. The plan is to step-by-step
move rendering functions there until the non-interactive
code can only use the scene and doesn't have to use
the QGraphicsView. This will hopefully remove quite
some conditional code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
5a34bdccb5 cleanup: remove redundant ifdef in profile code
Remove a not-mobile #ifdef inside a not-mobile #ifdef.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
064d861e97 profile: update comment
The usage of the DiveProfileItems has changed (axes, etc. are passed
at construction time). Update a comment accordingly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
f05cd702b5 profile: remove ProfileWidget2::getFontPrintScale()
The last user was removed recently.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
2caea1cd56 profile: remove ProfileWidget2::setFontPrintScale()
The font print scale is now set once on construction and this
function can therefore be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
01983c65c3 profile: pass fontPrintScale at construction time
Instead of intializing the text fields and then changing the
font scale via signal-rigmarole, pass down the font-scale
at construction time.

Since the fontPrintScale is only set in print mode, we also
can access it directly instead of testing for printMode.

Since the DiveTextItem is not updated using signals anymore,
the connected flag can be removed.

The commit is larger than I had hoped for, but this makes
things ultimately less brittle.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7744fec0bf cleanup: reuse constructor of DiveCartesianAxis
The constructors of Time- and TemperatureAxis don't do anything.
In reasonable modern C++ we can simply reuse the constructor
of the base class with a "using" directive.

The point here is to simplify followup commits that will
add additional parameters to the constructors of the axes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
d725170914 cleanup: remove DiveCartesianAxis::fontLabelScale accessor
This was only used internally - there is no point in an
accessor function. It only makes grepping more complicated.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
a14f740df0 profile: pass printFontScale on creation of the profile
Not having to readjust the scale on-demand will make the
code distinctly simpler. Let's just pass it once.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
5df0efbc7f profile: recreate the profile view when changing font size
Thus, we can keep the scale factor constant during existence
of the view. For now, this is simpler than adapting existing
text elements. We might want to make this more flexible later.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
e844b8dcad profile: move creation of mobile profile-widget into function
The current way of handling the "print scale factor" is
complex: The text fields are added and later resized via
signals. Things could be simplified by just redoing the
chart when changing the scale factor.

Moreover, in the future we will want to adapt the size of the
axes depending on the size of the texts.

As a first step, factor out the creation of the profile-widget.
This can then be used to recreate the profile when changing
the scale factor.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
23ab6b7a8c cleanup: remove unused function setToolTipVisibile()
The alternative spelling "visibile" made searching for this
function very annoying. That makes removing it even more
satisfying.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
b39e88b8c6 profile: remove need for MainWindow when rendering the profile
Very annoyingly, to render the profile for printing / export,
the profile still had to be show()n, thus requiring a parent
window.

Analysis of qmlprofile.c showed that this was due to the
transformation matrix not being properly set up on non-show()n
scenes.

Instead, we can simply render via the QGraphicsScene
(circumventing the QGraphicsView).

The code was factored out into the ProfileWidget2::draw()
function. This will hopefully make it easier to change
the size-code of the profile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
13d4f595cb profile: remove profile widget code from mainwindow
Create a new class that encapsulates the profile-widget UI.

This is called ProfileWidget, which might be confusing since
the actual display is called ProfileWidget2. However, the
plan is to rename the latter to ProfileView. After all, it
is also used to print and to show the profile on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
6b615ccb4b desktop: fold configureToolBar() into plotCurrentDive()
The MainWindow::configureToolBar() function is called every
time plotCurrentDive() is called. Moreover, this is the only
time that it is called. We might just fold the former into
the latter.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
c466a8f044 desktop: make MainWindow::graphics private
There are no more external users of the profile. Make it private.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
1a9300fed0 export: use independent profile instance for rendering
Just as for printing, use an independent profile widget, so
that the UI widget doesn't have to be set/reset.

Also, make the size of the exported image independent from
the current window size.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
60b82de058 export: move initialization/resetting of profile out of loop
When multiple profiles were exported, for every exported image
the profile-widget was switched to/from print mode.

Move this out of the loop, i.e. initialize and reset the profile
only once. This should slightly speed up export, but not by a lot,
since most of the time is spent by compressing the PNGs.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
8f0e2245c2 export: move exportProfile() function to exportfuncs.cpp
The exportProfile function uses the UI and therefore was
supposed to be declared in backend-shared/* but defined
separately for desktop and mobile. Currently, only the
desktop version exists.

The goal however should be that there is no need of the
UI for this function. In a first step, move the function
to the common backend-shared/* code and conditionally
compile for desktop. In upcoming commits, the function
will be made independent of the UI.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
811c8a441e printing: use independent profile instance for printing plan
In analogy to normal printing, don't misuse the mainwindow's
profile widget to do the printing.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
956a6d6c68 printing: use independent profile instance for printing
When printing the dives were rendered into the visible profile.
This meant setting a number of flags and reverting after printing.
That's obviously quite brittle.

Instead, use a separate profile instance, since we can have
different profiles showing different dives now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
ca7a2df121 profile: remove AbstractProfilePolygonItem::setVisible()
This was just a stub to make the setVisible() function a "slot".
Since there are no more signals using it, remove it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
17dabe5d09 profile: remove gas-visibility signals
The visibility of the gas lines is updated on every profile-redraw,
which is performed when the preferences changes. No need to have
these signals.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
13bd7aa163 profile: remove signals that update visibility of chart features
The visibility is set on every redraw, which is called when
the preferences change. No need for these signals.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
009c91a8fc profile: call DiveCalculatedTissue::setVisible() correctly
This one is rich: when changing to profile-mode, the calculated
tissues are set according to the prefs.calcalltissues flag.

The DiveCalculatedTissue::setVisible() function ignores the
parameter and insteads sets the visibility according to the
expression "prefs.calcalltissues && prefs.calcceiling".

This is because the function is also called by signals,
which provide the wrong parameter.

Pass the correct parameter in the first place. Remove the
crazy signals and the overridden setVisible() function,
which ignores its parameter, later.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
adf6e6d31e profile: update visibility on replot
Currently, setting the visibility of chart features is a mess. It
is done when switching to the profile state and then via signals,
when the preferences are changed.

However, when the preferences are changed the chart is replot anyway.
So let us simply set the visibility on chart replot. Then in
a follow-up commit, the signals can be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
cab179601f profile: factor out updating of visibility from setProfileState()
The plan is to simplify the visibility-control of non-interactive
chart features. As a first step identify those features that
depend on preferences-flags and factor out the setting of their
visibility into a new function updateVisibility().

This commit effectively only reorders the setting of the
visibility and therefore should have not user-visible effect.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
80fe85067c statistics: add dive-trip variable
We have a dive-site variable, therefore we probably should also
have a dive-trip variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 10:36:13 -08:00
Berthold Stoeger
d1b8f1ca3d formatting: move get_trip_title to string-format.h and split it
To enable grouping by trip in the statistics module, split
the get_trip_title() function in a version that appends
a "(n dive(s)" string an one that doesn't. The statistics
module doesn't want that added string, since it displays
the number of dives in a different way.

Also, move the functions to string-format.h, where these
are collected. And rename them to camelCase. Yes, it's
ugly, but consistent with most other C++ code in the code
base.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 10:36:13 -08:00
Berthold Stoeger
5d1f12438b cleanup: remove 'const constexpr' pairs
'constexpr' implies 'const' since it is a stronger guarantee,
so let's remove the redundant 'const'.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 10:36:13 -08:00
Berthold Stoeger
afa989e32c cleanup: replace std::size() replacement by real deal
At other places, we already used std::size().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 10:36:13 -08:00
Dirk Hohndel
fdffb870e5 desktop: avoid dangling reference
Let the compiler figure out the correct type...

Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-12-17 10:33:17 -08:00
Dirk Hohndel
bded5f3e5f statistics: clean up class vs. struct
Those should be equivalent, but apparently aren't with some compilers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-12-17 09:30:59 -08:00
Dirk Hohndel
61e8ceef05 core: avoid resource leak
That code was obviously wrong from the start.

Fixes CID 373921

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-12-17 09:23:34 -08:00
Dirk Hohndel
cffcce77bb core: avoid uninitialized data
In an abundance of caution, make sure all fields are initialized.

Fixes CID 350734

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-12-17 09:23:10 -08:00
Dirk Hohndel
840f273ade mobile: update version to 3.4.2
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-12-17 09:22:45 -08:00
Berthold Stoeger
1af67512a1 cylinders: add cylinder before hidden cylinders
When adding a cylinder, it was added at the end of the list.
This would make hidden cylinders visible as the new rule is
to only hide unused cylinders at the end of the list.

Therefore, add the cylinder after the last used cylinder,
i.e. before the first hidden cylinder.

This means that the position where the cylinder is added has
to be hidden in the undo command.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-13 11:54:24 -08:00
Berthold Stoeger
a40b40ae7a cylinders: only hide cylinders at the end of the list
On the equipment tab, unused cylinders (automatically added,
no pressure data) could be hidden. This was implemented using
a QSortFilterProxyModel.

Apparently, it causes confusion if cylinders in the middle of
the list are hidden. Therefore, only hide cylinders at the end
of the list.

QSortFilterProxyModel seems the wrong tool for that job, so
remove it and add a flag "hideUnused" to the base model. Calculate
the number of cylinders when changing the dive.

This is rather complex, because the same model is used for
the planner (which doesn't hide cylinders) and the equipment
tab (which does). Of course, syncing core and model now becomes
harder. For instance, the caching of the number of rows was removed
in a37939889b1a77dd269fd7f25f97b813f733133a and now has to be
readded.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-13 11:54:24 -08:00
Berthold Stoeger
3466d0c44d cylinders: remove redundant index check in the model
There is a warning when the code tries to access a non-existing
cylinder, since that indicates that something went out of sync.

However, this warning can never trigger because the bounds are
checked before. Remove the first of the two redundant checks.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-13 11:54:24 -08:00
Berthold Stoeger
8afb0dedc9 planner: hide internal cylinder columns
In cb80ff746b687a3ad29b53d9f633cbdc6b142c71 internal columns
were added to the cylinder model. These were not hidden in
the planner. Nobody complained?

Remove this clutter from the UI by hiding the columns.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-13 11:54:24 -08:00
Berthold Stoeger
c6f0fcbb0b cylinder: fix hidden-column logic in cylinder tab
The logic did not consider the WORKINGPRESS_INT and SIZE_INT
columns added in cb80ff746b687a3ad29b53d9f633cbdc6b142c71.

By some unknown magic this worked by routing everything
through the CylindersModelFiltered model.

Let's fix it and explicitly ignore these columns. Put
the test whether a column should be ignored in a function
to avoid inconsistencies should new columns be added.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-13 11:54:24 -08:00
Robert C. Helling
9fd531dcc5 Round gas depth properly
The D in MOD, EAD, END, and EADD stands for "depth" and
as such these should be mm in int rather than double.

The intermediate fn2 and fhe2, however, as intermediate
value should not be rounded to an integer.

The upshot of this is a litle more numerical stability.
It should lead to more stable values in TestProfile
when run on architectures with different floating
point precision.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-12-06 22:29:04 +01:00
Berthold Stoeger
cbe6d89767 profile: fix editing depth / duration
The undo commands for depth and duration editing cleared
the samples of the dive computer. They relied on the profile
automatically creating a fake profile. However, at some point
that code got removed. Therefore, do it explicitly in the undo
command.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-04 09:40:08 -08:00
Dirk Hohndel
1e527fb9f0 mobile: correctly store manually entered GPS
If there was no pre-existing dive site for a dive, manually entered GPS
information didn't get saved.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-24 11:13:46 -08:00
Robert C. Helling
07745893e5 Don't attempt to compute SAC for CCR dives
CCRs are different. It does not make sense to compute
a depth dependent SAC. You could compute the rate of O2
consumption but even that is likely wrong (as O2 in the
diluent would enter that as well), so simply don't attempt
it.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-11-24 11:03:51 -08:00
Dirk Hohndel
cfd6a1634f cleanup: fix SkipEmptyParts warning for mobile
And while doing that, have all the cases where we already include
qthelper.h simply use a define in that header file - but keep the two
other instances of the define where the C++ source don't need qthelper.h
otherwise.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-24 10:53:26 -08:00
Dirk Hohndel
d15ecef706 small whitespace fix
Just because QtCreator auto-fixed it for me...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-24 10:53:26 -08:00
Dirk Hohndel
343ed43581 update ReleaseTasks
I keep forgetting to do things...
This tries to help me get things right when I make releases.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-20 12:01:27 -08:00
Dirk Hohndel
0262deec16 Pull latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-19 08:55:34 -08:00
Dirk Hohndel
16e9174007 update README and ReleaseNotes for 5.0.5
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-19 08:54:51 -08:00
Dirk Hohndel
b87cbed53c Android: target API level 30
As of November 20201 the Google Play store now requires that new apps
target API level 30. The minimum API level remains 21 so we should
continue to support devices all the way back to Android 5.0 (Lollipop).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-12 15:32:31 -08:00
Dirk Hohndel
da2ee24121 mobile: update version to 3.4.1
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-12 15:21:47 -08:00
Dirk Hohndel
31e688ec00 core: load and save fingerprint to cloud storage
Very similar structure to the XML format. Raw data is again saved as a
hex string (which implicitly provides us with its length). The rest of
components are in a more human readable format.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-12 12:45:22 -08:00
Dirk Hohndel
2b1db9da82 core: load and save fingerprints to XML
We always use the global fingerprint table - maybe this should just not
be a parameter of the accessor functions?

The syntax is very simple - the raw data is encoded as a hex string, the
rest of the components are hex numbers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-12 12:45:22 -08:00
Dirk Hohndel
33527cb9e5 core: add more C interfaces for fingerprint table
These are used to read/write fingerprint records as git or XML data from
C code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-12 12:45:22 -08:00
Dirk Hohndel
02c770d997 core: use fingerprint table and on disk fingerprints
In order to not break existing behavior, we still store fingerprints on disk, but
we first check the data in the in-memory table, and we remember the fingerprint data
in the fingerprint table as well (which is then saved as part of the dive log data).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-12 12:45:22 -08:00
Dirk Hohndel
fa250906c9 core: add structures for handling fingerprints
This just adds the basic structures and the accessor functions needed to
manage a table of fingerprint data. The table is indexed by the hash of
the model name and binary serial number as created by libdivcecomputer.
This way the data is accessible when libdivecomputer fist accesses a
dive computer (which is the point in time when we need to use the
fingerprint.

The table also contains the corresponding device id and dive id so we
can verify that the current dive table still contains that dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-05 10:36:56 -07:00
Dirk Hohndel
95192bdf83 core: move has_dive helper function
This way it can be used by other code that needs this capability.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-30 20:22:52 -07:00
Dirk Hohndel
9891bdc9ee mobile manual: update version and date
Also update the rendered version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-30 08:50:30 -07:00
Dirk Hohndel
838151835b dc-download: use short date string
In both places in the UI where we show the date of a dive during
download we are actually pressed for space. So let's use the short
version of the date string to save some space.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-29 15:14:59 -07:00
Dirk Hohndel
44691dae10 dc-download: fingerprint details are debug info
In the normal use of the app this information is simply too verbose.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-29 15:14:59 -07:00
Dirk Hohndel
10e6519ad5 dc-download: give progress update for long downloads
Most divecomputers download data dive by dive - so we get reasonably
frequent updates during the download (as new dives are found and posted
in the progress text area). But some (like the G2) download all of the
new dives at once and only then start parsing them. As a result the
download can look like it is hung.

As a compromise this shows updates on the data received in 10kB
increments. Which for most cases should never be shown and therefore not
make the user experience any worse - but for cases like the G2 will make
a huge difference.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-29 15:14:59 -07:00
Dirk Hohndel
ee87d28d7b cleanup: replace QRegExp with QRegularExpression
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.

The exactMatch in getVersion() was rather bogus, given the pattern.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-27 12:38:11 -07:00
Dirk Hohndel
7d6552ff65 cleanup: replace QRegExp with QRegularExpression
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.

The syntax for matches and captures has changed and needed to be
adjusted.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-27 12:37:54 -07:00
Dirk Hohndel
73e9c099eb cleanup: replace QRegExp with QRegularExpression
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.

The syntax for matches has changed and needed to be adjusted.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-27 12:37:31 -07:00
Dirk Hohndel
bb5866f49e cleanup: replace QRegExp with QRegularExpression
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-27 12:36:49 -07:00
Dirk Hohndel
7a6f2581e8 cleanup: replace QRegExp with QRegularExpression
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.

The syntax for matches and captures has changed and needed to be
adjusted.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-27 12:36:27 -07:00
Dirk Hohndel
8e4b2d9b82 cleanup: replace QRegExp with QRegularExpression
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.

Much of this is a simple replacement of one class with the other, but
there are some changes to the way matches are tracked and captures are
created. Also, the exactMatch now needs to be implemented via anchors in
the regular expression itself.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-27 12:35:09 -07:00
Dirk Hohndel
4d0c863d61 cleanup: replace QRegExp with QRegularExpression
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.

This is a straight forward replacement without any other code changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-27 12:33:20 -07:00
Dirk Hohndel
b2d5350bb1 cleanup: remove use of QRegExp in TeX export
Qt 6 will drop support for QRegExp.

When looking at replacing this use of a QRegExp it seemed like a much
better idea to simply switch to utilizing the taxonomy data instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-27 12:30:46 -07:00
Dirk Hohndel
ba1564fddb build-system: stop using openSUSE Tumbleweed
The docker container for Tumbleweed has been broken for a while now.
Given the Hirsuite gives us Qt 5.15 testing, I guess it makes sense to
drop Tumbleweed for now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-22 10:45:28 -07:00
Dirk Hohndel
94136db4e1 Android: use more recent usb library
Builds started to fail because v2.2.2 (about 18 months old) couldn't be
found anymore. That issue seems to have been fixed, but it was a good
reminder not to get completely disconnected from upstream here.

This switches things to the currently latest version of the Android USB
library (which coincidentally will also provide support for additional
USB-serial chipset - not that I think that any dive computers will
benefit from that).

Some of the interfaces changed in the upstream Java library and our code
had to be adjusted to accomodate this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-22 10:35:57 -07:00
Dirk Hohndel
c3a5cf3315 build-system: update Ubuntu releases
groovy has been rejecting updates for a while, but impish should now be
available.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-19 12:26:09 -07:00
Dirk Hohndel
ff694af92b build-system: prevent recursive symbolic links
If cmake is called multiple times we can end up with a recursive set of
symbolic links that can confuse package build scripts.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-19 12:19:18 -07:00
Dirk Hohndel
ef5c94bb81 Android: fix broken permissions
In trying to avoid the wrath of the Google Play police I ended up giving
up too many permissions. And while in my test installs things continued
to work, in new installs on Android 10 or newer the lack of
FINE_LOCATION permission resulted in BLE scans no longer working.

The frustrating thing is that apparently installing an update with a
different set of permissions isn't enough to trigger either the bug or
the fix (at least not reliably). What appears to work is to uninstall
the existing app and then do a fresh install of a new app with the
correct permissions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-18 20:32:47 +00:00
Dirk Hohndel
c2a9da89cc mobile: update version to 3.4.0
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-18 19:59:52 +00:00
Berthold Stoeger
540e4437d5 cleanup: fix conversion warning
Fix a pair of warnings, which annoyed me for a long time:
For some reasons prefs.bottompo2 is an integer (mbar)
whereas prefs.modpO2 is a float (bar). This results
in mixed integer/floating point arithmetics when
conditionally using either of them. And ultimately
a warning, when storing a mbar value as an integer.
Fix this by an explicit cast to int after converting
modpO2 to mbar.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-10-16 15:32:56 -07:00
Dirk Hohndel
ac91eccbdd Pull latest translations from transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-15 11:53:36 -07:00
Dirk Hohndel
9c900415f3 Update README and ReleaseNotes for 5.0.4
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-14 19:35:27 -07:00
Dirk Hohndel
afdfccd274 Android: allow user installed root certificates
On Android devices that no longer get updates to the system installed
SSL root certificates, the user can easily install the updated Let's
Encrypt root certificate, but that is only used by Subsurface-mobile if
we explicitly allow the use of those user installed root certificates.

Fixes #3335

Suggested-by: Greg Hunter
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-14 15:53:10 +00:00
Tim Segers
b618d93241 desktop: fix div-by-zero when selecting multiple invalid dives
Signed-off-by: Tim Segers <tsegers@pm.me>
2021-10-11 20:53:41 +03:00
Tim Segers
f3a02d7049 Ignore invalid dives in subsurface-mobile dive summary
Match subsurface-desktop's invalid dive behavior

Signed-off-by: Tim Segers <tsegers@pm.me>
2021-10-11 20:20:20 +03:00
Dirk Hohndel
18c0fa37d1 Update translations and source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-09 13:43:14 -07:00
Robert C. Helling
41258647d2 Don't access gasmix.o2.fraction
Air is a special gas that does not contain oxygen according
to gasmix.o2.fraction. If you want to use the fo2, you
need to use get_o2() to treat this special case correctly.

This fixes a bug when setting the MND of a gas containing
21% oxygen when o2 is considered not narcotic.

Reported-by: Christoph Gruen <gruen.christoph@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-10-01 08:50:36 -07:00
Dirk Hohndel
5e9ee9febb mobile: restore dev_info display
In commit 105b60389c ("mobile: remove GpsLocation reference from qmlmanager") I
was a bit careless with the code removal and unintentionally also removed the
initialization of the progress callback.  With this change the updates from the
download process are once again shown on screen in the mobile app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-27 08:42:50 -07:00
Berthold Stoeger
a481cdc13d core: don't write pressure samples with "no sensor"
This has led to broken XML files, don't do it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-09-22 09:11:00 -07:00
Berthold Stoeger
d9c77a27da core: properly clear pressure data of invalid sensors
When we found an invalid sensor (referring to a non
existing cylinder) in fixup_dive() the sensor-id was
set to NO_SENSOR.

This led to invalid XML files, because the code decides
to switch into legacy mode. However, there are two
pressure readings, which is invalid in legacy mode.

Therefore, also clear the pressure data.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-09-22 09:11:00 -07:00
Dirk Hohndel
f50585a906 desktop/image-time-shift: use better filename filter
We already have a function to select all supported image formats. Let's
just use that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-22 09:09:12 -07:00
Tim Segers
10798c2a8d desktop/image-time-shift: reorder UI
The camera sync feature has been moved above the Ok and Cancel buttons
and given its own descriptive header. The checkbox to ignore unaligned
image timestamps has been moved closer to the buttons.

Signed-off-by: Tim Segers <tsegers@pm.me>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-22 09:09:12 -07:00
Dirk Hohndel
4167b2ff14 desktop/image: allow larger range for manual time shift
The QTimeEdit field is severely limited when it comes to the supported
time range. By coding our own input / validation we can allow far larger
time shifts. For simplicity, this always assumes hours:minutes format.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-22 09:09:12 -07:00
Tim Segers
6ea4cfcc02 desktop: add support for camera sync delta of more than 24h
When using the camera sync feature to sync media to the dive timeline,
the calculated time difference was considered invalid if it was more
than 24 hours.

To prevent this, this commit disables the manual time offset input
fields when the camera sync button is clicked. It then uses the epoch
difference in the final offset calculation, enabling arbitrary time
differences between camera and divecomputer.

Signed-off-by: Tim Segers <tsegers@pm.me>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-22 09:09:12 -07:00
Dirk Hohndel
8525b2e274 core: remove superfluous arguments
Fixes CID 373231

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-20 14:49:57 -07:00
Linus Torvalds
85392343fa Re-do the libdivecomputer fingerprint save/load code
This tries to make our fingerprinting code work better, by avoiding
using the "deviceid" field that has always been unreliable because we've
calculated it multiple different ways, and even for the same version of
subsurface, it ends up changing in the middle (ie we calculate one value
initially, then re-calculate it when we have a proper serial number
string).

So instead, the fingerprinting code will look up and save the
fingerprint file using purely "stable" information that is available
early during the download:

 - the device model name (which is a string with vendor and product name
   separated by a space)

 - the DC_EVENT_DEVINFO 32-bit 'serial' number (which is not necessarily
   a real serial number at all, but hopefully at least a unique number
   for the particular product)

but because the model name is not necessarily a good filename (think
slashes and other possibly invalid characters), we hash that model name
and use the resulting hex number in the fingerprint file name.

This way the fingerprint file is unambiguous at load and save time, and
depends purely on libdivecomputer data.

But because we also need to verify that we have the actual _dive_
associated with that fingerprint, we also need to save the final
deviceid and diveid when saving the fingerprint file, so that when we
load it again we can look up the dive and verify that we have it before
we use the fingerprint data.

To do that, the fingerprint file itself contains not just the
fingerprint data from libdivecomputer, but the last 8 bytes of the file
are the (subsurface) deviceid and the diveid of the dive that is
associated with the fingerprint.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-09-19 16:51:46 -07:00
Dirk Hohndel
de69f12262 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:30:19 -07:00
Dirk Hohndel
32e3f7e7c2 build-system: update translation source script
Kirigami sources are now under 3rdparty.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:28:35 -07:00
Dirk Hohndel
2bb88a354f Android: hardcode permissions and don't ask for features
That seems to be the way to force it to not request FINE_LOCATION or GPS access.
If I leave this on 'auto' then the dependency on QtPositioning (for showing the
map) appears enough for it to claim access to GPS location. I no longer want
to deal with the Google Play police for that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
e454669215 documentation: remove location service reference from mobile manual
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
64098aeb2e iOS: don't request GPS permission anymore
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
539455071c update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
2a0d14b100 core: remove location service preferences
Including the related tests.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
6f813b9f8e mobile: remove GpsLocation
Only used in context of acquiring GPS locations with the mobile app, which
we no longer do.

Keep the DiveAndLocation structure around as that's needed by the
ApplyGpsFixes command.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
105b60389c mobile: remove GpsLocation reference from qmlmanager
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
5bc99194da mobile: remove locationService interfaces
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
7bf90fd208 mobile: remove hasLocationSourceChanged interface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
085c65b0c4 mobile: remove logText property
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
f33c90ba6b mobile: remove deleteGpsFix interface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
094a3b01c8 mobile: remove applyGpsData interface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
0b8c8599c1 mobile: remove copyGpsFixesToClipboard interface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
3065eddbe1 mobile: remove clearGpsData interface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
ea751928aa mobile: remove getCurrentPosition interface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
bea552bf0d mobile: remove GpsListModel
This is only needed to show the list of GPS fixes obtained with
the now removed location service.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
edf4fbd38a mobile: remove GPS list UI
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
76e0208a11 mobile: remove current location checkbox from dive edit
Since we no longer access the device location, we can't do that any longer,
either.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
ebbef8cf17 mobile: remove long disabled planner UI
This was never functional.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
53cbf53058 mobile: remove GPS related item in main mobile UI
Given the nonsense that Google and Apple makes us go through in order to
support this feature, it's time to cut our losses and walk away.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Josh Torres
4e93d38482 Adding changelog entry for rich text support
Signed-off-by: Josh Torres <torres.josh.j@gmail.com>
2021-09-07 08:51:40 -07:00
Josh Torres
dcf1188a3b Support rich text on mobile notes field
When viewing dives on mobile the notes field does not support rich
text. User formatting, output from the planning feature, etc will
render html as plain text.

Adding qml tag to support rich text

Signed-off-by: Josh Torres <torres.josh.j@gmail.com>
2021-09-07 08:51:40 -07:00
Josh Torres
da6eb9d947 Add changelog entry
Signed-off-by: Josh Torres <torres.josh.j@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-06 13:00:42 -07:00
Josh Torres
7e6d9935f1 core: fix off-by-one causing incorrect profile display
In commit 4724c88 get_plot_details_new was updated to pass an index
instead of the entry into plot_string. This means we are passing "i" to
plot_string after the final increment of the for loop, instead of
getting the entry[i] within the loop before the final increment. This
means if we are mousing over the far right of the graph, where the time
based break is not hit, we will end up passing an index equal to nr-2
instead of nr-3, which is intended to shave off the final two rows
containing data not useful to the display.

There are a handful of ways to fix this. This commit intends to be
consistent with stylistic choices made elsewhere in the project.

Signed-off-by: Josh Torres <torres.josh.j@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-06 13:00:37 -07:00
Berthold Stoeger
64faa23448 undo: renumber cylinders when deleting a cylinder
Removal of a cylinder requires a renumbering of
cylinders in the core data structures (samples, etc.).

The renumbering was performed in the undo-action of
cylinder removal, but not during actual cylinder removal.
What a mess!

Add the missing call.

Attention: this makes the deletion of sensor-readings
on cylinder-deletion non-undoable!

Undo will have to be fixed in upcoming commits.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-09-03 13:35:28 -07:00
Berthold Stoeger
9376721873 desktop: warn when deleting a cylinder with sensor readings
This makes the sensors pointless and in the future, they
will be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-09-03 13:35:28 -07:00
Berthold Stoeger
28fe6a7b38 core: add a function to test for sensors of a given cylinder
We want to prevent the user from accidentally deleting a
cylinder with sensor readings. Therefore, we need such a
function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-09-03 13:35:28 -07:00
Berthold Stoeger
5eda1c0e39 parser: XML_PARSE_RECOVER to xmlReadMemory()
Due to changes in the handling of sensor-ids, invalid XMLs were
generated. In particular, these contained duplicate attributes
in the sample tags.

Even though these files shouldn't exist, let's try to parse
them anyway. Some data will be lost, but that's better than
not opening the file.

libxml2 can be told to try to recover from such petty(?) errors
by passing the XML_PARSE_RECOVER flag.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-09-03 09:30:34 -07:00
Dirk Hohndel
836111da98 mobile: update version to 3.3.1
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-02 12:42:39 -07:00
Dirk Hohndel
f19e10209c mobile: fix broken cylinder name tracking in dive edit
Prior to this change, we had two different cylinder lists as models for
drop down boxes - one that prepends the "no default cylinder" entry
(which we need for setting up no default cylinder to be used in the
app), and another one that only includes actual cylinders.

The problem occured if a dive is created before the first time we edit
an existing dive: in this case we are applying indices across the two
models, but the indices are of course off by one; this results in
actually picking the wrong cylinder. So each time we try to edit a dive,
we end up with the previous cylinder in the list.

This commit simplifies the code by having only one place where we create
list of cylinder names (which is then used as the model for the combo
box). It also uses more logical names for the two 'flavors' of this list
to make it clear which one is supposed to be used (the regular list when
editing or adding dives, the one with the "no default cylinder" entry
prependet for the Settings page).

Reported-by: Brian Fransen
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-02 12:41:00 -07:00
Dirk Hohndel
33dc5478d8 update README and ReleaseNotes for 5.0.3
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-20 20:26:26 -07:00
Dirk Hohndel
834f9b813a Update list of supported dive computers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-20 20:26:26 -07:00
Dirk Hohndel
ece0ac7918 Pull latest translations from transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-20 19:58:21 -07:00
Dirk Hohndel
0988855285 another libdivecomputer update
- add string serial numbers for Suunto Vyper and Mares IconHD type dive computers
- add support for Cressi Neon

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-20 19:45:44 -07:00
Dirk Hohndel
af734c81f1 update libdivecomputer
Add support for new gas change data from EON Steel with FW 2.5

Fixes #3254

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-19 12:57:31 -07:00
Robert C. Helling
2126ac7c25 Adopt tests to updated CNS and OTU calculations
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-08-19 10:58:08 -07:00
Robert C. Helling
c634a07e38 Planner: Correctly compute CNS and OTU for bailout segments
For dives with mixed divemode, one needs to check sample.setpoint
to figure out if the segment is an OC segment and the po2 needs
to be computed from the gasmix and ambient pressure.

This fixes #3310

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-08-19 10:58:08 -07:00
Dirk Hohndel
edce243147 mobile: update version to 3.3.0
New minor numbers are always arbitrary...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 19:09:59 -07:00
Dirk Hohndel
503d8bd1fc mobile: don't quit on back button in Statistics mode
Fixes #3192

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 19:09:59 -07:00
Dirk Hohndel
2c04a1f297 mobile: tweak line spacing
When strings in dive details wrap, the line spacing is too tight
in some circumstances. While not perfect, this change improves
the situation somewhat.

See #3263

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 19:09:59 -07:00
Dirk Hohndel
9b669d91e0 mobile: add ability to edit tags
We already showed the tags, but we didn't allow the user to edit them.

This tries hard not to create inconsistent or illogical tags by trimming
white space and being careful with how the tags are added.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 19:09:59 -07:00
Dirk Hohndel
454207cd80 mobile: make cloud timeouts more consistent
In the mobile version we should always allow a little more wait time for
the cloud server - there just seem to be more issues with response times
on mobile devices, especially when in places with poor data reception
(which isn't uncommon for dive sites).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 19:09:59 -07:00
Dirk Hohndel
3faff0b7f0 update Changelog and user manual
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 13:22:02 -07:00
Dirk Hohndel
b1d53481ad profile: use undo infrastructure for editing nicknames
This does the right thing even when removing a nickname by setting it to
an empty string. The oddly named DiveListNotifier handles the need to
redraw the profile when the name changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 13:22:02 -07:00
Dirk Hohndel
e7a5ec46f5 undo/device: adjust device management infrastructure
We no longer need the remove infrastructure, and the edit nickname function
becomes much more intuitive to use by passing in the dive computer for
which we want to create a nickname instead of the internal index into
the array of devices.

This also removes / simplifies the device list update signals in the
DiveListNotifier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 13:22:02 -07:00
Dirk Hohndel
fbe17e620e core: add get_or_add helper for dc table
This makes it much easier to manipulate dc nickname entries. In order
for that to work we can't simply remove entries with empty nickname (but
that isn't needed, anyway, as the code that saves XML or git already
handles that case correctly).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 13:22:02 -07:00
Linus Torvalds
47b0a9ce65 Don't share dive computer data allocations
... it just causes problems later when we free them, since we don't do
any reference counting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-08-18 13:22:02 -07:00
Dirk Hohndel
2c12648156 WIP profile: add UI to edit dc nickname
This is just a quick first implementation - it will need to use the undo
code in the future, but for now this is a reasonable first step.

It's also missing the code to redraw the profile with the updated DC
name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 13:22:02 -07:00
Linus Torvalds
d141bbf38f Update the serial number and deviceid in sync when loading
When we save the divecomputer data, we never actually save the serial
value as a field.  We used to rely on saving the very dodgy 'deviceid',
and then look up the serial number from there.  And that never really
worked reliably, but we didn't really notice, because we never really
_used_ the serial number anywhere.

The only place the serial number is actually reliably displayed is in
the "Extra data" tab, which contains the key value pairs, and that's
where the original dive download code got the serial number from.

So just parse that at load time too, the same way we parsed it at dive
download time.

In fact, do the firmware version the same way, and remove the code from
the downloader, since it too can rely on 'add_extra_data()' just picking
up the information directly.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-08-18 13:22:02 -07:00
Linus Torvalds
35adf2d729 Add (nonfunctional) dive computer rename hooks
This adds the menu item to rename a dive computer (ie create a nickname
for it) when right-clicking on the dive computer name of a dive computer
that has a serial number (indicated by having a non-zero ->deviceid).

It is nonfunctional because it's really just the skeleton code: it needs
the UI to actually ask for a new nickname, and then it needs to actually
do the proper "create_device_node(model,serial,nickname)" to set it (or
remove the nickname if empty).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-08-18 13:22:02 -07:00
Linus Torvalds
2da7e9e5ad Remove the divecomputermodel code
This is no longer reachable, since the divecomputer tab is gone.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-08-18 13:22:02 -07:00
Linus Torvalds
ba6f7361da Remove the divecomputer naming tab
The TabDiveComputer model won't work in the new world order, where you
can't even insert a new device entry without a nickname to be edited.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-08-18 13:22:02 -07:00
Linus Torvalds
6c4e890960 Clean up divecomputer 'device' handling
We have this odd legacy notion of a divecomputer 'device', that was
originally just basically the libdivecomputer 'EVENT_DEVINFO' report
that was associated with each dive.  So it had firmware version,
deviceid, and serial number.

It had also gotten extended to do 'nickname' handling, and it was all
confusing, ugly and bad.  It was particularly bad because it wasn't
actually a 'per device' thing at all: due to the firmware field, a dive
computer that got a firmware update forced a new 'device'.

To make matters worse, the 'deviceid' was also almost random, because
we've calculated it a couple of different ways, and libdivecomputer
itself has changed how the legacy 32-bit 'serial number' is expressed.

Finally, because of all these issues, we didn't even try to make the
thing unique, so it really ended up being a random snapshot of the state
of the dive computer at the time of a dive, and sometimes we'd pick one,
and sometimes another, since they weren't really well-defined.

So get rid of all this confusion.

The new rules:

 - the actual random dive computer state at the time of a dive is kept
   in the dive data. So if you want to know the firmware version, it
   should be in the 'extra data'

 - the only serial number that matters is the string one in the extra
   data, because that's the one that actually matches what the dive
   computer reports, and isn't some random 32-bit integer with ambiguous
   formatting.

 - the 'device id' - the thing we match with (together with the model
   name, eg "Suunto EON Steel") is purely a hash of the real serial
   number.

   The device ID that libdivecomputer reports in EVENT_DEVINFO is
   ignored, as is the device ID we've saved in the XML or git files. If
   we have a serial number, the device ID will be uniquely associated
   with that serial number, and if we don't have one, the device ID will
   be zero (for 'match anything').

   So now 'deviceid' is literally just a shorthand for the serial number
   string, and the two are joined at the hip.

 - the 'device' managament is _only_ used to track devices that have
   serial numbers _and_ nicknames. So no more different device
   structures just because one had a nickname and the other didn't etc.

   Without a serial number, the device is 'anonymous' and fundamentally
   cannot be distinguished from other devices of the same model, so a
   nickname is meaningless. And without a nickname, there is no point in
   creating a device data structure, since all the data is in the dive
   itself and the device structure wouldn't add any value..

These rules mean that we no longer have ambiguous 'device' structures,
and we can never have duplicates that can confuse us.

This does mean that you can't give a nickname to a device that cannot be
uniquely identified with a serial number, but those are happily fairly
rare (and mostly older ones).  Dirk said he'd look at what it takes to
give more dive computers proper serial numbers, and I already did it for
the Garmin Descent family yesterday.

(Honesty in advertizing: right now you can't add a nickname to a dive
computer that doesn't already have one, because such a dive computer
will not have a device structure.  But that's a UI issue, and I'll sort
that out separately)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-08-18 13:22:02 -07:00
Dirk Hohndel
61524f9b2d update libdivecomputer
Garmin: add extra-info for serial number and firmware version

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-16 19:23:32 -07:00
Dirk Hohndel
f7e222718a desktop: avoid crash when changing dive logs
If the last displayed dive had events, those DiveEventItems had slots connected
that would update those icons if things changed. When closing the dive log and
switching to a different one, those slots were still called and would then access
freed memory (the event structure from that old dive that is long gone by then).
This code explicitly deletes those DiveEventItems which also removes those signal
slot connections.

Fixes #3305

Sugested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-16 18:37:59 -07:00
Dirk Hohndel
75fdb8676b core: add downloaded GPS to existing dive site
If we download a first dive computer and add a dive site to the dive (by
setting a location name for example), and then download from another
dive computer that provides us with GPS data, we should keep the
existing dive site information, but add the GPS data from the freshly
downloaded dive computer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-15 09:31:17 -07:00
Berthold Stoeger
67769235e7 desktop: fix crash when right-clicking of trip headers
Commit e42fc1a1e9a13c77d3474dbcb26b68b8772b8c6d introduced a
crash condition. Apparently the code attempts to test whether
the clicked-on item is a top-level dive. The "Collapse others"
menu item should not be shown in that case. It does this by
testing "d->divetrip". However, "d" might quite logically be
null if clicking on an unexpanded trip header.

Therefore, check explicitly for the trip header case (which
should show the menu item) and for good measure prevent
the nullpointer access (that should be caught by testing
for trip, but who knows).

Fixes #3301.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-08-12 20:57:26 +02:00
Richard Fuchs
f308a6b57b export: clean up temp file after divelogs.de upload
This adds a cleanup function to be called after a divelogs.de upload
finishes (successful or not) to make sure the temporary zip file is
closed and removed.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2021-08-06 11:05:06 -07:00
Richard Fuchs
cf78e4cb20 export: use unique temporary file for divelogs.de upload
On multi-user systems with a shared directory for temporary files, using
a static file name can lead to permissions problems and subsequent
errors due to collisions. Use a random unique file name for each
generated file to avoid these problems.

Note: the temporary file generated from the divelogs.de upload is still
left behind after the upload finishes.

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2021-08-03 08:34:18 -07:00
Berthold Stoeger
55bc1938ad cleanup: remove DiveCalculatedCeiling::profileWidget
The DiveCalculatedCeiling had a back-pointer to the profileWidget.
This was used for weird control-flow shenanigans, which were
removed in 975c123a30de95eafd9b3c2ce2a625a1d05a79dc.

Remove this now useless member variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-30 08:02:05 -07:00
Berthold Stoeger
f16a7c262e cleanup: unify the ProfileWidget2::shouldCalculateMax* variables
The shouldCalcluateMaxTime and shouldCalculateMaxDepth member
variables of ProfileWidget2 are set to false during drag-mode to
avoid strange shrinking of the graph. They always adopt the
same value. Therefore, replace by a single shouldCalculateMax
boolean.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-30 08:02:05 -07:00
Dirk Hohndel
15c524804a mobile: update version to 3.2.1
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-28 07:57:16 -07:00
Dirk Hohndel
383f326136 build-system: fail with Qt6
I thought that explicitly requesting Qt5 should be enough, but we have a report
from a user who tried to build against Qt6 and cmake happily let them proceed.
So let's fail this explicitly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-28 07:44:58 -07:00
Dirk Hohndel
42eb39fc4a changelog: add summary of recent changes
First step towards doing another release.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-23 11:49:24 -07:00
Dirk Hohndel
096de0efd0 core/import: fix string check logic
The intent of the code was to check that there is a string and it has at least
two characters. Since iter is the result of a strchr(iter, '|') call, we
know that if iter isn't NULL, iter[0] is '|', so we only need to check the next
character.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-23 11:30:17 -07:00
Dirk Hohndel
c90352008b core/csv-import: don't do pointer math after realloc
try_to_xslt_open_csv() re-allocates the memory passed in (not really great as
far as design goes, maybe something that should be reimplemented). Doing
pointer arithmatic with the returned base pointer results in garbage, unless
one gets super lucky and the realloc manages to not move the memory.

It's a wonder this ever worked.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-23 11:30:17 -07:00
Berthold Stoeger
846e1ba53e core: always create a fake profile if there are no samples
Before making the cylinder-table dynamic, dives always
had at least one cylinger. When such a dive is displayed,
the TabDiveInformation class calls per_cylinder_mean_depth().
If there are no samples, this function generates a "fake
profile" with fake_dc(). Thus, effectively dives always
had samples once the user was displaying them.

When the cylinder-table was made dynamic, dives without
cylinders were supported. This can notably happen, when
importing from CSV (this could actually be a bug).
per_cylinder_mean_depth() exits early in that case and
doesn't create a fake profile. This lead to crashes
of the profile-widget, which were fixed in 6b2e56e5131.
Non-sample dives were now shown with the Subsurface-logo.

To restore the previous behavior, genarate a fake profile
for sample-less dives in fixup_dive(), which is called
anytime  a dive is loaded or imported. This seems to
have been the intention anyway and this worked only
"by chance". This will make a few fake_dc() calls obsolete,
but so be it.

Since fake profiles are now generated on loading,
the parse-tests need to be fixed to account for that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-23 11:30:17 -07:00
Dirk Hohndel
72bdd506f0 tests: initialize our prefs to the default values
Otherwise we end up with nonsensical values which lead to a division by zero,
which in return leads to different results, depending on platform.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-23 11:30:17 -07:00
Berthold Stoeger
63e1516579 core: recalculate CNS values on merge
When merging two dives, the higher CNS value was taken. This could
result in inconsistent CNS values if two dives were merged where
one dive's CNS was calculated from a "fake profile", i.e. a dive
without dive-computer profile. In that case, the most conservative
value (all time spent at the bottom) was assumed. The merged dive
then consisted of the dive-computer profile and the conservative
CNS estimate.

This is fixed by setting the CNS value to "0" after merging,
which means "unknown". The correct value will then be recalculated
in "fixup_dive" from the actual sample data.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-23 11:30:17 -07:00
Berthold Stoeger
b18b3119b5 cleanup: don't NUL-terminate membuffer in uploadDiveLogsDE
The data of the membuffer is passed as a data/length pair
to xmlReadMemory(). There is no point in NUL-terminating it.

Moreover, pass the data directly to xmlReadMemory()
instead of via variables. These variables are reused
later with a different meaning, making this super-confusing.

The membuf variable is turned from "const char *" to "char *"
to signal that we own the buffer.

Amazingly, zip_source_buffer() frees the buffer, even though
a "const void *" is passed in. This API is pure madness. Add
a comment.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-23 11:22:43 -07:00
Berthold Stoeger
69914964f6 cleanup: replace membuffer by qasprintf_loc()
There is a function to format QString with C-format strings. Let's
use it instead of doing a detour via membuffer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-23 11:22:43 -07:00
Berthold Stoeger
16b31985c3 cleanup: replace membuffer by membufferpp in C-code
Thus, the membuffer data is automatically freed when going
out of scope - one thing less to worry about.

This fixes one use-after-free bug in uploadDiveLogsDE.cpp
and one extremely questionable practice in divetooltipitem.cpp:
The membuffer was a shared instance across all instances
of the DiveToolTipItem.

Remves unnecessary #include directives in files that didn't
even use membuffer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-23 11:22:43 -07:00
Berthold Stoeger
f142e9a9c6 core: C++-ify membuffer
C-style memory management is a pain and nearly nobody seems to get
it right. Add a C++-version of membuffer that frees the buffer
when it gets out-of-scope. Originally, I was thinking about
conditionally adding a constructor/destructor pair when compiling
with C++. But then decided to create a derived class membufferpp,
because it would be extremely confusing to have behavioral change
when changing a source from from C to C++ or vice-versa.

Also add a comment about the dangers of returned pointer: They
become dangling on changes to the membuffer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-23 11:22:43 -07:00
Berthold Stoeger
0c84f369c3 core: use int16_t for sensor-id
The sensor-id in the sample struct was a uint8_t, with all
the known problems of unsigned integers. In the rest of the
code cylinder ids are signed integers. To avoid confusion,
make it a signed int. int8_t should be enough (max. 127
cylinders). To allow for degenerate cases, use an int16_t.
16k cylinders should be enough for everyone.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-23 11:16:00 -07:00
Dirk Hohndel
8ac0519a99 desktop: explicitly enable shortcuts
The changes in commit 4daf687876 ("profile: remove [disable|enable]Shortcuts()
signals") resulted in us no longer enabling the shortcuts on the desktop (at
least on macOS where I debugged this). This placement of the call feels like a
bit of overkill, but at least it shouldn't be wrong.

Fixes #3293

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-23 10:20:50 -07:00
Dirk Hohndel
c7a2d95617 Update libdivecomputer
- fix potential crash with Garmin Descent Mk2
- fix HW Sport and Mares Genius firmware update
- Various parser updates:
  - sporasub depth, salinity and sample rate parsing
  - Atomics Cobalt atmospheric pressure parsing
  - unit cleanups (Uwatec, McLean Extreme)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-20 09:28:38 -07:00
Dirk Hohndel
2193f09006 core/ble: add auto detection for Aladin A2
This way it will be recognized as a dive computer when it is scanned via BLE.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-20 09:28:38 -07:00
Berthold Stoeger
9f277e65ff cleanup: remove function static variables
There were two function-static variables in ToolTipItem::refresh(),
which is a very scary proposition. Curently, there is only
one ToolTipItem, but this may change on mobile, where there
are multiple profiles at the same time.

Remove this timebomb and make the two objects subobjects.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-20 09:27:35 -07:00
Berthold Stoeger
82f967ddb3 core: sanitize pressure-sensor cylinder ids in fixup_dive()
The code will happily perform out-of-bound accesses if
pressure-sensors refer to non-existing cylinders. Therefore,
sanitize these values in fixup_dive(), which is called
everytime a dive is loaded or imported.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-19 10:13:51 -07:00
Berthold Stoeger
361678dcbe parser: don't create samples with invalid cylinder ids
By default, the parser would create samples with cylinder
ids 0 and 1. This creates out-of-bound accesses for the
common one-cylinder (or even no-cylinder) dives. These
were harmless when the cylinder-table was of a fixed size.
Since changing to a dynamic cylinder-table, these became
actual out-of-bound accesses. Don't create such samples
in the parser.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-19 10:13:51 -07:00
Berthold Stoeger
7e11a35371 core: add a special NO_SENSOR value for sample::sensor
The sensor member of sample refers to a cylinder from which
the pressure was read. However, some dives don't even have
a cylinder. Therefore, introduce a special NO_SENSOR value
for these dives. Since the cylinder is given as a uint8_t,
0xff seems to be a sensible choice.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-19 10:13:51 -07:00
Miika Turkia
48c2929f48 Fix coverity reported memory leaks
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2021-07-19 09:07:48 -07:00
Miika Turkia
63795a84f4 Export unused cylinders to divelogs.de
When user has selected to show unused cylinders in equipment tab,
respect this setting when exporting to divelogs.de.

Fixes #3277

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2021-07-18 13:43:54 +03:00
Dirk Hohndel
235ee4803f printing: remote incorrect scaling of event icons
It appears that this well intended change in commit 52aa7d83b6 ("Increase event
icon size in print mode") actually causes the scaling of the event icons to be
generally wrong. This removes the hard 4* scaling and also adds some debugging
output in verbose mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-11 13:02:43 -07:00
Berthold Stoeger
cfc87e9da3 cleanup: remove Printer::dpi member variable
This variable is not used outside a single function, where it
is reset every time the function runs. This can be realized by
a function-local variable just as well.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-07 07:57:11 -07:00
Dirk Hohndel
7944978274 snap: push regular updates of dependencies to stable
We simply don't use release candidates in Subsurface these days, and no one
then moves these builds to stable after testing, so stable has been getting
stale while the builds that people SHOULD use have been sitting in candidate.

Of course, this will only become the default after our next release (as I don't
want four digit versions in a release build, so I can't simply add this to our
snap-stable branch).

Oh well - 5.0.3 will happen soon, given the print resolution issue for icons.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-05 10:48:30 -07:00
Berthold Stoeger
65580fceda profile: scale dive event items according to font print scale
When printing with low DPI, the dive event items become comically
large, because they are not resized like the fonts. Therefore,
scale using the fontPrintScale.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-04 11:51:17 -07:00
Robert C. Helling
6b2e56e513 Handle dives with no samples
This occurs upon importing dives for example via CSV.

Make sure the profile display is cleared when selecting
such a dive rather than showing a different dive.

Allow editing the profile for such a dive.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-07-03 14:38:19 -07:00
Dirk Hohndel
876a09753a Update translation source strings
And update all the translated copyright notices.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-03 14:36:59 -07:00
Berthold Stoeger
4c118f3573 profile: remove ProfileWidget2::Items
This enum was an artifact from the primordial days of the profile
widget. As far as I can see it was never used.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-03 14:30:46 -07:00
Berthold Stoeger
4a7cf0e970 profile: rename ADD state to EDIT state
The ADD state is not used for adding dives since adding dives
was made undoable. Therefore, rename it to EDIT state, since
that is what it is used for.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-03 14:30:46 -07:00
Berthold Stoeger
9424760eff cleanup: remove lost comment in profilewidget2.h
Clearly, this comment got lost in code reshuffling, as it comments
about ADD and PLAN mode, but is in front of picture declarations.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-03 14:30:46 -07:00
Berthold Stoeger
2a0ae4991b profile: remove EDIT_STATE from ProfileWidget2
This state is not used anywhere.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-07-03 14:30:46 -07:00
Dirk Hohndel
329fcf7fdc cleanup: update copyrights
That should have been done six months ago.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-03 14:28:37 -07:00
Dirk Hohndel
50ef42d580 cleanup: remove long obsolete code
We have stopped playing with beta versions many many years ago.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-03 14:28:37 -07:00
Dirk Hohndel
827e3f8ecc Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-02 09:36:37 -07:00
Dirk Hohndel
a7ae751105 Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-30 10:59:32 -07:00
Dirk Hohndel
d0b6e61fc1 update bundled mobile manual html
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-30 10:58:49 -07:00
Dirk Hohndel
7c93624c41 mobile: update version to 3.2.1
I should do this right after pushing a release for mobile.
2021-06-30 10:55:21 -07:00
Dirk Hohndel
32cec6a775 update README, ReleaseNotes, and supported dive computers for 5.0.2
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-30 10:53:31 -07:00
Dirk Hohndel
a529f90d46 Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-29 16:10:41 -07:00
Berthold Stoeger
48c2b4b1bd cleanup: remove unused item in ProfileWidget2's ItemPos
This is most likely an artifact from a long time ago.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-29 23:05:13 +02:00
Berthold Stoeger
080834c6f2 cleanup: remove dead code in ToolTipItem::refresh()
The code was downcasting the QGraphicsScene to ProfileWidget2,
but then didn't use the result. *shrug*

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-28 09:53:23 -07:00
Berthold Stoeger
248976bf11 cleanup: factor out duplicate axis-initialization code
The axes of the profile are setup when switching into
the "ProfileState" and also when the preferences are
changed. The same code existed twice for both cases.

Let's factor it out into a single function to avoid
future divergence and confusion.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-27 19:05:20 +02:00
Dirk Hohndel
9eb10af68f build-system: updates to processes
This is mostly for my own use, but I think it makes sense to have it in
the repo.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-07 08:25:31 -07:00
Dirk Hohndel
bf363c016b Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-07 08:23:48 -07:00
Berthold Stoeger
0b190243dd profile: remove internal event-copy (fix deleting/renaming events)
The DiveEventItem had an internal copy of the event. It passed
that copy to the undo-machinery, which of course didn't work.

Simply keep a pointer to the event. All changes to a dive no
pass via the undo-machinery, which causes a reload of the profile,
so this should be safe.

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-05 11:29:00 -07:00
Berthold Stoeger
fd2862042b profile: pass axes and model to DiveEventItem on construction
Firstly, there is no point in supporting DiveEventItems without
model and axis. Secondly, this avoid pointless position-
recalculations.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-05 11:29:00 -07:00
Berthold Stoeger
c93fb83edf profile: pass event at construction time to DiveEventItem
There is no point in having a dive event without an event.
Let's pass the event at construction time to avoid having
to handle "invalid" events.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-05 11:29:00 -07:00
Mark Stiebel
e42fc1a1e9 desktop: add numerus translation for dive context menu
Add numerus translation lookup for the right-click context menu in the dive
list to show proper singular/plural text.

Fixes #3256

Signed-off-by: Mark Stiebel <mark@aretha.stiebel.me>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-04 09:35:16 -07:00
Dirk Hohndel
891805763e build-system: remove relative paths to icons
Asciidoc appears to insert './images' references when using the admonitionblock.
Clean that up in the post processing of the user manual for HTML.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-04 09:30:54 -07:00
Berthold Stoeger
4462ae5aee profile: remove unused function ProfileWidget2::getPrintMode()
The last user was removed in the previous commit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-04 08:45:32 -07:00
Berthold Stoeger
1ddb55dcad profile: use printMode flag directly in DiveCartesianAxis
The axis has a print-mode flag. There is no point in querying
the widget.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-04 08:45:32 -07:00
Berthold Stoeger
b2b24665e7 profile: remove DiveCartesianAxis::maxChanged signal
The last listener was removed in 0104b0a91588.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-04 08:45:32 -07:00
Dirk Hohndel
1762ad9472 documentation: update the included html manual
Forgot to do that when updating the user manual the last time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-03 08:30:07 -07:00
Dirk Hohndel
49130150cd cleanup: don't use colons in file names
While Subsurface doesn't build on Windows, we shouldn't prevent people
from checking out the sources there...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-03 08:25:11 -07:00
Berthold Stoeger
9e391b4eea documentation: update installation instructions for Ubuntu
Apparently, with Ubuntu 21.04 the qt5-default package doesn't
exist anymore. Removing it from the list of installed packages
makes things still work on a freshly installed system.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-01 09:26:41 -07:00
Berthold Stoeger
622abc5afd cleanup: strongly type DepthAxis::unitSystem
This takes an enum of units::LENGTH, therefore declare it as
such. Yes, this is kind of superfluous bike shedding, but since
we have a strongly typed language, let's use it.

On a side note, the enum should probably not be named with
all-caps.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-01 09:25:32 -07:00
Berthold Stoeger
04d7c9b808 cleanup: remove DiveCartesianAxis::unitSystem
This was only used by the child class DepthAxis,
where it was defined separately. An oversight?

In any case, remove the unused member.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-01 09:25:32 -07:00
Ryan Gardner
87e203ea50 make whitespace in build script match existing whitespace
Signed-off-by: Ryan Gardner <ryan.gardner@coxautoinc.com>
2021-05-20 15:10:52 -07:00
Ryan Gardner
effd0dbae8 Make the Mac SDK detection in build.sh more robust
When trying to build on Big Sur, the xcode command-line tools
install are installed in /Library/Developer/CommandLineTools/SDKs,
and as of Xcode 12.5, it does not include a 10.x version
of SDK.

This changes it to search in the location of the command-line tools SDK
for a 10.x version, and if it can't find a 10.x version it will
find an explicit 11.x version of the SDK to use because it is
conceivable that in the near future Apple will stop installing any
10.x SDK's as part of the command-line tool installer.

If the SDK can't be found, the build script will exit now instead
of continuing with an unset BASESDK version that causes a later failure.

Signed-off-by: Ryan Gardner <ryan.gardner@coxautoinc.com>
2021-05-20 15:10:52 -07:00
mikeller
2d734c529b desktop: Add the capability to copy / paste dive number and date / time.
This is adding the capability to select 'Dive number' and 'Date / Time'
in the 'Copy dive components' dialog, and then copy them into the
clipboard.
When using 'Paste dive components, these values will then be pasted into
the selected dive(s).
This is intended to help with workflows that import dive information
from two different sources, like general information from another
logging program, and CCR ppO2 sensor readings from a unit log, and then
stitch them together into one cohesive entry with all data per dive.
Copied data is also output into formatted text when pasting the
clipboard outside of the application:

```
Dive number: 401
Date / time: Sun 2 May 2021 12:00 AM
```

No translations have been added as of now - I could not find any
information on how strings are translated for this project.

Signed-off-by: Michael Keller <github@ike.ch>
2021-05-19 15:15:34 -07:00
Berthold Stoeger
2264a5e166 cleanup: remove double layout name in statswidget.ui
This gave an annoying warning.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-05-17 11:58:59 -07:00
Robert C. Helling
41f87f3e77 Translate header strings for APD
We are matching translated header names. Thus, when composing
a header line for APD, make sure it contains translations.

This mechanism is quite brittle. Our German translations had
two different translations for "Sample time" and this already
broke it. This is why this patch also includes a fix for a
translation string (should be fixed in transiflex as well
of course).

Fixes #3246

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-05-13 12:28:38 -07:00
Robert C. Helling
5dfc183517 Planner: Update plan when deco parameters change
This makes sure that the dive plan is updated (including the
planner notes) when parameters of the dive or the planner
change.

This fixes a bug reported by Jay Anchor.

There is a chance that by partly undoing 77a6bc6d623148, this
introduces too many recalculations of the plan. But without
this patch, there are definitely not enough recalculations.

Reported-by: Jay Anchor <jay.anchor-subsurface@e257.fi>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-05-12 10:02:47 +02:00
Berthold Stoeger
dc645ce8c6 profile: rename GF_LINE color to DURATION_LINE
The color was misnamed, since it has only been used for the
duration line for quite some time (since 893bea700c98 to be
exact).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-05-08 13:40:24 +02:00
Berthold Stoeger
a7002f4089 profile: remove DiveAmbPressureItem
This was replaced by the tissue map in 893bea700c98.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-05-08 13:40:24 +02:00
Berthold Stoeger
8b0db14f64 profile: remove DiveGFLineItem
This was replaced by the tissue map in 893bea700c98.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-05-08 13:40:24 +02:00
Dirk Hohndel
fd3ebf9b62 build-system: build for Ubuntu 21.04 / hirsute as well
This release drops the qt5-default package - which really wasn't needed since
focal. So just drop it on all of the builds after 18.04 (bionic).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-05-07 12:17:21 -07:00
Robert C. Helling
312b760c5b Planner: Update notes when not computing variations
A change not to compute plan variations when not needed
was too aggressive and eliminated also the signal to update
the notes. Bug fixed.

Reported-by: Jay Anchor <jay.anchor-subsurface@e257.fi>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-05-07 11:20:30 -07:00
Robert C. Helling
09bbd846da The planner should not always ascent from the depth of
the last manually entered waypoint but consider the
possibility that it should first top where we are
before the next stop depth has cleared.

Reported-by: David Carron

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-05-07 08:16:41 -07:00
Berthold Stoeger
3e1ade5206 cleanup: free print dialog in planner
When printing the plan, a print-dialog was created with "new",
but not freed later. Strictly speaking, this is not a leak,
because the dialog is attached to the main-window in Qt's
object hierarchy. Thus it is freed on application exit. On
the other hand, it is a leak in the sense that resources are
pointlessly hogged until application exit.

Let's just turn it into a stack-allocated object.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-05-06 08:46:57 -07:00
Dirk Hohndel
b95ab84226 build-system: fix AppImage build failure
It's debatable if it makes sense to continue building on Trusty. The AppImage
community moved on to Xenial for a reason. But for now let's just make sure the
CI builds don't all break.

Suggested-by: Simon Peter <probono@puredarwin.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-05-06 08:43:01 -07:00
Berthold Stoeger
38d0fac2d1 export: show progress dialog for profile exports
Simply reuse QProgressDialog interface for the TeX exports.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-05-06 08:21:04 -07:00
Berthold Stoeger
9ee8807af7 export: show progress dialog for TeX exports
The TeX exports may hang the UI for a long time.

Show a progress-dialog that is updated after every exported dive
and allows the user to cancel the export.

This is pretty lame, because it is synchronous (export still runs
in UI thread) and therefore the UI still is sluggish. But it
is an improvement.

Since the TeX-exporting code is in a shared directory (desktop and
mobile), this uses a slim interface class. Mobile does not
yet use TeX export, but you never know. Better than #ifdefs
sprinkled all around, I reckon.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-05-06 08:21:04 -07:00
Berthold Stoeger
573de51e48 export: remove redundant QString::isNull() checks
If QString::isEmpty() is false, QString::isNull() is likewise
false, so these tests are redundant.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-05-06 08:21:04 -07:00
Berthold Stoeger
c34f0b88a2 profile: move checking for DiveTextItem into its own function
When creating the context menu, a special menu is created for
the dive computer name.

This was checked in a loop, that set a flag and exited early.

This can all be simplified by moving the loop into its own
function. No more flag, less indentation. Overall better.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-26 08:24:28 -07:00
Berthold Stoeger
78f4d7b2b9 profile: simplify checking for DiveTextItem
When creating the context menu on the profile, the code has
to check whether the context menu is activated on the
dive computer name to show a special menu (delete / split
dive computer).

This was done by setting a special property on the item
and then checking for that property on the item that
the menu is invoked on or its parents.

The reason the code didn't simply check the pointer was
probably that DiveTextItem uses multiple inheritance:
It derives from QObject and QGraphicsItem. It has to derive
from QObject first, because (the ridiculously broken) MOC
needs it that way. The object added to the scene is a
QGraphicsItem. Thus, we get a pointer _into_ the DiveTextItem
object.

However, that's all completely unnecessary. We can simply
compare the pointers, as the compiler will understand that
QGraphicsItem is only the second base class of DiveTextItem.
Magic!

Let's remove the cruft and simply compare the pointers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-26 08:24:28 -07:00
Berthold Stoeger
e9dd1b150f cleanup: remove unnecessary includes from profilewidget2.cpp
These became unnecessary along the way. "qthelper.hpp" was
included twice and <QtWidget> was to broad and was replaced
by <QMimeData>.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-26 08:24:28 -07:00
Berthold Stoeger
159dc15f99 cleanup: make a few ToolTipItem member functions private
They were not used outside the class.

Moreover, mark ToolTipItem::persistPos() as const.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-25 12:33:20 -07:00
Berthold Stoeger
bd6b714be1 profile: ignore animation-speed setting when printing
When printing, the animation speed was set to 0 by the
caller and later reset to the original value. Instead of
modifying global state, set it internally (in the profile-code)
to zero when in print mode.

This is another small step in making the printing independent
from the shown profile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-25 12:33:20 -07:00
Dirk Hohndel
757eeced78 Update to latest libdivecomputer
Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-DS9

Merge upstream updates from Jef:

 - add suppoort for various new variants of existing dive computers:

    + Suunto Eon Steel Black, and new variant of Zoop Novo

    + Sherwood Beacon

    + new Shearwater Perdix AI model number

 - add new Sporasub SP2 support

 - various minor fixes and updates

* 'master' of git://github.com/libdivecomputer/libdivecomputer: (22 commits)
  Add support for a new Suunto Zoop Novo variant
  Add support for the EON Steel Black
  Add support for the Sporasub SP2
  Fix an overflow in the progress events
  Use a common sleep implementation
  Fix the clang compiler flag detection
  Add Github Actions CI builds and releases
  Show a summary after configuration
  Extend the OS detection to non Windows platforms
  Implement the ndl/deco sample
  Fix the maximum depth
  Mark the McLean Extreme as supporting BLE
  Fix -Wcast-qual compiler warning
  Mark the new iX3M 2021 models as supporting BLE
  Add support for the Sherwood Beacon
  Remove the infinite timeout
  Simplify the loop for reading the packet header
  Add a new Perdix AI hardware type
  Fix the McLean Extreme fingerprint feature
  Perform the check for the NULL key earlier
  ...

Merge-done-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-04-23 10:34:03 -07:00
Berthold Stoeger
267c82d85f cleanup: remove MainWindow::turnOffNdlTts()
This flag is handled directly by the profile code
since 2015 (000c9cc21c8991682169987ae8f348243ec5008b).

The function therefore can be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-21 10:04:26 -07:00
Linus Torvalds
a0a631122a xml parsing: add XML_PARSE_HUGE flag to xmlReadMemory()
It looks like libxml2 has some internal limitations by default that
causes parse failures in some situations.  Avoid them with
XML_PARSE_HUGE.

Without this, you get errors like

    test.xml:349250: parser error : internal error: Huge input lookup
    όμουν τουλάχιστον αλλά +2kg και ενδεχομένως +4
                                                                                   ^
when something in the xml file grows too large.

I don't know libxml2 internals, so I have no idea what exactly goes
wrong, but the docs say:

    XML_PARSE_HUGE = 524288 : relax any hardcoded limit from the parser

and that makes us successfully parse the Greek file from Kostas.

Reported-by: Kostas Katsioulis <kostaskatsioulis@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-04-21 08:39:29 -07:00
723 changed files with 147606 additions and 181493 deletions

View File

@ -10,7 +10,7 @@ ColumnLimit: 0
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
ForEachMacros: [ 'foreach', 'for_each_dc', 'for_each_dive', 'for_each_line', 'Q_FOREACH', 'BOOST_FOREACH' ]
ForEachMacros: [ 'for_each_dc', 'for_each_relevant_dc', 'for_each_dive', 'for_each_line' ]
IndentFunctionDeclarationAfterType: false #personal taste, good for long methods
IndentWidth: 8
MaxEmptyLinesToKeep: 2

2
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,2 @@
github: subsurface
ko_fi: dirkhh

View File

@ -0,0 +1,56 @@
name: Manage the Subsurface CICD versioning
inputs:
no-increment:
description: 'Only get the current version, do not increment it even for push events (Caution: not actually a boolean)'
default: false
nightly-builds-secret:
description: The secret to access the nightly builds repository
default: ''
outputs:
version:
description: The long form version number
value: ${{ steps.version_number.outputs.version }}
buildnr:
description: The build number
value: ${{ steps.version_number.outputs.buildnr }}
runs:
using: composite
steps:
- name: atomically create or retrieve the build number and assemble release notes for a push (i.e. merging of a pull request)
if: github.event_name == 'push' && inputs.no-increment == 'false'
env:
NIGHTLY_BUILDS_SECRET: ${{ inputs.nightly-builds-secret }}
shell: bash
run: |
if [ -z "$NIGHTLY_BUILDS_SECRET" ]; then
echo "Need to supply the secret for the nightly-builds repository to increment the version number, aborting."
exit 1
fi
scripts/get-atomic-buildnr.sh $GITHUB_SHA $NIGHTLY_BUILDS_SECRET "CICD-release"
- name: retrieve the current version number in all other cases
if: github.event_name != 'push' || inputs.no-increment != 'false'
env:
PULL_REQUEST_BRANCH: ${{ github.event.pull_request.head.ref }}
shell: bash
run: |
echo "pull-request-$PULL_REQUEST_BRANCH" > latest-subsurface-buildnumber-extension
- name: store version number for the build
id: version_number
env:
PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
shell: bash
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
# For a pull request we need the information from the pull request branch
# and not from the merge branch on the pull request
git checkout $PULL_REQUEST_HEAD_SHA
version=$(scripts/get-version.sh)
echo "version=$version" >> $GITHUB_OUTPUT
buildnr=$(scripts/get-version.sh 1)
echo "buildnr=$buildnr" >> $GITHUB_OUTPUT
git checkout $GITHUB_SHA

View File

@ -1,49 +0,0 @@
name: Android Docker Image CI
# -- disabled for now, as the resulting image is HUGE and causes our
# Android builds to fail
#on:
# push:
# paths:
# - scripts/docker/android-build-container/Dockerfile
# - .github/workflows/android-docker*
# this is here to prevent errors about not having an on: clause
on:
repository_dispatch:
types:
- unused
jobs:
android-build-container:
runs-on: ubuntu-latest
env:
VERSION: ${{ '5.13.10' }} # the version numbers here is based on the Qt version, the third digit is the rev of the docker image
steps:
- uses: actions/checkout@v1
- name: Get our pre-reqs
run: |
cd scripts/docker/android-build-container
bash download.sh
sed -ie 's/^sudo/#sudo/' setup-docker.sh
bash setup-docker.sh
- name: set env
run: |
v=${{ env.VERSION }}
b=${{ github.ref }} # -BRANCH suffix, unless the branch is master
b=${b/refs\/heads\//}
b=${b,,} # the name needs to be all lower case
if [ $b = "master" ] ; then b="" ; else b="-$b" ; fi
echo "::set-env name=NAME::subsurface/android-build-container${b}:${v}"
- name: Build and Publish Linux Docker image to Dockerhub
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ env.NAME }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: 'Dockerfile'
workdir: './scripts/docker/android-build-container/'

View File

@ -0,0 +1,37 @@
name: Android Docker Image CI
on:
push:
branches:
- master
paths:
- scripts/docker/android-build-container/**
- .github/workflows/android-dockerimage.yml
jobs:
android-build-container:
runs-on: ubuntu-latest
env:
VERSION: ${{ '5.15.2' }} # the version numbers here is based on the Qt version, the third digit is the rev of the docker image
steps:
- uses: actions/checkout@v4
- name: Build the name for the docker image
id: build_name
run: |
v=$VERSION
b=$GITHUB_REF # -BRANCH suffix, unless the branch is master
b=${b/refs\/heads\//}
b=${b,,} # the name needs to be all lower case
if [ $b = "master" ] ; then b="" ; else b="-$b" ; fi
echo "NAME=$GITHUB_REPOSITORY_OWNER/android-build${b}:${v}" >> $GITHUB_OUTPUT
- name: Build and Publish Linux Docker image to Dockerhub
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ steps.build_name.outputs.NAME }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: 'Dockerfile'
workdir: './scripts/docker/android-build-container/'

View File

@ -1,27 +1,55 @@
name: Android
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
buildAndroid:
build:
env:
KEYSTORE_FILE: ${{ github.workspace }}/../subsurface.keystore
runs-on: ubuntu-latest
container:
image: docker://subsurface/android-build-container:5.15.1
image: docker://subsurface/android-build:5.15.2
steps:
- name: checkout sources
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
- name: set up the keystore
if: github.event_name == 'push'
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
run: |
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > $KEYSTORE_FILE
- name: run build
id: build
env:
KEYSTORE_PASSWORD: pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
BUILDNR: ${{ steps.version_number.outputs.buildnr }}
run: |
# this is rather awkward, but it allows us to use the preinstalled
# Android and Qt versions with relative paths
cd $GITHUB_WORKSPACE/..
cd ..
ln -s /android/5.15.* .
ln -s /android/build-tools .
ln -s /android/cmdline-tools .
@ -29,11 +57,35 @@ jobs:
ln -s /android/platform-tools .
ln -s /android/platforms .
ln -s /android/tools .
ls -l
git config --global user.email "ci@subsurface-divelog.org"
git config --global user.name "Subsurface CI"
# it turns out our build container doesn't have a native compiler
# yet ECM needs that
apt-get install --reinstall cpp-7 gcc-7-base libgcc-7-dev libcc1-0 gcc-7
bash -x ./subsurface/packaging/android/qmake-build.sh
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
# get the build number via curl so this works both for a pull request as well as a push
export OUTPUT_DIR="$GITHUB_WORKSPACE"
bash -x ./subsurface/packaging/android/qmake-build.sh -buildnr $BUILDNR
- name: delete the keystore
if: github.event_name == 'push'
run: |
rm $KEYSTORE_FILE
- name: publish pull request artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: Subsurface-Android-${{ steps.version_number.outputs.version }}
path: Subsurface-mobile-*.apk
# only publish a 'release' on push events (those include merging a PR)
- name: upload binaries
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version_number.outputs.version }}
repository: ${{ github.repository_owner }}/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false
fail_on_unmatched_files: true
files: |
Subsurface-mobile-${{ steps.version_number.outputs.version }}.apk

24
.github/workflows/artifact-links.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Add artifact links to pull request
on:
workflow_run:
workflows: ["Ubuntu 16.04 / Qt 5.15-- for AppImage", "Mac", "Windows", "Android", "iOS"]
types: [completed]
jobs:
artifacts-url-comments:
name: Add artifact links to PR and issues
runs-on: ubuntu-22.04
steps:
- name: Add artifact links to PR and issues
if: github.event.workflow_run.event == 'pull_request'
uses: tonyhallett/artifacts-url-comments@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prefix: "**Artifacts:**"
suffix: "_**WARNING:** Use at your own risk._"
format: name
addTo: pull
errorNoArtifacts: false

View File

@ -25,33 +25,32 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['cpp', 'javascript']
language: ['c-cpp', 'javascript-typescript']
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
fetch-depth: 0
submodules: recursive
- name: get container ready for build
run: |
sudo apt-get update
sudo apt-get install -y -q --force-yes \
sudo apt-get install -y -q \
autoconf automake cmake g++ git libcrypto++-dev libcurl4-gnutls-dev \
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
pkg-config qml-module-qtlocation qml-module-qtpositioning \
qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \
qml-module-qtquick2 qt5-qmake qtchooser qtconnectivity5-dev \
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@ -62,7 +61,9 @@ jobs:
- name: Build
run: |
cd ..
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
bash -e -x subsurface/scripts/build.sh -desktop -build-with-webkit
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3

View File

@ -1,58 +1,56 @@
name: Coverity Scan Linux Qt 5.9
on:
schedule:
- cron: '0 18 * * *' # Daily at 18:00 UTC
jobs:
CoverityScanBuildOnBionic:
runs-on: ubuntu-18.04
CoverityScanBuildOnUbuntu:
runs-on: ubuntu-latest
container:
image: ubuntu:18.04 # yes, this looks redundant, but something is messed up with their Ubuntu image that causes our builds to fail
image: ubuntu:22.04
steps:
- name: checkout sources
uses: actions/checkout@v1
- name: add build dependencies
run: |
apt update
apt install -y \
apt-get update
apt-get dist-upgrade -y
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
wget curl \
autoconf automake cmake g++ git libcrypto++-dev libcurl4-gnutls-dev \
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
pkg-config qml-module-qtlocation qml-module-qtpositioning \
qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \
qml-module-qtquick2 qt5-qmake qtchooser qtconnectivity5-dev \
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
qtquickcontrols2-5-dev libbluetooth-dev libmtp-dev
- name: Download Coverity Build Tool
run: |
cd ..
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=Subsurface-divelog%2Fsubsurface" -O cov-analysis-linux64.tar.gz
mkdir cov-analysis-linux64
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
- name: checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: run build
- name: configure environment
run: |
cd ..
export PATH=`pwd`/cov-analysis-linux64/bin:$PATH
cov-build --dir cov-int bash -x subsurface/scripts/build.sh -desktop -build-with-webkit
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
- name: Submit the result to Coverity Scan
run: |
cd ..
tar czvf subsurface.tgz cov-int
curl \
--form token=$TOKEN \
--form email=glance@acc.umu.se \
--form file=@subsurface.tgz \
--form version=$(/scripts/get-version linux) \
--form description="Automatic scan on github actions" \
https://scan.coverity.com/builds?project=Subsurface-divelog%2Fsubsurface
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
- name: get the version information
id: version_number
uses: ./.github/actions/manage-version
with:
no-increment: true
- name: run coverity scan
uses: vapier/coverity-scan-action@v1
with:
project: Subsurface-divelog/subsurface
token: ${{ secrets.COVERITY_SCAN_TOKEN }}
email: glance@acc.umu.se
command: subsurface/scripts/build.sh -desktop -build-with-webkit
working-directory: ${{ github.workspace }}/..
version: ${{ steps.version_number.outputs.version }}
description: Automatic scan on github actions

36
.github/workflows/documentation.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: Documentation
on:
push:
branches:
- master
paths:
- Documentation
- .github/workflows/documentation.yml
pull_request:
branches:
- master
paths:
- Documentation
- .github/workflows/documentation.yml
jobs:
documentation:
runs-on: ubuntu-22.04
steps:
- name: Install Packages
run: |
sudo apt-get -y update
sudo apt-get -y install asciidoc docbook-xml w3m
- name: Checkout Sources
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Process the Documentation
id: process_documentation
working-directory: Documentation
run: make

59
.github/workflows/fedora-copr-build.yml vendored Normal file
View File

@ -0,0 +1,59 @@
name: Fedora Copr Build
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
- current
jobs:
setup-build:
name: Submit build to Fedora COPR
# this seems backwards, but we want to run under Fedora, but Github doesn' support that
runs-on: ubuntu-latest
container:
image: fedora:latest
steps:
- name: Setup build dependencies in the Fedora container
run: |
dnf -y install @development-tools @rpm-development-tools
dnf -y install copr-cli make
- name: Check out sources
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: setup git
run: |
git config --global --add safe.directory /__w/subsurface/subsurface
git config --global --add safe.directory /__w/subsurface/subsurface/libdivecomputer
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
- name: Setup API token for copr-cli
env:
API_TOKEN: ${{ secrets.COPR_TOKEN }}
API_LOGIN: ${{ secrets.COPR_LOGIN }}
run: |
mkdir -p "$HOME/.config"
cp packaging/copr/config.copr "$HOME/.config/copr"
sed -i "s/API_TOKEN/$API_TOKEN/;s/API_LOGIN/$API_LOGIN/" "$HOME/.config/copr"
- name: Checkout googlemaps
run: |
cd ..
git clone https://github.com/subsurface/googlemaps
- name: run the copr build script
run: |
cd ..
bash -x subsurface/packaging/copr/make-package.sh $GITHUB_REF_NAME

View File

@ -1,31 +1,61 @@
name: iOS
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
iOSBuild:
runs-on: macOS-10.15
build:
runs-on: macOS-11
steps:
- name: switch to Xcode 11
run: sudo xcode-select -s "/Applications/Xcode_11.7.app"
- name: checkout sources
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: setup Homebrew
run: brew install autoconf automake libtool pkg-config
- name: set our Qt build
run: |
env
curl -L --output Qt-5.14.1-ios.tar.xz https://f002.backblazeb2.com/file/Subsurface-Travis/Qt-5.14.1-ios.tar.xz
mkdir -p $HOME/Qt
xzcat Qt-5.14.1-ios.tar.xz | tar -x -C $HOME/Qt -f -
- name: checkout Qt resources
uses: actions/checkout@v4
with:
repository: subsurface/qt-ios
ref: main
path: qt-ios
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
- name: build Subsurface-mobile for iOS
env:
VERSION: ${{ steps.version_number.outputs.version }}
run: |
cd $GITHUB_WORKSPACE/..
ln -s $HOME/Qt Qt
cd ..
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
export IOS_QT=$GITHUB_WORKSPACE/qt-ios
echo "build for simulator"
bash -x $GITHUB_WORKSPACE/packaging/ios/build.sh -simulator
# We need this in order to be able to access the file and publish it
mv build-Subsurface-mobile-Qt_5_14_1_for_iOS-Release/Release-iphonesimulator/Subsurface-mobile.app $GITHUB_WORKSPACE/Subsurface-mobile-$VERSION.app
- name: publish artifacts
uses: actions/upload-artifact@v4
with:
name: Subsurface-iOS-${{ steps.version_number.outputs.version }}
path: Subsurface-mobile-*.app

View File

@ -1,46 +0,0 @@
name: Ubuntu 18.04 / Qt 5.9--
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
buildOnBionic:
runs-on: ubuntu-18.04
container:
image: ubuntu:18.04 # yes, this looks redundant, but something is messed up with their Ubuntu image that causes our builds to fail
steps:
- name: checkout sources
uses: actions/checkout@v1
- name: add build dependencies
run: |
apt update
apt install -y \
autoconf automake cmake g++ git libcrypto++-dev libcurl4-gnutls-dev \
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
pkg-config qml-module-qtlocation qml-module-qtpositioning \
qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev
- name: build Subsurface
run: |
cd ..
bash -x subsurface/scripts/build.sh -desktop -build-with-webkit
- name: test desktop build
run: |
# and now run the tests - with Qt 5.9 we can only run the desktop flavor
echo "------------------------------------"
echo "run tests"
cd build/tests
# xvfb-run --auto-servernum ./TestGitStorage -v2
xvfb-run --auto-servernum make check

View File

@ -1,46 +1,59 @@
name: Ubuntu 20.10 / Qt 5.14--
name: Generic workflow for Debian and derivatives
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_call:
inputs:
container-image:
required: true
type: string
jobs:
buildUbuntuGroovy:
build:
runs-on: ubuntu-latest
container:
image: ubuntu:20.10
image: ${{ inputs.container-image }}
steps:
- name: checkout sources
uses: actions/checkout@v1
- name: get container ready for build
run: |
echo "--------------------------------------------------------------"
echo "update distro and install dependencies"
apt-get update
apt-get upgrade -y
DEBIAN_FRONTEND=noninteractive apt-get install -y -q --force-yes \
apt-get dist-upgrade -y
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
autoconf automake cmake g++ git libcrypto++-dev libcurl4-gnutls-dev \
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
pkg-config qml-module-qtlocation qml-module-qtpositioning \
qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \
qml-module-qtquick2 qt5-qmake qtchooser qtconnectivity5-dev \
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev
qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev \
mdbtools-dev
- name: build Subsurface-mobile
git config --global user.email "ci@subsurface-divelog.org"
git config --global user.name "Subsurface CI"
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
# needs git from the previous step
- name: checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
no-increment: true
- name: build subsurface-mobile
run: |
echo "--------------------------------------------------------------"
echo "building mobile"
git config --global user.email "ci@subsurface-divelog.org"
git config --global user.name "Subsurface CI"
cd ..
bash -e -x subsurface/scripts/build.sh -mobile
@ -53,7 +66,7 @@ jobs:
# xvfb-run --auto-servernum ./TestGitStorage -v2
xvfb-run --auto-servernum make check
- name: build Subsurface
- name: build subsurface
run: |
echo "--------------------------------------------------------------"
echo "building desktop"
@ -70,3 +83,18 @@ jobs:
# xvfb-run --auto-servernum ./TestGitStorage -v2
xvfb-run --auto-servernum make check
- name: build subsurface-downloader
run: |
echo "--------------------------------------------------------------"
echo "building downloader"
cd ..
bash -e -x subsurface/scripts/build.sh -downloader
- name: build smtk2ssrf
run: |
echo "--------------------------------------------------------------"
echo "building smtk2ssrf"
# build smtk2ssrf (needs the artefacts generated by the subsurface build
cd ..
bash -e -x subsurface/scripts/smtk2ssrf-build.sh -y

View File

@ -0,0 +1,19 @@
name: Debian trixie / Qt 5.15--
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
do-build-test:
uses: ./.github/workflows/linux-debian-generic.yml
with:
container-image: debian:trixie

View File

@ -1,39 +0,0 @@
name: Linux Qt 5.12 Docker Image CI
#on:
# push:
# paths:
# - scripts/docker/trusty-qt512/Dockerfile
# - .github/workflows/linux-docker*
jobs:
trusty-qt512:
runs-on: ubuntu-latest
env:
VERSION: ${{ '1.0' }} # 'official' images should have a dot-zero version
steps:
- uses: actions/checkout@v1
- name: Get our pre-reqs
run: |
cd scripts/docker/trusty-qt512
bash getpackages.sh
- name: set env
run: |
v=${{ env.VERSION }}
b=${{ github.ref }} # -BRANCH suffix, unless the branch is master
b=${b/refs\/heads\//}
b=${b,,} # the name needs to be all lower case
if [ $b = "master" ] ; then b="" ; else b="-$b" ; fi
echo "::set-env name=NAME::subsurface/trusty-qt512${b}:${v}"
- name: Build and Publish Linux Docker image to Dockerhub
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ env.NAME }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: 'Dockerfile'
workdir: './scripts/docker/trusty-qt512/'

View File

@ -0,0 +1,68 @@
name: Fedora 35 / Qt 6--
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
container:
image: fedora:35
steps:
- name: get container ready for build
run: |
echo "--------------------------------------------------------------"
echo "update distro and install dependencies"
dnf update -y
dnf install -y autoconf automake bluez-libs-devel cmake gcc-c++ git-core \
libcurl-devel libsqlite3x-devel libssh2-devel libtool libudev-devel \
libusbx-devel libxml2-devel libxslt-devel make \
qt6-qtbase-devel qt6-qtconnectivity-devel qt6-qtdeclarative-devel \
qt6-qtlocation-devel qt6-qtsvg-devel \
qt6-qttools-devel redhat-rpm-config \
libxkbcommon-devel qt6-qt5compat-devel \
bluez-libs-devel libgit2-devel libzip-devel libmtp-devel \
xorg-x11-server-Xvfb
- name: checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
no-increment: true
- name: build Subsurface
run: |
echo "--------------------------------------------------------------"
echo "building desktop"
# now build for the desktop version (without WebKit)
cd ..
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
git config --global --get-all safe.directory
bash -e -x subsurface/scripts/build.sh -desktop -build-with-qt6
- name: test desktop build
run: |
echo "--------------------------------------------------------------"
echo "running tests for desktop"
cd build/tests
xvfb-run --auto-servernum make check

View File

@ -1,72 +0,0 @@
name: Ubuntu 20.04 / Qt 5.12--
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
buildUbuntuFocal:
runs-on: ubuntu-latest
container:
image: ubuntu:20.04
steps:
- name: checkout sources
uses: actions/checkout@v1
- name: get container ready for build
run: |
echo "--------------------------------------------------------------"
echo "update distro and install dependencies"
apt-get update
apt-get upgrade -y
DEBIAN_FRONTEND=noninteractive apt-get install -y -q --force-yes \
autoconf automake cmake g++ git libcrypto++-dev libcurl4-gnutls-dev \
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
pkg-config qml-module-qtlocation qml-module-qtpositioning \
qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev
- name: build Subsurface-mobile
run: |
echo "--------------------------------------------------------------"
echo "building mobile"
git config --global user.email "ci@subsurface-divelog.org"
git config --global user.name "Subsurface CI"
cd ..
bash -e -x subsurface/scripts/build.sh -mobile
- name: test mobile build
run: |
echo "--------------------------------------------------------------"
echo "running tests for mobile"
cd build-mobile/tests
# xvfb-run --auto-servernum ./TestGitStorage -v2
xvfb-run --auto-servernum make check
- name: build Subsurface
run: |
echo "--------------------------------------------------------------"
echo "building desktop"
# now build for the desktop version (including WebKit)
cd ..
bash -e -x subsurface/scripts/build.sh -desktop -build-with-webkit
- name: test desktop build
run: |
echo "--------------------------------------------------------------"
echo "running tests for desktop"
cd build/tests
# xvfb-run --auto-servernum ./TestGitStorage -v2
xvfb-run --auto-servernum make check

View File

@ -1,44 +0,0 @@
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -32,6 +32,7 @@ parts:
googlemaps:
source: git://github.com/Subsurface/googlemaps.git
build-packages:
+ - ccache
- wget
override-pull: |
snapcraftctl pull
@@ -75,6 +76,8 @@ parts:
plugin: qmake
options:
- INCLUDEPATH+=QtHeaders
+ - QMAKE_CC=ccache gcc
+ - QMAKE_CXX=ccache g++
desktop-qt5:
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
@@ -105,7 +108,11 @@ parts:
source: .
source-type: git
source-subdir: libdivecomputer
+ configflags:
+ - CC=ccache gcc
+ - CXX=ccache g++
build-packages:
+ - ccache
- libbluetooth-dev
- libhidapi-dev
- libusb-dev
@@ -127,9 +134,12 @@ parts:
- -DLIBGIT2_DYNAMIC=ON
- -DFTDISUPPORT=ON
- -DLIBDIVECOMPUTER_LIBRARIES=../../../stage/lib/libdivecomputer.so
+ - -DCMAKE_C_COMPILER_LAUNCHER=ccache
+ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
source-type: git
build-packages:
- build-essential
+ - ccache
- libcurl4-gnutls-dev
- libftdi1-dev
- libgit2-dev

View File

@ -1,10 +1,14 @@
name: Linux Snap
name: Snap
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
@ -12,69 +16,65 @@ jobs:
Snap:
runs-on: ubuntu-latest
env:
SNAPCRAFT_BUILD_INFO: 1
timeout-minutes: 60
steps:
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v1
- name: Setup LXD
uses: whywaita/setup-lxd@v1
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
# Needed for version determination to work
fetch-depth: 0
submodules: recursive
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
- name: store dummy version and build number for pull request
if: github.event_name == 'pull_request'
run: |
echo "100" > latest-subsurface-buildnumber
echo "CICD-pull-request" > latest-subsurface-buildnumber-extension
- name: Set up LXD
uses: canonical/setup-lxd@main
- name: Set up CCache
id: setup-ccache
run: |
sudo apt-get install ccache
mkdir -p ${HOME}/.ccache
ccache --max-size=2G
/snap/bin/lxc profile device add default ccache disk source=${HOME}/.ccache/ path=/root/.ccache
# Patch snapcraft.yaml to enable ccache
patch -p1 < .github/workflows/linux-snap.patch
patch -p1 < .github/workflows/scripts/linux-snap.patch
# Find common base between master and HEAD to use as cache key.
git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules origin master
echo "::set-output name=key::$( git merge-base origin/master ${{ github.sha }} )"
echo "key=$( git merge-base origin/master $GITHUB_SHA )" >> $GITHUB_OUTPUT
- name: CCache
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: ccache-${{ runner.os }}-${{ steps.setup-ccache.outputs.key }}
restore-keys: |
ccache-${{ runner.os }}-
path: ~/.ccache/**
- name: Build
run: |
# Build the `subsurface` part.
/snap/bin/snapcraft build --use-lxd subsurface
- name: Build and verify the snap
uses: canonical/actions/build-snap@release
id: build-snap
with:
setup-lxd: false
- name: Clear CCache stats
run: ccache --show-stats --zero-stats
- name: Build and verify the snap
id: build-snap
env:
SNAP_ENFORCE_RESQUASHFS: 0
run: |
# Actually build the snap.
/snap/bin/snapcraft --use-lxd
sudo snap install review-tools
/snap/bin/review-tools.snap-review *.snap
echo "::set-output name=snap-file::$( ls *.snap )"
- name: Upload the snap
uses: actions/upload-artifact@v2
if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build-snap.outputs.snap-file }}
path: ${{ steps.build-snap.outputs.snap-file }}
name: ${{ steps.build-snap.outputs.snap-name }}
path: ${{ steps.build-snap.outputs.snap-path }}
if-no-files-found: error

View File

@ -1,37 +0,0 @@
name: Ubuntu 14.04 / Qt 5.12 for AppImage--
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
buildAppImage:
runs-on: ubuntu-latest
container:
image: docker://subsurface/trusty-qt512:1.1
steps:
- name: checkout sources
uses: actions/checkout@v1
- name: run build
run: |
cd ..
rm -rf /install-root/include/libdivecomputer
bash -x subsurface/.github/workflows/scripts/linux-in-container-build.sh
- name: prepare PR artifacts
if: github.event_name == 'pull_request'
run: |
mkdir -p Linux-artifacts
mv Subsurface.AppImage Linux-artifacts
- name: PR artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@master
with:
name: Linux-artifacts
path: Linux-artifacts

View File

@ -1,53 +0,0 @@
name: openSUSE/Tumbleweed / Qt latest--
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
buildOpenSUSElatest:
runs-on: ubuntu-latest
container:
image: opensuse/tumbleweed:latest
steps:
- name: checkout sources
uses: actions/checkout@v1
- name: get container ready for build
run: |
echo "--------------------------------------------------------------"
echo "update distro and install dependencies"
zypper -n install git gcc-c++ make autoconf automake libtool cmake libzip-devel \
libxml2-devel libxslt-devel sqlite3-devel libusb-1_0-devel \
libqt5-linguist-devel libqt5-qttools-devel libQt5WebKitWidgets-devel \
libqt5-qtbase-devel libQt5WebKit5-devel libqt5-qtsvg-devel \
libqt5-qtscript-devel libqt5-qtdeclarative-devel \
libqt5-qtconnectivity-devel libqt5-qtlocation-devel libcurl-devel \
libQt5QuickControls2-devel bluez-devel \
which libgit2-devel libssh2-devel libmtp-devel
# if we want to run the tests below, add xvfb-run
- name: build Subsurface
run: |
echo "--------------------------------------------------------------"
echo "building all three binaries"
# now build the desktop version (including WebKit), mobile and downloader
# the mobile build needs git setup to apply the Kirigami changes
git config --global user.email "ci@subsurface-divelog.org"
git config --global user.name "Subsurface CI"
cd ..
bash -e -x subsurface/scripts/build.sh -all -build-with-webkit
# let's not run the tests... to do that, we need to install 'xvfb-run' above
# - name: test desktop build
# run: |
# echo "--------------------------------------------------------------"
# echo "running tests for desktop"
# cd build
# xvfb-run --auto-servernum make check

View File

@ -0,0 +1,149 @@
name: Ubuntu 16.04 / Qt 5.15-- for AppImage
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
container:
image: ubuntu:16.04
steps:
- name: get container ready for build
run: |
echo "--------------------------------------------------------------"
echo "update distro and install dependencies"
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
software-properties-common
add-apt-repository -y ppa:savoury1/qt-5-15
add-apt-repository -y ppa:savoury1/kde-5-80
add-apt-repository -y ppa:savoury1/gpg
add-apt-repository -y ppa:savoury1/ffmpeg4
add-apt-repository -y ppa:savoury1/vlc3
add-apt-repository -y ppa:savoury1/gcc-9
add-apt-repository -y ppa:savoury1/display
add-apt-repository -y ppa:savoury1/apt-xenial
add-apt-repository -y ppa:savoury1/gtk-xenial
add-apt-repository -y ppa:savoury1/qt-xenial
add-apt-repository -y ppa:savoury1/kde-xenial
add-apt-repository -y ppa:savoury1/backports
add-apt-repository -y ppa:savoury1/build-tools
apt-get update
apt-get dist-upgrade -y
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
autoconf automake cmake g++ g++-9 git libcrypto++-dev libcurl4-gnutls-dev \
libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libssl-dev \
libtool libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make \
pkg-config qml-module-qtlocation qml-module-qtpositioning \
qml-module-qtquick2 qt5-qmake qtchooser qtconnectivity5-dev \
qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \
qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \
qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev liblzma-dev \
curl
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9
- name: checkout sources
# We cannot update this as glibc on 16.04 is too old for node 20.
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
- name: build Subsurface
run: |
echo "--------------------------------------------------------------"
echo "building desktop"
# now build the appimage
cd ..
bash -e -x subsurface/scripts/build.sh -desktop -create-appdir -build-with-webkit
- name: test desktop build
run: |
echo "--------------------------------------------------------------"
echo "running tests for desktop"
cd build/tests
# xvfb-run --auto-servernum ./TestGitStorage -v2
xvfb-run --auto-servernum make check
- name: build appimage
env:
VERSION: ${{ steps.version_number.outputs.version }}
run: |
echo "--------------------------------------------------------------"
echo "assembling AppImage"
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_DEBUG_PLUGINS=1
cd ..
# set up the appdir
mkdir -p appdir/usr/plugins/
# mv googlemaps plugins into place
mv appdir/usr/usr/lib/x86_64-linux-gnu/qt5/plugins/* appdir/usr/plugins # the usr/usr is not a typo, that's where it ends up
rm -rf appdir/usr/home/ appdir/usr/include/ appdir/usr/share/man/ # No need to ship developer and man files as part of the AppImage
rm -rf appdir/usr/usr appdir/usr/lib/x86_64-linux-gnu/cmake appdir/usr/lib/pkgconfig
cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 appdir/usr/lib/
cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 appdir/usr/lib/
# get the linuxdeployqt tool and run it to collect the libraries
curl -L -O "https://github.com/probonopd/linuxdeployqt/releases/download/7/linuxdeployqt-7-x86_64.AppImage"
chmod a+x linuxdeployqt*.AppImage
unset QTDIR
unset QT_PLUGIN_PATH
unset LD_LIBRARY_PATH
./linuxdeployqt*.AppImage --appimage-extract-and-run ./appdir/usr/share/applications/*.desktop -exclude-libs=libdbus-1.so.3 -bundle-non-qt-libs -qmldir=./subsurface/stats -qmldir=./subsurface/map-widget/ -verbose=2
# create the AppImage
./linuxdeployqt*.AppImage --appimage-extract-and-run ./appdir/usr/share/applications/*.desktop -exclude-libs=libdbus-1.so.3 -appimage -qmldir=./subsurface/stats -qmldir=./subsurface/map-widget/ -verbose=2
# copy AppImage to the calling VM
# with GitHub Actions the $GITHUB_WORKSPACE directory is the current working directory at the start of a step
cp Subsurface*.AppImage* $GITHUB_WORKSPACE/Subsurface-$VERSION.AppImage
- name: PR artifacts
if: github.event_name == 'pull_request'
# We cannot update this as glibc on 16.04 is too old for node 20.
uses: actions/upload-artifact@v3
with:
name: Subsurface-Linux-AppImage-${{ steps.version_number.outputs.version }}
path: Subsurface-*.AppImage
compression-level: 0
# only publish a 'release' on push events (those include merging a PR)
- name: upload binaries
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version_number.outputs.version }}
repository: ${{ github.repository_owner }}/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false
fail_on_unmatched_files: true
files: |
./Subsurface-*.AppImage

View File

@ -0,0 +1,19 @@
name: Ubuntu 20.04 / Qt 5.12--
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
do-build-test:
uses: ./.github/workflows/linux-debian-generic.yml
with:
container-image: ubuntu:20.04

View File

@ -0,0 +1,19 @@
name: Ubuntu 22.04 / Qt 5.15--
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
do-build-test:
uses: ./.github/workflows/linux-debian-generic.yml
with:
container-image: ubuntu:22.04

View File

@ -0,0 +1,19 @@
name: Ubuntu 24.04 / Qt 5.15--
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
do-build-test:
uses: ./.github/workflows/linux-debian-generic.yml
with:
container-image: ubuntu:24.04

View File

@ -1,72 +1,80 @@
name: Mac
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
buildMac:
runs-on: macOS-latest
build:
runs-on: macOS-11
steps:
- name: checkout sources
uses: actions/checkout@v1
- name: setup Homebrew
run: brew install autoconf automake libtool xz hidapi libusb libxml2 libxslt libzip openssl pkg-config libgit2 libssh2 libjpg libpng libmtp
- name: set our Qt build
run: |
mkdir -p Qt/5.13.0
curl --output Qt-5.13.0-mac.tar.xz https://f002.backblazeb2.com/file/Subsurface-Travis/Qt-5.13.0-mac.tar.xz
tar -xJ -C Qt/5.13.0 -f Qt-5.13.0-mac.tar.xz
- name: build Subsurface-mobile
run: |
cd ${GITHUB_WORKSPACE}/..
export QT_ROOT=${GITHUB_WORKSPACE}/Qt/5.13.0/clang_64
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export PATH=$QT_ROOT/bin:$PATH
export CMAKE_PREFIX_PATH=$QT_ROOT/lib/cmake
DIR=$(pwd)
git config --global user.email "ci@subsurface-divelog.org"
git config --global user.name "Subsurface CI"
# first build Subsurface-mobile to ensure this didn't get broken
bash -e -x ./subsurface/scripts/build.sh -mobile
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: test mobile build
run: |
echo "------------------------------------"
echo "run tests for mobile build"
export QT_ROOT=${GITHUB_WORKSPACE}/Qt/5.13.0/clang_64
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
cd ${GITHUB_WORKSPACE}/build-mobile/tests
# ./TestGitStorage -v2
make check
- name: setup Homebrew
run: brew install hidapi libxslt libjpg libmtp create-dmg confuse
- name: checkout Qt resources
uses: actions/checkout@v4
with:
repository: subsurface/qt-mac
ref: main
path: qt-mac
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
- name: build Subsurface
id: build
run: |
cd ${GITHUB_WORKSPACE}/..
export QT_ROOT=${GITHUB_WORKSPACE}/Qt/5.13.0/clang_64
export QT_ROOT=${GITHUB_WORKSPACE}/qt-mac/Qt5.15.13
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export PATH=$QT_ROOT/bin:$PATH
export CMAKE_PREFIX_PATH=$QT_ROOT/lib/cmake
DIR=$(pwd)
# now Subsurface with WebKit
bash -e -x ./subsurface/scripts/build.sh -desktop -build-with-webkit -release
# now setup Subsurface with WebKit and build the dependencies, using the generic build script
bash -e -x ./subsurface/scripts/build.sh -desktop -build-with-webkit -release -build-deps -ftdi -prep-only
cd ${GITHUB_WORKSPACE}/build
echo "finished initial cmake setup of Subsurface - next build the package"
cd subsurface/build
echo "run the packaging script"
bash -e -x ../packaging/macosx/make-package.sh | tee mp.log 2>&1
IMG=$(grep ^created: mp.log | tail -1 | cut -b10-)
echo "Created $IMG"
echo "dmg=$IMG" >> $GITHUB_OUTPUT
# build export-html to make sure that didn't get broken
make export-html
- name: test desktop build
run: |
echo "------------------------------------"
echo "run tests for desktop build"
export QT_ROOT=${GITHUB_WORKSPACE}/Qt/5.13.0/clang_64
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
cd ${GITHUB_WORKSPACE}/build/tests
# ./TestGitStorage -v2
make check
- name: publish pull request artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: Subsurface-MacOS-${{ steps.version_number.outputs.version }}
path: ${{ steps.build.outputs.dmg }}
compression-level: 0
# only publish a 'release' on push events (those include merging a PR)
- name: upload binaries
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version_number.outputs.version }}
repository: ${{ github.repository_owner }}/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false
fail_on_unmatched_files: true
files: ${{ steps.build.outputs.dmg }}

45
.github/workflows/post-releasenotes.yml vendored Normal file
View File

@ -0,0 +1,45 @@
name: Post Release Notes
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
postRelease:
runs-on: ubuntu-latest
steps:
- name: checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
# since we are running this step on a pull request, we will skip build numbers in releases
- name: assemble release notes
env:
EVENT_HEAD_COMMIT_ID: ${{ github.event.head_commit.id }}
# Required because we are using the GitHub CLI in 'create-releasenotes.sh'
GH_TOKEN: ${{ github.token }}
run: |
scripts/create-releasenotes.sh $EVENT_HEAD_COMMIT_ID
# add a file containing the release title so it can be picked up and listed on the release page on our web server
- name: publish release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version_number.outputs.version }}
repository: ${{ github.repository_owner }}/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false
files: release_content_title.txt
body_path: gh_release_notes.md

View File

@ -23,17 +23,19 @@ logger.setLevel(logging.INFO)
APPLICATION = "subsurface-ci"
LAUNCHPAD = "production"
RELEASE = "bionic"
TEAM = "subsurface"
SOURCE_NAME = "subsurface"
SNAPS = {
"subsurface": {"candidate": {"recipe": "subsurface-stable"}},
"subsurface": {
"stable": {"recipe": "subsurface-stable"},
},
}
STORE_URL = "https://api.snapcraft.io/api/v1/snaps" "/details/{snap}?channel={channel}"
STORE_HEADERS = {"X-Ubuntu-Series": "16", "X-Ubuntu-Architecture": "{arch}"}
CHECK_NOTICES_PATH = "/snap/bin/review-tools.check-notices"
CHECK_NOTICES_ARGS = ["--ignore-pockets", "esm-apps"]
def get_store_snap(processor, snap, channel):
@ -76,7 +78,7 @@ def check_snap_notices(store_snaps):
)
try:
notices = subprocess.check_output([CHECK_NOTICES_PATH] + snaps, encoding="UTF-8")
notices = subprocess.check_output([CHECK_NOTICES_PATH] + CHECK_NOTICES_ARGS + snaps, encoding="UTF-8")
logger.debug("Got check_notices output:\n%s", notices)
except subprocess.CalledProcessError as e:
logger.error("Failed to check notices:\n%s", e.output)

View File

@ -1,58 +0,0 @@
#!/bin/bash
set -x
set -e
# this gets executed by the GitHub Action when building an AppImage for Linux
# inside of the trusty-qt512 container
export PATH=$QT_ROOT/bin:$PATH # Make sure correct qmake is found on the $PATH for linuxdeployqt
export CMAKE_PREFIX_PATH=$QT_ROOT/lib/cmake
# echo "--------------------------------------------------------------"
# echo "install missing packages"
# apt install -y libbluetooth-dev libmtp-dev
# the container currently has things under / that need to be under /__w/subsurface/subsurface instead
cp -a /appdir /__w/subsurface/
cp -a /install-root /__w/subsurface/
echo "--------------------------------------------------------------"
echo "building desktop"
# now build our AppImage
bash -e -x subsurface/scripts/build.sh -desktop -create-appdir -build-with-webkit -quick
echo "--------------------------------------------------------------"
echo "assembling AppImage"
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_DEBUG_PLUGINS=1
# set up the appdir
mkdir -p appdir/usr/plugins/
# mv googlemaps plugins into place
mv appdir/usr/usr/local/Qt/5.*/gcc_64/plugins/* appdir/usr/plugins # the usr/usr is not a typo, that's where it ends up
rm -rf appdir/usr/home/ appdir/usr/include/ appdir/usr/share/man/ # No need to ship developer and man files as part of the AppImage
rm -rf appdir/usr/usr appdir/usr/lib/cmake appdir/usr/lib/pkgconfig
cp /ssllibs/libssl.so appdir/usr/lib/libssl.so.1.1
cp /ssllibs/libcrypto.so appdir/usr/lib/libcrypto.so.1.1
# get the linuxdeployqt tool and run it to collect the libraries
curl -L -O "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod a+x linuxdeployqt*.AppImage
unset QTDIR
unset QT_PLUGIN_PATH
unset LD_LIBRARY_PATH
./linuxdeployqt*.AppImage --appimage-extract-and-run ./appdir/usr/share/applications/*.desktop -exclude-libs=libdbus-1.so.3 -bundle-non-qt-libs -qmldir=./subsurface/stats -qmldir=./subsurface/map-widget/ -verbose=2
# create the AppImage
export VERSION=$(cd subsurface/scripts ; ./get-version linux) # linuxdeployqt uses this for naming the file
./linuxdeployqt*.AppImage --appimage-extract-and-run ./appdir/usr/share/applications/*.desktop -exclude-libs=libdbus-1.so.3 -appimage -qmldir=./subsurface/stats -qmldir=./subsurface/map-widget/ -verbose=2
# copy AppImage to the calling VM
# with GitHub Actions the /${GITHUB_WORKSPACE} directory is the current working directory at the start of a step
cp Subsurface*.AppImage* /${GITHUB_WORKSPACE}/Subsurface.AppImage
ls -l /${GITHUB_WORKSPACE}/Subsurface.AppImage

View File

@ -0,0 +1,44 @@
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 9f34d0169..0d5a89fd9 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -35,6 +35,7 @@ parts:
source: https://github.com/Subsurface/googlemaps.git
plugin: make
build-packages:
+ - ccache
- qtbase5-dev
- wget
override-pull: |
@@ -79,6 +80,7 @@ parts:
override-build: |
qmake \
INCLUDEPATH+=${CRAFT_PART_SRC}/QtHeaders \
+ CONFIG+=ccache \
${CRAFT_PART_SRC}
craftctl default
@@ -111,7 +113,11 @@ parts:
source: .
source-type: git
source-subdir: libdivecomputer
+ autotools-configure-parameters:
+ - CC="ccache gcc"
+ - CXX="ccache g++"
build-packages:
+ - ccache
- libbluetooth-dev
- libhidapi-dev
- libusb-dev
@@ -134,8 +140,11 @@ parts:
- -DFTDISUPPORT=ON
- -DLIBDIVECOMPUTER_LIBRARIES=../../../stage/usr/local/lib/libdivecomputer.so
- -DLIBDIVECOMPUTER_INCLUDE_DIR=../../../stage/usr/local/include
+ - -DCMAKE_C_COMPILER_LAUNCHER=ccache
+ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
build-packages:
- build-essential
+ - ccache
- libcurl4-gnutls-dev
- libftdi1-dev
- libgit2-dev

View File

@ -1,33 +1,34 @@
name: SnapUSNs
on:
workflow_dispatch:
schedule:
- cron: '0 5 * * *'
jobs:
CheckUSNs:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.11'
- name: Install Python dependencies
uses: BSFishy/pip-action@v1
uses: insightsengineering/pip-action@v2.0.0
with:
requirements: .github/workflows/scripts/requirements.txt
- name: Install Snap dependencies
run: |
sudo snap install review-tools
sudo snap install review-tools --edge
- name: Set up Launchpad credentials
uses: DamianReeves/write-file-action@v1.0
uses: DamianReeves/write-file-action@v1.2
with:
path: lp_credentials
contents: ${{ secrets.LAUNCHPAD_CREDENTIALS }}

View File

@ -0,0 +1,55 @@
name: Ubuntu Launchpad Build
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
- current
jobs:
push-to-ppa:
name: Submit build to Ubuntu Launchpad
runs-on: ubuntu-latest
steps:
- name: Check out sources
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
- name: Setup build dependencies
run: |
sudo apt-get update
sudo apt-get install -y devscripts dput gpg debhelper qt5-qmake cmake
- name: Setup gpg key token for launchpad
env:
GPG_PRIVATE_KEY: ${{ secrets.PPA_SECRET_KEY }}
run: |
echo "$GPG_PRIVATE_KEY" > ~/.key
gpg --import ~/.key
- name: setup git
run: |
git config --global --add safe.directory /__w/subsurface/subsurface
git config --global --add safe.directory /__w/subsurface/subsurface/libdivecomputer
- name: Checkout googlemaps
run: |
cd ..
git clone https://github.com/subsurface/googlemaps
- name: run the launchpad make-package script
run: |
cd ..
bash -x subsurface/packaging/ubuntu/make-package.sh $GITHUB_REF_NAME

View File

@ -0,0 +1,38 @@
name: Windows (MXE) Docker Image
on:
push:
branches:
- master
paths:
- scripts/docker/mxe-build-container/**
- .github/workflows/windows-mxe-dockerimage.yml
jobs:
windows-mxe:
runs-on: ubuntu-latest
env:
VERSION: ${{ '3.1.0' }} # 'official' images should have a dot-zero version
mxe_sha: 'c0bfefc57a00fdf6cb5278263e21a478e47b0bf5'
steps:
- uses: actions/checkout@v4
- name: Build the name for the docker image
id: build_name
run: |
v=$VERSION
b=$GITHUB_REF # -BRANCH suffix, unless the branch is master
b=${b/refs\/heads\//}
b=${b,,} # the name needs to be all lower case
if [ $b = "master" ] ; then b="" ; else b="-$b" ; fi
echo "NAME=$GITHUB_REPOSITORY_OWNER/mxe-build${b}:${v}" >> $GITHUB_OUTPUT
- name: Build and Publish Linux Docker image to Dockerhub
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ steps.build_name.outputs.NAME }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
workdir: './scripts/docker/mxe-build-container/'
buildargs: mxe_sha

View File

@ -1,43 +1,73 @@
name: Windows
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
buildWindows:
build:
runs-on: ubuntu-latest
container:
image: docker://subsurface/mxe-build-container:2.2
image: docker://subsurface/mxe-build:3.1.0
steps:
- name: checkout sources
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: set the version information
id: version_number
uses: ./.github/actions/manage-version
with:
nightly-builds-secret: ${{ secrets.NIGHTLY_BUILDS }}
- name: get other dependencies
env:
SUBSURFACE_REPO_PATH: ${{ github.workspace }}
run: |
echo "Running script to install additional dependancies into container"
git config --global --add safe.directory ${SUBSURFACE_REPO_PATH}
git config --global --add safe.directory ${SUBSURFACE_REPO_PATH}/libdivecomputer
cd /win
ln -s /__w/subsurface/subsurface .
bash -x subsurface/.github/workflows/scripts/windows-container-prep.sh 2>&1 | tee pre-build.log
bash -x subsurface/packaging/windows/container-prep.sh 2>&1 | tee pre-build.log
- name: run build
run: |
export OUTPUT_DIR="$GITHUB_WORKSPACE"
cd /win
bash -x subsurface/.github/workflows/scripts/windows-in-container-build.sh 2>&1 | tee build.log
bash -x subsurface/packaging/windows/in-container-build.sh 2>&1 | tee build.log
grep "Built target installer" build.log
- name: prepare PR artifacts
- name: publish pull request artifacts
if: github.event_name == 'pull_request'
run: |
mkdir -p Windows-artifacts
mv ./subsurface-installer.exe ./subsurface.exe ./subsurface.exe.debug ./smtk2ssrf-installer.exe ./smtk2ssrf.exe Windows-artifacts
- name: PR artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v4
with:
name: Windows-artifacts
path: Windows-artifacts
name: Subsurface-Windows-${{ steps.version_number.outputs.version }}
path: |
subsurface*.exe*
smtk2ssrf*.exe
# only publish a 'release' on push events (those include merging a PR)
- name: upload binaries
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version_number.outputs.version }}
repository: ${{ github.repository_owner }}/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false
fail_on_unmatched_files: true
files: |
./subsurface*.exe*
./smtk2ssrf*.exe

9
.gitignore vendored
View File

@ -35,9 +35,18 @@ Subsurface.app
.DS_Store
!android/**/*.xml
build*
nightly-builds/
mobile-widgets/qml/kirigami
mobile-widgets/3rdparty/ECM/
mobile-widgets/3rdparty/breeze-icons/
mobile-widgets/3rdparty/extra-cmake-modules/
mobile-widgets/3rdparty/kirigami/
packaging/ios/install-root
packaging/ios/Info.plist
packaging/ios/Qt
packaging/ios/asset_catalog_compiler.Info.plist
appdata/subsurface.appdata.xml
android-mobile/Roboto-Regular.ttf
gh_release_notes.md
release_content_title.txt
/output/

2
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "libdivecomputer"]
path = libdivecomputer
url = git://github.com/Subsurface/libdc.git
url = https://github.com/Subsurface/libdc.git
branch = Subsurface-NG

View File

@ -11,3 +11,4 @@ type = TS
source_file = terms
source_lang = en
type = txt

View File

@ -1,4 +1,46 @@
printing: use sensible font size even for strange window size
statistics: show proper dates in January
desktop: add country to the fields indexed for full text search
import: update libdivecomputer version, add support for the Scubapro G3 / Luna and Shearwater Tern
desktop: add a button linking to the 'Contribute' page
mobile: fix configuration of decompression ceiling and gradient factors
desktop: fix gas switches in UDDF exports
core: allow of up to 6 O2 sensors (and corresponding voting logic)
desktop: add divemode as a possible dive list column
profile-widget: Now zomed in profiles can be panned with horizontal scroll.
desktop: hide only events with the same severity when 'Hide similar events' is used
equipment: mark gas mixes reported by the dive computer as 'inactive' as 'not used'
equipment: include unused cylinders in merged dive if the preference is enabled
equipment: fix bug showing the first diluent in the gas list as 'used' for CCR dives
desktop: added button to hide the infobox in the dive profile
desktop: use persisted device information for the dive computer configuration
core: fix bug using salinity and pressure values in mbar <-> depth conversion
export: fix bug resulting in invalid CSV for '""' in 'CSV summary dive details'
desktop: add support for multiple tanks to the profile ruler
export: change format produced by 'CSV summary dive details' from TSV (tab separated) to CSV
desktop: add function to merge dive site into site selected in list
import: add option to synchronise dive computer time when downloading dives
desktop: fix salinity combo/icon when DC doesnt have salinity info
core: fix bug when save sea water salinity given by DC
desktop: add option to force firmware update on OSTC4
desktop: add column for dive notes to the dive list table
desktop: Add an option for printing in landscape mode
desktop: fix bug when printing a dive plan with multiple segments
desktop: fix remembering of bluetooth address for remembered dive computers (not MacOS)
desktop: fix bug in bailout gas selection for CCR dives
desktop: fix crash on cylinder update of multiple dives
desktop: use dynamic tank use drop down in equipment tab and planner
desktop: fix brightness configuration for OSTC4
equipment: Use 'diluent' as default gas use type if the dive mode is 'CCR'
htmlexport: fix search in HTML export
htmlexport: fix diveguide display
statistics: fix value axis for degenerate value ranges
profile: Show correct gas density when in CCR mode
statistics: show correct color of selected scatter items when switching to unbinned mode
statistics: fix display of month number in continuous date axis
statistics: fix range of continuous date axis
desktop: fix dive time display in time shift dialog
libdivecomputer: garmin: relax string parsing sanity checks
libdivecomputer: add Cressi Donatello, Scubapro G2 TEK, Oceanic Geo Air, Scorpena Alpha
---
* Always add new entries at the very top of this file above other existing entries and this note.

View File

@ -20,6 +20,7 @@ endif ()
set(CMAKE_MODULE_PATH
${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules
${${PROJECT_NAME}_SOURCE_DIR}/../install-root/lib/cmake
${CMAKE_MODULE_PATH}
)
@ -49,12 +50,15 @@ option(NO_PRINTING "disable the printing support" OFF)
option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
#Options regarding enabling parts of subsurface
option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" ON)
option(BTSUPPORT "enable support for QtBluetooth" ON)
option(FTDISUPPORT "enable support for libftdi based serial" OFF)
# Options regarding What should we build on subsurface
option(MAKE_TESTS "Make the tests" ON)
# Option whether we should try to build against Qt6, if it is available
option(BUILD_WITH_QT6 "try to build against Qt6 (incomplete)" OFF)
SET(SUBSURFACE_TARGET_EXECUTABLE "DesktopExecutable" CACHE STRING "The type of application, DesktopExecutable, MobileExecutable, or DownloaderExecutable")
LIST(APPEND SUBSURFACE_ACCEPTED_EXECUTABLES "DesktopExecutable" "MobileExecutable" "DownloaderExecutable")
SET_PROPERTY(CACHE SUBSURFACE_TARGET_EXECUTABLE PROPERTY STRINGS ${SUBSURFACE_ACCEPTED_EXECUTABLES})
@ -120,8 +124,8 @@ if (SUBSURFACE_ASAN_BUILD)
endif()
# every compiler understands -Wall
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror=format")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=format")
# by detault optimize with -O2 even for debug builds
set (GCC_OPTIMIZATION_FLAGS "-O2" CACHE STRING "GCC optimization flags")
@ -141,9 +145,6 @@ include(pkgconfig_helper)
# module file.
include(HandleFindGit2)
include(HandleFindLibDiveComputer)
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
include(HandleUserManual)
endif()
include(HandleFtdiSupport)
include(HandleVersionGeneration)
include(RunOnBuildDir)
@ -151,7 +152,7 @@ include(cmake_variables_helper)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
include_directories(${CMAKE_OSX_SYSROOT}/usr/include/libxml2)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lxml2 -lxslt -lsqlite3)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lxml2 -lxslt -lsqlite3)
else()
pkg_config_library(LIBXML libxml-2.0 REQUIRED)
pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED)
@ -173,6 +174,67 @@ include_directories(.
${CMAKE_BINARY_DIR}/desktop-widgets
)
# decide what to do about Qt
# this is messy because we want to support older Qt5 versions, newer Qt5 versions,
# and Qt6 when enabled / available.
if(BUILD_WITH_QT6)
set(CHECK_QT6 "Qt6")
endif()
# figure out which version of Qt we are building against
# in theory this should get us all the variables set up correctly, but that
# ended up failing in subtle ways to do what was advertized; in the Qt5 case
# some of the variables didn't get set up, so we'll immediately call it again
# for Qt5
find_package(QT NAMES ${CHECK_QT6} Qt5 REQUIRED COMPONENTS Core Widgets)
# right now there are a few things that don't work with Qt6
# let's disable them right here and remember our Qt version
if(QT_VERSION_MAJOR STREQUAL "6")
set(USINGQT6 ON)
set(QT5OR6 "")
# for Qt6 we want the Qt5 compatibility package
LIST(APPEND QT_EXTRA_COMPONENTS Core5Compat)
LIST(APPEND QT_TEST_LIBRARIES Qt::Core5Compat)
# QtWebKit doesn't work with Qt6, so no printing, no manual
set(NO_PRINTING ON)
set(NO_USERMANUAL ON)
# as of Qt 6.3 by default QtLocation isn't included, but one can
# build the module from source; so let's look if the user has installed
# it (or if a newer version is out that includes it, anyway)
find_package(Qt6 COMPONENTS Location)
if(Qt6Location_FOUND)
message(STATUS "Found Qt6Location")
LIST(APPEND QT_EXTRA_COMPONENTS Location)
add_definitions(-DMAP_SUPPORT)
set(MAPSUPPORT ON)
# at least on macOS something goes sideways and we fail to load the
# QML files with a weird error about Qml.WorkerScript missing
# linking Subsurface against that component appears enough to hack
# around that, but that feels... wrong
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(Qt6 COMPONENTS QmlWorkerScript)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt6::QmlWorkerScript)
endif()
endif()
else()
# as mentioned above, since some variables appear to fail to populate
# on some platforms, simply run this again the 'old' way
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
set(USINGQT6 OFF)
set(QT5OR6 "5")
set(QT_VERSION ${Qt5_VERSION})
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
# for Qt5 we want the Location component (which is missing so far in Qt6)
LIST(APPEND QT_EXTRA_COMPONENTS Location)
add_definitions(-DMAP_SUPPORT)
set(MAPSUPPORT ON)
endif()
message(STATUS "building with Qt ${QT_VERSION}")
# Project Target specific configuration should go here,
# if the configuration is too big or would disrupt the normal code flux,
# move it somewhere else (another file) and include it.
@ -184,14 +246,32 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
endif()
list(APPEND QT_EXTRA_COMPONENTS QuickWidgets)
remove_definitions(-DSUBSURFACE_MOBILE)
if(NO_USERMANUAL)
message(STATUS "building without built-in user manual support")
add_definitions(-DNO_USERMANUAL)
else()
set(REQUEST_WEBKIT ON)
endif()
if(NO_PRINTING)
message(STATUS "building without printing support")
add_definitions(-DNO_PRINTING)
else()
LIST(APPEND QT_EXTRA_COMPONENTS PrintSupport)
set(REQUEST_WEBKIT ON)
endif()
if(REQUEST_WEBKIT)
# Because Qt5WebKitWidgets isn't a part of the "regular" Qt5, we can't get it the normal way
find_package(Qt5WebKitWidgets REQUIRED)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} Qt5::WebKitWidgets)
find_package(Qt5WebKitWidgets QUIET)
if(Qt5WebKitWidgets_FOUND STREQUAL "1")
LIST(APPEND QT_EXTRA_COMPONENTS PrintSupport WebKitWidgets)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt5::WebKitWidgets)
message(STATUS "building with QtWebKit")
else()
message(STATUS "didn't find QtWebKit, building without user manual and printing support")
add_definitions(-DNO_PRINTING)
add_definitions(-DNO_USERMANUAL)
set(NO_PRINTING ON)
set(NO_USERMANUAL ON)
endif()
endif()
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
@ -210,10 +290,10 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
set(BTSUPPORT ON)
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(SUBSURFACE_TARGET Subsurface-downloader)
else()
set(SUBSURFACE_TARGET subsurface-downloader)
endif()
set(SUBSURFACE_TARGET Subsurface-downloader)
else()
set(SUBSURFACE_TARGET subsurface-downloader)
endif()
set(BTSUPPORT ON)
add_definitions(-DSUBSURFACE_DOWNLOADER)
message(STATUS "building the embedded Subsurface-downloader app")
@ -224,30 +304,30 @@ if(ANDROID)
set(NO_USERMANUAL ON)
set(MAKE_TESTS OFF)
list(APPEND QT_EXTRA_COMPONENTS AndroidExtras)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -llog)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -llog)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# add pthread to the end of the library list on Linux
# this is only needed on Ubuntu
# but shouldn't hurt on other Linux versions
# in some builds we appear to be missing libz for some strange reason...
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lz -lpthread)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lz -lpthread)
# Test for ARM processor (Raspberry Pi) and add libGLESv2 if found
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv6l")
message (STATUS "Found ARM processor. Adding libGLESv2")
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lGLESv2)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lGLESv2)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
execute_process(
COMMAND sh scripts/get-version linux
COMMAND bash scripts/get-version.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE SSRF_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_library(APP_SERVICES_LIBRARY ApplicationServices)
find_library(HID_LIB HidApi)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${HID_LIB})
LIST(APPEND SUBSURFACE_LINK_LIBRARIES ${HID_LIB})
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
@ -266,7 +346,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32 -lws2_32)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lwsock32 -lws2_32)
remove_definitions(-DUNICODE)
add_definitions(-mwindows -D_WIN32)
endif()
@ -284,37 +364,47 @@ if(ANDROID)
# our Qt installation. This is ugly, but it works.
set(CMAKE_FIND_ROOT_PATH "/;${CMAKE_FIND_ROOT_PATH}")
endif()
set(QT_FIND_COMPONENTS Core Concurrent Widgets Network Svg Positioning Quick Location ${QT_EXTRA_COMPONENTS})
set(QT_FIND_COMPONENTS Core Concurrent Widgets Network Svg Positioning Quick ${QT_EXTRA_COMPONENTS})
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
find_package(Qt5 5.9.1 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
# Kirigami 5.62 and newer require at least Qt 5.12
if(ANDROID)
find_package(Qt5 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools)
find_package(Qt${QT_VERSION_MAJOR} 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools)
else()
find_package(Qt5 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
find_package(Qt${QT_VERSION_MAJOR} 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
endif()
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
# let's pick a version that's not ancient
find_package(Qt5 5.11 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS})
find_package(Qt${QT_VERSION_MAJOR} 5.11 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS})
set(MAKE_TESTS OFF)
endif()
foreach(_QT_COMPONENT ${QT_FIND_COMPONENTS})
list(APPEND QT_LIBRARIES Qt5::${_QT_COMPONENT})
list(APPEND QT_LIBRARIES Qt${QT5OR6}::${_QT_COMPONENT})
endforeach()
if(NOT ANDROID)
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test Qt5::QuickTest)
LIST(APPEND QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt${QT5OR6}::Test Qt${QT5OR6}::QuickTest)
endif()
#set up the subsurface_link_libraries variable
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
LIST(APPEND SUBSURFACE_LINK_LIBRARIES ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc stats/statsicons.qrc map-widget/qml/map-widget.qrc desktop-widgets/qml/statsview2.qrc)
if(USINGQT6)
if(MAPSUPPORT)
qt_add_resources(SUBSURFACE_RESOURCES map-widget/qml/map-widget.qrc)
set(SUBSURFACE_MAPWIDGET subsurface_mapwidget)
endif()
qt_add_resources(SUBSURFACE_RESOURCES subsurface.qrc profile.qrc stats/statsicons.qrc desktop-widgets/qml/statsview2.qrc)
else()
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc profile.qrc stats/statsicons.qrc map-widget/qml/map-widget.qrc desktop-widgets/qml/statsview2.qrc)
set(SUBSURFACE_MAPWIDGET subsurface_mapwidget)
endif()
endif()
# hack to build successfully on LGTM
if(DEFINED ENV{LGTM_SRC})
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lgssapi_krb5 -lhttp_parser)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lgssapi_krb5 -lhttp_parser)
endif()
# include translations
@ -326,7 +416,9 @@ add_subdirectory(qt-models)
add_subdirectory(commands)
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
add_subdirectory(profile-widget)
if(MAPSUPPORT)
add_subdirectory(map-widget)
endif()
add_subdirectory(mobile-widgets)
add_subdirectory(stats)
endif()
@ -354,9 +446,17 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
subsurface-mobile-main.cpp
subsurface-helper.cpp
)
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc)
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/icons.qrc)
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/kirigami/src/scenegraph/shaders/shaders.qrc)
if(USINGQT6)
qt_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc)
qt_add_resources(MOBILE_RESOURCES profile.qrc)
qt_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/icons.qrc)
qt_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/kirigami/src/scenegraph/shaders/shaders.qrc)
else()
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc)
qt5_add_resources(MOBILE_RESOURCES profile.qrc)
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/icons.qrc)
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/kirigami/src/scenegraph/shaders/shaders.qrc)
endif()
# the following is split across two commands since in cmake 3.12 this would result
# in a non-sensical "no sources given to target" error if done all as one set of
@ -367,7 +467,7 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
${SUBSURFACE_TARGET}
subsurface_mobile
subsurface_profile
subsurface_mapwidget
${SUBSURFACE_MAPWIDGET}
subsurface_backend_shared
subsurface_models_mobile
subsurface_commands
@ -393,8 +493,7 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
subsurface_generated_ui
subsurface_interface
subsurface_profile
subsurface_statistics
subsurface_mapwidget
${SUBSURFACE_MAPWIDGET}
subsurface_backend_shared
subsurface_models_desktop
subsurface_commands
@ -403,7 +502,6 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
${SUBSURFACE_LINK_LIBRARIES}
)
add_dependencies(subsurface_desktop_preferences subsurface_generated_ui)
add_dependencies(subsurface_statistics subsurface_generated_ui)
add_dependencies(subsurface_interface subsurface_generated_ui)
add_dependencies(subsurface_profile subsurface_generated_ui)
add_dependencies(subsurface_models_desktop subsurface_generated_ui)
@ -447,14 +545,17 @@ set(DOCFILES
${CMAKE_BINARY_DIR}/Documentation/user-manual.html
${CMAKE_BINARY_DIR}/Documentation/user-manual_es.html
${CMAKE_BINARY_DIR}/Documentation/user-manual_fr.html
${CMAKE_BINARY_DIR}/Documentation/user-manual_ru.html
)
# add all the translations that we may need
FILE(STRINGS "subsurface_enabled_translations" QTTRANSLATIONS_BASE)
if(NOT DEFINED QT_TRANSLATION_DIR OR QT_TRANSLATION_DIR STREQUAL "")
set(QT_TRANSLATION_DIR ${Qt5Core_DIR}/../../../translations)
if(USINGQT6)
set(QT_TRANSLATION_DIR ${QtCore_DIR}/../../../translations)
else()
set(QT_TRANSLATION_DIR ${Qt5Core_DIR}/../../../translations)
endif()
endif()
set(QTTRANSLATIONS "")
foreach(QTTRANSLATION ${QTTRANSLATIONS_BASE})
@ -495,34 +596,53 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
install(FILES ${QTTRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR})
install(CODE "execute_process(COMMAND mkdir -p ${RESOURCEDIR}/qml)")
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
install(CODE "execute_process(COMMAND cp ${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
# this is a hack - but I don't know how else to find the macdeployqt program if it's not in the PATH
string(REPLACE moc macdeployqt MACDEPLOYQT ${QT_MOC_EXECUTABLE})
install(CODE "execute_process(COMMAND ${MACDEPLOYQT} ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})")
if(USINGQT6)
set(QT_INSTALL_PREFIX ${QT6_INSTALL_PREFIX})
else()
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
endif()
if(MAPSUPPORT)
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
# this is really weird. We first try a plugin that ended up in the Qt install prefix
# then we try one that's in that odd broken install location that the qmake file results in (that includes the QT_INSTALL_PREFIX after our INSTALL_ROOT
# and finally, for fat binaries, we copy the one that's in the 'logical' spot under the INSTALL_ROOT
# this should cover all cases and always get us the correct library
install(CODE "execute_process(COMMAND cp ${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
endif()
# this will fail is macdeployqt isn't in the PATH - that seemed to happen in the past, but not recently
# also, on M1 macOS systems macdeployqt throws a ton of (apparently harmless) errors. Warn the unsuspecting developer
install(CODE "execute_process(COMMAND macdeployqt ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})")
# the next hack is here to delete the sqlite plugin that get's installed even though it isn't needed
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns/sqldrivers)")
# and another hack to get the QML Components in the right place
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick.2,QtLocation,QtPositioning})")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtLocation ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
if(NOT Qt5Core_VERSION VERSION_LESS 5.11.0)
if(MAPSUPPORT)
if (USINGQT6)
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick,QtLocation,QtPositioning})")
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
else()
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick.2,QtLocation,QtPositioning})")
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
endif()
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtLocation ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
endif()
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
if(NOT QT_VERSION VERSION_LESS 5.11.0)
# and with Qt 5.11 we need another library that isn't copied by macdeployqt
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtPositioningQuick.framework)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/lib/QtPositioningQuick.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/lib/QtPositioningQuick.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
endif()
if(NOT Qt5Core_VERSION VERSION_LESS 5.14.0)
if(NOT QT_VERSION VERSION_LESS 5.14.0)
# and with Qt 5.14 we need another library that isn't always copied by macdeployqt
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtQmlWorkerScript.framework)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/lib/QtQmlWorkerScript.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/lib/QtQmlWorkerScript.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
endif()
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtGraphicalEffects ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQml ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtGraphicalEffects ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQml ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
@ -556,10 +676,10 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION ${WINDOWSSTAGING})
install(FILES ${CMAKE_BINARY_DIR}/qt.conf DESTINATION ${WINDOWSSTAGING})
if(NOT Qt5Core_VERSION VERSION_LESS 5.11.0)
if(NOT QT_VERSION VERSION_LESS 5.11.0)
# hack to work around the fact that we don't process the dependencies of plugins
# as of Qt 5.11 this additional DLL is needed and it's only referenced in the qml DLLs
install(FILES ${_qt5Core_install_prefix}/bin/Qt5PositioningQuick.dll DESTINATION ${WINDOWSSTAGING})
install(FILES ${QT_INSTALL_PREFIX}/bin/Qt5PositioningQuick.dll DESTINATION ${WINDOWSSTAGING})
endif()
if(NOT DEFINED MAKENSIS)
@ -600,8 +720,8 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
endif()
install(FILES subsurface.debug DESTINATION bin)
install(FILES subsurface.desktop DESTINATION share/applications)
install(CODE "execute_process(COMMAND sh ${CMAKE_SOURCE_DIR}/scripts/add-version-to-appdata.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})")
install(FILES appdata/subsurface.appdata.xml DESTINATION share/metainfo)
install(CODE "execute_process(COMMAND sh ${CMAKE_SOURCE_DIR}/scripts/add-version-to-metainfo.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})")
install(FILES metainfo/subsurface.metainfo.xml DESTINATION share/metainfo)
install(FILES icons/subsurface-icon.svg DESTINATION share/icons/hicolor/scalable/apps)
install(DIRECTORY Documentation/images DESTINATION share/subsurface/Documentation)
install(FILES ${DOCFILES} DESTINATION share/subsurface/Documentation)

View File

@ -6,11 +6,11 @@ not yet fully consistent to these rules, but following these rules will make
sure that no one yells at you about your patches.
We have a script that can be used to reformat code to be reasonably close
to these rules; it's in scripts/whitespace.pl - this script requires
to these rules; it's in `scripts/whitespace.pl` this script requires
clang-format to be installed (which sadly isn't installed by default on
any of our platforms; even on Mac where clang is the default compiler).
At the end of this file are some ideas for your .emacs file (if that's
At the end of this file are some ideas for your `.emacs` file (if that's
your editor of choice) as well as for QtCreator. If you have settings for
other editors that implement this coding style, please add them here.
@ -21,14 +21,14 @@ other editors that implement this coding style, please add them here.
* all keywords followed by a '(' have a space in between
```
if (condition)
for (i = 0; i < 5; i++)
if (condition)
for (i = 0; i < 5; i++)
```
* function calls do NOT have a space between their name and argument
```
i = some_function(argument);
i = some_function(argument);
```
* usually there is no space on the inside of parenthesis (see examples
@ -40,69 +40,81 @@ other editors that implement this coding style, please add them here.
* all other opening curly braces follow at the end of the line, with a
space separating them:
```
if (condition) {
dosomething();
dosomethingelse();
}
if (condition) {
dosomething();
dosomethingelse();
}
```
* both sides of an if / else clause either use or do not use curly braces:
* both sides of an `if` / `else` clause either use or do not use curly braces:
```
if (condition)
i = 4;
else
j = 6;
if (condition) {
i = 6;
} else {
i = 4;
j = 6;
}
if (condition)
i = 4;
else
j = 6;
if (condition) {
i = 6;
} else {
i = 4;
j = 6;
}
```
* use space to make visual separation easier
```
a = b + 3 + e / 4;
a = b + 3 + e / 4;
```
* continuation lines have the operator / comma at the end
```
if (very_long_condition_1 ||
condition_2)
b = a + (c + d +
f + z);
if (very_long_condition_1 ||
condition_2)
b = a + (c + d +
f + z);
```
* in a C++ constructor initialization list, the colon is on the same line and
continuation lines are aligned as the rule above:
```
ClassName::ClassName() : x(1),
y(2),
z(3)
{
}
ClassName::ClassName() : x(1),
y(2),
z(3)
{
}
```
* unfortunate inconsistency
- C code usually uses underscores to structure names
```
variable_in_C
variable_in_C
```
- In contrast, C++ code usually uses camelCase
```
variableInCPlusPlus
variableInCPlusPlus
```
for variable names and PascalCase
```
ClassInCPlusPlus
ClassInCPlusPlus
```
for names of classes and other types
where the two meet, use your best judgment and go for best consistency
(i.e., where does the name "originate")
* macro names should be capitalized; e.g., prefer
```
#define FROB 17
#define FROBULATE(x) (x)+FROB
```
to
```
#define frob 17
#define frobulate(x) (x)+frob
```
* there is a strong preference for lower case file names; sometimes conventions
or outside requirements make camelCase filenames the better (or only) choice,
but absent such an outside reason all file names should be lower case
@ -113,33 +125,34 @@ other editors that implement this coding style, please add them here.
case. Where it seems appropriate, multiple, closely related classes can be
in a single file with a more generic name.
* switch statements with blocks are a little bit special (to avoid indenting
* `switch` statements with blocks are a little bit special (to avoid indenting
too far)
```
switch (foo) {
case FIRST:
whatever();
break;
case SECOND: {
int i;
for (i = 0; i < 5; i++)
do_something(i);
}
}
switch (foo) {
case FIRST:
whatever();
break;
case SECOND: {
int i;
for (i = 0; i < 5; i++)
do_something(i);
}
}
```
## Coding conventions
* variable declarations
In C code we really like them to be at the beginning of a code block,
not interspersed in the middle.
in C++ we are a bit less strict about this - but still, try not to go
in C++ we are a bit less strict about this but still, try not to go
crazy. Notably, in C++ the lifetime of a variable often coincides with the
lifetime of a resource (e.g. file) and therefore the variable is defined
at the place where the resource is needed.
* The `*`, `&` and `&&` declarators are grouped with the name, not the type
(classical C-style) as in `char *string` instead of `char* string`. This
(classical C-style) as in `char *string` instead of `char* string`. This
reflects the precedence rules of the language: `int &i` means that the name
`i` stands for a reference [to an object with type `int`], not that
`i` stands for an object of the type [reference to `int`].
@ -147,84 +160,85 @@ other editors that implement this coding style, please add them here.
have the same effect) it is crucial in the
definition of multiple variables, such
as
```
struct dive *next, **pprev;
```
```
struct dive *next, **pprev;
```
* In C++ code, we generally use explicit types in variable declarations for clarity.
Use `auto` sparingly and only in cases where code readability improves.
Two classical examples are:
- Iterators, whose type names often are verbose:
```
auto it = m_trackers.find(when);
```
is not only distinctly shorter than
```
QMap<qint64, gpsTracker>::iterator it = m_trackers.find(when);
```
it will also continue working if a different data structure is chosen.
```
auto it = m_trackers.find(when);
```
is not only distinctly shorter than
```
QMap<qint64, gpsTracker>::iterator it = m_trackers.find(when);
```
it will also continue working if a different data structure is chosen.
- If the type is given in the same line anyway. Thus,
```
auto service = qobject_cast<QLowEnergyService*>(sender());
```
is easier to read than and conveys the same information as
```
QLowEnergyService *service = qobject_cast<QLowEnergyService*>(sender());
```
```
auto service = qobject_cast<QLowEnergyService*>(sender());
```
is easier to read than and conveys the same information as
```
QLowEnergyService *service = qobject_cast<QLowEnergyService*>(sender());
```
- If the variable is a container that is only assigned to a local variable to
be able to use it in a range-based for loop
```
const auto l = device.serviceUuids();
for (QBluetoothUuid id: serviceUuids) {
```
The variable has also to be const to avoid that Qt containers will do a
deep copy when the range bases for loop will call the begin() method
internally.
be able to use it in a range-based `for` loop
```
const auto serviceUuids = device.serviceUuids();
for (QBluetoothUuid id: serviceUuids) {
```
The variable has also to be const to avoid that Qt containers will do a
deep copy when the range bases `for` loop will call the `begin()` method
internally.
* text strings
The default language of subsurface is US English so please use US English
spelling and terminology.
User-visible strings should be passed to the tr() function to enable
User-visible strings should be passed to the `tr()` function to enable
translation into other languages.
- like this
```
QString msgTitle = tr("Check for updates.");
QString msgTitle = tr("Check for updates.");
```
- rather than
```
QString msgTitle = "Check for updates.";
QString msgTitle = "Check for updates.";
```
This works by default in classes (indirectly) derived from QObject. Each
This works by default in classes (indirectly) derived from `QObject`. Each
string to be translated is associated with a context, which corresponds
to the class name. Classes that are not derived from QObject can generate
the tr() functions by using the `Q_DECLARE_TR_FUNCTIONS` macro:
to the class name. Classes that are not derived from `QObject` can generate
the `tr()` functions by using the `Q_DECLARE_TR_FUNCTIONS` macro:
```
#include <QCoreApplication>
class myClass {
Q_DECLARE_TR_FUNCTIONS(gettextfromC)
...
};
#include <QCoreApplication>
class myClass {
Q_DECLARE_TR_FUNCTIONS(gettextfromC)
...
};
```
As an alternative, which also works outside of class context, the tr()
As an alternative, which also works outside of class context, the `tr()`
function of a different class can be called. This avoids creating multiple
translations for the same string:
```
gettextFromC::tr("%1km")
gettextFromC::tr("%1km")
```
The gettextFromC class in the above example was created as a catch-all
The `gettextFromC` class in the above example was created as a catch-all
context for translations accessed in C code. But it can also be used
from C++ helper functions. To use it from C, include the "core/gettext.h"
header and invoke the translate() macro:
from C++ helper functions. To use it from C, include the `"core/gettext.h"`
header and invoke the `translate()` macro:
```
#include "core/gettext.h"
report_error(translate("gettextFromC", "Remote storage and local data diverged"));
#include "core/gettext.h"
report_error(translate("gettextFromC", "Remote storage and local data diverged"));
```
It is crucial to pass "gettextFromC" as a first macro argument so that Qt
It is crucial to pass `"gettextFromC"` as a first macro argument so that Qt
is able to associate the string with the correct context.
The translate macro returns a cached C-style string, which is generated at runtime
when the particular translation string is encountered for the first time.
@ -233,19 +247,20 @@ other editors that implement this coding style, please add them here.
Outside of function context, the `QT_TRANSLATE_NOOP` macro can be used as in
```
struct ws_info_t ws_info[100] = {
{ QT_TRANSLATE_NOOP("gettextFromC", "integrated"), 0 },
{ QT_TRANSLATE_NOOP("gettextFromC", "belt"), 0 },
{ QT_TRANSLATE_NOOP("gettextFromC", "ankle"), 0 },
{ QT_TRANSLATE_NOOP("gettextFromC", "backplate"), 0 },
{ QT_TRANSLATE_NOOP("gettextFromC", "clip-on"), 0 },
{ QT_TRANSLATE_NOOP("gettextFromC", "integrated"), 0 },
{ QT_TRANSLATE_NOOP("gettextFromC", "belt"), 0 },
{ QT_TRANSLATE_NOOP("gettextFromC", "ankle"), 0 },
{ QT_TRANSLATE_NOOP("gettextFromC", "backplate"), 0 },
{ QT_TRANSLATE_NOOP("gettextFromC", "clip-on"), 0 },
};
```
Note that here, the texts will be scheduled for translation with the "gettextFromC"
Note that here, the texts will be scheduled for translation with the `"gettextFromC"`
context, but the array is only initialized with the original text. The actual
translation has to be performed later in code. For C-code, the `QT_TRANSLATE_NOOP`
macro is defined in the "core/gettext.h" header.
macro is defined in the `"core/gettext.h"` header.
* UI text style
These guidelines are designed to ensure consistency in presentation within
Subsurface.
Only the first word of multi-word text strings should be capitalized unless
@ -264,10 +279,14 @@ other editors that implement this coding style, please add them here.
* string manipulation
* user interface
In UI part of the code use of QString methods is preferred, see this pretty
good guide in [QString documentation][1]
In UI part of the code use of `QString` methods is preferred, see this pretty
good guide in [`QString` documentation][1]
* core components
In the core part of the code, C-string should be used.
C-string manipulation is not always straightforward specifically when
it comes to memory allocation, a set of helper functions has been developed
@ -278,8 +297,8 @@ other editors that implement this coding style, please add them here.
### Emacs
These lines in your .emacs file should get you fairly close when it comes
to indentation - many of the other rules you have to follow manually
These lines in your `.emacs` file should get you fairly close when it comes
to indentation many of the other rules you have to follow manually
```
;; indentation
@ -374,7 +393,7 @@ style that you can select which should work well for our coding style.
### Vim
As everybody knows vim is a way better editor than emacs and thus needs to be
in this file too. Put this into your .vimrc and this should produce something
in this file too. Put this into your `.vimrc` and this should produce something
close to our coding standards.
```

View File

@ -1,68 +1,96 @@
[Source](https://subsurface-divelog.org/documentation/contributing/ "Permalink to Contributing | Subsurface")
# Contributing to Subsurface
# Contributing | Subsurface
## Ways to Contribute
It might be a good idea to join our [mailing list][1]. Conversation there is in English -- even though this site (and Subsurface itself) are available in many languages, the shared language we all communicate in is English. Actually "Broken English" is just fine… :-)
There are many ways in which you can contribute. We are always looking for testers who are willing to test the code while it is being developed. We especially need people running Windows and Mac (as the majority of the active developers are Linux people). We are also always looking for volunteers who help reviewing and improving the documentation. And very importantly we are looking for translators willing to translate the software into different languages. Our translations are centrally handled at [Transifex][4] please sign up for an account there and then request to join the [Subsurface Team][5].
We also tend to have some developers hanging out in the `#subsurface` channel on [Freenode][2].
If you would like to contribute financially to help us cover the cost of running a free cloud synchronisation service for dive logs, you can do so by sponsoring this project.
There are many ways in which you can contribute. We are always looking for testers who are willing to test the code while it is being developed. We especially need people running Windows and Mac (as the majority of the active developers are Linux people). We are also always looking for volunteers who help reviewing and improving the documentation. And very importantly we are looking for translators willing to translate the software into different languages. Our translations are centrally handled at [Transifex][3] \-- please sign up for an account there and then request to join the [Subsurface Team][4].
If you would like to contribute patches that fix bugs or add new features, that is of course especially welcome. If you are looking for places to start, look at the open bugs in our [bug tracker][5].
## Joining the Subsurface Contributors' Community
Here is a very brief introduction on creating commits that you can either send as [pull requests][6] on our main GitHub repository or send as emails to the mailing list. Much more details on how to use git can be found at the [git user manual][7].
To get 'into the loop' for what is going on in Subsurface you should join our [mailing list][1], and start watching the [subsurface/subsurface repository on GitHub][2]. Conversation in the mailing list is in English even though Subsurface itself and the website and documentation are available in many languages, the shared language the contributors communicate in is English. Actually "Broken English" is just fine… :-)
Start with getting the latest source.
`cd subsurface`
`git checkout master`
`git pull`
ok, now we know you're on the latest version. Create a working branch to keep your development in:
`git checkout -b devel`
Edit the code (or documentation), compile, test… then create a commit:
`git commit -s -a`
Depending on your OS this will open a default editor -- usually you can define which by setting the environment variable `GIT_EDITOR`. Here you enter your commit message. The first line is the title of your commit. Keep it brief and to the point. Then a longer explanation (more on this and the fact that we insist on all contributions containing a Signed-off-by: line below).
If you want to change the commit message, "git commit --amend" is the way to go. Feel free to break your changes into multiple smaller commits. Then, when you are done there are two directions to go, which one you find easier depends a bit on how familiar you are with GitHub. You can either push your branch to GitHub and create a [pull requests on GitHub][6], or you run
`git format-patch master..devel`
Which creates a number of files that have names like 0001-Commit-title.patch, which you can then send to our developer mailing list.
Of course it is also a good idea to join our [User Forum][3], to be able to see feedback and bug reports from our users.
## Tips for Code Contributions
### Code Change Submissions
If you would like to contribute patches that fix bugs or add new features, that is of course especially welcome. If you are looking for places to start, look at the open bugs in our [bug tracker][6].
Here is a very brief introduction on creating commits that you can either send as [pull requests][7] on our main GitHub repository or send as emails to the mailing list. Much more details on how to use Git can be found at the [Git user manual][8].
Start with getting the latest source.
cd subsurface
git checkout master
git pull
ok, now we know you're on the latest version. Create a working branch to keep your development in:
git checkout -b devel
Edit the code (or documentation), compile, test… then create a commit:
git commit -s -a
Depending on your OS this will open a default editor usually you can define which by setting the environment variable `GIT_EDITOR`. Here you enter your commit message. The first line is the title of your commit. Keep it brief and to the point. Then a longer explanation (more on this and the fact that we insist on all contributions containing a Signed-off-by: line below).
If you want to change the commit message, `git commit --amend` is the way to go. Feel free to break your changes into multiple smaller commits. Then, when you are done there are two directions to go, which one you find easier depends a bit on how familiar you are with GitHub. You can either push your branch to GitHub and create a [pull requests on GitHub][7], or you run:
git format-patch master..devel
Which creates a number of files that have names like `0001-Commit-title.patch`, which you can then send to our developer mailing list.
### Developer Certificate of Origin (DCO)
When sending code, please either send signed-off patches or a pull request with signed-off commits. If you don't sign off on them, we will not accept them. This means adding a line that says "Signed-off-by: Name \<Email\>" at the end of each commit, indicating that you wrote the code and have the right to pass it on as an open source patch.
See: [Signed-off-by Lines][8]
See: [Signed-off-by Lines][9]
Also, please write good git commit messages. A good commit message looks like this:
Header line: explaining the commit in one line
### Commit Messages
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
Also, please write good Git commit messages. A good commit message looks like this:
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
74 characters or so. That way "git log" will show things
nicely even when it's indented.
Reported-by: whoever-reported-it
Signed-off-by: Your Name \<you@example.com\>
Header line: explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
74 characters or so. That way "git log" will show things
nicely even when it's indented.
Reported-by: whoever-reported-it
Signed-off-by: Your Name <you@example.com>
That header line really should be meaningful, and really should be just one line. The header line is what is shown by tools like gitk and shortlog, and should summarize the change in one readable line of text, independently of the longer explanation.
The preferred way to write a commit message is using imperative mood, e.g. "Make foo do xyz" instead of "This patch makes foo do xyz" or "I made foo do xyz", as if you are giving commands or requests to the code base.
https://en.wikipedia.org/wiki/Imperative_mood
The preferred way to write a commit message is using [imperative mood][12], e.g. "Make foo do xyz" instead of "This patch makes foo do xyz" or "I made foo do xyz", as if you are giving commands or requests to the code base.
![gitk sample][9]
![gitk sample][10]
Example with gitk
_Example with gitk_
Additionally when important changes to behaviors, fixes or new feature are introduced an entry must be added to CHANGELOG.md file. Always add new entries at the very top of the file above other existing entries. Use this layout for new entries:
Area: Details about the change [reference thread / issue]
### Changelog
Additionally when important changes to behaviors, fixes or new feature are introduced an entry must be added to `CHANGELOG.md` file. Always add new entries at the very top of the file above other existing entries. Use this layout for new entries:
Area: Details about the change [reference thread / issue]
When multiple areas are affected list the areas separated with a /:
Area1/Area2: Detail about the change [reference thread / issue]
Area1/Area2: Detail about the change [reference thread / issue]
Here is a (non exhaustive) list of Areas that can be used:
* Bluetooth
* Cloud-storage
* Desktop
@ -75,15 +103,20 @@ Here is a (non exhaustive) list of Areas that can be used:
* Printing
* Profile
In order to make reviews simpler and have contributions merged faster in the code base, please follow Subsurface project's coding style and coding conventions described in the [CodingStyle][10] file.
### Coding Style
In order to make reviews simpler and have contributions merged faster in the code base, please follow Subsurface project's coding style and coding conventions described in the [CodingStyle][11] file.
[1]: http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
[2]: http://freenode.net/
[3]: https://www.transifex.com/
[4]: https://www.transifex.com/projects/p/subsurface/
[5]: https://github.com/Subsurface/subsurface/issues
[6]: https://github.com/Subsurface/subsurface/pulls
[7]: https://www.kernel.org/pub/software/scm/git/docs/user-manual.html
[8]: https://gerrit-review.googlesource.com/Documentation/user-signedoffby.html
[9]: https://subsurface-divelog.org/wp-content/uploads/2011/10/Screenshot-gitk-subsurface-1.png "Example with gitk"
[10]: https://github.com/Subsurface/subsurface/blob/master/CodingStyle
[2]: https://github.com/subsurface/subsurface
[3]: https://groups.google.com/g/subsurface-divelog
[4]: https://www.transifex.com/
[5]: https://explore.transifex.com/subsurface/subsurface/
[6]: https://github.com/Subsurface/subsurface/issues
[7]: https://github.com/Subsurface/subsurface/pulls
[8]: https://www.kernel.org/pub/software/scm/git/docs/user-manual.html
[9]: https://gerrit-review.googlesource.com/Documentation/user-signedoffby.html
[10]: https://github.com/subsurface/subsurface/Documentation/images/Screenshot-gitk-subsurface-1.png "Example with gitk"
[11]: https://github.com/Subsurface/subsurface/blob/master/CODINGSTYLE.md
[12]: https://en.wikipedia.org/wiki/Imperative_mood

View File

@ -135,7 +135,7 @@ msgid ""
"mailto:subsurface@subsurface-divelog.org[our mailing list] and report bugs "
"at https://github.com/Subsurface/subsurface/issues[our bugtracker]. "
"For instructions on how to build the software and (if needed) its "
"dependencies please consult the INSTALL file included with the source code."
"dependencies please consult the INSTALL.md file included with the source code."
msgstr ""
#. type: Plain text
@ -9076,6 +9076,9 @@ msgid ""
"reconnect it. You can now retry (or start a new download session) and the "
"download will continue where it stopped previously. You may have to do this "
"more than once, depending on how many dives are stored on the dive computer."
"You may define a dive number offset by setting environment variable "
"UEMIS_DIVE_OFFSET (e.g. export UEMIS_DIVE_OFFSET=300), "
"if subsurface starts downloading dives that are already synced."
msgstr ""
#. type: Title ===

View File

@ -1,163 +0,0 @@
<!-- when editing please don't break the formatting... WordPress is a bit silly about this
- I need the empty lines after the [expand...] and before the [/expand]
- Every paragraph is a single line (how stupid is that!) with an empty line in between -->
<h2>Here are some Frequently Asked Questions by our users</h2>
<span class="expandall">Expand All</span> --- <span class="collapseall">Collapse All</span>
[expand title="Which operating system does Subsurface support?"]
Subsurface runs on Windows (32 and 64bit, Windows XP and newer), MacOS (Intel, 10.7 and newer) and many flavors of Linux. We provide Linux packages for Ubuntu, Linux Mint, Debian, openSUSE and Fedora. Details on where to find Subsurface for your OS are on our <a title="Downloads" href="http://subsurface-divelog.org/download/">Downloads</a> page.
[/expand]
[expand title="How do I install Subsurface on Windows?"]
<a href="http://subsurface-divelog.org/download/">Download the installer</a> and double-click on it. You will get a warning that the installer is from an unknown publisher. Please click Yes to allow installation. Next you are presented with the license for Subsurface, after that you can choose where you would like to install Subsurface (the default should be reasonable in most cases) and the <em>Start Menu Folder</em> where a shortcut to call Subsurface and an entry to uninstall Subsurface will be installed.
[/expand]
[expand title="How do I install Subsurface on MacOS?"]
<a href="http://subsurface-divelog.org/download/">Download the installer DMG</a> and open it. Drag the Subsurface icon on to the Applications icon.
[/expand]
[expand title="How do I install Subsurface on Ubuntu?"]
Simply add the following PPA to your system:
<pre><code style="font-size: 8pt;">ppa:subsurface/subsurface</code></pre>
[/expand]
[expand title="How do I install Subsurface on Debian?"]
We currently only support Debian Jessie; you need to add the Ubuntu repository:
<pre><code style="font-size: 8pt;">echo "deb http://ppa.launchpad.net/subsurface/subsurface/ubuntu trusty main" \
| sudo tee /etc/apt/sources.lists.d/subsurface.list
gpg --keyserver subkeys.pgp.net --recv-keys A8BC9756EE61D9C6
gpg -a --export A8BC9756EE61D9C6 | sudo apt-key add -
sudo apt-get update</code></pre>
Now you can install Subsurface from that repository:
<pre><code style="font-size: 8pt;">sudo apt-get install subsurface</code></pre>
Make sure you are getting a current version with all its Qt5 dependencies.
[/expand]
[expand title="How do I install Subsurface on openSUSE?"]
Go to <a href="http://software.opensuse.org/download.html?project=home:Subsurface-Divelog&amp;package=subsurface">our build service project page</a> and follow the simple instructions there -- its as easy as two clicks.
[/expand]
[expand title="The shortcut keys don't work on Ubuntu"]
Please uninstall <code style="font-size: 9pt;">appmenu-qt5</code> and the shortcuts will work.
[/expand]
[expand title="How can I post my dive on Facebook?"]
Go to the preferences and select the Facebook section. There you can log in to your Facebook account. You have to do this every time you want to post to Facebook, for privacy reasons Subsurface does not stay logged in to Facebook between sessions.
Once you are logged into Facebook you can close the preferences. You will now see a Facebook button next to the Notes section towards the center of the Subsurface window. Clicking on that opens a dialog that allows you to control which parts of the current dive are posted to your timeline. The post is always "private" - you need to connect to Facebook and change the audience for that post in order for others to see it (we do this so you get to review what is posted before it becomes public).
[/expand]
[expand title="How can I post my dives on the web?"]
Currently Subsurface integrates with two different online logbooks: <a href="http://divelogs.de">divelogs.de</a> and <a href="http://dive-share.appspot.com/">DiveShare</a>. You can export dives to either of those two services from the File➝Export menu.
[/expand]
[expand title="How do I use the companion apps?"]
There are companion apps available for both Android and IOS. You can find them in the respective stores. Once you install them on your mobile device you can either mark dive sites and name them (e.g., right before or after a dive), or you can run a "service" in the background that periodically records your position. Don't forget to turn the service off when you are done as it may increase your battery consumption.
Once you have uploaded the dive site data from the companion app to our web service, you can then download the data from within Subsurface. Do this <em>after</em> you have downloaded the dives from that day from your divecomputer (or manually added the dives) so that Subsurface can match the dive data (and their time stamps) with the data stored by the companion app. Subsurface will then add GPS data to those dives that didn't have GPS information and are reasonably close in time to to markers saved by the companion app.
Please note that the companion apps by themselves do <em>not</em> add dives to your dive list. The dive needs to exist before GPS data is added to it.
[/expand]
[expand title="How can I use more than one tank with the same gas?"]
This is a typical question for side mount divers or some tec divers. Subsurface supports having more than one tank with the same gas, even if some dive computers don't. Simply add a gas change to your second tank of the same gas as both tanks will be included in the gas use calculations. In order to add gas changes simply right-click on the profile at the appropriate spot and you will be offered to add such an event.
[/expand]
[expand title="Why is Subsurface not able to download my dives?"]
Clean the contacts. Clean the contacts again. Make sure the connector is firmly connected. Wiggle it. Seriously. Make sure the dive computer is in transfer mode (this isn't necessary for all dive computers but for many common ones). Check with other software that the download works in general. Try another cable. See our user manual for pairing with BT and the general use case.
[/expand]
[expand title="Why is the CSV import failing?"]
The CSV import has a couple of caveats. You should avoid some special characters like ampersand (&), less than (<), greater than (>) and double quotes ("), the latter if quoting text cells. The file should use UTF-8 character set, if having non-ASCII characters. Also the size of the CSV file might cause problems. Importing 100 dives at a time (without dive profile) has worked previously, but larger files might exceed limits of the parser used. When having problems with CSV imports, try first with a smaller sample to make sure everything works.
[/expand]
[expand title="How can I use Subsurface for multiple users?"]
Store logs of different users to separate log files. From Subsurface, you can open individual files for different divers and multiple users are supported quite well.
[/expand]
[expand title="How can I load pictures and associate them with my dive?"]
Select the dives you want to load and associate the pictures with. Then right click on one of the selected dives and select "Load images" from the
popup menu. This will bring in a file selection dialog where you can select one or multiple pictures. When the selection is done and you hit Open, you get a new dialog where you can shift the times of the images. This is described in more detail in our user manual.
If you are having trouble with loading the images, check that you have at least one of the following tags in the Exif headers DateTimeOriginal or
DateTime. We take the time from these fields to detect if the image was shot during the dive or not. If the picture is edited, you should store the original Exif information on the new/edited image for it to be loaded properly.
[/expand]
[expand title="Can I import my dives from my old log software?"]
Many common programs are already supported and we are always happy to try to add new ones. If your old log software supports exporting the log book, we might well be able to import that (for example via CSV files or UDDF). However, usually support for importing the native format will help you to get more complete information into Subsurface. To implement support for the log format, we will need a sample log file. It would be great to have also a screenshot from the original log software or description of the dive that is shown on the sample log. Preferably we would like to have a reasonably simple dive to get basic support and another dive that has as many features enabled as possible (e.g. gas changes during the dive). Please post this information to the user forum or send it to the developer mailing list subsurface@subsurface-divelog.org. Unfortunately some of the log formats we have not been able to decipher (as some vendors have decided to encrypt their log files to increase the degree of lock-in of their customers), so there are no guarantees that this will bring support for your old log software, but it is worth a try.
[/expand]
[expand title="Can you add support for dive computer X?"]
We support a large number of dive computers already and are always happy to add support for more. Please contact us via the user forums so we can try to help. Some vendors have actively helped us in our work and adding support for new models from those vendors is usually easy. Other vendors are more neutral, some are actively hostile. Without help from the vendor it can be rather challenging to reverse engineer the transfer protocol and the dive encoding, but with sufficient help from you it is often possible to do so.
A good starting point is often to send us a libdivecomputer log and dump (you can pick those in the dive computer download dialog) when connecting to the dive computer using a similar existing model (if possible).
[/expand]
[expand title="Is there a virus in the Subsurface installer?"]
If you get a warning message or if Subsurface is blocked by your anti virus software, that is almost certainly a false positive. Subsurface is not built on a Windows machine, it is cross built from source on Linux on a well maintained and clean server.
Most/all Windows AV software packages support an "add exception" feature, which skips an executable from being scanned. Try adding Subsurface to the list of non-harmful software. If the Subsurface installer download is detected as malware, please temporary disable your AV software until Subsurface is installed
In either case, please inform your AV software vendor of a "false positive" as we assure your that Subsurface is not malware
[/expand]
[expand title="I cannot download all my dives, only the most recent ones even though my dive computer's manual states that it records history of e.g. 999 dives."]
Dive history is different than the dive profiles on the log. The history only keeps track of the total number of dives and total amount of time spent below surface. The logs, on the other hand, store the dive profile, but they have limited amount of memory to do so. The exact amount of dive profiles that can be stored on the device depend on sample interval and duration of the dives. Once the memory is full the oldest dives get overwritten with new dives. Thus we are only able to download the last 13, 30 or 199 dives.
If you have downloaded your dives to different dive logging software before they were overwritten, there is a high change that Subsurface can import these. However, if the logs are only on your dive computer, they cannot be salvaged after being over written by new dives.
[/expand]
[expand title="How do I download dives from my Bluetooth dive computer (e.g. Shearwater, OSTC) on Linux?"]
Downloading dives over Bluetooth on all platforms is done using the "Choose Bluetooth download mode" option when downloading dives, and pairing with the detected dive computer. This is further explained in the <a href="https://subsurface-divelog.org/documentation/subsurface-4-user-manual/">Subsurface User Manual</a>.
Previous versions of Subsurface required setting up an RFCOMM connection from the command line before downloading dives from a Bluetooth enabled dive computer. This is no longer the case.
[/expand]
[expand title="How do I fix permission errors when trying to download from my Atomics Aquatics Cobalt under Linux?"]
Sadly this is a somewhat difficult process on some versions of Linux. By default new devices are sometimes given permissions that prevent a regular user from accessing them. If you get a permission error when trying to download from a Cobalt or Cobalt 2 under Linux, please try these steps.
This should work on most Linux flavors. We'd appreciate feedback if this doesn't work for you. Open a terminal window and cut and paste the following command. It may ask you to enter your password in order to allow access as super user (which is required to set up the udev rule that changes the device permissions as you plug in your Cobalt).
<pre><code style="font-size: 8pt;">(MYGRP=$(id | sed "s/^.*gid=.*(\(.*\)) .*$/\1/") ; \
echo -n 'SUBSYSTEM=="usb", ATTR{idVendor}=="0471", ATTR{idProduct}=="0888", MODE="0660", GROUP="' ; \
echo -n $MYGRP ; echo '"') | sudo tee /etc/udev/rules.d/99-cobalt.rules </code></pre>
If you disconnect and reconnect your Cobalt it should now get the correct access permissions.
[/expand]
[expand title="How do I fix permission errors when trying to download from my Suunto EON Steel under Linux?"]
By default new devices are sometimes given permissions that prevent a regular user from accessing them. If you get a permission error when trying to download from an EON Steel under Linux, please try these steps.
This should work on most Linux flavors. We'd appreciate feedback if this doesn't work for you. Open a terminal window and cut and paste the following command. It may ask you to enter your password in order to allow access as super user (which is required to set up the udev rule that changes the device permissions as you plug in your EON Steel).
<pre><code style="font-size: 8pt;">echo 'SUBSYSTEM=="usb",ATTR{idVendor}=="1493",ATTR{idProduct}=="0030", MODE="0666"' |
sudo tee /etc/udev/rules.d/99-cobalt.rules </code></pre>
If you disconnect and reconnect your DC it should now get the correct access permissions.
[/expand]
[expand title="Why is my IRDA based dive computer not working on a MAC?"]
Subsurface on the Mac does not currently support IRDA based dive computers. This is an issue of missing support libraries for us to use - other dive log software may have implemented their own IRDA stack on the Mac, we have not. Subsurface on Windows and Linux does support IRDA based dive computers just fine.
[/expand]

View File

@ -7,7 +7,7 @@
# submitting patches to the user manual, only submit the changes to the .txt
# file - the maintainer will recreate the .html.git file
DOCNAMES = user-manual user-manual_es user-manual_fr user-manual_ru user-manual_nl mobile-manual-v2 mobile-manual-v3
DOCNAMES = user-manual user-manual_es user-manual_fr user-manual_nl mobile-manual-v3
HTMLDOCS = $(patsubst %,$(OUT)%.html,$(DOCNAMES))
TEXTDOCS = $(patsubst %,$(OUT)%.text,$(DOCNAMES))
@ -19,7 +19,7 @@ BROWSER = firefox
THEME = compact_subsurface
PWD = $(realpath .)
all: $(HTMLEDOCS) $(TEXTDOCS) $(PDFDOCS)
all: $(HTMLDOCS) $(TEXTDOCS) $(PDFDOCS)
doc: $(HTMLDOCS)
@ -30,7 +30,7 @@ $(OUT)%.pdf: %.txt
-$(A2X) --dblatex-opts "-P latex.output.revhistory=0" -f pdf $<
$(OUT)%.html: %.txt
@echo "if asciidoc isn't found the html file included in the sources is copied"
$(ASCIIDOC) --version > /dev/null 2>&1 || echo "if asciidoc isn't found the html file included in the sources is copied"
$(ASCIIDOC) -a toc -a toclevels=3 -a themedir=$(PWD) -a theme=$(THEME) -o $@ $< || \
cp $(<:%.txt=%.html.git) $@

View File

@ -175,7 +175,7 @@ msgid ""
"an email to mailto:subsurface@subsurface-divelog.org[our mailing list] and "
"report bugs at https://github.com/Subsurface-divelog/subsurface/issues[our "
"bugtracker]. For instructions on how to build the software and (if needed) "
"its dependencies please consult the INSTALL file included with the source "
"its dependencies please consult the INSTALL.md file included with the source "
"code."
msgstr ""
"Ce manuel explique comment utiliser le programme _Subsurface_. Pour "
@ -184,7 +184,7 @@ msgstr ""
"pouvez envoyer un e-mail sur mailto:subsurface@subsurface-divelog.org[notre "
"liste de diffusion] et rapportez les bogues sur http://trac.hohndel."
"org[notre bugtracker]. Pour des instructions de compilation du logiciel et "
"(si besoin) de ses dépendances, merci de consulter le fichier INSTALL inclus "
"(si besoin) de ses dépendances, merci de consulter le fichier INSTALL.md inclus "
"dans les sources logicielles."
#. type: Plain text

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ image::mobile-images/Banner.jpg["Banner",align="center"]
// toc::[]
[blue]#_Version 3.2, March 2021_#
[blue]#_Version 3.4, October 2021_#
toc::[]
@ -35,8 +35,7 @@ aimed at Android and iOS smartphone and tablet devices.
While the desktop version of _Subsurface_ shows much more detailed information
for each dive, the mobile version allows a more accessible dive log on the go. For example,
you can prove dive experience on a dive trip to dive shops or review
previous dives while on a dive boat. _Subsurface-mobile_ also allows
the gathering of GPS locations where dives are performed.
previous dives while on a dive boat.
Assuming you have a dive computer that is supported by the mobile OS of
your choice, _Subsurface-mobile_ supports the downloading of dives from your dive computer.
@ -53,7 +52,6 @@ _Subsurface-mobile_ allows:
- Download dive data directly from some dive computers.
- Editing most of the dive log data, e.g. dive-master, buddy,
equipment or notes relating to a dive.
- Recording, storing and applying GPS positions to dive information.
- Viewing the localities of recorded GPS positions and of dives
on a map.
@ -105,8 +103,6 @@ actions on that screen (see image on the left). Some screens have only
the round central button, others have one or two additional
actions on either side of the central button.
unfloat::[]
On Android devices, use the Android Back
button for "cancel", "discard" or "back" actions. For example, when
editing dive information, tapping the action button saves the changes while the
@ -271,8 +267,6 @@ Filter to achieve this. The filter mechanism searches through all the informatio
looking for one or more key words. Only the dives containing these key words are listed in the dive
list. To Filter the dive list, tap the Filter action button:
unfloat::[]
image::mobile-images/FilterButton.jpg["FIGURE: Filter button",align="center"]
at the bottom of the dive list. A text box appears at the top of the screen (image below). Type the
@ -343,9 +337,9 @@ _Forget remembered dive computers_ in the xref:S_Settings[_Settings_] menu.
==== Download from USB serial dive computers
This feature is not supported on iOS.
[width="100%", frame="None"]
[width="100%"]
|=======
a|image::mobile-images/USB-OTG.jpg["FIGURE: USB-OTG cable",align="center"] |
a|image:mobile-images/USB-OTG.jpg["FIGURE: USB-OTG cable",align="center"] |
Most current Android devices now have a USB
Type C port and come with a simple A-to-C adapter plug, which lets you plug in
the dive computer cable into the phone or tablet.
@ -496,9 +490,9 @@ and the dives during the last six months.
[[S_Stats]]
== Dive Statistics
[width="100%", frame="None", cols="2,3"]
[width="100%", cols="2,3"]
|===
a|image::mobile-images/StatsPanel.jpg["Image: Statistics panel",float="left"] |
a|image:mobile-images/StatsPanel.jpg["Image: Statistics panel",float="left"] |
Creating meaningful statistics that convey the information you are looking for is surprisingly hard.
Different users have very different needs and very different expectations. Subsurface-Mobile provides
a rather detailed set of statistics features to summarize information from the dive log in a graphical
@ -663,9 +657,9 @@ image::mobile-images/StatsBarchartSubdivided.jpg["Stats subdivided barchart",ali
=== Scattergraphs
[width="100%", cols="2,3", frame="None"]
[width="100%", cols="2,3"]
|=======
a|image::mobile-images/StatsRegression.jpg["Regression data example",align="center"] |
a|image:mobile-images/StatsRegression.jpg["Regression data example",align="center"] |
Sometimes you might wish to investigate the relationship between two dive variables. Has my SAC rate decreased over
the years? Is the water temperature colder at greater dive depth? One of the ways of investigating these questions
is to draw a scattergraph where the values of one variable is plotted against the other variable (see image on the left).
@ -717,90 +711,6 @@ specific XML files (both for dives and dive sites) as well as _UDDF_.
Tapping on _Next_ opens an additional page for login information for the destination website (or a file selection dialog).
== Obtaining dive site locations using the GPS
The fact that almost all smartphones have GPS facilities allows
_Subsurface-mobile_ to record
the locations of dives.
****
[icon="images/icons/important.png"]
[IMPORTANT]
*Accuracy of GPS coordinates*
GPS-derived coordinates on a smartphone
are not always accurate and can have an error greater than 1 km. GPS accuracy
is determined by the hardware and software of the
smartphone as well as by the GPS settings selected within Android/iOS.
As of Android V6 (Marshmallow) select Android _Settings -> Communication -> Location -> High accuracy_*.
If the smartphone is taken on the boat
during a dive, locations can be automatically recorded at regular intervals.
These locations can then be applied to dives in the dive list as described below
****
To collect dive site coordinates four step are required:
[[S_ConfigureGPS]]
=== Configuring the GPS service
For most users, the defaults for tracking GPS locations are
appropriate. If you would like to change them, go to
the _Main Menu_, select the xref:S_Settings[_Settings_] screen, and open
the _Advanced_ area on that page where there is a section for
configuring the GPS service (see image below). GPS location data
are collected at regular intervals, e.g. every 5 minutes, or at regular
distances, e.g. after the boat has moved more than 200m, or a combination of
both of these approaches. Provide the appropriate information and
tap the _Back_ button. The program is now ready to collect GPS positions.
image::mobile-images/GPSConfig.jpg["FIGURE: GPS configure",align="center"]
=== Collecting GPS positions
[width="100%", frame="None", cols="2,3"]
|=======
a|image::mobile-images/LocationMenu.jpg["FIGURE: GPS start",align="center"] |
In the _Location_ menu select _Run location service_.
_Subsurface-mobile_ starts to collect GPS locations automatically,
following the preferences specified as described above. While the GPS
location service is running, all menus have a GPS symbol at the bottom,
indicating that the service is active. After returning from
the dive, deactivate the collection of GPS data by tapping
the option _Location -> Disable location service_. The GPS symbol at the bottom
of menus disappears.
|=======
Collecting GPS fixes like this is relatively battery intensive and unfortunately
both Android and especially iOS have become increasingly aggressive in killing
applications that are running while the screen is turned off. It may make sense
to check between dives that the location service is still running. On the other hand
the battery consumption of a smartphone with GPS enabled is often significantly less than
the battery consumption of a dedicated GPS that is logging a track.
=== Viewing GPS data collected during a dive
From the _Location_ submenu select _Show GPS fixes_. This brings
up a list of GPS positions obtained by the location service (image
below). Two actions are possible for each of the locations, enabled by
dragging the right part of a location to the left. This exposes two
options. Tapping the dustbin deletes this particular GPS location. Tapping the
teardrop-shaped icon (actually a Google Maps pin) opens up Google Maps with a pin
indicating the exact map position of the GPS record being viewed. The two above
options can be hidden by drawing the GPS record to the right.
image::mobile-images/gpsmanagement.jpg["FIGURE: GPS management",align="center"]
=== Applying GPS data to dives in the dive log
After running the location service during a dive trip, first either download
the dives from your dive computer or manually enter the dives into the dive list.
Now you can apply the GPS positions to these dives.
From the _Dive management_ menu, tap _Apply GPS fixes_. The dive list contains the start
and end times of each dive. Now, _Subsurface-mobile_ applies the first
GPS position that falls within the dive period of each dive. This results
in a GPS position for each dive that is saved as part of the dive log.
== Viewing the locations of all dives in the dive list
image::mobile-images/DivesMap.jpg["FIGURE: Map of all dive sites",align="center"]
@ -846,9 +756,9 @@ buttons on the _Download from dive computer_ page.
==== Color theme
[width="100%", frame="None"]
[width="100%"]
|=======
a|image::mobile-images/ThemeSettings.jpg["FIGURE: Theme Settings",align="center"] |
a|image:mobile-images/ThemeSettings.jpg["FIGURE: Theme Settings",align="center"] |
Besides the default blue color scheme, _Subsurface-mobile_ supports two additional color schemes
for users with different tastes (see image on left). All screenshots shown in this user manual are
based on the blue default color scheme. You can pick the _pink_ or _dark_ color theme from
@ -872,11 +782,6 @@ your location.
As the name indicates, most users do not need to make changes here.
==== GPS location service thresholds
As indicated above in the _Location_ section of this manual, here you can set the distance and time
thresholds for the _location service_
==== Bluetooth
Since most mobile devices tend to find a _LOT_ of BT/BLE devices that aren't dive computers, by

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ https://subsurface-divelog.org/[_Subsurface_ web site].
Please discuss issues with this program by sending an email to
mailto:subsurface@subsurface-divelog.org[our mailing list] and report bugs at
https://github.com/Subsurface/subsurface/issues[our bugtracker]. For instructions on how to build the
software and (if needed) its dependencies please consult the INSTALL file
software and (if needed) its dependencies please consult the INSTALL.md file
included with the source code.
*Audience*: Recreational Scuba Divers, Free Divers, Tec Divers, Professional
@ -178,7 +178,7 @@ These dives can be imported from:
This is usually the approach for dives without a dive computer. The basic record
of information within _Subsurface_ is a dive. The most important information
in a simple dive logbook usually includes dive type, date, time, duration,
depth, the names of your dive buddy and the divemaster or dive guide, and
depth, the names of your dive buddy and the dive guide, and
some remarks about the dive. _Subsurface_ can store much more
information for each dive. To add a dive to a dive log, select _Log
-> Add Dive_ from the Main Menu. The program then shows three panels
@ -374,6 +374,13 @@ of the dive computer (at least for those not charging while connected via USB).
- Do *not* check the checkboxes labelled _Save libdivecomputer logfile_ and
_Save libdivecomputer dumpfile_. These are only used as diagnostic tools
when there are problems with downloads(see below).
- With some dive computers it is possible to adjust the clock on the dive
computer based on the PC clock. This can be very helpful when dealing with
daylight savings time changes, or when travelling between different time
zones. In order to synchronise the dive computer clock with the PC clock
every time dives are imported, check _Sync dive computer time_.
- Then select the _Download_ button.
With communication established, you can see how the data are
retrieved from the dive computer.
@ -398,6 +405,7 @@ of the dive computer (at least for those not charging while connected via USB).
(Puck Pro)". Refer to the text in the box below.
****
*PROBLEMS WITH DATA DOWNLOAD FROM A DIVE COMPUTER?*
[icon="images/icons/important.png"]
@ -591,12 +599,12 @@ you might like to call one "Alice's Suunto D4" and the other
"Bob's Suunto D4". Alternatively, consider a technical diver who dives with two or more
dive computers of the same model, the logs of both (or all) being uploaded.
In this case it might be prudent to call one of them
"Suunto D4 (1)" and another "Suunto D4 (2)". This is easily done in _Subsurface_.
On the *Main Menu*, select _Log -> Edit device names_. A dialog box opens, showing the
current Model, ID and Nickname of the dive computers used for upload. Edit the Nickname
field for the appropriate dive computer. After saving the Nickname, the dive logs
show the nickname for that particular device instead of the model name,
allowing easy identification of devices.
"Suunto D4 (1)" and another "Suunto D4 (2)".
To achieve this, display a dive downloaded from this dive computer, right click on its name
in the profile and select the option to set a new nickname. If this option isn't shown, then
Subsurface cannot reliably identify this specific dive computer (not all models support this
feature, but most modern ones do).
[[S_MultipleDiveComputers]]
==== Uploading data for a specific dive from more than one dive computer
@ -635,7 +643,7 @@ increase in the amount of information stored for a dive.
1. The *Notes* tab
holds basic information about the dive, the date and time, locality,
buddy, divemaster and some dive notes. This is about the minimum amount of
buddy, dive guide and some dive notes. This is about the minimum amount of
information required for a coherent dive log.
2. If one wishes, one can expand the dive information by using the
@ -701,7 +709,7 @@ image::images/undo.jpg["FIGURE:Performing an undo",align="center"]
Dive locations are managed as a *separate* part of the dive log (See the section entitled xref:S_DiveSiteManagement[Manipulating Dive Site Information]).
The dive information in the *Notes* and *Equipment* tabs can therefore NOT be edited at the same
time as the dive site information. Save all the other dive information (e.g.
divemaster, buddy, protective gear, notes about the dive) by selecting _Apply changes_ on the
dive guide, buddy, protective gear, notes about the dive) by selecting _Apply changes_ on the
*Notes* tab BEFORE editing the dive site information. Then supply a dive site name in the
textbox labelled _Location_ on the *Notes* tab.
@ -734,8 +742,7 @@ New dive locations can be recorded in one of four ways:
1. xref:S_existing_locations[Typing in known coordinates by hand]
2. xref:S_dive_map_location[Positioning the dive site flag on the dive map]
3. xref:S_Subsurface_mobile[Dive site coordinates from the Subsurface-Mobile phone app]
4. xref:S_GPS[Dive site coordinates from a GPS track]
3. xref:S_GPS[Dive site coordinates from a GPS track]
[[S_existing_locations]]
*(1): Enter coordinates by hand* if they are known, using one of
@ -785,18 +792,9 @@ image::images/Globe_image3.jpg["FIGURE:Location creation panel",align="center"]
Once the dive location data have been saved, the dive on the Dive List has
a globe icon immediately to the left of the location name of a particular dive.
[[S_Subsurface_mobile]]
[[S_Using_mobile]]
*(3): Dive coordinates from a mobile device with GPS using Subsurface-Mobile.*
Most smartphones have an integrated GPS, useful for collecting the coordinates of dive sites.
The https://subsurface-divelog.org/documentation/subsurface-mobile-user-manual[user manual for _Subsurface-mobile_] (accessible from within that app)
contains detailed instructions for
performing the collection of GPS data and for managing, uploading and
synchronising the coordinates with a dive log.
[[S_GPS]]
*(4): Import coordinates from GPS equipment.* Some divers prefer to take a GPS
*(3): Import coordinates from GPS equipment.* Some divers prefer to take a GPS
onto the boat and record a GPS track while diving. Subsurface can extract the
dive site from this track and store the dive site coordinates as part of the dive log.
Follow the next steps:
@ -863,9 +861,8 @@ dive site name in the *Notes tab*.
Having entered information about the dive site into the *Notes* tab, the following
additional information can be typed in:
*Divemaster*: The name of the divemaster or dive guide should be
entered in this field
which offers auto selection based on the list of divemasters in
*Dive guide*: The name of the dive guide should be entered in this field
which offers auto selection based on the list of dive guides in
the current logbook.
*Buddy*: In this field, enter the name(s) of the buddy or buddies
@ -1107,7 +1104,7 @@ and gas composition). Other fields remain empty.
It may be useful to simultaneously edit some of the
fields in the *Notes* and *Equipment* tabs. For instance, its possible
that a diver performed several dives during a single day, using identical equipment at the same
dive site, or with the same divemaster and/or buddy or tags. Instead
dive site, or with the same dive guide and/or buddy or tags. Instead
of completing the information for each
dive separately, select all the dives for that day in the *Dive List* and
insert the same information in the *Notes* and *Equipment* fields that need
@ -1443,7 +1440,7 @@ There are two types of _CSV_ dive logs that can be imported into _Subsurface_:
1. _CSV dive details_: This dive log format contains similar information to that of a
typical written dive log, e.g. dive date and time, dive depth, dive duration, names of
buddy and divemaster and information about cylinder pressures before and
buddy and dive guide and information about cylinder pressures before and
after the dive, as well as comments about the dive. All the data for a single
dive go on a single line of text, following the order of the column headings.
@ -1643,6 +1640,8 @@ Select the dive site to be merged by right-clicking it. A confirmation
message is presented (see image above). Clicking the confirmation message merges the selected dive with
the dive named at the top of the panel and returns you to the dive sites management panel.
Alternatively, if exactly one dive site is selected in the 'Near dive sites' list, there is an additional function 'Merge current site into this site' available in the context menu. This can be helpful if the name of the destination dive site is not known, e.g. when importing dive sites from a third party source.
==== Add a dive site
At the top right of the dive sites management table is a round button with a "+". Clicking that button inserts a
@ -1944,6 +1943,29 @@ logging of cylinder pressures during sidemount involves three steps, exactly as
image::images/sidemount1.jpg["FIGURE: Sidemount profile",align="center"]
==== Fixing sensor being attached to wrong cylinder
When importing a dive _Subsurface_ generally has to make some assumptions when importing dives. One
of these assumptions is which cylinder a pressure sensor is attached to. The following dive is a sidemount
dive with two deco cylinders. Each of the main cylinders has a pressure sensor attached to them. In this
case _Subsurface_ only knows about 3 gasses and 2 sensors so it makes the assumption that the sensors
are attached to the first two cylinders, one bottom gas and one with deco gas. For the cylinders with
attached sensors the cylinder index will be shown in the sensors column.
image::images/sensors-import.png["FIGURE: Imported cylinders and sensors",align="center"]
To fix this, you can add a new cylinder with bottom gas and pick the index for the deco cylinder in
the sensors drop down.
image::images/sensors-newcylinder.png["FIGURE: New cylinder added for sensor move",align="center"]
After this change the second sensor will be attached to the fourth cylinder and the two deco cylinders
won't have any cylinders attached.
image::images/sensors-moved.png["FIGURE: Sensor moved to new cylinder",align="center"]
The profile graph will also be updated to reflect this change.
[[S_sSCR_dives]]
==== Passive semi-closed circuit rebreather (pSCR) dives
@ -2299,6 +2321,10 @@ M-value, corresponds to 100%), the time to surface (TTS), the calculated ceiling
as of the statistics in the Information Box, shown as four
buttons on the left of the profile panel. These are:
[icon="images/icons/InfoBox.png"]
[NOTE]
Show or hide the *Information Box*. This allows the Information Box to be hidden in order to see the entire dive profile without any obstructions.
[icon="images/icons/MOD.jpg"]
[NOTE]
Show the *Maximum Operating Depth (MOD)* of the dive, given the
@ -2713,7 +2739,7 @@ restored to view by selecting Unhide all events from the context menu.
=== Filtering the dive list
The dives in the *Dive List* can be filtered, selecting only some
of the dives based on attributes such as dive tags, dive site, divemaster or buddy.
of the dives based on attributes such as dive tags, dive site, dive guide or buddy.
For instance, filtering lets you list the dives during a particular year at a specific
dive site, or otherwise the cave dives with a particular buddy. Filtering can be performed
based on virtually any information in the *Info* panel.
@ -2766,20 +2792,20 @@ We may wish to refine our selection of dives to show in the *Dive List*. Let's s
temperature was 18 °C or higher. Select "Water Temp." from the list of constraints. A line containing this new constraint is added to the filter
panel. Select "at least" from the combobox on this line and type "18" in the appropriate text box. Below is an image with constraints defined to filter dives at Sodwana with water temperatures at 18 °C or higher.
image::images/Filter:LocTemp.png["Figure: Filter: Stage 2 Filter set construction",align="center"]
image::images/Filter-LocTemp.png["Figure: Filter: Stage 2 Filter set construction",align="center"]
In order to refine our filter we may wish to show only dives on a Tuesday. Select "week day" from the list of constraints. A line
containing this new constraint is added to the filter panel with a dropdown list of days that are selectable. Select "Tuesday" from the
list. The image below shows a filter that selects dives at Sodwana on Tuesdays with the water temperature at or above 18 °C.
image::images/Filter:LocTempWeek.png["Figure: Filter: Stage 3 Filter set construction",align="center"]
image::images/Filter-LocTempWeek.png["Figure: Filter: Stage 3 Filter set construction",align="center"]
As a last step in refining our filter we may wish to add another constraint specifying visibility of at least three stars. Select
"visibility" from the list of constraints. A new line is added to the filter panel, allowing us to select the number of stars
we require. In this case click on the third star and ensure that the combobox shows "at least". We have now filtered for all dives
at Sodwana on a Tuesday with water temperature at or above 18 °C and with a 3-star or better visibility.
image::images/Filter:LocTempWeekVis.png["Figure: Filter: Stage 4 Filter set construction",align="center"]
image::images/Filter-LocTempWeekVis.png["Figure: Filter: Stage 4 Filter set construction",align="center"]
Clearly it is possible to construct highly refined filters. The examples above show only a tiny fraction of the possibilities
in creating filters.
@ -3217,7 +3243,7 @@ image::images/texexample.png["Figure: Export to TeX", align="center"]
of each of those photos/videos was taken.
When the "Anonymize" option is selected for xml-based file formats, the letters A-Z
are all replaced by the letter 'X' in the notes, buddy, divemaster, divesite name
are all replaced by the letter 'X' in the notes, buddy, dive guide, divesite name
and divesite description fields. This way, you can share dive log files for debugging
purposes without revealing personal information. Please note, though, that other
characters are not replaced, so this is not useful for languages with non-latin
@ -3618,6 +3644,8 @@ image::images/Pref_eqpmnt.jpg["FIGURE: Preferences: equipment",align="center"]
** *Show unused cylinders*: Checking this checkbox allows showing all cylinders entered for a dive
in the Cylinder Table of the *Equipment* tab, even if one or more cylinders were actually not used.
This will also include unused cylinders in data exports and when dives are cloned for the planner
or merged into one dive.
=== Media
@ -3639,10 +3667,8 @@ image::images/Pref_media.jpg["FIGURE: Preferences: media",align="center"]
This tab sets common variables used for decompression calculations pertaining to technical diving.
image::images/Pref_tech.jpg["FIGURE: Preferences: Tech setup",align="center"]
[[S_CCR_options]]
[[S_GradientFactors]]
image::images/Pref_tech.jpg["FIGURE: Preferences: Tech setup",align="center"]
* *Gas pressure display setup*. Even though nitrogen and helium pressures are also included here,
these items mainly pertain to oxygen management:
@ -3968,7 +3994,7 @@ used without changing the original values in the _Preferences_.
Gradient Factor settings strongly affect the calculated ceilings and their depths.
A very low GFLow value brings on decompression stops early during the dive.
** For more information about Gradient factors, see the section on xref:S_GradientFactors[Gradient Factor Preference settings].
** For more information about Gradient factors, see the section on xref:S_CCR_options[Gradient Factor Preference settings].
If the VPM-B model is selected, the Conservatism_level needs to be specified on a scale of 0 (least conservative) to 4 (most conservative).
This model tends to give deco stops at deeper levels than the Bühlmann model and often results in slightly shorter
@ -5164,8 +5190,7 @@ explained on the section xref:S_ImportingCSVDives[Importing CSV dives].
== APPENDIX E: Writing a custom print template
_Subsurface_ has a way to create or modify templates for printing dive logs to
produce customized printouts of them. Templates written in HTML, as well as a simple
Grantlee instruction set, are rendered to the print device by _Subsurface_.
produce customized printouts of them. Templates written in HTML are rendered to the print device by _Subsurface_.
Templates are accessed using the print dialog (see image *B* below).
@ -5188,14 +5213,11 @@ image::images/Template1_f22.jpg["FIGURE: template edit dialog",align="center"]
customizable: the _Edit_ buttons in the _Colors_ tab allows choosing arbitrary colors for different
components of the dive log printout.
3) The _Template_ tab of the Edit Panel (see image below) allows creating a template using HTML as well as a few
Grantlee programming primitives. Grantlee can create and format HTML code in
a highly simple but efficient way (see below). The HTML of the template can be edited and saved. The saved
template is stored in the same directory as the dive being processed. By default, a _Custom_
template is a skeleton with no specific print instructions. The information printed
needs to be specified and formatted in the template by replacing the section marked with:
"<!-- Template must be filled -->". Writing HTML code with Grantlee instructions allows unlimited
freedom in determining what is printed and in which way it should be rendered.
3) The _Template_ tab of the Edit Panel (see image below) allows creating a template using HTML. The HTML of the
template can be edited and saved. The saved template is stored in the same directory as the dive being processed.
By default, a _Custom_ template is a skeleton with no specific print instructions. The information printed needs to
be specified and formatted in the template by replacing the section marked with:
"<!-- Template must be filled -->".
image::images/Template2_f22.jpg["FIGURE:Template tab",align="center"]
@ -5206,7 +5228,8 @@ dialog to save the new template using a new template name.
To write a custom template, the following elements must exist so the template will be correctly handled and rendered.
=== Main dive loop
_Subsurface_ exports a dive list called (*dives*) to the _Grantlee_ back end. It is possible to iterate over the list as follows:
_Subsurface_ exports a dive list called (*dives*) as well as a list of cylinders called (*cylinderObjects*) to the back end. It is
possible to iterate over the list as follows:
.template.html
....
{% for dive in dives %}
@ -5221,33 +5244,40 @@ _Subsurface_ exports a dive list called (*dives*) to the _Grantlee_ back end. It
<h1> 3 </h1>
....
Additional information about _Grantlee_ can be found http://www.grantlee.org/apidox/for_themers.html[here]
=== Grantlee exported variables
=== Exported dive variables
Only a subset of the dive data is exported:
|====================
|*Name*|*Description*
|number| (*int*) dive number
|id| (*int*) unique dive ID, should be used to fetch the dive profile
|rating| (*int*) dive rating which ranges from 0 to 5
|visibility| (*int*) dive visibility which ranges from 0 to 5
|wavesize| (*int*) wave size during the dive which ranges from 0 to 5
|current| (*int*) current during the dive which ranges from 0 to 5
|surge| (*int*) surge during the dive which ranges from 0 to 5
|chill| (*int*) chill during the dive which ranges from 0 to 5
|date| (*string*) date of the dive
|time| (*string*) time of the dive
|location| (*string*) location of the dive
|gps| (*string*) GPS coordinates of the dive
|gps_decimal| (*string*) GPS coordinates of the dive in decimal format
|duration| (*string*) duration of the dive
|depth| (*string*) depth of the dive
|meandepth| (*string*) mean depth of the dive
|divemaster| (*string*) divemaster for the dive
|diveguide| (*string*) dive guide for the dive
|buddy| (*string*) buddy for the dive
|airTemp| (*string*) air temperature of the dive
|waterTemp| (*string*) water temperature of the dive
|notes| (*string*) dive notes
|rating| (*int*) dive rating which ranges from 0 to 5
|sac| (*string*) SAC value for the dive
|tags| (*string*) list of dive tags for the dive
|gas| (*string*) list of gases used in the dive
|sac| (*string*) SAC value for the dive
|weights| (*string*) complete information of all used weight systems
|weight0-5| (*string*) information about a specific weight system
|suit| (*string*) the suit used for the dive
|cylinders| (*string*) complete information of all used cylinders
|cylinder0-7| (*string*) information about a specific cylinder
|weights| (*string*) complete information of all used weight systems
|weight0-5| (*string*) information about a specific weight system
|maxcns| (*string*) maxCNS value for the dive
|otu| (*string*) OTU value for the dive
|sumWeight| (*string*) the summed weight of all used weight systems
@ -5258,6 +5288,22 @@ Only a subset of the dive data is exported:
|waterType| (*string*) the type of the water for the dive
|=====================
=== Exported cylinder object variables
Only a subset of the cylinder data is exported:
|====================
|*Name*|*Description*
|description| (*string*) cylinder description
|size| (*string*) cylinder size
|workingPressure| (*string*) cylinder working pressure
|startPressure| (*string*) start pressure of cylinder
|endPressure| (*string*) end pressure of cylinder
|gasMix| (*string*) gas mix of cylinder
|gasO2| (*int*) oxygen percentage of gas mix
|gasHe| (*int*) helium percentage of gas mix
|gasN2| (*int*) nitrogen percentage of gas mix
|=====================
Please note that some of the variables like 'notes' need to be extended with '|safe' to support HTML tags:
....
<p> {{ dive.notes|safe }} </p>
@ -5443,7 +5489,7 @@ _Subsurface_ ends up ignoring surface time for many things (average depth, divet
but then come back up and wait five minutes for your buddies, your dive computer may say
that your dive is 50 minutes long - because you have fifty minutes worth of samples - but
subsurface will say it's 45 minutes - because you were actually diving for 45 minutes.
It's even more noticeable if you do things like divemastering the initial OW dives, when
It's even more noticeable if you do things like guiding the initial OW dives, when
you may stay in the water for a long time, but spend most of it at the surface. And then
you don't want that to count as some kind of long dive”.

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.10" />
<meta name="generator" content="AsciiDoc 10.1.2" />
<title></title>
<style type="text/css">
/*
@ -17,7 +17,7 @@
*/
* { padding: 0; margin: 0; }
img { border: 0; }
img { border: 0; margin: 15px; max-width:90% }
/*** Layout ***/
@ -78,12 +78,12 @@ body { font-family: Verdana, sans-serif; }
#footer { font-size: 0.8em; }
h2, h3, h4, h5, .title { font-family: Arial, sans-serif; }
h2 { font-size: 1.5em; }
h2 { font-size: 160%; }
.sectionbody { font-size: 0.85em; }
.sectionbody .sectionbody { font-size: inherit; }
h3 { font-size: 159%; } /* 1.35em */
h4 { font-size: 141%; } /* 1.2em */
h5 { font-size: 118%; } /* 1em */
h3 { font-size: 150%; } /* 1.35em */
h4 { font-size: 140%; } /* 1.2em */
h5 { font-size: 130%; } /* 1em */
.title { font-size: 106%; /* 0.9em */
font-weight: bold;
}
@ -446,7 +446,7 @@ asciidoc.install(3);
<div class="paragraph"><p><strong>Autores</strong>: Willem Ferguson, Jacco van Koll, Dirk Hohndel, Reinout Hoornweg,
Linus Torvalds, Miika Turkia, Amit Chaudhuri, Jan Schubert, Salvador Cuñat,
Pedro Neves, Stefan Fuchs</p></div>
<div class="paragraph"><p><span class="BLUE"><em>Versión 4.8, Septiembre 2018</em></span></p></div>
<div class="paragraph"><p><span class="BLUE"><em>Versión 4.9, Febrero 2019</em></span></p></div>
<div class="paragraph"><p>Bienvenido como usuario de <em>Subsurface</em>, un avanzado programa de registro de
inmersiones con extensa infraestructura para describir, organizar e
interpretar buceos en apnea o con botella. <em>Subsurface</em> ofrece muchas ventajas
@ -515,9 +515,9 @@ y libdivecomputer.</p></div>
el software, consulta la página Descargas en <a href="https://subsurface-divelog.org/">la
web</a>. Por favor, comenta los problemas que tengas con este programa enviando un
mail a <a href="mailto:subsurface@subsurface-divelog.org">nuestra lista de correo</a> e informa de
fallos en <a href="https://github.com/Subsurface-divelog/subsurface/issues">nuestro bugtracker</a>.
fallos en <a href="https://github.com/Subsurface/subsurface/issues">nuestro bugtracker</a>.
Para instrucciones acerca de como compilar el software y (en caso necesario)
sus dependencias, por favor, consulta el archivo INSTALL incluido con el código
sus dependencias, por favor, consulta el archivo INSTALL.md incluido con el código
fuente.</p></div>
<div class="paragraph"><p><strong>Audiencia</strong>: Buceadores recreativos, Buceadores en apnea, Buceadores técnicos,
Buceadores profesionales.</p></div>
@ -591,7 +591,7 @@ se puede hacer lanzando <em>Subsurface</em> desde la línea de comandos con la o
<h2 id="S_StartUsing">3. Empezar a usar el programa</h2>
<div class="sectionbody">
<div class="paragraph"><p>La ventana <em>Subsurface</em> está, habitualmente, dividida en cuatro paneles con un
<strong>Menú principal</strong> (Archivo Importar Registro Vista Compartir Ayuda) en la parte
<strong>Menú principal</strong> (Archivo Importar Registro Vista Ayuda) en la parte
superior (en Windows y Linux) o en la parte superior de la pantalla (en Mac y
Ubuntu Unity). Los cuatro paneles son:</p></div>
<div class="olist arabic"><ol class="arabic">
@ -642,7 +642,7 @@ temperaturas del agua, consumos de gases; el tiempo total y el número de
inmersiones seleccionadas).</p></div>
<div class="imageblock" id="S_ViewPanels" style="text-align:center;">
<div class="content">
<img src="images/main_window_f22.jpg" alt="La ventana principal" />
<img src="images/MainWindow.jpg" alt="La ventana principal" />
</div>
</div>
<div class="paragraph"><p>El usuario puede elegir cual de los cuatro paneles se mostrará seleccionando la
@ -906,6 +906,19 @@ El desplegable <strong>Dispositivo o punto de montaje</strong> contiene el nombr
para detalles técnicos de como encontrar la información apropiada sobre
puertos, para un ordenador en concreto y, en algunos casos, como hacer los
ajustes correctos al Sistema Operativo del ordenador que ejecuta <em>Subsurface</em>.
Algunos ordenadores de buceo desactivan este desplegable ya que usan otras
formas de conectar con el dispositivo. Para algunos ordenadores, el dato
introducido aquí es en realidad el punto de montaje del dispositivo de
almacenamiento USB con el que el ordenador de buceo se identifica a sí
mismo.
</p>
</li>
<li>
<p>
Bajo los desplegables hay hasta cuatro botones que te permiten cambiar
fácilmente entre varios ordenadores desde los que descargues
frecuentemente. Estos botones solo aparecen después de que hayas descargado
desde diferentes ordenadores de buceo.
</p>
</li>
<li>
@ -1207,6 +1220,19 @@ de descarga _Bluetooth</em>.</p></div>
<td class="icon">
<img src="images/icons/important.png" alt="Important" />
</td>
<td class="content">El soporte de Subsurface en Windows para ordenadores de buceo BTLE es
<strong>EXPERIMENTAL</strong> y solo está soportado en Windows10.
Por favor, asegúrate de tener la última versión de Windows10.
<a href="https://en.wikipedia.org/wiki/Windows_10_version_history#Version_1803_(April_2018_Update)">La
versión 1803</a> is el requerimiento mínimo. Asegúrate también de tener
instalados los últimos drivers para tu placa base o receptor BTLE.</td>
</tr></table>
</div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
<img src="images/icons/important.png" alt="Important" />
</td>
<td class="content"><strong>EN CASO DE PROBLEMAS</strong>: Si el adaptador Bluetooth del ordenador con <em>Subsurface</em>
se cuelga y el proceso de descarga falla repetidamente, <em>desempareja</em> los
dispositivos y repite los pasos indicados anteriormente. Si a pesar de ello
@ -1289,13 +1315,14 @@ aire ya que el cambio en la lectura del sensor de temperatura es bastante lento
para seguir los cambios en el entorno. Si fuera necesario, no hay que teclear
las unidades de temperatura: <em>Subsurface</em> las suministra automáticamente de
acuerdo con las <em>Preferencias</em> (métricas o imperiales).</p></div>
<div class="paragraph"><p><strong>Ubicación</strong>:</p></div>
<div class="paragraph" id="S_locations"><p><strong>Ubicación</strong>:</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
<img src="images/icons/warning2.png" alt="Warning" />
</td>
<td class="content">Las localizaciones de buceo se gestionan como una parte <strong>separada</strong> del divelog.
<td class="content">Las localizaciones de buceo se gestionan como una parte <strong>separada</strong> del divelog
(Visita la sección llamada <a href="#S_DiveSiteManagement">Manipular información de puntos de buceo</a>).
La información de buceo de las pestañas <strong>Notas</strong> y <strong>Equipo</strong> no se puede editar
al mismo tiempo que la información de los puntos de buceo. Guarda toda la otra
información (p.e. divemaster, compañero, equipo, etc) seleccionando <em>Aplicar
@ -1746,9 +1773,24 @@ diarios de CCR APD.
</p>
</li>
</ul></div>
<div class="paragraph"><p>Seleccionar el archivo correspondiente en la lista del diálogo abre el archivo
importado directamente en la <strong>Lista de Inmersiones</strong> de <em>Subsurface</em>. También
están soportados algunos otros formatos, no accesibles desde el diálogo
<div class="paragraph"><p>Selecciona el formato correspondiente en la lista del diálogo y el archivo de
la lista de la ventana principal. Luego haz clic en el botón _Abrir_abajo a la
derecha.</p></div>
<div class="paragraph"><p>Si el archivo que se está importando está en formato CSV, se da al usuario la
ocasión de efectuar ediciones manuales en las cabeceras de las columnas antes
de importarlas a <em>Subsurface</em> (ver imagen a continuación).</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/Import_csv.jpg" alt="FIGURA: Diálogo de importación: paso 2" />
</div>
</div>
<div class="paragraph"><p>Para más información sobre como configurar la importación CSV, visita
<a href="#S_ImportingCSVDives">Importar datos en formato CSV</a>.
En muchos casos no se requiere hacer cambios en las cabeceras de las columnas
porque están pre configuradas para el tipo de importación en concreto y la
pantalla de importación CSV se puede saltar pulsando el botón <em>OK</em>.
Esto abrirá el divelog importado en la <strong>Lista de inmersiones</strong> de <em>Subsurface</em>.</p></div>
<div class="paragraph"><p>También están soportados algunos otros formatos, no accesibles desde el diálogo
Importar, como se explica a continuación.</p></div>
</div>
<div class="sect3">
@ -2144,7 +2186,126 @@ asegurarse de que el resto funciona.</p></div>
</div>
</div>
<div class="sect2">
<h3 id="_importar_coordenadas_de_buceo_desde_un_dispositivo_movil_con_gps">5.4. Importar coordenadas de buceo desde un dispositivo movil con GPS</h3>
<h3 id="S_DiveSiteManagement">5.4. Manipular la información de puntos de buceo</h3>
<div class="paragraph"><p>La información de los puntos de buceo se gestiona como una entidad separada de
la información de la inmersión.
Al seleccionar la pestaña llamada "Puntos de buceo" en el panel <strong>Notas</strong>,
aparecerá el <em>panel de gestión de puntos de inmersión</em> (ver imagen a
continuación). Asignar un punto de buceo a una inmersión se hace desde la
pestaña Notas que muestra la información de la inmersión (visita la sección
<a href="#S_locations">Ubicaciones</a>). Por otra parte, el panel de gestión de puntos
de buceo permite manejar datos independientes de las inmersiones. Un punto de
buceo nuevo se puede crear mientras se edita una inmersión o bien desde el
panel de gestión de puntos de buceo (ver imagen a continuación).</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/DiveSitesTab.jpg" alt="FIGURE: Pestaña puntos de buceo" />
</div>
</div>
<div class="paragraph"><p>Si se ha creado previamente la descripción de un punto de buceo, este se
mostrará en el panel, así como el número de inmersiones en cada punto. La
lista de puntos puede ordenarse haciendo clic en cualquiera de los
encabezamientos. A la derecha de cada punto de buceo hay un icono de papelera
y otro de edición, Se pueden efectuar las siguientes acciones para gestionar
la colección de puntos de buceo:</p></div>
<div class="sect3">
<h4 id="_filtrar_la_lista_de_puntos_de_inmersion">5.4.1. Filtrar la lista de puntos de inmersión</h4>
<div class="paragraph"><p>Arriba a la derecha en el panel hay una casilla de texto (ver imanterior). Si
solo quieres visualizar inmersiones de un punto en concreto, teclea un nombre
parcial como "Genova", así se mostrarán solo los nombres que contengan la
palabra "Genova" en el nombre o la descripción.</p></div>
</div>
<div class="sect3">
<h4 id="_editar_un_punto_de_buceo">5.4.2. Editar un punto de buceo</h4>
<div class="paragraph"><p>La información de cada punto de buceo puede editarse, bien desde la pestaña
<strong>Notas</strong>, bien desde la pestaña <strong>Puntos de buceo</strong>. Para editar la información,
selecciona el icono Editar de la izquierda del nombre del punto de buceo (ver
imagen anterior). La edición desde la pestaña <strong>Notas</strong> se comenta en la sección
<a href="#S_locations">Ubicaciones</a> donde se explica cada uno de los campos del
panel de edición.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/DiveSiteEdit.jpg" alt="FIGURA: Edición de puntos de buceo" />
</div>
</div>
<div class="paragraph"><p>Añade cualquier información que desees en la pestaña. Como editar las
coordenadas se explica en la sección sobre <a href="#S_locations">Ubicaciones</a>.
Cuando termines de editar la información del punto de inmersión, selecciona el
botón <strong>Terminado</strong> en la parte de arriba. Esto te devolverá al panel de gestión
de puntos de buceo.</p></div>
</div>
<div class="sect3">
<h4 id="_mezclar_puntos_de_inmersion">5.4.3. Mezclar puntos de inmersión</h4>
<div class="paragraph"><p>Mezclar dos o más puntos de inmersión se consigue desde el panel de edición de
puntos de buceo (ver imagen anterior). Asumimos que los puntos que se están
mezclando no están a mucha distancia. La mezcla se efectúa seleccionando un
punto y luego mezclando otros con este primero. En la parte superior del panel
de edición, selecciona la casilla de texto etiquetada "Mostrar los puntos de
buceo en el rango:" e introduce la distancia que consideres oportuna para
considerar que los diversos puntos son el mismo.
Se te presentará una lista con los puntos en el radio que hayas introducido
(ver imaden a continuación).</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/DiveSiteMerge.jpg" alt="FIGURA: Mezcla de puntos de buceo" />
</div>
</div>
<div class="paragraph"><p>Selecciona el punto a mezclar haciendo clic derecho sobre él. Se mostrará un
mensaje de confirmación (ver imagen anterior). Al aceptar el mensaje de
confirmación se mezcla la inmersión seleccionada con la de arriba del panel y
se regresa al panel de gestión de puntos de buceo.</p></div>
</div>
<div class="sect3">
<h4 id="_anadir_un_punto_de_buceo">5.4.4. Añadir un punto de buceo</h4>
<div class="paragraph"><p>En la parte alta de la tabla de gestión de puntos de buceo hay un botón
redondo con un "+". Haciendo clic en este botón se inserta un nuevo punto de
buceo llamado "Nuevo punto de buceo" (imagen a continuación). El nuevo punto
puede borrarse si nos hubiéramos equivocado seleccionando <em>Editar &#8594; Deshacer</em>
en el menú principal o tecleando Ctrl-Z mientras mantenemos enfocada la tabla
de gestión de puntos de buceo. El punto nuevo se edita seleccionando su botón
de edición y proporcionando un nombre, coordenadas y, si se desea, una
descripción. Al pulsar el botón "Terminado" en el panel de edición se regresa
a al panel de gestión de puntos de buceo.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/DiveSiteInsert.jpg" alt="FIGURA: Añadir un punto de buceo" />
</div>
</div>
</div>
<div class="sect3">
<h4 id="_borrar_un_punto_de_inmersion">5.4.5. Borrar un punto de inmersión</h4>
<div class="paragraph"><p>A la izquierda de cada punto de buceo hay una papelera. Pulsar este icono
borrará el punto de buceo asociado. Si hay varias inmersiones asociadas a este
punto, se mostrará un mensaje de aviso (ver imagen a continuación). Si el
punto se borra, será necesario crear ubicaciones para las inmersiones que
estuvieran asociadas al punto borrado.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/DiveSiteDelete.jpg" alt="FIGURA: Borrar un punto de buceo" />
</div>
</div>
</div>
<div class="sect3">
<h4 id="_aproximacion_general_al_uso_de_la_lista_de_puntos_de_buceo">5.4.6. Aproximación general al uso de la lista de puntos de buceo</h4>
<div class="paragraph"><p>Ya que la lista de puntos de buceo se gestiona separadamente de la lista de
inmersiones, es posible añadir puntos de buceo aunque no se hayan utilizado en
ninguna inmersión. En este caso, la columna etiquetada "# de buceos" muestra
un cero.
Esto posibilita que los buceadores que comparten puntos de buceo puedan
crearlos antes de haberlos buceado. Además, un punto puede crearse con
mucha información en la descripción, de esta forma la lista de puntos de buceo
se convierte en un útil repositorio de información fuera de la lista de
inmersiones.</p></div>
</div>
<div class="sect3">
<h4 id="_borrar_puntos_de_buceo_no_utilizados">5.4.7. Borrar puntos de buceo no utilizados</h4>
<div class="paragraph"><p>Arriba a la izquierda en el panel de gestión de inmersiones hay un botón
"Purgar puntos de buceo no usados". Al pulsar este botón se borran todos los
puntos de buceo que no tengan inmersiones asociadas.</p></div>
</div>
</div>
<div class="sect2">
<h3 id="_importar_coordenadas_de_buceo_desde_un_dispositivo_movil_con_gps">5.5. Importar coordenadas de buceo desde un dispositivo movil con GPS</h3>
<div class="paragraph"><p>Un smartphone con GPS incorporado puede utilizarse para guardar las
ubicaciones de las inmersiones. Esto se hace como sigue:</p></div>
<div class="paragraph"><p>1) Llevar el dispositivo móvil en el barco de buceo o vida abordo, para
@ -2161,7 +2322,7 @@ El antiguo servicio de posiciones GPS en internet se cerrará a finales de 2018
y a partir de ese momento, la app <em>Companion</em> ya no se podrá utilizar. Por
favor, usa la app <em>Subsurface-mobile</em> en su lugar.</p></div>
<div class="sect3">
<h4 id="_guardar_y_utilizar_coordenadas_gps_utilizando_em_subsurface_mobile_em">5.4.1. Guardar y utilizar coordenadas GPS utilizando <em>Subsurface-mobile</em></h4>
<h4 id="_guardar_y_utilizar_coordenadas_gps_utilizando_em_subsurface_mobile_em">5.5.1. Guardar y utilizar coordenadas GPS utilizando <em>Subsurface-mobile</em></h4>
<div class="sect4">
<h5 id="_instalar_em_subsurface_mobile_em">Instalar <em>Subsurface-mobile</em></h5>
<div class="paragraph"><p>Busca <em>Subsurface-mobile</em> en Google Play e instálala en el dispositivo
@ -2245,7 +2406,7 @@ recogida, subida, gestión y sincronizado de estas información.</p></div>
</div>
</div>
<div class="sect2">
<h3 id="S_LoadImage">5.5. Añadir fotografías o vídeos a las inmersiones</h3>
<h3 id="S_LoadImage">5.6. Añadir fotografías o vídeos a las inmersiones</h3>
<div class="paragraph"><p>Muchos buceadores (si no la mayoría) toman fotografías o vídeos durante sus
inmersiones. LLamaremos a estos archivos "medios" refiriendonos a fotos o
vídeos.
@ -2255,7 +2416,7 @@ donde se tomaron. Los medios pueden visualizarse desde el perfil o desde la
pestaña <em>Medios</em> en el <strong>Panel de Notas</strong>. <em>Subsurface</em> permite visualizar las
fotos o vídeos en un interfaz unificado.</p></div>
<div class="sect3">
<h4 id="_cargar_medios_y_sincronizar_la_camara_con_el_ordenador_de_buceo">5.5.1. Cargar medios y sincronizar la cámara con el ordenador de buceo</h4>
<h4 id="_cargar_medios_y_sincronizar_la_camara_con_el_ordenador_de_buceo">5.6.1. Cargar medios y sincronizar la cámara con el ordenador de buceo</h4>
<div class="paragraph"><p>Se selecciona una inmersión o un grupo de ellas en la lista. Luego se hace
clic-derecho en la selección lo que nos mostrará el <a href="#S_DiveListContextMenu">Menú contextual de la lista de inmersiones</a>.
Hacemos click-izquierdo en la opción apropiada para cargar los medios desde
@ -2342,7 +2503,7 @@ que todas las fotos o videos asociados con un buceo puedan visualizarse,
incluidos los que se hayan tomado antes o despues de la inmersión.</p></div>
</div>
<div class="sect3">
<h4 id="S_ViewMedia">5.5.2. Visualizar los medios</h4>
<h4 id="S_ViewMedia">5.6.2. Visualizar los medios</h4>
<div class="sidebarblock">
<div class="content">
<div class="paragraph"><p><strong>Asegurarse de que se crean las miniaturas para los archivos de vídeo</strong></p></div>
@ -2422,7 +2583,7 @@ sobre las imágenes. Las imágenes también puede borrase desde la pestaña
</div>
</div>
<div class="sect3">
<h4 id="_la_pestana_em_medios_em">5.5.3. La pestaña <em>Medios</em></h4>
<h4 id="_la_pestana_em_medios_em">5.6.3. La pestaña <em>Medios</em></h4>
<div class="paragraph"><p>Los medios asociados a una inmersión se muestran como miniaturas en la
pestaña <em>Medios</em> del <em>Panel de Notas</em>. Se puede acceder con facilidad a las
fotos hechas en rápida sucesión durante la inmersión, desde la pestaña <em>Medios</em>.
@ -2437,9 +2598,22 @@ video superpuesto a la ventana de <em>Subsurface</em>. Podemos borrar un medio d
la pestaña <em>Medios</em> seleccionándolo (un solo clic) y pulsando a continuación la
tecla <em>Supr</em> en el teclado. Esto eliminará el medio tanto de la pestaña
<em>Medios</em> como del <em>Perfil de la inmersión</em>.</p></div>
<div class="paragraph"><p>Haciendo clic derecho en un vídeo y seleccionando "Guardar datos como
subtitulos", se creará un archivo con el mismo nombre que el vídeo y con
extensión ".ass" que contendrá datos de la inmersión en función del tiempo
(tiempo transcurrido, profundidad, temperatura, LND, TTS, y GF) que se
superpondrán al vídeo. El reproductor de medios VLC encuentra automáticamente
este archivo y lo utiliza al reproducir un vídeo. Como alternativa, puede
utilizarse el codificador de vídeo ffmpeg para crear un nuevo archivo de vídeo
con los datos codificados en él. Para ello, ejecuta</p></div>
<div class="literalblock">
<div class="content">
<pre><code>ffmpeg -v video.mp4 -vf "ass=video.ass" video_with_data.mp4</code></pre>
</div></div>
<div class="paragraph"><p>desde la línea de comandos. Es necesario tener instalada la librería libass,</p></div>
</div>
<div class="sect3">
<h4 id="_fotos_en_disco_duro_externo">5.5.4. Fotos en disco duro externo</h4>
<h4 id="_fotos_en_disco_duro_externo">5.6.4. Fotos en disco duro externo</h4>
<div class="paragraph"><p>La mayoría de fotosubs guardan sus fotografías en un disco duro externo. Si este
disco puede mapearse (como es casi siempre el caso) <em>Subsurface</em> puede acceder
directamente a los medios. Esto facilita la interacción entre <em>Subsurface</em> y un
@ -2454,7 +2628,7 @@ Si, posteriormente, el disco externo con los medios se vuelve a conectar, los
medios podrán visualizarse normalmente.</p></div>
</div>
<div class="sect3">
<h4 id="_averiguar_que_inmersiones_tienen_medios_asociados">5.5.5. Averiguar que inmersiones tienen medios asociados</h4>
<h4 id="_averiguar_que_inmersiones_tienen_medios_asociados">5.6.5. Averiguar que inmersiones tienen medios asociados</h4>
<div class="paragraph"><p>Inspeccionar cada inmersión individual para saber si tiene asociados medios
puede llevarnos mucho tiempo. Hay una forma rápida de saber que inmersiones
tiene asociados medios y cuales no: activa la casilla <em>Medios</em> en la lista
@ -2465,7 +2639,7 @@ después o todo ello. Hay más información en la sección del manual que cubre
los <a href="#S_Divelist_columns">iconos de fotos en la <strong>Lista de Inmersiones</strong></a>.</p></div>
</div>
<div class="sect3">
<h4 id="S_FindMovedImages">5.5.6. Mover medios entre directorios, discos duros u ordenadores</h4>
<h4 id="S_FindMovedImages">5.6.6. Mover medios entre directorios, discos duros u ordenadores</h4>
<div class="paragraph"><p>Tras haber cargado un medio en <em>subsurface</em> y haberlo asociado a un buceo
determinado, se archiva el directorio donde el archivo permanece guardado, para poder
encontrarlo cuando se vuelva a abrir la inmersión. Si la foto, la colección
@ -2498,11 +2672,11 @@ sus posiciones conocidas. Los cambios propuestos pueden aplicarse clicando en
</div>
</div>
<div class="sect2">
<h3 id="_registrar_tipos_de_inmersion_especiales">5.6. Registrar tipos de inmersión especiales</h3>
<h3 id="_registrar_tipos_de_inmersion_especiales">5.7. Registrar tipos de inmersión especiales</h3>
<div class="paragraph"><p>Esta sección da ejemplos de la verstilidad de <em>Subsurface</em> como herramienta de
registro de inmersiones.</p></div>
<div class="sect3">
<h4 id="S_MulticylinderDives">5.6.1. Inmersiones multi botella</h4>
<h4 id="S_MulticylinderDives">5.7.1. Inmersiones multi botella</h4>
<div class="paragraph"><p><em>Subsurface</em> maneja fácilmente inmersiones que requieren más de una botella. El
buceo multi botella se produce habitualmente cuando (a) un buceador no tiene
bastante gas para completar una inmersión con una sola botella o (b) cuando el
@ -2572,7 +2746,7 @@ en lateral (en las que utilicen dos botellas). Visita el link
de ordenadores de buceo soportados</a>.</p></div>
</div>
<div class="sect3">
<h4 id="_inmersiones_en_montaje_lateral_sidemount">5.6.2. Inmersiones en montaje lateral (sidemount)</h4>
<h4 id="_inmersiones_en_montaje_lateral_sidemount">5.7.2. Inmersiones en montaje lateral (sidemount)</h4>
<div class="paragraph"><p>El buceo en montaje lateral es solo otra forma de buceo multi botella, a menudo
con ambas o todas las botellas conteniendo la misma mezcla. Aunque es una
configuración popular entre los espeleo buceadores, el buceo en lateral se
@ -2628,7 +2802,7 @@ exactamente como con las inmersiones multi botella anteriores:</p></div>
</div>
</div>
<div class="sect3">
<h4 id="S_sSCR_dives">5.6.3. Inmersiones con rebreather pasivo de circuito semi cerrado (pSCR)</h4>
<h4 id="S_sSCR_dives">5.7.3. Inmersiones con rebreather pasivo de circuito semi cerrado (pSCR)</h4>
<div class="admonitionblock">
<table><tr>
<td class="icon">
@ -2727,7 +2901,7 @@ naranja).</td>
</div>
</div>
<div class="sect3">
<h4 id="S_CCR_dives">5.6.4. Inmersiones con rebreather de circuito cerrado (CCR)</h4>
<h4 id="S_CCR_dives">5.7.4. Inmersiones con rebreather de circuito cerrado (CCR)</h4>
<div class="admonitionblock">
<table><tr>
<td class="icon">
@ -3138,10 +3312,13 @@ Entre ellas se incluyen: Momento de tiempo en la inmersión (indicado por un
ascenso y descenso, el Consumo de aire en superficie (CAS), la presión
parcial de oxigeno, la profundidad máxima operativa de la mezcla (POM o MOD),
la profundidad equivalente a aire (PEA o EAD), la profundidad narcótica equivalente
(PNE o END), la profundidad equivalenta a la densidad del aire (EADD), los
requisitos descompresivos en ese instante de tiempo (Deco), el Tiempo hasta la
superficie (TTS), el techo calculado así como el techo calculado para varios
compartimentos de tejidos de Bühlmann.</p></div>
(PNE o END), la profundidad equivalente a la densidad del aire (EADD), los
requisitos descompresivos en ese instante de tiempo (Deco), el GF en
superficie (una medida de la carga de gas inerte en el cuerpo del buzo
definida como el exceso sobre la presión en superficie normalizada tal que la
la presión máxima permitida en superficie, el valor M, corresponde al 100%), el
Tiempo hasta la superficie (TTS), el techo calculado así como el techo
calculado para varios compartimentos de tejidos de Bühlmann.</p></div>
<div class="paragraph"><p>El usuario tiene control sobre varios de los datos que se muestran en la Caja
de Información, mostrados como cuatro de los botones en la columna a la
izquierda del panel del perfil. Estos son:</p></div>
@ -3182,6 +3359,19 @@ Los TTS mayores a 2 horas resultan muy imprecisos y Subsurface solo indicará
<div class="admonitionblock">
<table><tr>
<td class="icon">
<img src="images/icons/GFLow.jpg" alt="Note" />
</td>
<td class="content">Muestra información de deco. Si está activado, la caja de información muestra
el GF en superficie y los techos para los compartimentos de tejidos
individuales. El GF en superficie es un indicador de hasta que punto la
presión parcial de nitrógeno en la sangre excede la presión parcial que se
necesita para llegar a superficie con seguridad. Un GF en superficie superior
al 100% significa que emerger no es seguro.</td>
</tr></table>
</div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
<img src="images/icons/SAC.jpg" alt="Note" />
</td>
<td class="content">Pulsar en este botón hace que se muestre en la Caja de Información el
@ -3481,6 +3671,13 @@ ha eliminado a través de la respiración por lo que, aunque el buceador
técnicamente encontrara un techo, la inmersión aún no requiere explícitamente
una parada de descompresión. Esta característica permite a los ordenadores de
buceo ofrecer tiempos de fondo más largos.</p></div>
<div class="paragraph"><p>Estríctamente hablando, el techo verde calculado es solo una representación directa
de las cargas de gas inerte de los tejidos simulados y es independiente de
cualquier velocidad de ascenso asumida. Indica la profundidad mínima permitida
por el modelo de descompresión en ese instante de tiempo para unas cargas de
gas determinadas y no es una afirmación acerca de una posible tabla de ascenso
para el resto de la inmersión. Para obtener esta última utiliza la opción
"Editar inmersión en el Planificador_" en el menú Registro.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
@ -3712,6 +3909,87 @@ un marcador preexistente, el menú se extiende añadiendo opciones para permitir
el borrado del marcador o permitir ocultar todos los marcadores de ese tipo.</p></div>
</div>
</div>
<div class="sect2">
<h3 id="S_Filter">6.5. Filtrar la lista de inmersiones</h3>
<div class="paragraph"><p>Los buceos de la <strong>Lista de Inmersiones</strong> se pueden filtrar seleccionando solo
algunos de ellos basándonos en atributos como etiquetas, puntos de buceo,
compañero o divemaster. Por ejemplo, el filtrado nos permite ver las
inmersiones de un año en concreto en cierto punto de buceo, o, por otro lado,
las inmersiones en cuevas con determinado compañero. El filtrado puede hacerse
en base a cualquier dato del <em>Panel de Información</em>.</p></div>
<div class="paragraph"><p>Para abrir el filtro, seleccionamos <em>Registro &#8594; Filtrar lista de inmersiones</em>
desde el menú principal. Esto reemplazará el <em>Panel Mapa</em> por el <em>Panel
Filtro</em>. La barra superior contiene el número de buceos que satisfacen las
selecciones efectuadas en el filtro (ver imagen a continuación).</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/FilterWindowBar.jpg" alt="Figura: Barra de la ventana de filtrado" />
</div>
</div>
<div class="paragraph"><p>Al abrirse, el filtro contiene valores por defecto que incluyen todas los
buceos de la <em>Lista de Inmersiones</em>. Fíltrala cambiando algunos de los valores
por defecto del panel o tecleando valores concretos o palabras en cualquiera
de los campos de texto. Por ejemplo, en la imagen a continuación se muestran
inmersiones en circuito abierto, con traje seco, en una ubicación específica
(Simonstad). No hay botón para activar la acción de filtrado: el hecho de
teclear en uno de los campos de texto o especificar un rango en cualquiera de
los campos, efectúa automáticamente el filtrado.</p></div>
<div class="paragraph"><p>Durante el filtrado, el modo de buceo (Circuito abierto, CCR, pSCR, Apnea) se
añade a la lista de etiquetas de una inmersión, lo que permite seleccionar
solo determinados tipos de buceo (p.e. CCR) en el filtro. Esto resulta útil
para buceadores con reciclador o apneistas que también buceen en circuito
abierto.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/FilterPanel.jpg" alt="Figura: Panel de filtrado" />
</div>
</div>
<div class="paragraph"><p>El criterio de filtrado puede ser cualquiera de los siguientes:</p></div>
<div class="paragraph"><p>1) Usar varios campos de texto en el panel de filtrado produce una operación
"AND" en los atributos. Por ejemplo, al teclear "Peter" en el atributo
Personas y "Sipadan" en el atributo Ubicación se obtiene una lista de
inmersiones que contienen a Peter y a Sipadan.</p></div>
<div class="paragraph"><p>2) En un atributo único, el criterio "All of" implementa un operador "AND". En
la imagen a continuación, para el atributo <em>Personas</em>, la lista de inmersiones
contiene los buceos en los que aparecen Bob Smith Y Stephan Schultz como
compañeros/divemaster en base a la información de personas del <em>Panel
Información</em>.</p></div>
<div class="paragraph"><p>3) El criterio "Any of" implementa una operación "OR". Para el atributo
<em>Ubicación</em> de la imagen a continuación, la lista filtrada contiene las
inmersiones efectuadas en Simonstad "O" en Hout Bay.</p></div>
<div class="paragraph"><p>4) El criterio "None of" implementa una operación "NOT". Para el atributo
<em>Traje</em> en la imagen a continuación, la lista de inmersiones EXCLUYE todas
las inmersiones en las que se usó traje seco,</p></div>
<div class="paragraph"><p>5) Campo vacío. El resultado de los campos vacíos para <em>Notas</em> y <em>Etiquetas</em>
en la imagen a continuación, es que estos atributos no se tienen en cuenta
durante el filtrado.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/FilterOptions.jpg" alt="Figura: Opciones de filtrado" />
</div>
</div>
<div class="paragraph"><p>En la parte superior del <em>Panel de Filtrado</em>, la <strong>flecha amarilla hacia
arriba</strong> se usa para reiniciar el filtro y mostrar todos los buceos. El botón
rojo con el aspa blanca se usa para cerrar el panel.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
<img src="./images/icons/important.png" alt="Important" />
</td>
<td class="content">La acción de filtrado solo se puede detener usando el botón "flecha
amarilla hacia arriba" o limpiando manualmente todos los campos de texto.
Cerrar el <em>Panel de filtrado</em> no acaba con la acción de filtrado: la lista
permanece sin cambios. Esto resulta obvio al indicar la barra superior de
<em>Subsurface</em> que solo se están mostrando parte de las inmersiones. Cerrar el
<em>Panel de filtrado</em> reabre el <em>Panel Mapa</em>, permitiendo visualizar las
posiciones de la lista filtrada. Por ejemplo, podemos querer filtrar a Bob
Smith como compañero. Al cerrar el <em>Panel de filtrado</em> se visualizan las
ubicaciones en las que hemos buceado con este compañero. Para reabrir el
<em>Panel de filtrado</em>, en este caso, seleccionamos <em>Registro &#8594; Filtrar lista de
inmersiones</em> desde el <em>Menú Principal</em>.</td>
</tr></table>
</div>
</div>
</div>
</div>
<div class="sect1">
@ -3941,117 +4219,11 @@ selecciona <em>Editar</em> desde el <strong>Menú Principal</strong>, lo que pre
con las posibilidades <em>Deshacer</em> y <em>Rehacer</em>.</p></div>
</div>
</div>
<div class="sect2">
<h3 id="S_Filter">7.5. Filtrar la Lista de Inmersiones</h3>
<div class="paragraph"><p>Los buceos del panel <strong>Lista de inmersiones</strong> pueden filtrarse, esto es, se pueden
seleccionar únicamente algunos de los buceos basándose en sus atributos, p.e.
las etiquetas, el lugar de buceo, el divemaster, compañeros o traje protector.
El filtrado permite, por ejemplo, listar las inmersiones profundas en un punto
determinado o, por el contrario, las inmersiones en cuevas con cierto
compañero.</p></div>
<div class="paragraph"><p>Para abrir el filtrado, seleccionar <em>Registro &#8594; Filtrar la lista de inmersiones</em>
desde el menú principal. Esto abrirá el <em>Panel de filtrado</em> en la parte de arriba
de la ventana de <em>Subsurface</em>. Arriba a la derecha del panel se ubican tres
iconos (ver imagen a continuación).
El <em>Panel de filtrado</em> puede reiniciarse (p.e. limpiar todos los filtros
actuales) seleccionando la flecha amarilla. El <em>Panel de filtrado</em> también puede
minimizarse seleccionando la <strong>flecha verde</strong>. Cuando está minimizado solo se
muestran los tres iconos. El panel puede maximizarse clicando el icono que lo
minimizó. El filtro se cierra y reinicia seleccionando el <strong>botón rojo</strong> con la
cruz blanca.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/Filterpanel.jpg" alt="Figura: Panel de filtrado" />
</div>
</div>
<div class="paragraph"><p>Se pueden utilizar cuatro criterios para filtrar la lista de inmersiones:
las etiquetas, las personas (compañeros/divemasters), punto de inmersión y traje
de buceo, cada uno de los cuales viene representado por una lista seleccionable.
Sobre cada lista hay un segundo nivel de filtrado. Por ejemplo, tecleando "<em>Ba</em>"
en la casilla de texto sobre las ubicaciones, la lista podría quedar reducida a
"<em>Bajo Piles I</em>", "<em>Bajo Piles II</em>" y "<em>Bajo de Testa</em>". Filtrar la lista
permite encontrar rápidamente términos de búsqueda para filtrar la lista de
inmersiones.</p></div>
<div class="paragraph"><p>Para activar el filtrado de la lista de inmersiones, se necesita seleccionar
al menos una casilla en una de las cuatro listas. La lista de inmersiones se
reduce para mostrar solo los buceos que cumplen los criterios seleccionados en
las listas. Las cuatro listas funcionan como un filtro con operadores <em>Y</em>,
<em>Subsurface</em> filtraría, pues, para "<em>cueva</em>" como etiqueta y "<em>José García</em>"
como compañero; pero los filtros dentro de una categoría son inclusivos, esto
es, filtrar por etiquetas con "cueva" y "barco" mostraría todas las inmersiones
en las que aparezcan las etiquetas "cueva" <em>O</em> "barco", solas o conjuntamente.</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="S_ExportLog">8. Exportar el registro de inmersiones o parte del mismo</h2>
<div class="sectionbody">
<div class="paragraph"><p>Hay dos posibilidades de exportar información de buceo desde <em>Subsurface</em>:</p></div>
<div class="ulist"><ul>
<li>
<p>
Exportar información de buceo a <em>Facebook</em>
</p>
</li>
<li>
<p>
<a href="#S_Export_other">Exportar información de buceo a otros destinos o formatos</a>
</p>
</li>
</ul></div>
<div class="sect2">
<h3 id="S_Facebook">8.1. Exportar información de buceo a <em>Facebook</em></h3>
<div class="paragraph"><p>La exportación de inmersiones a <em>Facebook</em> se maneja de forma diferente a otros
tipos de exportación porque se requiere una
conexión a esta red social y se necesita un usuario de <em>Facebook</em> y su password.
Si, desde el menú principal, seleccionamos <em>Compartir &#8594; Conectar a &#8594;
Facebook</em> (imagen <strong>A</strong> siguiente), se nos presentará una pantalla de acceso
(imagen <strong>B</strong> a continuación). Introducimos nuestro usuario y password de
<em>Facebook</em>.
Desde la ventana de <em>Subsurface</em> es fácil saber si se tiene una conexión válida
con <em>Facebook</em>. Desde el <strong>Menú principal</strong>, selecciona <em>Compartir</em>
(ver imagen <strong>A</strong> a continuación). Normalmente la opción <em>Facebook</em> está
desactivada, pero, si hay una conexión establecida, la opción está activa y
puede ser seleccionada.
Tras haber establecido una conexión con <em>Facebook</em>, se mostrará un panel con
un mensaje: "<em>Para desconectar Subsurface de tu cuenta de Facebook, utiliza la
entrada del menú 'Compartir'</em>."
Cierra este panel.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/facebook1.jpg" alt="Figure: Facebook login" />
</div>
</div>
<div class="paragraph"><p>Habiendo establecido una conexión a <em>Facebook</em>, transferir un perfil al
historial es fácil.
Selecciona en la <strong>Lista de Inmersiones</strong> de <em>Subsurface</em> el buceo que quieras
transferir; entonces, desde el <strong>Menú</strong> selecciona <em>Compartir &#8594; Facebook</em>,
aparecerá un diálogo en el que se definirá la cantidad de información
adicional que se desea compartir en el historial junto con el perfil (ver imagen
<strong>A</strong>, a continuación). Se necesita proporcionar el nombre de un álbum de <em>Facebook</em>
para poder enviar el perfil de inmersión. Las casillas seleccionables de la
izquierda nos permiten seleccionar la información que vamos a enviar. Esta
información se muestra en la ventana de texto de la derecha (ver imagen <strong>A</strong>
a continuación). El mensaje que se va a enviar se puede editar directamente en
esta ventana de texto. Tras haber elegido la información y verificado lo que se va
a subir, se selecciona el botón <em>OK</em> lo que inicia la transferencia a <em>Facebook</em>.
Unos momentos después aparecerá un mensaje indicando una transferencia correcta.</p></div>
<div class="paragraph"><p>El álbum creado y el post al historial se marcarán como privados. Para que
los amigos puedan ver el post habrá que cambiar los permisos desde un acceso
normal a <em>Facebook</em> desde un navegador o desde la app de <em>Facebook</em>. Aunque
esto suponga un paso de más, los desarrolladores entienden que esta es la mejor
solución para evitar subidas no deseadas en el historial público.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/facebook2.jpg" alt="Figure: Facebook data submission" />
</div>
</div>
<div class="paragraph"><p>Si se considera necesario, cierra la conexión a <em>Facebook</em>, seleccionando
desde el <strong>Menú principal</strong>, <em>Compartir &#8594; Desconectar de &#8594; Facebook</em> (imagen
<strong>B</strong> anterior).</p></div>
</div>
<div class="sect2">
<h3 id="S_Export_other">8.2. Exportar información de buceo a otros destinos o formatos</h3>
<div class="paragraph"><p>Para exportar a otros destinos,
se llega a la función de exportación seleccionando <em>Archivo &#8594; Exportar</em> lo que
despliega el diálogo de exportación. Este diálogo siempre ofrece dos opciones:
@ -4109,6 +4281,20 @@ Universal Dive Data format (UDDF). Ver <a href="http://uddf.org">http://uddf.org
</li>
<li>
<p>
<em>Perfil de Inmersión</em>, que permite compartir facilmente el perfil usando
redes sociales. Esta opción escribe la imagen del perfil de buceo en un
archivo en formato gráfico <em>.PNG</em> en la carpeta indicada en el diálogo
<em>Guardar Archivo</em>. La imagen guardada es exactamente la que se puede ver en
el perfil en la pantalla, así que comprueba que tienes activadas las
opciones correctas de la caja de herramientas del perfil. Si se seleccionan
varias inmersiones las imagenes se escriben en archivos separados. Al
seleccionar la opción <em>Perfil de Inmersión</em> se abre una ventana para elegir
el nombre que queremos asignar a los archivos a los que escribir los
perfiles. Pulsa <em>Guardar</em> tras haber escrito el nombre.
</p>
</li>
<li>
<p>
Formato <em>HTML</em>, en el cual los buceos se guardan en archivos HTML,
visualizables con un navegador de internet.Se soportan la mayoría de navegadores
modernos, pero debe estar activado Javascript. Este archivo <strong>NO</strong> es editable. El
@ -4157,6 +4343,12 @@ Formato <em>TeX</em>, un archivo para imprimir usando el software tipográfico T
<div class="ulist"><ul>
<li>
<p>
<em>LaTeX</em>. Escribe la inmersión a un documento Latex, en el que los ajustes
tipográficos se efectuan automáticamente usando TeX.
</p>
</li>
<li>
<p>
<em>Profundidad de imágenes</em>, que crea un fichero de texto que contiene los
nombres de todos los archivos de imagen o vídeo añadidos a cualquiera de los buceos
seleccionados del la <em>Lista de inmersiones</em>, junto con la profundidad a la
@ -4208,7 +4400,6 @@ Solo exportar lista: Solo se exportará una lista de inmersiones. No se
</ul></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="S_Cloud_access">9. Guardar un diario de <em>Subsurface</em> en la Nube</h2>
<div class="sectionbody">
@ -4558,7 +4749,7 @@ el nombre de dispositivo asignado al ordenador por el sistema operativo.
Ver el <a href="#_apendice_a_informacion_especifica_del_sistema_operativo_para_importar_inmersiones_desde_un_ordenador_de_buceo">APÉNDICE A</a>
para información sobre como hacerlo.</p></div>
<div class="paragraph"><p>Una vez que el ordenador de buceo está al PC con <em>Subsurface</em>, se selecciona
<em>Archivo &#8594; Configurar ordenador de buceo</em> en el menú principal. Si se ha
<em>Archivo &#8594; Cambiar ajustes del ordenador de buceo</em> en el menú principal. Si se ha
indicado el nombre de dispositivo correcto en el campo de texto de la parte
superior, esto abrirá y seleccionará el modelo correcto en el panel de la
izquierda (ver imagen a continuación).</p></div>
@ -5666,7 +5857,15 @@ circuito por la caída de oxígeno en la boquilla del equipo pSCR.</p></div>
<td class="content">Bucear en circuito abierto forma parte amenudo de las inmersiones con pSCR,
porque a pequeñas profundidades la pO<sub>2</sub> en el circuito es demasiado baja. El
cambio de rebreather a circuito abierto y viceversa se indica usando eventos
de "bailout". La imagen a la izquierda muestra un plan con pSCR (utilizando
de "bailout". Hay dos formas de planificar bailouts en inmersiones con
reciclador: 1) Seleccionar la casilla <em>Bailout</em> en la sección <em>Modo de
Inmersión</em> del planificador; en este caso, las necesidades del bailout se
calcularán empezando por el último segmento especificado en la tabla del
planificador. 2) Si el bailout tiene lugar en otro punto de la inmersión (ver
el ejemplo de buceo en cuevas a continuación), el bailout se planifica
manipulando la columna <em>Modo de Inmersión</em> en la tabla <strong>Puntos del
Planificador</strong>.
La imagen a la izquierda muestra un plan con pSCR (utilizando
tres botellas) en el que las partes más superficiales se llevan a cabo usando
EAN50 para poder tener una pO<sub>2</sub> suficiente. La parte profunda se lleva a cabo
usando con EAN31 (bot. 2 en la tabla de gases disponibles, también indicada en
@ -5690,7 +5889,7 @@ la botella en la tabla <strong>Puntos del Planificador de inmersiones</strong> c
en la imagen de la derecha (<strong>B</strong>). El icono del perfil mostrará ahora un evento
de bailout superpuesto con un cambio de botella. Como en el gráfico de la
izquierda, los valores apropiados de pO<sub>2</sub> se muestran en el perfil. Los
volumenes de gas necesarios se encuentran al final del panel <strong>Detalles del
volúmenes de gas necesarios se encuentran al final del panel <strong>Detalles del
Plan de Buceo</strong>.</td>
</tr></table>
</div>
@ -5700,12 +5899,13 @@ Plan de Buceo</strong>.</td>
</div>
</div>
<div class="paragraph"><p>En el caso de un plan de inmersión en aguas abiertas con pSCR, el "peor
escenacio" es, probablemente, una emergencia al final de la parte más profunda
de la inmersión. Crea un segmento de 1 minuto al final de la parte más
profunda del plan. Luego manipula el segmento utilizando las columnas <strong>Modo de
buceo</strong> y <strong>Gas usado</strong>, como en el ejemplo anterior de la cueva. Visita el
ejemplo de emergencia para una inmersión con CCR, a continuación, que utiliza
esta aproximación.</p></div>
escenario" es, probablemente, una emergencia al final de la parte más profunda
de la inmersión y esto puede simularse usando la casilla <em>Bailout</em> del
planificador. Como alternativa, se puede crear un segmento de 1 minuto al final
de la parte más profunda del plan. Luego manipula el segmento utilizando las
columnas <strong>Modo de buceo</strong> y <strong>Gas usado</strong>, como en el ejemplo anterior de la cueva.
Visita el ejemplo de emergencia para una inmersión con CCR, a continuación, que
utiliza esta aproximación.</p></div>
</div>
</div>
<div class="sect2">
@ -5743,12 +5943,15 @@ gas para un segmento en CCR, por tanto, lo normal es obtener valores de 0 l.</p>
<td class="icon">
<img src="images/CCR_b1.jpg" alt="Note" />
</td>
<td class="content">A menudo es necerario planificar casos de "peor escenario" para asegurarnos de
<td class="content">A menudo es necesario planificar casos de "peor escenario" para asegurarnos de
que dispondremos de gas suficiente, en caso de emergencia, para alcanzar la
superficie, teniendo en cuenta la descompresión. Esto se hace definiendo
segmentos de 1 minuto al final de la parte de fondo de la inmersión, como se
muestra en la imagen de la izquierda donde se planifica una inmersión a 40m
durante 21 minutos.</td>
superficie, teniendo en cuenta la descompresión. Esto se hace: 1)
seleccionando la casilla <em>Bailout</em> del planificador (el bailout se calculará
empezando en el último segmento de inmersión definido en la tabla); 2)
Definiendo segmentos de 1 minuto al final de la parte de fondo de la inmersión,
como se muestra en la imagen de la izquierda donde se planifica una inmersión a
40m durante 21 minutos; 3) Cambiando a un gas en circuito abierto en cualquier
segmento de la tabla de <em>Puntos del Planificador</em>.</td>
</tr></table>
</div>
<div class="admonitionblock">
@ -7876,7 +8079,7 @@ sido sobrescritos.</p></div>
<div id="footer">
<div id="footer-text">
Last updated
2018-09-23 17:52:40 PDT
2024-02-08 08:36:54 PST
</div>
</div>
</body>

View File

@ -61,7 +61,7 @@ web]. Por favor, comenta los problemas que tengas con este programa enviando un
mail a mailto:subsurface@subsurface-divelog.org[nuestra lista de correo] e informa de
fallos en https://github.com/Subsurface/subsurface/issues[nuestro bugtracker].
Para instrucciones acerca de como compilar el software y (en caso necesario)
sus dependencias, por favor, consulta el archivo INSTALL incluido con el código
sus dependencias, por favor, consulta el archivo INSTALL.md incluido con el código
fuente.
*Audiencia*: Buceadores recreativos, Buceadores en apnea, Buceadores técnicos,
@ -727,6 +727,7 @@ para seguir los cambios en el entorno. Si fuera necesario, no hay que teclear
las unidades de temperatura: _Subsurface_ las suministra automáticamente de
acuerdo con las _Preferencias_ (métricas o imperiales).
[[S_locations]]
*Ubicación*:
[icon="images/icons/warning2.png"]
[WARNING]

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.9" />
<meta name="generator" content="AsciiDoc 10.1.2" />
<title></title>
<style type="text/css">
/*
@ -16,7 +17,7 @@
*/
* { padding: 0; margin: 0; }
img { border: 0; }
img { border: 0; margin: 15px; max-width:90% }
/*** Layout ***/
@ -77,12 +78,12 @@ body { font-family: Verdana, sans-serif; }
#footer { font-size: 0.8em; }
h2, h3, h4, h5, .title { font-family: Arial, sans-serif; }
h2 { font-size: 1.5em; }
h2 { font-size: 160%; }
.sectionbody { font-size: 0.85em; }
.sectionbody .sectionbody { font-size: inherit; }
h3 { font-size: 159%; } /* 1.35em */
h4 { font-size: 141%; } /* 1.2em */
h5 { font-size: 118%; } /* 1em */
h3 { font-size: 150%; } /* 1.35em */
h4 { font-size: 140%; } /* 1.2em */
h5 { font-size: 130%; } /* 1em */
.title { font-size: 106%; /* 0.9em */
font-weight: bold;
}
@ -525,7 +526,7 @@ problème, vous pouvez envoyer un e-mail sur
<a href="mailto:subsurface@subsurface-divelog.org">notre liste de diffusion</a> et
rapportez les bogues sur <a href="http://trac.hohndel.org">notre bugtracker</a>. Pour
des instructions de compilation du logiciel et (si besoin) de ses
dépendances, merci de consulter le fichier INSTALL inclus dans les sources
dépendances, merci de consulter le fichier INSTALL.md inclus dans les sources
logicielles.</p></div>
<div class="paragraph"><p><strong>Public</strong> : Plongeurs loisirs, apnéistes, plongeurs Tek et plongeurs
professionnels</p></div>
@ -576,7 +577,7 @@ meilleur manière qui soit, il est important d&#8217;avoir des informations sur
utilisateurs. À l&#8217;ouverture de <em>Subsurface</em> après avoir utilisé le logiciel
pendant une semaine environ, une fenêtre de sondage apparait. Cela est
complètement optionnel et l&#8217;utilisateur contrôle quelles informations sont
envoyées ou non à l'équipe de développement de <em>Subsurface</em>. Toutes les
envoyées ou non à l&#8217;équipe de développement de <em>Subsurface</em>. Toutes les
données que l&#8217;utilisateur envoie sont utiles et ne seront utilisées que pour
les futurs développements et modifications du logiciel pour coller au mieux
aux besoins des utilisateurs de <em>Subsurface</em>. Si vous complétez le sondage
@ -592,7 +593,7 @@ envoyer un nouveau sondage en démarrant <em>Subsurface</em> avec l&#8217;option
<div class="sectionbody">
<div class="paragraph"><p>La fenêtre <em>Subsurface</em> est généralement divisée en 4 panneaux avec un <strong>Menu
principal</strong> (Fichier Édition Importer Journal Vue Partager Aide) en haut de
la fenêtre (pour Windows et Linux) ou en haut de l'écran (pour Mac et Ubuntu
la fenêtre (pour Windows et Linux) ou en haut de l&#8217;écran (pour Mac et Ubuntu
Unity). Les quatre panneaux sont :</p></div>
<div class="paragraph"><p>La <strong>liste des plongées</strong> en bas à gauche, affichant toutes les plongées du
journal (carnet) de plongées de l&#8217;utilisateur. Une plongée peut être
@ -602,7 +603,7 @@ d&#8217;une plongée à l&#8217;autre. La <strong>liste des plongées</strong> e
manipuler un journal (carnet) de plongée.</p></div>
<div class="paragraph"><p>La <strong>carte de plongée</strong> en bas à droite, affiche les sites de plongées de
l&#8217;utilisateur, sur une carte mondiale et centrée sur le site de la dernière
plongée sélectionnée dans la <strong>liste des plongées</strong>. L'échelle de la carte
plongée sélectionnée dans la <strong>liste des plongées</strong>. L&#8217;échelle de la carte
peut être augmentée ou réduite.</p></div>
<div class="paragraph"><p>Les <strong>informations</strong> en haut à gauche, fournissent des informations détaillées
sur la plongée sélectionnée dans la <strong>liste des plongées</strong>, dont des
@ -632,7 +633,7 @@ plongées sélectionnées).</p></div>
<div class="paragraph"><p>Décider quels panneaux sont affichés, parmi les 4, en sélectionnant l&#8217;option
<strong>Vue</strong> dans le menu principal. Cette fonctionnalité permet plusieurs choix
d&#8217;affichage :</p></div>
<div class="paragraph"><p><strong>Tout</strong> : affiche les quatre panneaux tels que sur la capture d'écran ci-dessus.</p></div>
<div class="paragraph"><p><strong>Tout</strong> : affiche les quatre panneaux tels que sur la capture d&#8217;écran ci-dessus.</p></div>
<div class="paragraph"><p><strong>Liste des plongées</strong> : affiche uniquement la liste des plongées.</p></div>
<div class="paragraph"><p><strong>Profil</strong> : affiche uniquement le profile de plongée de la plongée sélectionnée.</p></div>
<div class="paragraph"><p><strong>Info</strong> : affiche uniquement les notes de plongées de la dernière plongée sélectionnée et les statistiques pour
@ -761,7 +762,7 @@ doit être enregistré sur le disque ou non.</p></div>
<div class="paragraph"><p>Le <strong>Profil de plongée</strong> (une représentation graphique de la profondeur d&#8217;une
plongée en fonction du temps) est affiché dans le panneau en haut à droite
de la fenêtre de <em>Subsurface</em>. Lorsqu&#8217;il est ajouté manuellement au carnet,
<em>Subsurface</em> affiche un profil de plongée par défaut qui nécessite d'être
<em>Subsurface</em> affiche un profil de plongée par défaut qui nécessite d&#8217;être
modifié pour représenter au mieux la plongée décrite:</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
@ -777,7 +778,7 @@ en haut de la boîte noire d&#8217;information (@ et D). Les unités
ligne séparés par des points de passage (les points blancs sur le profil,
voir ci-dessous). La profondeur par défaut d&#8217;une plongée est de 15m. Si la
prfondeur de votre plongée était de 20m, vous devez glisser le point de
passage approprié jusqu'à 20m. Pour ajouter un point de passage,
passage approprié jusqu&#8217;à 20m. Pour ajouter un point de passage,
double-cliquez sur n&#8217;importe quel segment de la ligne. Pour bouger un point
de passage supplémentaire, glissez-le. Le bouger peut également être réalisé
en le sélectionnant et en utilisant les flèches du clavier. Pour supprimer
@ -831,7 +832,7 @@ de plongée supportés</a>.</p></div>
<td class="icon">
<img src="images/icons/warning2.png" alt="Warning" />
</td>
<td class="content">Certains ordinateurs de plongée consomme plus d'énergie lorsqu&#8217;ils sont en
<td class="content">Certains ordinateurs de plongée consomme plus d&#8217;énergie lorsqu&#8217;ils sont en
mode Communication PC. <strong>Ceci peut consommer une grande partie de la
batterie de votre ordinateur de plongée</strong>. Nous recommandons à l&#8217;utilisateur
de vérifier que l&#8217;ordinateur de plongée est chargé lorsqu&#8217;il est connecté au
@ -843,7 +844,7 @@ au port USB.</td>
</tr></table>
</div>
<div class="paragraph"><p>Pour importer les informations depuis un ordinateur de plongée vers un
ordinateur utilisant <em>Subsurface</em>, les deux pièces d'équipement doivent
ordinateur utilisant <em>Subsurface</em>, les deux pièces d&#8217;équipement doivent
communiquer entre elles. Ceci implique la configuration des ports de
communication (ou point de montage) de l&#8217;ordinateur sur lequel tourne
<em>Subsurface</em> qui communique avec l&#8217;ordinateur de plongée. Pour configurer
@ -851,8 +852,7 @@ cette communication, les utilisateurs doivent trouver l&#8217;information
appropriée pour renseigner à <em>Subsurface</em> d&#8217;où et comment importer les
informations de
plongée.
<a href="#_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer">Annexe
A</a> donne les informations techniques pour aider l&#8217;utilisateur à configurer
<a href="#appendix_a">Annexe A</a> donne les informations techniques pour aider l&#8217;utilisateur à configurer
ceci pour les différents systèmes d&#8217;exploitation et
<a href="#_appendix_b_dive_computer_specific_information_for_importing_dive_information">Annexe
B</a> contient des informations spécifiques à chaque ordinateur de plongée.</p></div>
@ -908,8 +908,7 @@ La boîte de dialogue propose deux menus déroulants, <strong>Fournisseur</stron
Le menu déroulant <strong>Périphérique ou point de montage</strong> le nom du port USB ou
Bluetooth dont <em>Subsurface</em> a besoin pour communiquer avec l&#8217;ordinateur de
plongée. Le port approprié doit être sélectionné. Consultez
<a href="#_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer">Annexe
A</a> et
<a href="#appendix_a">Annexe A</a> et
<a href="#_appendix_b_dive_computer_specific_information_for_importing_dive_information">Annexe
B</a> pour obtenir des détails techniques sur la façon de trouver des
informations sur le port approprié à chaque ordinateur de plongée et, dans
@ -1035,17 +1034,15 @@ Le câble de connexion est-il fautif ? Le câble fonctionne-t-il avec d&#8217;au
<li>
<p>
Consultez
<a href="#_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer">Annexe
A</a> pour être certain que le point de montage correct a été spécifié (voir
<a href="#appendix_a">Annexe A</a> pour être certain que le point de montage correct a été spécifié (voir
ci-dessus).
</p>
</li>
<li>
<p>
Sur les systèmes d&#8217;exploitation de type Unix, l&#8217;utilisateur a-t-il les
droits d'écriture sur le port USB? Si non, consultez
<a href="#_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer">Annexe
A</a>
droits d&#8217;écriture sur le port USB? Si non, consultez
<a href="#appendix_a">Annexe A</a>
</p>
</li>
</ul></div>
@ -1142,7 +1139,7 @@ start by scanning for Bluetooth devices from an empty list (on the desktop)
of Bluetooth devices. Once <em>Subsurface</em> has recognised the Bluetooth dive
computer, subsequent divelog downloads are likely to be simple.</p></div>
<div class="paragraph"><p>Sur les plateformes <em>Linux</em> ou -MacOS_, le nom de l&#8217;ordinateur utilisant
Subsurface_ et son adresse Bluetooth sont affichées du côté droit. L'état
Subsurface_ et son adresse Bluetooth sont affichées du côté droit. L&#8217;état
(allumé/éteint) de l&#8217;adaptateur Bluetooth est affiché sous l&#8217;adresse et peut
être modifié en cliquer sur la case <em>Allumer/éteindre</em>. Si l&#8217;adresse
Bluetooth n&#8217;est pas affichée, <em>Subsurface</em> ne détecte pas le périphérique
@ -1221,10 +1218,10 @@ ci-dessus). Si l&#8217;ordinateur de plongée est connecté à Subsurface pour l
première fois, il est possible que Subsurface demande un nombre ou un code
PIN. Entrez le code indiqué dans le manuel utilisateur de l&#8217;ordinatuer de
plongée. Un code ou PIN de 0000 est souvent le code par défaut.</p></div>
<div class="paragraph"><p>L'étape de jumelage est vérifiée et réalisée automatiquement durant le
<div class="paragraph"><p>L&#8217;étape de jumelage est vérifiée et réalisée automatiquement durant le
processus de téléchargement. Si les périphériques n&#8217;ont pas encore été
jumelés, le système demandera l&#8217;autorisation de le faire et affichera un
message sur la partie droite de l'écran. <em>Ajouter un périphérique</em>, <em>Tapez
message sur la partie droite de l&#8217;écran. <em>Ajouter un périphérique</em>, <em>Tapez
pour configurer votre périphérique</em>. <em>Toujours autoriser le jumelage. Après
la sélection d&#8217;un item découvert, cliquez sur le bouton
_Enregistrer</em>. Enfin, sélectionnez le bouton "Télécharger_ dans la boîte de
@ -1278,7 +1275,7 @@ avec <em>Subsurface</em>.</td>
</div>
<div class="sect3">
<h4 id="S_DeviceNames">5.2.3. Changement du nom d&#8217;un ordinateur de plongée</h4>
<div class="paragraph"><p>Il peut être nécessaire d'établir une distinction entre différents
<div class="paragraph"><p>Il peut être nécessaire d&#8217;établir une distinction entre différents
ordinateurs de plongée utilisés pour télécharger des données de plongée vers
<em>Subsurface</em>. Par exemple, si l&#8217;ordinateur d&#8217;un équipier provient du même
fabriquant et est dun même modèle que le votre et que les données sont
@ -1349,7 +1346,7 @@ dans des boîtes de texte à droite de l&#8217;heure de début de plongée. De n
renseignent la température de l&#8217;eau, et cette boîte peut contenir cette information.
Si la température de l&#8217;air n&#8217;est pas renseignée par l&#8217;ordinateur de plongée, la première température pour l&#8217;eau
peut être utilisée comme température de l&#8217;air. En général, elle est proche de la température de l&#8217;air.
S&#8217;il est nécessaire d'éditer ces informations, seule une valeur est nécessaire, l&#8217;unité de température étant
S&#8217;il est nécessaire d&#8217;éditer ces informations, seule une valeur est nécessaire, l&#8217;unité de température étant
automatiquement fournie par
<em>Subsurface</em> (sur base des <em>Préférences</em>, les unités métriques ou impériales
seront utilisées).</p></div>
@ -1365,7 +1362,7 @@ plongée. Les informations de plongée dans les onglets <strong>Notes</strong>
informations sur le site de plongée. Enregistrez toutes les autres
informations (p. ex. instructeur, équipier, équipement, notes à propos de la
plongée) en sélectionnant <em>Appliquer les modifications</em> dans l&#8217;onglet
<strong>Notes</strong> AVANT d'éditer les informations sur le site de plongée. Ensuite,
<strong>Notes</strong> AVANT d&#8217;éditer les informations sur le site de plongée. Ensuite,
nommez le site de plongée dans la bpîte de texte <em>Lieu</em> dans l&#8217;onglet
<strong>Notes</strong>.</td>
</tr></table>
@ -1488,11 +1485,11 @@ Une sélection automatique est disponible.
Certains utilisateurs de vêtement étanche peuvent utiliser ce champ pour enregistrer quelle ensemble de
combinaison et souris ils ont utilisé.</p></div>
<div class="paragraph"><p><strong>Évaluation</strong>: attribue une évaluation subjective à une plongée sur une
échelle de 5 points en cliquant sur l'étoile correspondante.</p></div>
échelle de 5 points en cliquant sur l&#8217;étoile correspondante.</p></div>
<div class="paragraph"><p><strong>Visibilité</strong>: attribue une évaluation de la visibilité à une plongée sur une
échelle de 5 points en cliquant sur l'étoile correspondante.</p></div>
échelle de 5 points en cliquant sur l&#8217;étoile correspondante.</p></div>
<div class="paragraph"><p><strong>Étiquettes</strong>: il est possible de définir ici des étiquettes qui décrivent le
type de plongée (séparées par des virgules). Des exemples courants d'étiquettes sont bateau,
type de plongée (séparées par des virgules). Des exemples courants d&#8217;étiquettes sont bateau,
plongée dérivante, exercice, grotte, etc.
<em>Subsurface</em> contient de nombreuses étiquettes. En commençant à taper une étiquette, <em>Subsurface</em> liste
les étiquettes correspondant à la frappe. Par exemple, en entrant
@ -1515,7 +1512,7 @@ message dans la boîte bleue en haut du panneau:</p></div>
<img src="images/BlueEditBar_f22.jpg" alt="FIGURE: Blue edit bar" />
</div>
</div>
<div class="paragraph"><p>indique que l'équipement a été édité. C&#8217;est une partie hautement interactive
<div class="paragraph"><p>indique que l&#8217;équipement a été édité. C&#8217;est une partie hautement interactive
de <em>Subsurface</em> et les informations sur les blocs et les gaz (entrées ici)
déterminent le comportement du <strong>Profil de plongée</strong> (panneau en haut à
droite).</p></div>
@ -1892,7 +1889,7 @@ not currently supported on Mac.</p></div>
your system before building: <em>glib2.0</em> and <em>mdbtools</em> (see below).</p></div>
<div class="paragraph"><p>In addition, a web service is available for divelog convertions from
SmartTrak to <em>Subsurface</em> (see below).</p></div>
<div class="paragraph"><p>N&#8217;hésitez pas à contacter l'équipe de développement de <em>Subsurface</em> via
<div class="paragraph"><p>N&#8217;hésitez pas à contacter l&#8217;équipe de développement de <em>Subsurface</em> via
<a href="mailto:subsurface@subsurface-divelog.org">notre liste de diffusion</a> pour de
l&#8217;aide à l&#8217;importation des lofs <em>SmartTrak</em>.</p></div>
<div class="sect4">
@ -3192,7 +3189,7 @@ profondeur à un moment précis de la plongée.</p></div>
<img src="images/icons/scale.jpg" alt="Note" />
</td>
<td class="content">Dans certains cas, le profil de plongée ne remplit pas toute la zone du
panneau <strong>Profil de plongée</strong>. Cliquer sur le bouton <strong>Ajuster l'échelle du
panneau <strong>Profil de plongée</strong>. Cliquer sur le bouton <strong>Ajuster l&#8217;échelle du
graphique</strong> dans la barre d&#8217;outils sur la gauche du profil de plongée
augmente la taille du profil de plongée pour remplir la zone du panneau.</td>
</tr></table>
@ -3237,8 +3234,8 @@ panel. These are:</p></div>
<td class="content">Affiche la <strong>Profondeur maximale d&#8217;utilisation (MOD)</strong> d&#8217;une plongée, en
fonction du mélange gazeux utilisé. La MOD dépend de la concentration en
oxygène du gaz respiré. Pour l&#8217;air (21% d&#8217;oxygène), il vaut envuron 57m si
une pO<sub>2 maximale de 1.4 est choisie dans la section <strong>Préférences</strong>
(sélectionnez <em>Fichier &#8594; Préférences &#8594; Profil</em> et éditez le champ <em>pO</sub>2
une pO<sub>2</sub> maximale de 1.4 est choisie dans la section <strong>Préférences</strong>
(sélectionnez <em>Fichier &#8594; Préférences &#8594; Profil</em> et éditez le champ <em>pO<sub>2</sub>
dans le calcul de MOD</em>). En plongeant sous la MOD, il y a un risque
important d&#8217;exposition aux dangers liés à la toxicité de l&#8217;oxygène.</td>
</tr></table>
@ -4049,66 +4046,13 @@ those dives that have either one OR both of these tags.</p></div>
<div class="ulist"><ul>
<li>
<p>
Exporter les informations de plongée vers <em>Facebook</em>
</p>
</li>
<li>
<p>
<a href="#S_Export_other">Exporter des informations de plongée vers d&#8217;autres
destinations ou formats</a>
</p>
</li>
</ul></div>
<div class="sect2">
<h3 id="S_Facebook">8.1. Export des informations de plongée vers <em>Facebook</em></h3>
<div class="paragraph"><p>L&#8217;export des plongées vers <em>Facebook</em> est géré différemment des autres types
d&#8217;export car une connexion vers <em>Facebook</em> est nécessaire, nécessitant un
identifiant et un mot de passe. À partir du menu principal, sélectionnez
<em>Partager sur &#8594; Connecter à &#8594; Facebook</em> (image <strong>A</strong> ci-dessous). Un écran
de connexion s&#8217;affiche (image <strong>B</strong> ci dessous). Entrez l&#8217;identifiant et le
mot de passe <em>Facebook</em>. Depuis la fenêtre <em>Subsurface</em>, il est facile de
vérifier si <em>Subsurface</em> a une connection valide vers <em>Facebook</em> : Depuis le
"Menu principal", sélectionnez <em>Partager sur</em> (image <strong>A</strong>
ci-dessous). Normalement, l&#8217;option <em>Facebook</em> est grisée. Mais si une
connection vers <em>Facebook</em> existe, cette option est active (c&#8217;est à dire
écrit en noir et sélectionnable).</p></div>
<div class="paragraph"><p>Once logged into to <em>Facebook</em> , a panel is shown with a message: "<em>To
disconnect Subsurface from your Facebook account, use the <em>Share on</em> menu
entry</em>." Close this message panel.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/facebook1.jpg" alt="Figure: Facebook login" />
</div>
</div>
<div class="paragraph"><p>Une fois qu&#8217;une connexion à <em>Facebook</em> est établie, transférer un profil de
plongée vers <em>Facebook</em> est facile. Dans le panneau <strong>Liste des plongées</strong> de
<em>Subsurface</em>, sélectionnez la plongée à transférer. Ensuite, à partir du
<strong>menu principal</strong>, sélectionnez <em>Partager sur &#8594; Facebook</em>. Une fenêtre
s&#8217;affiche, pour déterminer quelles informations seront transférées avec le
profil de plongée (image <strong>A</strong> ci-dessous). Pour transférer un profil de
plongée vers <em>Facebook</em>, le nom d&#8217;un album <em>Facebook</em> doit être fourni. Les
cases à cocher sur la partie gauche permettent de sélectionner des
informations supplémentaires à transférer avec le profil de plongée. Ces
informations sont affichées dans le champs de texte sur la partie droite du
panneau. (image <strong>A</strong> ci dessous). Personnalisez le message qui sera envoyé
avec le profil de plongée en modifiant les informations. Une fois les
informations supplémentaires ajoutées et vérifiées, sélectionner le bouton
<em>OK</em> qui effectue le transfert vers <em>Facebook</em>. Après le transfert, une
fenêtre de confirmation apparait ,indiquant le succès du transfert.</p></div>
<div class="paragraph"><p>À la fois l&#8217;album créé et la publication sur votre ligne temporelle seront
marquées comme privés. Pour que vos amis puissent la voir, connectez-vous à
<em>Facebook</em> depuis un navigateur ou l&#8217;application Facebook et modifiez les
permissions.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/facebook2.jpg" alt="Figure: Facebook data submission" />
</div>
</div>
<div class="paragraph"><p>If required, then close the <em>Facebook</em> connection by selecting, from the
<strong>Main Menu</strong>, <em>Share on &#8594; Disconnect from &#8594; Facebook</em> (image <strong>B</strong> above).</p></div>
</div>
<div class="sect2">
<h3 id="S_Export_other">8.2. Exporter des informations de plongée vers d&#8217;autres destinations ou formats</h3>
<h3 id="S_Export_other">8.1. Exporter des informations de plongée vers d&#8217;autres destinations ou formats</h3>
<div class="paragraph"><p>For non-<em>Facebook exports</em>, the export function can be found by selecting
<em>File &#8594; Export</em>, which brings up the Export dialog. This dialog always
gives two options: save ALL dives, or save only the dives selected in <strong>Dive
@ -4600,7 +4544,7 @@ ces ordinateurs de plongée peuvent être lues et modifiées. Pour commencer,
assurez vous que les pilotes pour votre ordinateur de plongée sont installés
(également nécessaire pour télécharger les plongées) et que le nom de
périphérique de l&#8217;ordinateur de plongée est connu. Voir
<a href="#_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer">ANNEXE A</a> pour plus d&#8217;informations sur la manière de procéder.</p></div>
<a href="#appendix_a">ANNEXE A</a> pour plus d&#8217;informations sur la manière de procéder.</p></div>
<div class="paragraph"><p>Une fois que l&#8217;ordinateur de plongée est connecté à <em>Subsurface</em>,
sélectionner <em>Fichier &#8594; Configurer l&#8217;ordinateur de plongée</em>, à partir du
menu principal. Sélectionner le nom du périphérique (ou le point de montage)
@ -5035,7 +4979,7 @@ L&#8217;utilisateur planifie des plongées dans les limites de sa certification.
<li>
<p>
La planification de plongée se base sur les caractéristiques d&#8217;une <em>personne
normale</em> et ne peut compenser les caractéristiques physiologiques, l'état de
normale</em> et ne peut compenser les caractéristiques physiologiques, l&#8217;état de
santé, l&#8217;historique personnel et les caractéristiques du mode de vie.
</p>
</li>
@ -5059,7 +5003,7 @@ Un utilisateur qui n&#8217;est pas absolument certain d&#8217;un des prérequis
</ul></div>
</div></div>
<div class="sect2">
<h3 id="_l_écran_du_planificateur_de_plongée_em_subsurface_em">14.1. L'écran du planificateur de plongée <em>Subsurface</em></h3>
<h3 id="_l_8217_écran_du_planificateur_de_plongée_em_subsurface_em">14.1. L&#8217;écran du planificateur de plongée <em>Subsurface</em></h3>
<div class="paragraph"><p>Like the <em>Subsurface</em> dive log, the planner screen is divided into several
sections (see image below). The <strong>setup</strong> parameters for a dive are entered
into the sections on the left hand and bottom side of the screen. They are:
@ -6162,18 +6106,7 @@ The Edit option allows one to undo or redo an action, e.g. deleting dives.
</ul></div>
</div>
<div class="sect2">
<h3 id="_share_on">16.6. Share on</h3>
<div class="ulist"><ul>
<li>
<p>
<a href="#S_Facebook"><em>Facebook</em></a> - Partager la plongée sélectionnée sur votre
Facebook.
</p>
</li>
</ul></div>
</div>
<div class="sect2">
<h3 id="_aide">16.7. Aide</h3>
<h3 id="_aide">16.6. Aide</h3>
<div class="ulist"><ul>
<li>
<p>
@ -6205,7 +6138,7 @@ The Edit option allows one to undo or redo an action, e.g. deleting dives.
</div>
</div>
<div class="sect1">
<h2 id="_annexe_a_informations_spécifiques_au_système_d_8217_exploitation_utilisé_pour_importer_les_informations_de_plongées_depuis_un_ordinateur_de_plongée">17. ANNEXE A : informations spécifiques au système d&#8217;exploitation utilisé pour importer les informations de plongées depuis un ordinateur de plongée.</h2>
<h2 id="appendix_a">17. ANNEXE A : informations spécifiques au système d&#8217;exploitation utilisé pour importer les informations de plongées depuis un ordinateur de plongée.</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_assurez_vous_que_les_pilotes_drivers_nécessaires_sont_installés">17.1. Assurez-vous que les pilotes (drivers) nécessaires sont installés</h3>
@ -6315,14 +6248,14 @@ ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver</code></pre>
détecté et connecté sur <code>ttyUSB3</code>. Cette information peut à présent être
utilisée pour les paramètres d&#8217;importation en tant que <code>/dev/ttyUSB3</code> pour
que Subsurface utilise le bon port USB.</p></div>
<div class="paragraph"><p>S&#8217;assurer que l&#8217;utilisateur possède les droits d'écriture sur le port série
<div class="paragraph"><p>S&#8217;assurer que l&#8217;utilisateur possède les droits d&#8217;écriture sur le port série
USB :</p></div>
<div class="paragraph"><p>Sur les systèmes similaires à Unix, les ports USB ne peuvent être accédés
que par des utilisateurs membres d&#8217;un groupe spécial qui peut être <code>dialout</code>
ou <code>uucp</code>. Cela peut être vérifié en listant les permissions associées au
périphérique, par exemple via <code>ls - l /dev/ttyUSB0</code>. Notez que le numéro
dans le nom de fichier dépend du nombre de périphériques USB que vous avez
branchés et peut être ajusté au besoin.Si vous n'êtes pas root, vous n'êtes
branchés et peut être ajusté au besoin.Si vous n&#8217;êtes pas root, vous n&#8217;êtes
peut-être pas membre de ce groupe et ne pouvez donc pas utiliser le port
USB. Admettons que votre nom d&#8217;utilisateur soit <em>johnB</em>.</p></div>
<div class="paragraph"><p>En tant que root, tapez : usermod -a -G dialout johnB+ (utilisateurs
@ -7854,7 +7787,7 @@ salvaged after being overwritten by new dives.</p></div>
<div id="footer">
<div id="footer-text">
Last updated
2018-11-05 09:24:27 CET
2024-02-08 08:51:28 PST
</div>
</div>
</body>

View File

@ -61,7 +61,7 @@ problème, vous pouvez envoyer un e-mail sur
mailto:subsurface@subsurface-divelog.org[notre liste de diffusion] et
rapportez les bogues sur http://trac.hohndel.org[notre bugtracker]. Pour
des instructions de compilation du logiciel et (si besoin) de ses
dépendances, merci de consulter le fichier INSTALL inclus dans les sources
dépendances, merci de consulter le fichier INSTALL.md inclus dans les sources
logicielles.
*Public* : Plongeurs loisirs, apnéistes, plongeurs Tek et plongeurs
@ -365,8 +365,7 @@ cette communication, les utilisateurs doivent trouver l'information
appropriée pour renseigner à _Subsurface_ d'où et comment importer les
informations de
plongée.
xref:_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer[Annexe
A] donne les informations techniques pour aider l'utilisateur à configurer
xref:appendix_a[Annexe A] donne les informations techniques pour aider l'utilisateur à configurer
ceci pour les différents systèmes d'exploitation et
xref:_appendix_b_dive_computer_specific_information_for_importing_dive_information[Annexe
B] contient des informations spécifiques à chaque ordinateur de plongée.
@ -406,8 +405,7 @@ plongée (en tout cas pour ceux qui ne se rechargent pas via USB).
- Le menu déroulant *Périphérique ou point de montage* le nom du port USB ou
Bluetooth dont _Subsurface_ a besoin pour communiquer avec l'ordinateur de
plongée. Le port approprié doit être sélectionné. Consultez
xref:_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer[Annexe
A] et
xref:appendix_a[Annexe A] et
xref:_appendix_b_dive_computer_specific_information_for_importing_dive_information[Annexe
B] pour obtenir des détails techniques sur la façon de trouver des
informations sur le port approprié à chaque ordinateur de plongée et, dans
@ -493,14 +491,12 @@ Vérifiez les éléments suivants:
sont-ils propres ?
- Consultez
xref:_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer[Annexe
A] pour être certain que le point de montage correct a été spécifié (voir
xref:appendix_a[Annexe A] pour être certain que le point de montage correct a été spécifié (voir
ci-dessus).
- Sur les systèmes d'exploitation de type Unix, l'utilisateur a-t-il les
droits d'écriture sur le port USB? Si non, consultez
xref:_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer[Annexe
A]
xref:appendix_a[Annexe A]
Si l'ordinateur utilisant _Subsurface_ ne reconnaît pas l'adaptateur USB en
ne montrant pas le bon nom de périphérique à côté du Point de montage, il
@ -2307,8 +2303,8 @@ panel. These are:
Affiche la *Profondeur maximale d'utilisation (MOD)* d'une plongée, en
fonction du mélange gazeux utilisé. La MOD dépend de la concentration en
oxygène du gaz respiré. Pour l'air (21% d'oxygène), il vaut envuron 57m si
une pO~2 maximale de 1.4 est choisie dans la section *Préférences*
(sélectionnez _Fichier -> Préférences -> Profil_ et éditez le champ _pO~2
une pO~2~ maximale de 1.4 est choisie dans la section *Préférences*
(sélectionnez _Fichier -> Préférences -> Profil_ et éditez le champ _pO~2~
dans le calcul de MOD_). En plongeant sous la MOD, il y a un risque
important d'exposition aux dangers liés à la toxicité de l'oxygène.
@ -2982,8 +2978,6 @@ those dives that have either one OR both of these tags.
Il y a deux façons d'exporter des informations de plongée depuis Subsurface:
- Exporter les informations de plongée vers _Facebook_
- xref:S_Export_other[Exporter des informations de plongée vers d'autres
destinations ou formats]
@ -3305,8 +3299,7 @@ ces ordinateurs de plongée peuvent être lues et modifiées. Pour commencer,
assurez vous que les pilotes pour votre ordinateur de plongée sont installés
(également nécessaire pour télécharger les plongées) et que le nom de
périphérique de l'ordinateur de plongée est connu. Voir
<<_appendix_a_operating_system_specific_information_for_importing_dive_information_from_a_dive_computer,
ANNEXE A>> pour plus d'informations sur la manière de procéder.
<<appendix_a,ANNEXE A>> pour plus d'informations sur la manière de procéder.
Une fois que l'ordinateur de plongée est connecté à _Subsurface_,
sélectionner _Fichier -> Configurer l'ordinateur de plongée_, à partir du
@ -4337,10 +4330,6 @@ des sections de ce manuel traitant des opérations relatives.
- _Ordinateur suivant_ - Passer à l'ordinateur de plongée suivant.
- _Plein écran_ - Passer en mode plein écran.
=== Share on
- <<S_Facebook,_Facebook_>> - Partager la plongée sélectionnée sur votre
Facebook.
=== Aide
- _À propos de Subsurface_ - Affiche un panneau avec le numéro de version de
_Subsurface_ ainsi que les informations de licence.
@ -4354,6 +4343,7 @@ des sections de ce manuel traitant des opérations relatives.
[[appendix_a]]
== ANNEXE A : informations spécifiques au système d'exploitation utilisé pour importer les informations de plongées depuis un ordinateur de plongée.
=== Assurez-vous que les pilotes (drivers) nécessaires sont installés
@ -5301,7 +5291,7 @@ see thumbnails that represent individual videos, _Subsurface_ uses an
external program calle _FFmpeg_. To create thumbnails for videos, do two
things:
Install _FFmpeg_ on the computer that runs _Subsurface_. The program can be
1. Install _FFmpeg_ on the computer that runs _Subsurface_. The program can be
downloaded from the FFmpeg web site:
https://www.ffmpeg.org/download.html. Most Linux distributions ship with an
_ffmpeg_ package and therefore do not need an additional download.

View File

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.10" />
<meta name="generator" content="AsciiDoc 10.1.2" />
<title></title>
<style type="text/css">
/*
@ -17,7 +17,7 @@
*/
* { padding: 0; margin: 0; }
img { border: 0; }
img { border: 0; margin: 15px; max-width:90% }
/*** Layout ***/
@ -78,12 +78,12 @@ body { font-family: Verdana, sans-serif; }
#footer { font-size: 0.8em; }
h2, h3, h4, h5, .title { font-family: Arial, sans-serif; }
h2 { font-size: 1.5em; }
h2 { font-size: 160%; }
.sectionbody { font-size: 0.85em; }
.sectionbody .sectionbody { font-size: inherit; }
h3 { font-size: 159%; } /* 1.35em */
h4 { font-size: 141%; } /* 1.2em */
h5 { font-size: 118%; } /* 1em */
h3 { font-size: 150%; } /* 1.35em */
h4 { font-size: 140%; } /* 1.2em */
h5 { font-size: 130%; } /* 1em */
.title { font-size: 106%; /* 0.9em */
font-weight: bold;
}
@ -514,9 +514,9 @@ moet installeren staat uitgelegd op <em>Downloaden</em> page on the
<a href="https://subsurface-divelog.org/"><em>Subsurface</em> website</a>. Vragen over of problemen met
het programma kunnen bij de ontwikkelaars gemeld worden via email op
<a href="mailto:subsurface@subsurface-divelog.org">onze mailinglijst</a>. Fouten kunnen
ook gemeld worden op <a href="https://github.com/Subsurface-divelog/subsurface/issues">onze bugtracker</a>.
ook gemeld worden op <a href="https://github.com/Subsurface/subsurface/issues">onze bugtracker</a>.
Instructies hoe <em>Subsurface</em> zelf te compileren vanuit de broncode staan ook op
onze website en in het INSTALL bestand in de broncode.</p></div>
onze website en in het INSTALL.md bestand in de broncode.</p></div>
<div class="paragraph"><p><strong>Doelgroep</strong>: Recreatieve duikers, Tec duikers, Apneu duikers,
Professionele duikers.</p></div>
<div id="toc">
@ -2119,7 +2119,7 @@ met een duik, en op deze manier zichtbaar zijn via het <em>Media</em> tabblad va
het <strong>Notities</strong> paneel.</p></div>
</div>
<div class="sect3">
<h4 id="_media_bekijken">5.5.2. Media bekijken</h4>
<h4 id="S_ViewMedia">5.5.2. Media bekijken</h4>
<div class="sidebarblock">
<div class="content">
<div class="paragraph"><p><strong>Zorg ervoor dat thumbnails voor video kunnen worden gemaakt</strong></p></div>
@ -3529,58 +3529,12 @@ grotduik met Bob).</p></div>
<div class="ulist"><ul>
<li>
<p>
Exporteer duikinformatie naar <em>Facebook</em>
</p>
</li>
<li>
<p>
<a href="#S_Export_other">Exporteer duikinformatie naar andere bestemmingen of formaten</a>
</p>
</li>
</ul></div>
<div class="sect2">
<h3 id="S_Facebook">8.1. Exporteer duikinformatie naar <em>Facebook</em></h3>
<div class="paragraph"><p>Exporteren naar <em>Facebook</em> werkt op een andere manier dan andere vormen van
export, met name omdat er een verbinding met <em>Facebook</em> aanwezig moet zijn die
is ingelogd. Selecteer vanuit het hoofdmenu <em>Deel via &#8594; Facebook</em> (zie figuur
<strong>A</strong> hieronder). Een inlogscherm voor <em>Facebook</em> verschijnt (zie figuur
<strong>B</strong> hieronder), en log in bij <em>Facebook</em>.</p></div>
<div class="paragraph"><p>Het is eenvoudig te zien in het hoofdmenu of er een verbinding met <em>Facebook</em>
actief is. In het <em>Deel via</em> menu is de <em>Facebook knop</em> grijs en niet-selecteerbaar
als er geen verbinding is (figuur <strong>A</strong> hieronder).</p></div>
<div class="paragraph"><p>Eenmaal ingelogd op <em>Facebook</em> wordt er een paneel getoond met het bericht:
"Gebruik het <em>Deel via</em> menu om de verbinding van Subsurface met uw Facebook
account te sluiten.". Sluit dit paneel.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/facebook1.jpg" alt="Figuur: Facebook login" />
</div>
</div>
<div class="paragraph"><p>Met de verbinding met <em>Facebook</em> geactiveerd is het overdragen van een duik naar
<em>Facebook</em> eenvoudig. Selecteer eerst de duik in de <strong>Duiklijst</strong>. Selecteer dan
uit het hoofdmenu <em>Deel via &#8594; Facebook</em>. Er verschijnt een dialoog, waarin
aangegeven kan worden welke informatie naast het duikprofiel, moet worden
overgedragen naar <em>Facebook</em> (zie figuur <strong>A</strong> hieronder).</p></div>
<div class="paragraph"><p>Om een duikprofiel naar <em>Facebook</em> te exporteren is de naam van een (foto) album
nodig. De keuzevakjes aan de linker zijde bepalen welke data uit het logboek
eveneens wordt geëxporteerd. Deze verschijnen in het tekst veld aan de rechter zijde,
welke verder handmatig kan worden aangepast. Nadat alles naar wens is ingevuld,
kan via de <em>OK</em> knop de feitelijke export worden gedaan. Als de export gereed is
volgt een bevestiging.</p></div>
<div class="paragraph"><p>Zowel het album als de geëxporteerde profiel (met annotaties) is in <em>Facebook</em> als
privé aangemerkt, en de rechten van de geëxporteerde data moeten dus handmatig
in <em>Facebook</em> worden gezet zoals gewenst.</p></div>
<div class="imageblock" style="text-align:center;">
<div class="content">
<img src="images/facebook2.jpg" alt="Figuur: Facebook data submission" />
</div>
</div>
<div class="paragraph"><p>De verbinding met <em>Facebook</em> kan nu worden afgesloten als dat gewenst is. Gebruik
hiervoor uit het hoofdmenu <em>Deel via &#8594; Verbinding verbreken met &#8594; Facebook</em> (
figuur <strong>B</strong> hierboven).</p></div>
</div>
<div class="sect2">
<h3 id="S_Export_other">8.2. Exporteer duikinformatie naar andere bestemmingen of formaten</h3>
<h3 id="S_Export_other">8.1. Exporteer duikinformatie naar andere bestemmingen of formaten</h3>
<div class="paragraph"><p>Andere dan <em>Facebook</em> exports kunnen gevonden worden door in het hoofdmenu
<em>Bestand &#8594; Exporteren</em> te kiezen. De exporteer dialoog biedt de mogelijkheid
om ALLE, of alleen de in de <strong>Duiklijst</strong> geselecteerde duiken, te exporteren. Kies
@ -5484,17 +5438,7 @@ tegelijktijd.
</ul></div>
</div>
<div class="sect2">
<h3 id="_deel_via">16.6. Deel via</h3>
<div class="ulist"><ul>
<li>
<p>
<a href="#S_Facebook"><em>Facebook</em></a> - Deel de geselecteerde duik op de Facebook tijdslijn.
</p>
</li>
</ul></div>
</div>
<div class="sect2">
<h3 id="_help">16.7. Help</h3>
<h3 id="_help">16.6. Help</h3>
<div class="ulist"><ul>
<li>
<p>
@ -7105,7 +7049,7 @@ alleen als deze nog niet zijn overschreven door nieuwere duiken.</p></div>
<div id="footer">
<div id="footer-text">
Last updated
2018-09-19 08:04:33 PDT
2024-02-08 08:55:00 PST
</div>
</div>
</body>

View File

@ -59,7 +59,7 @@ het programma kunnen bij de ontwikkelaars gemeld worden via email op
mailto:subsurface@subsurface-divelog.org[onze mailinglijst]. Fouten kunnen
ook gemeld worden op https://github.com/Subsurface/subsurface/issues[onze bugtracker].
Instructies hoe _Subsurface_ zelf te compileren vanuit de broncode staan ook op
onze website en in het INSTALL bestand in de broncode.
onze website en in het INSTALL.md bestand in de broncode.
*Doelgroep*: Recreatieve duikers, Tec duikers, Apneu duikers,
Professionele duikers.
@ -1409,6 +1409,7 @@ met een duik, en op deze manier zichtbaar zijn via het _Media_ tabblad van
het *Notities* paneel.
[[S_ViewMedia]]
==== Media bekijken
****
@ -2541,8 +2542,6 @@ grotduik met Bob).
Er zijn twee manieren om duik informatie uit _Subsurface_ te exporteren:
- Exporteer duikinformatie naar _Facebook_
- xref:S_Export_other[Exporteer duikinformatie naar andere bestemmingen of formaten]
[[S_Export_other]]
@ -3772,9 +3771,6 @@ tegelijkertijd gebruiken>> en <<S_MergeDivePlan, combineren van een duik en zij
- _Volgende duikcomputer_ - Kies de volgende duikcomputer.
- _Volledig scherm_ - Volledig gevuld scherm aan en uit.
=== Deel via
- <<S_Facebook,_Facebook_>> - Deel de geselecteerde duik op de Facebook tijdslijn.
=== Help
- _Over Subsurface_ - Toont een paneel met versienummer van _Subsurface_ en
licentievoorwaarden.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

366
INSTALL
View File

@ -1,366 +0,0 @@
Building Subsurface from Source
===============================
Subsurface uses quite a few open source libraries and frameworks to do its
job. The most important ones include libdivecomputer, Qt, libxml2, libxslt,
libsqlite3, libzip, and libgit2.
Below are instructions for building Subsurface
- on some popular Linux distributions,
- MacOSX,
- Windows (cross-building)
- Android (cross-building)
- iOS (cross-building)
Getting Subsurface source
-------------------------
You can get the sources to the latest development version from our git
repository:
git clone http://github.com/Subsurface/subsurface.git
cd subsurface
git submodule init # this will give you our flavor of libdivecomputer
You keep it updated by doing:
git checkout master
git pull -r
git submodule update
Our flavor of libdivecomputer
-----------------------------
Subsurface requires its own flavor of libdivecomputer which is inclduded
above as git submodule
The branches won't have a pretty history and will include ugly merges,
but they should always allow a fast forward pull that tracks what we
believe developers should build against. All our patches are contained
in the "Subsurface-DS9" branch.
This should allow distros to see which patches we have applied on top of
upstream. They will receive force pushes as we rebase to newer versions of
upstream so they are not ideal for ongoing development (but they are of
course easy to use for distributions as they always build "from scratch",
anyway).
The rationale for this is that we have no intention of forking the
project. We simply are adding a few patches on top of their latest
version and want to do so in a manner that is both easy for our
developers who try to keep them updated frequently, and anyone packaging
Subsurface or trying to understand what we have done relative to their
respective upstreams.
Getting Qt5
-----------
We use Qt5 in order to only maintain one UI across platforms.
Qt5.9.1 is the oldest version supported if ONLY building Subsurface
Qt5.12 is the oldest version supported if also building Subsurface-mobile
Most Linux distributions include a new enough version of Qt (and if you are on
a distro that still ships with an older Qt, likely your C compiler is also not
new enough to build Subsurface).
If you need Qt (likely on macOS) or want a newer version than provided by your
Linux distro, you can install a separate version that Subsurface will use.
As of Qt5.15 it has become a lot harder to download and install Qt - you
now need a Qt account and the installer tool has a new space age look and
significantly reduced flexibility.
As of this writing, there is thankfully a thirdparty offline installer still
available:
pip3 install aqtinstall
aqt install -O <Qt Location> 5.15.2 mac desktop
(or whatever version / OS you need). This installer is surprisingly fast
and seems well maintained - note that we don't use this for Windows as
that is completely built from source using MXE.
In order to use this Qt installation, simply add it to your PATH:
PATH=<Qt Location>/<version>/<type>/bin:$PATH
QtWebKit is needed, if you want to print, but no longer part of Qt5,
so you need to download it and compile. In case you just want to test
without print possibility omit this step.
git clone -b 5.212 git://github.com/qt/qtwebkit
mkdir -p qtwebkit/WebKitBuild/Release
cd qtwebkit/WebKitBuild/Release
cmake -DPORT=Qt -DCMAKE_BUILD_TYPE=Release -DQt5_DIR=/<Qt Location>/<version>/<type>/lib/cmake/Qt5 ../..
make install
Other third party library dependencies
--------------------------------------
In order for our cloud storage to be fully functional you need
libgit2 0.26 or newer.
cmake build system
------------------
Our main build system is based on cmake. But qmake is needed
for the googlemaps plugin and the iOS build.
Download from https://cmake.org/download and follow the instructions
to install it or alternatively follow the instruction specific to a
distribution (see build instructions).
Build options for Subsurface
----------------------------
The following options are recognised when passed to cmake:
-DCMAKE_BUILD_TYPE=Release create a release build
-DCMAKE_BUILD_TYPE=Debug create a debug build
The Makefile that was created using cmake can be forced into a much more
verbose mode by calling
make VERBOSE=1
Many more variables are supported, the easiest way to interact with them is
to call
ccmake .
in your build directory.
Building the development version of Subsurface under Linux
----------------------------------------------------------
On Fedora you need
sudo dnf install autoconf automake bluez-libs-devel cmake gcc-c++ git \
libcurl-devel libsqlite3x-devel libssh2-devel libtool libudev-devel \
libusbx-devel libxml2-devel libxslt-devel make \
qt5-qtbase-devel qt5-qtconnectivity-devel qt5-qtdeclarative-devel \
qt5-qtlocation-devel qt5-qtscript-devel qt5-qtsvg-devel \
qt5-qttools-devel qt5-qtwebkit-devel redhat-rpm-config \
bluez-libs-devel libgit2-devel libzip-devel libmtp-devel
Package names are sadly different on OpenSUSE
sudo zypper install git gcc-c++ make autoconf automake libtool cmake libzip-devel \
libxml2-devel libxslt-devel sqlite3-devel libusb-1_0-devel \
libqt5-linguist-devel libqt5-qttools-devel libQt5WebKitWidgets-devel \
libqt5-qtbase-devel libQt5WebKit5-devel libqt5-qtsvg-devel \
libqt5-qtscript-devel libqt5-qtdeclarative-devel \
libqt5-qtconnectivity-devel libqt5-qtlocation-devel libcurl-devel \
bluez-devel libgit2-devel libmtp-devel
On Debian Buster this seems to work
sudo apt install \
autoconf automake cmake g++ git libbluetooth-dev libcrypto++-dev \
libcurl4-openssl-dev libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libtool \
libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make pkg-config \
qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick2 \
qt5-default qt5-qmake qtchooser qtconnectivity5-dev qtdeclarative5-dev \
qtdeclarative5-private-dev qtlocation5-dev qtpositioning5-dev \
qtscript5-dev qttools5-dev qttools5-dev-tools libmtp-dev
In order to build and run mobile-on-desktop, you also need
sudo apt install \
qtquickcontrols2-5-dev qml-module-qtquick-window2 qml-module-qtquick-dialogs \
qml-module-qtquick-layouts qml-module-qtquick-controls2 qml-module-qtquick-templates2 \
qml-module-qtgraphicaleffects qml-module-qtqml-models2 qml-module-qtquick-controls
Package names for Ubuntu 20.04
sudo apt install \
autoconf automake cmake g++ git libbluetooth-dev libcrypto++-dev \
libcurl4-gnutls-dev libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libtool \
libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make pkg-config \
qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick2 \
qt5-default qt5-qmake qtchooser qtconnectivity5-dev qtdeclarative5-dev \
qtdeclarative5-private-dev qtlocation5-dev qtpositioning5-dev \
qtscript5-dev qttools5-dev qttools5-dev-tools libmtp-dev
In order to build and run mobile-on-desktop, you also need
sudo apt install \
qtquickcontrols2-5-dev qml-module-qtquick-window2 qml-module-qtquick-dialogs \
qml-module-qtquick-layouts qml-module-qtquick-controls2 qml-module-qtquick-templates2 \
qml-module-qtgraphicaleffects qml-module-qtqml-models2 qml-module-qtquick-controls
On Raspberry Pi (Raspian Buster and Ubuntu Mate 20.04.1) this seems to work
sudo apt install \
autoconf automake cmake g++ git libbluetooth-dev libcrypto++-dev \
libcurl4-gnutls-dev libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libtool \
libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make pkg-config \
qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick2 \
qt5-default qt5-qmake qtchooser qtconnectivity5-dev qtdeclarative5-dev \
qtdeclarative5-private-dev qtlocation5-dev qtpositioning5-dev \
qtscript5-dev qttools5-dev qttools5-dev-tools libmtp-dev
In order to build and run mobile-on-desktop, you also need
sudo apt install \
qtquickcontrols2-5-dev qml-module-qtquick-window2 qml-module-qtquick-dialogs \
qml-module-qtquick-layouts qml-module-qtquick-controls2 qml-module-qtquick-templates2 \
qml-module-qtgraphicaleffects qml-module-qtqml-models2 qml-module-qtquick-controls
Note that on Ubuntu Mate on the Raspberry Pi, you may need to configure
some swap space in order for the build to complete successfully. There is no
swap space configured by default. See the dphys-swapfile package.
On PCLinuxOS you appear to need the following packages
su -c "apt-get install -y autoconf automake cmake gcc-c++ git libtool \
lib64bluez-devel lib64qt5bluetooth-devel lib64qt5concurrent-devel \
lib64qt5help-devel lib64qt5location-devel lib64qt5quicktest-devel \
lib64qt5quickwidgets-devel lib64qt5script-devel lib64qt5svg-devel \
lib64qt5test-devel lib64qt5webkitwidgets-devel lib64qt5xml-devel \
lib64ssh2-devel lib64usb1.0-devel lib64zip-devel qttools5 qttranslations5"
In order to build Subsurface, use the supplied build script. This should
work on most systems that have all the prerequisite packages installed.
You should have Subsurface sources checked out in a sane place, something
like this:
mkdir -p ~/src
cd ~/src
git clone https://github.com/Subsurface/subsurface.git
./subsurface/scripts/build.sh # <- this step will take quite a while as it
# compiles a handful of libraries before
# building Subsurface
Now you can run Subsurface like this:
cd ~/src/subsurface/build
./subsurface
Note: on many Linux versions (for example on Kubuntu 15.04) the user must
belong to the dialout group.
You may need to run something like
sudo usermod -a -G dialout username
with your correct username and log out and log in again for that to take
effect.
If you get errors like:
./subsurface: error while loading shared libraries: libGrantlee_Templates.so.5: cannot open shared object file: No such file or directory
You can run the following command:
sudo ldconfig ~/src/install-root/lib
Building Subsurface under MacOSX
--------------------------------
You have 2 options for the first time install, either using homebrew
or by manually building the dependencies from source, depending on
what else you have installed on your mac.
0) You need to have XCode installed. The first time (and possibly after updating OSX)
0.1) run "xcode-select --install"
homebrew option:
1) brew install autoconf automake libtool hidapi libusb libxml2 libxslt libzip openssl pkg-config libgit2 libssh2 libjpg libpng libmtp
2) cd <repo>/..; bash <repo>/scripts/build.sh
Manual option:
1) install pkg-config
1.1) download http://sourceforge.net/projects/macpkg/files/PkgConfig/0.26/PkgConfig.pkg/download
1.2) run "PkgConfig.pkg"
1.3) run "sudo ln -s /opt/pkgconfig/bin/pkg-config /usr/local/bin/pkg-config"
2) install autoconf tools
2.1) curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
2.2) tar -xzf autoconf-latest.tar.gz
2.3) cd autoconf-*; ./configure && make && sudo make install; cd ..
3) cd <repo>/..; bash <repo>/scripts/build.sh -build-deps -desktop
After the above is done, Subsurface.app will be available in the
subsurface/build directory. You can run Subsurface with the command
A) open subsurface/build/Subsurface.app
this will however not show diagnostic output
B) subsurface/build/Subsurface.app/Contents/MacOS/Subsurface
the TAB key is your friend :-)
Debugging can be done with either Xcode or QtCreator.
To install the app for all users, move subsurface/build/Subsurface.app to /Applications.
Cross-building Subsurface on MacOSX for iOS
-------------------------------------------
1) build SubSurface under MacOSX and iOS
1.1) cd <repo>/..; bash <repo>/scripts/build.sh -build-deps -both
note: this is mainly done to ensure all external dependencies are downloaded and set
to the correct versions
2) continue as described in subsurface/packaging/ios
Cross-building Subsurface on Linux for Windows
----------------------------------------------
Subsurface builds nicely with MinGW - the official builds are done as
cross builds under Linux (currently on Ubuntu 20.04). A shell script to do
that (plus the .nsi file to create the installer with makensis) are
included in the packaging/windows directory.
Please read through the explanations and instructions in
packaging/windows/README.md, packaging/windows/create-win-installer.sh, and
packaging/windows/mxe-based-build.sh if you want to build the Windows version
on your Linux system.
Building Subsurface on Windows
------------------------------
This is NOT RECOMMENDED. To the best of our knowledge there is one single
person who regularly does this. The Subsurface team does not provide support
for Windows binary build from sources natively under Windows...
The lack of a working package management system for Windows makes it
really painful to build Subsurface natively under Windows,
so we don't support that at all.
Cross-building Subsurface on Linux for Android
----------------------------------------------
Follow the instructions in packaging/android/README

430
INSTALL.md Normal file
View File

@ -0,0 +1,430 @@
# Building Subsurface from Source
Subsurface uses quite a few open source libraries and frameworks to do its
job. The most important ones include libdivecomputer, Qt, libxml2, libxslt,
libsqlite3, libzip, and libgit2.
Below are instructions for building Subsurface
- on some popular Linux distributions,
- MacOSX,
- Windows (cross-building)
- Android (cross-building)
- iOS (cross-building)
## Getting Subsurface source
You can get the sources to the latest development version from our git
repository:
```
git clone http://github.com/Subsurface/subsurface.git
cd subsurface
git submodule init # this will give you our flavor of libdivecomputer
```
You keep it updated by doing:
```
git checkout master
git pull -r
git submodule update
```
### Our flavor of libdivecomputer
Subsurface requires its own flavor of libdivecomputer which is inclduded
above as git submodule
The branches won't have a pretty history and will include ugly merges,
but they should always allow a fast forward pull that tracks what we
believe developers should build against. All our patches are contained
in the `Subsurface-DS9` branch.
This should allow distros to see which patches we have applied on top of
upstream. They will receive force pushes as we rebase to newer versions of
upstream so they are not ideal for ongoing development (but they are of
course easy to use for distributions as they always build "from scratch",
anyway).
The rationale for this is that we have no intention of forking the
project. We simply are adding a few patches on top of their latest
version and want to do so in a manner that is both easy for our
developers who try to keep them updated frequently, and anyone packaging
Subsurface or trying to understand what we have done relative to their
respective upstreams.
### Getting Qt5
We use Qt5 in order to only maintain one UI across platforms.
Qt5.9.1 is the oldest version supported if ONLY building Subsurface
Qt5.12 is the oldest version supported if also building Subsurface-mobile
Most Linux distributions include a new enough version of Qt (and if you are on
a distro that still ships with an older Qt, likely your C compiler is also not
new enough to build Subsurface).
If you need Qt (likely on macOS) or want a newer version than provided by your
Linux distro, you can install a separate version that Subsurface will use.
As of Qt5.15 it has become a lot harder to download and install Qt - you
now need a Qt account and the installer tool has a new space age look and
significantly reduced flexibility.
As of this writing, there is thankfully a thirdparty offline installer still
available:
```
pip3 install aqtinstall
aqt install -O <Qt Location> 5.15.2 mac desktop
```
(or whatever version / OS you need). This installer is surprisingly fast
and seems well maintained - note that we don't use this for Windows as
that is completely built from source using MXE.
In order to use this Qt installation, simply add it to your PATH:
```
PATH=<Qt Location>/<version>/<type>/bin:$PATH
```
QtWebKit is needed, if you want to print, but no longer part of Qt5,
so you need to download it and compile. In case you just want to test
without print possibility omit this step.
```
git clone -b 5.212 https://github.com/qt/qtwebkit
mkdir -p qtwebkit/WebKitBuild/Release
cd qtwebkit/WebKitBuild/Release
cmake -DPORT=Qt -DCMAKE_BUILD_TYPE=Release -DQt5_DIR=/<Qt Location>/<version>/<type>/lib/cmake/Qt5 ../..
make install
```
### Other third party library dependencies
In order for our cloud storage to be fully functional you need
libgit2 0.26 or newer.
### cmake build system
Our main build system is based on cmake. But qmake is needed
for the googlemaps plugin and the iOS build.
Download from https://cmake.org/download and follow the instructions
to install it or alternatively follow the instruction specific to a
distribution (see build instructions).
## Build options for Subsurface
The following options are recognised when passed to cmake:
`-DCMAKE_BUILD_TYPE=Release` create a release build
`-DCMAKE_BUILD_TYPE=Debug` create a debug build
The Makefile that was created using cmake can be forced into a much more
verbose mode by calling
```
make VERBOSE=1
```
Many more variables are supported, the easiest way to interact with them is
to call
```
ccmake .
```
in your build directory.
### Building the development version of Subsurface under Linux
On Fedora you need
```
sudo dnf install autoconf automake bluez-libs-devel cmake gcc-c++ git \
libcurl-devel libsqlite3x-devel libssh2-devel libtool libudev-devel \
libusbx-devel libxml2-devel libxslt-devel make \
qt5-qtbase-devel qt5-qtconnectivity-devel qt5-qtdeclarative-devel \
qt5-qtlocation-devel qt5-qtscript-devel qt5-qtsvg-devel \
qt5-qttools-devel qt5-qtwebkit-devel redhat-rpm-config \
bluez-libs-devel libgit2-devel libzip-devel libmtp-devel
```
Package names are sadly different on OpenSUSE
```
sudo zypper install git gcc-c++ make autoconf automake libtool cmake libzip-devel \
libxml2-devel libxslt-devel sqlite3-devel libusb-1_0-devel \
libqt5-linguist-devel libqt5-qttools-devel libQt5WebKitWidgets-devel \
libqt5-qtbase-devel libQt5WebKit5-devel libqt5-qtsvg-devel \
libqt5-qtscript-devel libqt5-qtdeclarative-devel \
libqt5-qtconnectivity-devel libqt5-qtlocation-devel libcurl-devel \
bluez-devel libgit2-devel libmtp-devel
```
On Debian Bookworm this seems to work
```
sudo apt install \
autoconf automake cmake g++ git libbluetooth-dev libcrypto++-dev \
libcurl4-openssl-dev libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libtool \
libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make pkg-config \
qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick2 \
qt5-qmake qtchooser qtconnectivity5-dev qtdeclarative5-dev \
qtdeclarative5-private-dev qtlocation5-dev qtpositioning5-dev \
qtscript5-dev qttools5-dev qttools5-dev-tools libmtp-dev
```
In order to build and run mobile-on-desktop, you also need
```
sudo apt install \
qtquickcontrols2-5-dev qml-module-qtquick-window2 qml-module-qtquick-dialogs \
qml-module-qtquick-layouts qml-module-qtquick-controls2 qml-module-qtquick-templates2 \
qml-module-qtgraphicaleffects qml-module-qtqml-models2 qml-module-qtquick-controls
```
Package names for Ubuntu 21.04
```
sudo apt install \
autoconf automake cmake g++ git libbluetooth-dev libcrypto++-dev \
libcurl4-gnutls-dev libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libtool \
libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make pkg-config \
qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick2 \
qt5-qmake qtchooser qtconnectivity5-dev qtdeclarative5-dev \
qtdeclarative5-private-dev qtlocation5-dev qtpositioning5-dev \
qtscript5-dev qttools5-dev qttools5-dev-tools libmtp-dev
```
In order to build and run mobile-on-desktop, you also need
```
sudo apt install \
qtquickcontrols2-5-dev qml-module-qtquick-window2 qml-module-qtquick-dialogs \
qml-module-qtquick-layouts qml-module-qtquick-controls2 qml-module-qtquick-templates2 \
qml-module-qtgraphicaleffects qml-module-qtqml-models2 qml-module-qtquick-controls
```
On Raspberry Pi (Raspian Buster and Ubuntu Mate 20.04.1) this seems to work
```
sudo apt install \
autoconf automake cmake g++ git libbluetooth-dev libcrypto++-dev \
libcurl4-gnutls-dev libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libtool \
libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make pkg-config \
qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick2 \
qt5-qmake qtchooser qtconnectivity5-dev qtdeclarative5-dev \
qtdeclarative5-private-dev qtlocation5-dev qtpositioning5-dev \
qtscript5-dev qttools5-dev qttools5-dev-tools libmtp-dev
```
In order to build and run mobile-on-desktop, you also need
```
sudo apt install \
qtquickcontrols2-5-dev qml-module-qtquick-window2 qml-module-qtquick-dialogs \
qml-module-qtquick-layouts qml-module-qtquick-controls2 qml-module-qtquick-templates2 \
qml-module-qtgraphicaleffects qml-module-qtqml-models2 qml-module-qtquick-controls
```
Note that on Ubuntu Mate on the Raspberry Pi, you may need to configure
some swap space in order for the build to complete successfully. There is no
swap space configured by default. See the dphys-swapfile package.
On Raspberry Pi OS with Desktop (64-bit) Released April 4th, 2022, this seems
to work
```
sudo apt install \
autoconf automake cmake g++ git libbluetooth-dev libcrypto++-dev \
libcurl4-gnutls-dev libgit2-dev libqt5qml5 libqt5quick5 libqt5svg5-dev \
libqt5webkit5-dev libsqlite3-dev libssh2-1-dev libssl-dev libtool \
libusb-1.0-0-dev libxml2-dev libxslt1-dev libzip-dev make pkg-config \
qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick2 \
qt5-qmake qtchooser qtconnectivity5-dev qtdeclarative5-dev \
qtdeclarative5-private-dev qtlocation5-dev qtpositioning5-dev \
qtscript5-dev qttools5-dev qttools5-dev-tools libmtp-dev
```
Note that you'll need to increase the swap space as the default of 100MB
doesn't seem to be enough. 1024MB worked on a 3B+.
If maps aren't working, copy the googlemaps plugin
from `<build_dir>/subsurface/googlemaps/build/libqtgeoservices_googlemaps.so`
to `/usr/lib/aarch64-linux-gnu/qt5/plugins/geoservices/`.
If Subsurface can't seem to see your dive computer on `/dev/ttyUSB0`, even after
adjusting your account's group settings (see note below about usermod), it
might be that the FTDI driver doesn't recognize the VendorID/ProductID of your
computer. Follow the instructions here:
https://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_101_Customising_FTDI_VID_PID_In_Linux(FT_000081).pdf
If you're unsure of the VID/PID of your device, plug your dive computer in to
your host and run `dmesg`. That should show the codes that are needed to
follow TN_101.
On PCLinuxOS you appear to need the following packages
```
su -c "apt-get install -y autoconf automake cmake gcc-c++ git libtool \
lib64bluez-devel lib64qt5bluetooth-devel lib64qt5concurrent-devel \
lib64qt5help-devel lib64qt5location-devel lib64qt5quicktest-devel \
lib64qt5quickwidgets-devel lib64qt5script-devel lib64qt5svg-devel \
lib64qt5test-devel lib64qt5webkitwidgets-devel lib64qt5xml-devel \
lib64ssh2-devel lib64usb1.0-devel lib64zip-devel qttools5 qttranslations5"
```
In order to build Subsurface, use the supplied build script. This should
work on most systems that have all the prerequisite packages installed.
You should have Subsurface sources checked out in a sane place, something
like this:
```
mkdir -p ~/src
cd ~/src
git clone https://github.com/Subsurface/subsurface.git
./subsurface/scripts/build.sh # <- this step will take quite a while as it
# compiles a handful of libraries before
# building Subsurface
```
Now you can run Subsurface like this:
```
cd ~/src/subsurface/build
./subsurface
```
Note: on many Linux versions (for example on Kubuntu 15.04) the user must
belong to the `dialout` group.
You may need to run something like
```
sudo usermod -a -G dialout $USER
```
with your correct username and log out and log in again for that to take
effect.
If you get errors like:
```
./subsurface: error while loading shared libraries: libGrantlee_Templates.so.5: cannot open shared object file: No such file or directory
```
You can run the following command:
```
sudo ldconfig ~/src/install-root/lib
```
### Building Subsurface under MacOSX
While it is possible to build all required components completely from source,
at this point the preferred way to build Subsurface is to set up the build
infrastructure via Homebrew and then build the dependencies from source.
0. You need to have XCode installed. The first time (and possibly after updating OSX)
```
xcode-select --install
```
1. install Homebrew (see https://brew.sh) and then the required build infrastructure:
```
brew install autoconf automake libtool pkg-config gettext
```
2. install Qt
download the macOS installer from https://download.qt.io/official_releases/online_installers
and use it to install the desired Qt version. At this point the latest Qt5 version is still
preferred over Qt6.
If you plan to deploy your build to an Apple Silicon Mac, you may have better results with
Bluetooth connections if you install Qt5.15.13. If Qt5.15.13 is not available via the
installer, you can download from https://download.qt.io/official_releases/qt/5.15/5.15.13
and build using the usual configure, make, and make install.
3. now build Subsurface
```
cd ~/src; bash subsurface/scripts/build.sh -build-deps
```
if you are building against Qt6 (still experimental) you can create a universal binary with
```
cd ~/src; bash subsurface/scripts/build.sh -build-with-qt6 -build-deps -fat-build
```
After the above is done, Subsurface.app will be available in the
subsurface/build directory. You can run Subsurface with the command
A. `open subsurface/build/Subsurface.app`
this will however not show diagnostic output
B. `subsurface/build/Subsurface.app/Contents/MacOS/Subsurface`
the [Tab] key is your friend :-)
Debugging can be done with either Xcode or QtCreator.
To install the app for all users, move subsurface/build/Subsurface.app to /Applications.
### Cross-building Subsurface on MacOSX for iOS
0. build SubSurface under MacOSX and iOS
1. `cd <repo>/..; bash <repo>/scripts/build.sh -build-deps -both`
note: this is mainly done to ensure all external dependencies are downloaded and set
to the correct versions
2. follow [these instructions](packaging/ios/README.md)
### Cross-building Subsurface on Linux for Windows
Subsurface for Windows builds on linux by using the [MXE (M cross environment)](https://github.com/mxe/mxe). The easiest way to do this is to use a Docker container with a pre-built MXE for Subsurface by following [these instructions](packaging/windows/README.md).
### Building Subsurface on Windows
This is NOT RECOMMENDED. To the best of our knowledge there is one single
person who regularly does this. The Subsurface team does not provide support
for Windows binary build from sources natively under Windows...
The lack of a working package management system for Windows makes it
really painful to build Subsurface natively under Windows,
so we don't support that at all.
But if you want to build Subsurface on a Windows system, the docker based [cross-build for Windows](packaging/windows/README.md) works just fine in WSL2 on Windows.
### Cross-building Subsurface on Linux for Android
Follow [these instructions](packaging/android/README.md).

View File

@ -1,20 +1,17 @@
# Subsurface
![Build Status](https://github.com/subsurface/subsurface/workflows/Windows/badge.svg)
![Build Status](https://github.com/subsurface/subsurface/workflows/Mac/badge.svg)
![Build Status](https://github.com/subsurface/subsurface/workflows/iOS/badge.svg)
![Build Status](https://github.com/subsurface/subsurface/workflows/Android/badge.svg)
[![Windows](https://github.com/subsurface/subsurface/actions/workflows/windows.yml/badge.svg)](https://github.com/subsurface/subsurface/actions/workflows/windows.yml)
[![Mac](https://github.com/subsurface/subsurface/actions/workflows/mac.yml/badge.svg)](https://github.com/subsurface/subsurface/actions/workflows/mac.yml)
[![iOS](https://github.com/subsurface/subsurface/actions/workflows/ios.yml/badge.svg)](https://github.com/subsurface/subsurface/actions/workflows/ios.yml)
[![Android](https://github.com/subsurface/subsurface/actions/workflows/android.yml/badge.svg)](https://github.com/subsurface/subsurface/actions/workflows/android.yml)
![Build Status](https://github.com/subsurface/subsurface/workflows/Linux%20Snap/badge.svg)
![Build Status](https://github.com/subsurface/subsurface/workflows/Ubuntu%2014.04%20/%20Qt%205.12%20for%20AppImage--/badge.svg)
![Build Status](https://github.com/subsurface/subsurface/workflows/Ubuntu%2018.04%20/%20Qt%205.9--/badge.svg)
![Build Status](https://github.com/subsurface/subsurface/workflows/Ubuntu%2020.10%20/%20Qt%205.14--/badge.svg)
![Build Status](https://github.com/subsurface/subsurface/workflows/openSUSE/Tumbleweed%20/%20Qt%20latest--/badge.svg)
[![Snap](https://github.com/subsurface/subsurface/actions/workflows/linux-snap.yml/badge.svg)](https://github.com/subsurface/subsurface/actions/workflows/linux-snap.yml)
[![Ubuntu 16.04 / Qt 5.15-- for AppImage](https://github.com/subsurface/subsurface/actions/workflows/linux-ubuntu-16.04-5.12-appimage.yml/badge.svg)](https://github.com/subsurface/subsurface/actions/workflows/linux-ubuntu-16.04-5.12-appimage.yml)
[![Ubuntu 24.04 / Qt 5.15--](https://github.com/subsurface/subsurface/actions/workflows/linux-ubuntu-24.04-5.15.yml/badge.svg)](https://github.com/subsurface/subsurface/actions/workflows/linux-ubuntu-24.04-5.15.yml)
[![Fedora 35 / Qt 6--](https://github.com/subsurface/subsurface/actions/workflows/linux-fedora-35-qt6.yml/badge.svg)](https://github.com/subsurface/subsurface/actions/workflows/linux-fedora-35-qt6.yml)
[![Debian trixie / Qt 5.15--](https://github.com/subsurface/subsurface/actions/workflows/linux-debian-trixie-5.15.yml/badge.svg)](https://github.com/subsurface/subsurface/actions/workflows/linux-debian-trixie-5.15.yml)
This is the README file for Subsurface 5.0.1
Please check the `ReleaseNotes.txt` for details about new features and
changes since Subsurface 5.0 (and earlier versions).
[![Coverity Scan Results](https://scan.coverity.com/projects/14405/badge.svg)](https://scan.coverity.com/projects/subsurface-divelog-subsurface)
Subsurface can be found at http://subsurface-divelog.org
@ -24,15 +21,9 @@ Report bugs and issues at https://github.com/Subsurface/subsurface/issues
License: GPLv2
We frequently make new test versions of Subsurface available at
http://subsurface-divelog.org/downloads/test/ and there you can always get
the latest builds for Mac, Windows, Linux AppImage and Android (with some
caveats about installability). Additionally, those same versions are
posted to the Subsurface-daily repos on Launchpad and OBS.
These tend to contain the latest bug fixes and features, but also
occasionally the latest bugs and issues. Please understand when using them
that these are primarily intended for testing.
We are releasing 'nightly' builds of Subsurface that are built from the latest version of the code. Versions of this build for Windows, macOS, Android (requiring sideloading), and a Linux AppImage can be downloaded from the [Latest Dev Release](https://www.subsurface-divelog.org/latest-release/) page on [our website](https://www.subsurface-divelog.org/). Alternatively, they can be downloaded [directly from GitHub](https://github.com/subsurface/nightly-builds/releases). Additionally, those same versions are
posted to the Subsurface-daily repos on Ubuntu Launchpad, Fedora COPR, and
OpenSUSE OBS, and released to [Snapcraft](https://snapcraft.io/subsurface) into the 'edge' channel of subsurface.
You can get the sources to the latest development version from the git
repository:
@ -44,17 +35,11 @@ git clone https://github.com/Subsurface/subsurface.git
You can also fork the repository and browse the sources at the same site,
simply using https://github.com/Subsurface/subsurface
If you want the latest release (instead of the bleeding edge
development version) you can either get this via git or the release tar
ball. After cloning run the following command:
Additionally, artifacts for Windows, macOS, Android, Linux AppImage, and iOS (simulator build) are generated for all open pull requests and linked in pull request comments. Use these if you want to test the changes in a specific pull request and provide feedback before it has been merged.
```
git checkout v5.0.1 (or whatever the last release is)
```
If you want a more stable version that is a little bit more tested you can get this from the [Curent Release](https://www.subsurface-divelog.org/current-release/) page on [our website](https://www.subsurface-divelog.org/).
or download a tarball from http://subsurface-divelog.org/downloads/Subsurface-5.0.1.tgz
Detailed build instructions can be found in the INSTALL file.
Detailed build instructions can be found in the [INSTALL.md](/INSTALL.md) file.
## System Requirements

View File

@ -2,6 +2,136 @@
= _Subsurface_ Release Notes
New in _Subsurface_ 5.0.10
~~~~~~~~~~~~~~~~~~~~~~~~~~
- remove divesite list from tab-widgets
- implement panning of the profile
- infobox: show an icon for warnings
- import: allow import of divesites without UUID
- planner: allow handle manipulation in zoomed in state
- divelist: do not include planned versions of a dive if there is real data
- fix key composition in tag widgets and dive site widget
- use combobox for moving sensor between cylinders
- dive computer support:
- fix Ratio dive computer detection for BLE only devices
New in _Subsurface_ 5.0.9
~~~~~~~~~~~~~~~~~~~~~~~~~
- filter: normalize unicode code points to base letter (for searching , etc.)
- core: when modifying cylinders across multiple dives, match cylinder number before comparing type
- core: merge all properties in a dive, including current, waveheight, etc
- core: prevent crash when merging dives without cylinders (as we might get when importing from divelogs.de)
- core: work around bug in TecDiving dive computer reporting spurious 0 deg C water temperature in first sample
- core: correctly parse DC_FIELD_SALINITY response; fixes incorrect water type with some dive computers, including the Mares Smart
- desktop: allow more than one media file to be imported from web
- desktop: improve UX for cloud email/password checking
- undo: clear undo stack when the current file is closed
- dive computer support
- Garmin: correctly deal with short format filenames
- Garmin: correctly parse dive mode
- Add support for the Seac Screen and Action
- Add support for the Cressi Michelangelo
- Add support for the new version of the Aqualung i200C
- Add support for the Shearwater Petrel 3 and Perdix 2
- Add support for the Ratio iX3M 2
- Add support for the Sherwood Amphos Air 2.0
New in _Subsurface_ 5.0.8
~~~~~~~~~~~~~~~~~~~~~~~~~
- core: add support for separator characters when using degree-style coordinates
- profile: plot sensor data from other dive computer if available
- build-system: fix packaging errors that prevented maps from being shown on Windows and macOS
- translations: fall back to related translations (before falling back to US English)
New in _Subsurface_ 5.0.7
~~~~~~~~~~~~~~~~~~~~~~~~~
- profile: include profile editing in undo system
- general: rename dive master to dive guide
- dive list: make dive guide visible in dive list [#3382]
- core: avoid crash with corrupted cloud storage
- equipment: allow manually asigning tank sensors to specific tanks (this helps
divers with multiple dive computers each tracking pressure for a different tank)
- planner: make ESC (cancel plan) work when moving handles
- desktop: don't lose cursor position in notes when switching between windows [#3369]
- build-system: don't rely on the git:// protocol when downloading sources
- build-system: initial support for Qt6 (missing maps, user manual, printing, among other things)
- build-system: initial support for Apple M1 (using Qt6, see limitations above)
- dive computer support
- Uemis support: fix the ability disconnect/reconnect the Zurich when its filesystem is full
- add support for latest BLE hardware in OSTC dive computers
- add support latest Shearwater firmware, including T3/T4 on Teric
- various other small changes
New in _Subsurface_ 5.0.6
~~~~~~~~~~~~~~~~~~~~~~~~~
- statistics: implement ordering of categorical bar charts
- divelist: Don't attempt to compute SAC for CCR dives
- profile: fix editing of time / duration (profile of edited dive was not shown)
- profile: rewrite of part of the implementation which resulted in performance improvements
- small dive computer fixes:
- Uwatec/Scubapro dive computers: restore the original standard gravity factor
- Garmin: fix gas change event parsing
New in _Subsurface_ 5.0.5
~~~~~~~~~~~~~~~~~~~~~~~~~
- store dive computer 'fingerprints' with the dive log data, including in the cloud
New in _Subsurface_ 5.0.4
~~~~~~~~~~~~~~~~~~~~~~~~~
- desktop: fix potential crash when selecting multiple dives marked invalid
- picture import: better support for large time stamp deltas
- planner: fix a bug setting the MND for gasmix with 21% oxygen
- core: fix off-by-one causing incorrect profile display #3184
- core: due to a bug in 5.0.3 certain dive logs were incorrectly stored and couldn't subsequently be read back
- core: fix potential crashes with very complex XML files
New in _Subsurface_ 5.0.3
~~~~~~~~~~~~~~~~~~~~~~~~~
- Correct OTU and CNS calculations for planned bailout
- replace dive computer management with a new implementation, this fixes rare cases where
Subsurface unnecessarily download already downloaded dives, but also means
that some older style dive computer can no longer have nicknames
- avoid potential crash when switching divelogs
- add GPS fix downloaded from a dive comuter to existing dive site
- fix broken curser left/right shortcut for showing multiple dive computers
- allow editing the profile for dives imported without samples (via CSV)
- fix potential crash (and other errors) importing DL7 dives
- add detection for Aladin A2 as BLE dive computer
- improve printout scaling for event icons
- support exporting unused cylinders to divelogs.de
- improve handling of CNS values when combining multiple dive computers
dive computer support:
- add support for Cressi Neon
- add support for Sherwood Amphos 2.0
- add support for new gas change data from EON Steel with FW 2.5
- fix potential crash with Garmin Descent Mk2
- fix HW Sport and Mares Genius firmware update
- various parser updates:
- sporasub depth, salinity and sample rate parsing
- Atomics Cobalt atmospheric pressure parsing
- unit cleanups (Uwatec, McLean Extreme)
New in _Subsurface_ 5.0.2
~~~~~~~~~~~~~~~~~~~~~~~~~
- desktop: fix removal/editing of bookmarks on the profile
- export: show progress dialog when exporting to TeX
- printing: use sensible font size even for strange window size
- planner: don't immediately ascent automatically
- planner: various small bug fixes
- import: fix parsing of translated ADP header strings
- dive edit: add ability to copy and paste dive nr and date
- core: prevent crash when parsing certain very complex XML files
- cloud: support redundandant backup servers
- cloud: try to pick a server close to the user if possible
dive computer support:
- add Suunto Eon Steel Black
- add Sherwood Beacon
- add new variant of Zoop Novo
- add new variants of Shearwater Perdix AI
- add Sporasub SP2
New in _Subsurface_ 5.0.1
~~~~~~~~~~~~~~~~~~~~~~~~~
- fix Windows crash when changing log file

View File

@ -2,7 +2,7 @@ TEMPLATE = app
QT += qml quick quickcontrols2 widgets positioning concurrent svg bluetooth
DEFINES += SUBSURFACE_MOBILE BT_SUPPORT BLE_SUPPORT
DEFINES += SUBSURFACE_MOBILE BT_SUPPORT BLE_SUPPORT MAP_SUPPORT
CONFIG += c++17
CONFIG += qtquickcompiler
@ -23,18 +23,17 @@ SOURCES += subsurface-mobile-main.cpp \
core/cloudstorage.cpp \
core/configuredivecomputerthreads.cpp \
core/devicedetails.cpp \
core/gpslocation.cpp \
core/downloadfromdcthread.cpp \
core/qtserialbluetooth.cpp \
core/plannernotes.c \
core/uemis-downloader.c \
core/plannernotes.cpp \
core/uemis-downloader.cpp \
core/qthelper.cpp \
core/checkcloudconnection.cpp \
core/color.cpp \
core/configuredivecomputer.cpp \
core/divelogexportlogic.cpp \
core/divesitehelpers.cpp \
core/errorhelper.c \
core/errorhelper.cpp \
core/exif.cpp \
core/format.cpp \
core/gettextfromc.cpp \
@ -42,58 +41,62 @@ SOURCES += subsurface-mobile-main.cpp \
core/qt-init.cpp \
core/subsurfacesysinfo.cpp \
core/windowtitleupdate.cpp \
core/file.c \
core/file.cpp \
core/fulltext.cpp \
core/subsurfacestartup.c \
core/subsurfacestartup.cpp \
core/subsurface-string.cpp \
core/pref.c \
core/profile.c \
core/profile.cpp \
core/device.cpp \
core/dive.c \
core/dive.cpp \
core/divecomputer.c \
core/divefilter.cpp \
core/event.c \
core/eventtype.cpp \
core/filterconstraint.cpp \
core/filterpreset.cpp \
core/divelist.c \
core/divelog.cpp \
core/gas-model.c \
core/gaspressures.c \
core/git-access.c \
core/liquivision.c \
core/load-git.c \
core/parse-xml.c \
core/parse.c \
core/git-access.cpp \
core/globals.cpp \
core/liquivision.cpp \
core/load-git.cpp \
core/parse-xml.cpp \
core/parse.cpp \
core/picture.c \
core/pictureobj.cpp \
core/sample.c \
core/import-suunto.c \
core/import-shearwater.c \
core/import-seac.c \
core/import-cobalt.c \
core/import-divinglog.c \
core/import-csv.c \
core/save-html.c \
core/sample.cpp \
core/import-suunto.cpp \
core/import-shearwater.cpp \
core/import-seac.cpp \
core/import-cobalt.cpp \
core/import-divinglog.cpp \
core/import-csv.cpp \
core/save-html.cpp \
core/statistics.c \
core/worldmap-save.c \
core/libdivecomputer.c \
core/worldmap-save.cpp \
core/libdivecomputer.cpp \
core/version.c \
core/save-git.c \
core/datatrak.c \
core/save-git.cpp \
core/datatrak.cpp \
core/ostctools.c \
core/planner.c \
core/save-xml.c \
core/cochran.c \
core/deco.c \
core/planner.cpp \
core/save-xml.cpp \
core/cochran.cpp \
core/deco.cpp \
core/divesite.c \
core/equipment.c \
core/gas.c \
core/membuffer.c \
core/membuffer.cpp \
core/selection.cpp \
core/sha1.c \
core/string-format.cpp \
core/strtod.c \
core/tag.c \
core/tag.cpp \
core/taxonomy.c \
core/time.c \
core/time.cpp \
core/trip.c \
core/units.c \
core/uemis.c \
@ -112,7 +115,6 @@ SOURCES += subsurface-mobile-main.cpp \
core/settings/qPrefGeneral.cpp \
core/settings/qPrefGeocoding.cpp \
core/settings/qPrefLanguage.cpp \
core/settings/qPrefLocationService.cpp \
core/settings/qPrefPartialPressureGas.cpp \
core/settings/qPrefPrivate.cpp \
core/settings/qPrefProxy.cpp \
@ -151,8 +153,6 @@ SOURCES += subsurface-mobile-main.cpp \
mobile-widgets/statsmanager.cpp \
mobile-widgets/themeinterface.cpp \
qt-models/divesummarymodel.cpp \
qt-models/diveplotdatamodel.cpp \
qt-models/gpslistmodel.cpp \
qt-models/completionmodels.cpp \
qt-models/divelocationmodel.cpp \
qt-models/maplocationmodel.cpp \
@ -171,14 +171,14 @@ SOURCES += subsurface-mobile-main.cpp \
profile-widget/qmlprofile.cpp \
profile-widget/divecartesianaxis.cpp \
profile-widget/diveeventitem.cpp \
profile-widget/divepercentageitem.cpp \
profile-widget/diveprofileitem.cpp \
profile-widget/profilewidget2.cpp \
profile-widget/ruleritem.cpp \
profile-widget/profilescene.cpp \
profile-widget/animationfunctions.cpp \
profile-widget/divepixmapcache.cpp \
profile-widget/divepixmapitem.cpp \
profile-widget/divetooltipitem.cpp \
profile-widget/tankitem.cpp \
profile-widget/divehandler.cpp \
profile-widget/divelineitem.cpp \
profile-widget/diverectitem.cpp \
profile-widget/divetextitem.cpp
@ -203,12 +203,15 @@ HEADERS += \
core/dive.h \
core/divecomputer.h \
core/event.h \
core/eventtype.h \
core/extradata.h \
core/git-access.h \
core/gpslocation.h \
core/globals.h \
core/owning_ptrs.h \
core/pref.h \
core/profile.h \
core/qthelper.h \
core/range.h \
core/save-html.h \
core/statistics.h \
core/units.h \
@ -223,11 +226,11 @@ HEADERS += \
core/configuredivecomputer.h \
core/datatrak.h \
core/deco.h \
core/display.h \
core/divefilter.h \
core/filterconstraint.h \
core/filterpreset.h \
core/divelist.h \
core/divelog.h \
core/divelogexportlogic.h \
core/divesitehelpers.h \
core/exif.h \
@ -242,7 +245,6 @@ HEADERS += \
core/sample.h \
core/selection.h \
core/sha1.h \
core/strndup.h \
core/string-format.h \
core/subsurfacestartup.h \
core/subsurfacesysinfo.h \
@ -268,7 +270,6 @@ HEADERS += \
core/settings/qPrefGeneral.h \
core/settings/qPrefGeocoding.h \
core/settings/qPrefLanguage.h \
core/settings/qPrefLocationService.h \
core/settings/qPrefPartialPressureGas.h \
core/settings/qPrefPrivate.h \
core/settings/qPrefProxy.h \
@ -310,8 +311,6 @@ HEADERS += \
mobile-widgets/themeinterface.h \
map-widget/qmlmapwidgethelper.h \
qt-models/divesummarymodel.h \
qt-models/diveplotdatamodel.h \
qt-models/gpslistmodel.h \
qt-models/divelocationmodel.h \
qt-models/completionmodels.h \
qt-models/weightsysteminfomodel.h \
@ -329,16 +328,16 @@ HEADERS += \
qt-models/filterconstraintmodel.h \
qt-models/filterpresetmodel.h \
profile-widget/qmlprofile.h \
profile-widget/divepercentageitem.h \
profile-widget/diveprofileitem.h \
profile-widget/profilewidget2.h \
profile-widget/ruleritem.h \
profile-widget/profilescene.h \
profile-widget/diveeventitem.h \
profile-widget/divetooltipitem.h \
profile-widget/tankitem.h \
profile-widget/animationfunctions.h \
profile-widget/divecartesianaxis.h \
profile-widget/divehandler.h \
profile-widget/divelineitem.h \
profile-widget/divepixmapcache.h \
profile-widget/divepixmapitem.h \
profile-widget/diverectitem.h \
profile-widget/divetextitem.h
@ -346,14 +345,15 @@ HEADERS += \
RESOURCES += mobile-widgets/qml/mobile-resources.qrc \
mobile-widgets/3rdparty/icons.qrc \
map-widget/qml/map-widget.qrc \
stats/statsicons.qrc
stats/statsicons.qrc \
profile.qrc
android {
SOURCES += core/android.cpp \
core/serial_usb_android.cpp
# ironically, we appear to need to include the Kirigami shaders here
# as they aren't found when we assume that they are part of the
# as they are not found when we assume that they are part of the
# libkirigami library
RESOURCES += packaging/android/translations.qrc \
android-mobile/font.qrc \
@ -404,7 +404,7 @@ android {
ios {
SOURCES += core/ios.cpp
RESOURCES += packaging/ios/translations.qrc
QMAKE_IOS_DEPLOYMENT_TARGET = 10.0
QMAKE_IOS_DEPLOYMENT_TARGET = 12.0
QMAKE_TARGET_BUNDLE_PREFIX = org.subsurface-divelog
QMAKE_BUNDLE = subsurface-mobile
QMAKE_INFO_PLIST = packaging/ios/Info.plist
@ -413,24 +413,32 @@ ios {
images.files = icons/subsurface-mobile-icon.png
QMAKE_BUNDLE_DATA += app_launch_images images
LIBS += ../install-root/ios/lib/libdivecomputer.a \
../install-root/ios/lib/libgit2.a \
../install-root/ios/lib/libzip.a \
../install-root/ios/lib/libxslt.a \
../install-root/ios/lib/qml/org/kde/kirigami.2/libkirigamiplugin.a \
OBJECTIVE_SOURCES += ios/ios-share.mm
HEADERS += ios/ios-share.h
Q_ENABLE_BITCODE.name = ENABLE_BITCODE
Q_ENABLE_BITCODE.value = NO
QMAKE_MAC_XCODE_SETTINGS += Q_ENABLE_BITCODE
ARCH_PATH = ../install-root/ios/$${ARCH}
LIBS += $${ARCH_PATH}/lib/libdivecomputer.a \
$${ARCH_PATH}/lib/libgit2.a \
$${ARCH_PATH}/lib/libzip.a \
$${ARCH_PATH}/lib/libxslt.a \
$${ARCH_PATH}/lib/qml/org/kde/kirigami.2/libkirigamiplugin.a \
../googlemaps-build/libqtgeoservices_googlemaps.a \
-liconv \
-lsqlite3 \
-lxml2
INCLUDEPATH += ../install-root/ios/include/ \
../install-root/lib/libzip/include \
../install-root/ios/include/libxstl \
../install-root/ios/include/libexstl \
../install-root/ios/include/openssl \
LIBS += -framework MessageUI
INCLUDEPATH += $${ARCH_PATH}/include/ \
$${ARCH_PATH}/include/libxstl \
$${ARCH_PATH}/include/libexstl \
$${ARCH_PATH}/include/openssl \
. \
./core \
./mobile-widgets/3rdparty/kirigami/src/libkirigami \
/usr/include/libxml2
$${ARCH_PATH}/include/libxml2
}

View File

@ -6,7 +6,7 @@
<li>Quantum X</li></ul>
</dd>
<dt>Aqualung</dt><dd><ul>
<li>i100, i200, i200C, i300, i300C, i450T, i470TC, i550, i550C, i750TC, i770R</li></ul>
<li>i100, i200, i200C, i200Cv2, i300, i300C, i450T, i470TC, i550, i550C, i750TC, i770R</li></ul>
</dd>
<dt>Atomic Aquatics</dt><dd><ul>
<li>Cobalt, Cobalt 2</li></ul>
@ -21,7 +21,13 @@
<li>Commander I, Commander II, Commander TM, EMC-14, EMC-16, EMC-20H</li></ul>
</dd>
<dt>Cressi</dt><dd><ul>
<li>Cartesio, Drake, Edy, Giotto, Goa, Leonardo, Newton</li></ul>
<li>Cartesio, Donatello, Drake, Edy, Giotto, Goa, Leonardo, Michelangelo, Neon, Newton</li></ul>
</dd>
<dt>Crest</dt><dd><ul>
<li>CR-4</li></ul>
</dd>
<dt>Deep Six</dt><dd><ul>
<li>Excursion</li></ul>
</dd>
<dt>Deepblu</dt><dd><ul>
<li>Cosmiq+</li></ul>
@ -32,11 +38,17 @@
<dt>DiveSystem</dt><dd><ul>
<li>Orca, iDive DAN, iDive Deep, iDive Easy, iDive Free, iDive Pro, iDive Reb, iDive Stealth, iDive Tech, iDive X3M</li></ul>
</dd>
<dt>Divesoft</dt><dd><ul>
<li>Freedom, Liberty</li></ul>
</dd>
<dt>FIT</dt><dd><ul>
<li>File import</li></ul>
</dd>
<dt>Garmin</dt><dd><ul>
<li>Descent Mk1, Descent Mk2/Mk2i</li></ul>
</dd>
<dt>Genesis</dt><dd><ul>
<li>React Pro, React Pro White</li></ul>
<li>Centauri, React Pro, React Pro White</li></ul>
</dd>
<dt>Heinrichs Weikamp</dt><dd><ul>
<li>Frog, OSTC, OSTC 2, OSTC 2 TR, OSTC 2C, OSTC 2N, OSTC 3, OSTC 4, OSTC Mk2, OSTC Plus, OSTC Sport, OSTC cR</li></ul>
@ -48,46 +60,52 @@
<li>Kaon, Lynx, Xen, Xeo</li></ul>
</dd>
<dt>Mares</dt><dd><ul>
<li>Airlab, Darwin, Darwin Air, Genius, Horizon, Icon HD, Icon HD Net Ready, M1, M2, Matrix, Nemo, Nemo Air, Nemo Apneist, Nemo Excel, Nemo Steel, Nemo Titanium, Nemo Wide, Nemo Wide 2, Puck, Puck 2, Puck Air, Puck Pro, Quad, Quad Air, Smart, Smart Air, Smart Apnea</li></ul>
<li>Airlab, Darwin, Darwin Air, Genius, Horizon, Icon HD, Icon HD Net Ready, M1, M2, Matrix, Nemo, Nemo Air, Nemo Apneist, Nemo Excel, Nemo Steel, Nemo Titanium, Nemo Wide, Nemo Wide 2, Puck, Puck 2, Puck Air, Puck Pro, Puck Pro +, Quad, Quad Air, Smart, Smart Air, Smart Apnea</li></ul>
</dd>
<dt>McLean</dt><dd><ul>
<li>Extreme</li></ul>
</dd>
<dt>Oceanic</dt><dd><ul>
<li>Atom 1.0, Atom 2.0, Atom 3.0, Atom 3.1, Datamask, F10, F11, Geo, Geo 2.0, Geo 4.0, OC1, OCS, OCi, Pro Plus 2, Pro Plus 2.1, Pro Plus 3, Pro Plus 4, Pro Plus X, VT 4.1, VT Pro, VT3, VT4, VTX, Veo 1.0, Veo 180, Veo 2.0, Veo 200, Veo 250, Veo 3.0, Veo 4.0, Versa Pro</li></ul>
<li>Atom 1.0, Atom 2.0, Atom 3.0, Atom 3.1, Datamask, F10, F11, Geo, Geo 2.0, Geo 4.0, Geo Air, OC1, OCS, OCi, Pro Plus 2, Pro Plus 2.1, Pro Plus 3, Pro Plus 4, Pro Plus X, VT 4.1, VT Pro, VT3, VT4, VTX, Veo 1.0, Veo 180, Veo 2.0, Veo 200, Veo 250, Veo 3.0, Veo 4.0, Versa Pro</li></ul>
</dd>
<dt>Oceans</dt><dd><ul>
<li>S1</li></ul>
</dd>
<dt>Ratio</dt><dd><ul>
<li>iDive Color Deep, iDive Color Easy, iDive Color Fancy, iDive Color Free, iDive Color Pro, iDive Color Reb, iDive Color Tech+, iDive Deep, iDive Easy, iDive Fancy, iDive Free, iDive Pro, iDive Reb, iDive Tech+, iX3M 2021 GPS Deep, iX3M 2021 GPS Easy, iX3M 2021 GPS Fancy, iX3M 2021 GPS Pro , iX3M 2021 GPS Reb, iX3M 2021 GPS Tech+, iX3M 2021 Pro Deep, iX3M 2021 Pro Easy, iX3M 2021 Pro Fancy, iX3M 2021 Pro Pro, iX3M 2021 Pro Reb, iX3M 2021 Pro Tech+, iX3M GPS Deep, iX3M GPS Easy, iX3M GPS Fancy, iX3M GPS Pro , iX3M GPS Reb, iX3M GPS Tech+, iX3M Pro Deep, iX3M Pro Easy, iX3M Pro Fancy, iX3M Pro Pro, iX3M Pro Reb, iX3M Pro Tech+</li></ul>
<li>ATOM, iDive 2 Deep, iDive 2 Easy, iDive 2 Fancy, iDive 2 Free, iDive 2 Pro, iDive 2 Reb, iDive 2 Tech, iDive Color Deep, iDive Color Easy, iDive Color Fancy, iDive Color Free, iDive Color Pro, iDive Color Reb, iDive Color Tech+, iDive Deep, iDive Easy, iDive Fancy, iDive Free, iDive Pro, iDive Reb, iDive Tech+, iX3M 2 Deep, iX3M 2 Easy, iX3M 2 GPS Deep, iX3M 2 GPS Easy, iX3M 2 GPS Gauge, iX3M 2 GPS Pro, iX3M 2 GPS Reb, iX3M 2 GPS Tech, iX3M 2 Gauge, iX3M 2 Pro, iX3M 2 Tech+, iX3M 2021 GPS Deep, iX3M 2021 GPS Easy, iX3M 2021 GPS Fancy, iX3M 2021 GPS Pro , iX3M 2021 GPS Reb, iX3M 2021 GPS Tech+, iX3M 2021 Pro Deep, iX3M 2021 Pro Easy, iX3M 2021 Pro Fancy, iX3M 2021 Pro Pro, iX3M 2021 Pro Reb, iX3M 2021 Pro Tech+, iX3M GPS Deep, iX3M GPS Easy, iX3M GPS Fancy, iX3M GPS Pro , iX3M GPS Reb, iX3M GPS Tech+, iX3M Pro Deep, iX3M Pro Easy, iX3M Pro Fancy, iX3M Pro Pro, iX3M Pro Reb, iX3M Pro Tech+</li></ul>
</dd>
<dt>Reefnet</dt><dd><ul>
<li>Sensus, Sensus Pro, Sensus Ultra</li></ul>
</dd>
<dt>Scorpena</dt><dd><ul>
<li>Alpha</li></ul>
</dd>
<dt>Scubapro</dt><dd><ul>
<li>Aladin A1, Aladin A2, Aladin H Matrix, Aladin Sport Matrix, Aladin Square, Chromis, G2, G2 Console, G2 HUD, Mantis, Mantis 2, Meridian, XTender 5</li></ul>
<li>Aladin A1, Aladin A2, Aladin H Matrix, Aladin Sport Matrix, Aladin Square, Chromis, G2, G2 Console, G2 HUD, G2 TEK, G3, Luna 2.0, Luna 2.0 AI, Mantis, Mantis 2, Meridian, XTender 5</li></ul>
</dd>
<dt>Seabaer</dt><dd><ul>
<li>T1, H3, HUDC</li></ul>
</dd>
<dt>Seac</dt><dd><ul>
<li>Guru, Jack</li></ul>
<li>Action, Guru, Jack, Screen</li></ul>
</dd>
<dt>Seemann</dt><dd><ul>
<li>XP5</li></ul>
</dd>
<dt>Shearwater</dt><dd><ul>
<li>Nerd, Nerd 2, Perdix, Perdix AI, Peregrine, Petrel, Petrel 2, Predator, Teric</li></ul>
<li>Nerd, Nerd 2, Perdix, Perdix 2, Perdix AI, Peregrine, Petrel, Petrel 2, Petrel 3, Predator, Teric, Tern</li></ul>
</dd>
<dt>Sherwood</dt><dd><ul>
<li>Amphos, Amphos Air, Insight, Insight 2, Sage, Vision, Wisdom, Wisdom 2, Wisdom 3, Wisdom 4</li></ul>
<li>Amphos, Amphos 2.0, Amphos Air, Amphos Air 2.0, Beacon, Insight, Insight 2, Sage, Vision, Wisdom, Wisdom 2, Wisdom 3, Wisdom 4</li></ul>
</dd>
<dt>Sporasub</dt><dd><ul>
<li>SP2</li></ul>
</dd>
<dt>Subgear</dt><dd><ul>
<li>XP Air, XP-10, XP-3G, XP-Air</li></ul>
</dd>
<dt>Suunto</dt><dd><ul>
<li>Cobra, Cobra 2, Cobra 3, D3, D4, D4f, D4i, D5, D6, D6i, D9, D9tx, DX, EON Core, EON Steel, Eon, Gekko, HelO2, Mosquito, Solution, Solution Alpha, Solution Nitrox, Spyder, Stinger, Vyper, Vyper 2, Vyper Air, Vyper Novo, Vytec, Zoop, Zoop Novo</li></ul>
<li>Cobra, Cobra 2, Cobra 3, D3, D4, D4f, D4i, D5, D6, D6i, D9, D9tx, DX, EON Core, EON Steel, EON Steel Black, Eon, Gekko, HelO2, Mosquito, Solution, Solution Alpha, Solution Nitrox, Spyder, Stinger, Vyper, Vyper 2, Vyper Air, Vyper Novo, Vytec, Zoop, Zoop Novo</li></ul>
</dd>
<dt>Tecdiving</dt><dd><ul>
<li>DiveComputer.eu</li></ul>

View File

@ -1,34 +1,40 @@
# This file is automatically generated, please edit scripts/parse-descriptor.pl
Aeris: 500 AI, A300, A300 AI, A300CS, Atmos 2, Atmos AI, Atmos AI 2, Compumask, Elite, Elite T3, Epic, F10, F11, Manta, XR-1 NX, XR-2
Apeks: Quantum X
Aqualung: i100, i200, i200C, i300, i300C, i450T, i470TC, i550, i550C, i750TC, i770R
Aqualung: i100, i200, i200C, i200Cv2, i300, i300C, i450T, i470TC, i550, i550C, i750TC, i770R
Atomic Aquatics: Cobalt, Cobalt 2
Beuchat: Mundial 2, Mundial 3, Voyager 2G
Citizen: Hyper Aqualand
Cochran: Commander I, Commander II, Commander TM, EMC-14, EMC-16, EMC-20H
Cressi: Cartesio, Drake, Edy, Giotto, Goa, Leonardo, Newton
Cressi: Cartesio, Donatello, Drake, Edy, Giotto, Goa, Leonardo, Michelangelo, Neon, Newton
Crest: CR-4
Deep Six: Excursion
Deepblu: Cosmiq+
Dive Rite: NiTek Q, NiTek Trio
DiveSystem: Orca, iDive DAN, iDive Deep, iDive Easy, iDive Free, iDive Pro, iDive Reb, iDive Stealth, iDive Tech, iDive X3M
Divesoft: Freedom, Liberty
FIT: File import
Garmin: Descent Mk1, Descent Mk2/Mk2i
Genesis: React Pro, React Pro White
Genesis: Centauri, React Pro, React Pro White
Heinrichs Weikamp: Frog, OSTC, OSTC 2, OSTC 2 TR, OSTC 2C, OSTC 2N, OSTC 3, OSTC 4, OSTC Mk2, OSTC Plus, OSTC Sport, OSTC cR
Hollis: DG02, DG03, TX1
Liquivision: Kaon, Lynx, Xen, Xeo
Mares: Airlab, Darwin, Darwin Air, Genius, Horizon, Icon HD, Icon HD Net Ready, M1, M2, Matrix, Nemo, Nemo Air, Nemo Apneist, Nemo Excel, Nemo Steel, Nemo Titanium, Nemo Wide, Nemo Wide 2, Puck, Puck 2, Puck Air, Puck Pro, Quad, Quad Air, Smart, Smart Air, Smart Apnea
Mares: Airlab, Darwin, Darwin Air, Genius, Horizon, Icon HD, Icon HD Net Ready, M1, M2, Matrix, Nemo, Nemo Air, Nemo Apneist, Nemo Excel, Nemo Steel, Nemo Titanium, Nemo Wide, Nemo Wide 2, Puck, Puck 2, Puck Air, Puck Pro, Puck Pro +, Quad, Quad Air, Smart, Smart Air, Smart Apnea
McLean: Extreme
Oceanic: Atom 1.0, Atom 2.0, Atom 3.0, Atom 3.1, Datamask, F10, F11, Geo, Geo 2.0, Geo 4.0, OC1, OCS, OCi, Pro Plus 2, Pro Plus 2.1, Pro Plus 3, Pro Plus 4, Pro Plus X, VT 4.1, VT Pro, VT3, VT4, VTX, Veo 1.0, Veo 180, Veo 2.0, Veo 200, Veo 250, Veo 3.0, Veo 4.0, Versa Pro
Oceanic: Atom 1.0, Atom 2.0, Atom 3.0, Atom 3.1, Datamask, F10, F11, Geo, Geo 2.0, Geo 4.0, Geo Air, OC1, OCS, OCi, Pro Plus 2, Pro Plus 2.1, Pro Plus 3, Pro Plus 4, Pro Plus X, VT 4.1, VT Pro, VT3, VT4, VTX, Veo 1.0, Veo 180, Veo 2.0, Veo 200, Veo 250, Veo 3.0, Veo 4.0, Versa Pro
Oceans: S1
Ratio: iDive Color Deep, iDive Color Easy, iDive Color Fancy, iDive Color Free, iDive Color Pro, iDive Color Reb, iDive Color Tech+, iDive Deep, iDive Easy, iDive Fancy, iDive Free, iDive Pro, iDive Reb, iDive Tech+, iX3M 2021 GPS Deep, iX3M 2021 GPS Easy, iX3M 2021 GPS Fancy, iX3M 2021 GPS Pro , iX3M 2021 GPS Reb, iX3M 2021 GPS Tech+, iX3M 2021 Pro Deep, iX3M 2021 Pro Easy, iX3M 2021 Pro Fancy, iX3M 2021 Pro Pro, iX3M 2021 Pro Reb, iX3M 2021 Pro Tech+, iX3M GPS Deep, iX3M GPS Easy, iX3M GPS Fancy, iX3M GPS Pro , iX3M GPS Reb, iX3M GPS Tech+, iX3M Pro Deep, iX3M Pro Easy, iX3M Pro Fancy, iX3M Pro Pro, iX3M Pro Reb, iX3M Pro Tech+
Ratio: ATOM, iDive 2 Deep, iDive 2 Easy, iDive 2 Fancy, iDive 2 Free, iDive 2 Pro, iDive 2 Reb, iDive 2 Tech, iDive Color Deep, iDive Color Easy, iDive Color Fancy, iDive Color Free, iDive Color Pro, iDive Color Reb, iDive Color Tech+, iDive Deep, iDive Easy, iDive Fancy, iDive Free, iDive Pro, iDive Reb, iDive Tech+, iX3M 2 Deep, iX3M 2 Easy, iX3M 2 GPS Deep, iX3M 2 GPS Easy, iX3M 2 GPS Gauge, iX3M 2 GPS Pro, iX3M 2 GPS Reb, iX3M 2 GPS Tech, iX3M 2 Gauge, iX3M 2 Pro, iX3M 2 Tech+, iX3M 2021 GPS Deep, iX3M 2021 GPS Easy, iX3M 2021 GPS Fancy, iX3M 2021 GPS Pro , iX3M 2021 GPS Reb, iX3M 2021 GPS Tech+, iX3M 2021 Pro Deep, iX3M 2021 Pro Easy, iX3M 2021 Pro Fancy, iX3M 2021 Pro Pro, iX3M 2021 Pro Reb, iX3M 2021 Pro Tech+, iX3M GPS Deep, iX3M GPS Easy, iX3M GPS Fancy, iX3M GPS Pro , iX3M GPS Reb, iX3M GPS Tech+, iX3M Pro Deep, iX3M Pro Easy, iX3M Pro Fancy, iX3M Pro Pro, iX3M Pro Reb, iX3M Pro Tech+
Reefnet: Sensus, Sensus Pro, Sensus Ultra
Scubapro: Aladin A1, Aladin A2, Aladin H Matrix, Aladin Sport Matrix, Aladin Square, Chromis, G2, G2 Console, G2 HUD, Mantis, Mantis 2, Meridian, XTender 5
Scorpena: Alpha
Scubapro: Aladin A1, Aladin A2, Aladin H Matrix, Aladin Sport Matrix, Aladin Square, Chromis, G2, G2 Console, G2 HUD, G2 TEK, G3, Luna 2.0, Luna 2.0 AI, Mantis, Mantis 2, Meridian, XTender 5
Seabaer: T1, H3, HUDC
Seac: Guru, Jack
Seac: Action, Guru, Jack, Screen
Seemann: XP5
Shearwater: Nerd, Nerd 2, Perdix, Perdix AI, Peregrine, Petrel, Petrel 2, Predator, Teric
Sherwood: Amphos, Amphos Air, Insight, Insight 2, Sage, Vision, Wisdom, Wisdom 2, Wisdom 3, Wisdom 4
Shearwater: Nerd, Nerd 2, Perdix, Perdix 2, Perdix AI, Peregrine, Petrel, Petrel 2, Petrel 3, Predator, Teric, Tern
Sherwood: Amphos, Amphos 2.0, Amphos Air, Amphos Air 2.0, Beacon, Insight, Insight 2, Sage, Vision, Wisdom, Wisdom 2, Wisdom 3, Wisdom 4
Sporasub: SP2
Subgear: XP Air, XP-10, XP-3G, XP-Air
Suunto: Cobra, Cobra 2, Cobra 3, D3, D4, D4f, D4i, D5, D6, D6i, D9, D9tx, DX, EON Core, EON Steel, Eon, Gekko, HelO2, Mosquito, Solution, Solution Alpha, Solution Nitrox, Spyder, Stinger, Vyper, Vyper 2, Vyper Air, Vyper Novo, Vytec, Zoop, Zoop Novo
Suunto: Cobra, Cobra 2, Cobra 3, D3, D4, D4f, D4i, D5, D6, D6i, D9, D9tx, DX, EON Core, EON Steel, EON Steel Black, Eon, Gekko, HelO2, Mosquito, Solution, Solution Alpha, Solution Nitrox, Spyder, Stinger, Vyper, Vyper 2, Vyper Air, Vyper Novo, Vytec, Zoop, Zoop Novo
Tecdiving: DiveComputer.eu
Tusa: Element II (IQ-750), IQ-700, Talis, Zen (IQ-900), Zen Air (IQ-950)
Uemis: Zürich SDA

View File

@ -10,7 +10,8 @@
android:hardwareAccelerated="true"
android:label="@string/app_name"
android:extractNativeLibs="true"
android:icon="@drawable/subsurface_mobile_icon" >
android:icon="@drawable/subsurface_mobile_icon"
android:networkSecurityConfig="@xml/network_security_config" >
<activity
android:name="org.subsurfacedivelog.mobile.SubsurfaceMobileActivity"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
@ -76,10 +77,19 @@
<meta-data android:name="android.max_aspect" android:value="3" />
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="org.subsurfacedivelog.mobile.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
</application>
<uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="29" />
android:targetSdkVersion="30" />
<supports-screens
android:anyDensity="true"
@ -94,11 +104,10 @@
-->
<!-- %%INSERT_PERMISSIONS -->
<!--
The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features.
-->
<!-- %%INSERT_FEATURES -->
<!-- %% no space here INSERT_FEATURES -->
</manifest>

View File

@ -5,8 +5,8 @@
*******************************************************/
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
google()
}
@ -17,8 +17,8 @@ buildscript {
allprojects {
repositories {
mavenCentral()
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
maven { url 'https://jitpack.io' }
google()
}
@ -27,8 +27,9 @@ allprojects {
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.github.mik3y:usb-serial-for-android:v2.2.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.github.mik3y:usb-serial-for-android:v3.4.3'
implementation 'com.android.support:support-v4:25.3.1'
}
android {
@ -62,6 +63,11 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<files-path path="./" name="logfiles" />
</paths>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>

View File

@ -298,9 +298,10 @@ public class AndroidSerial {
Log.d(TAG, "in " + Thread.currentThread().getStackTrace()[2].getMethodName());
try {
Log.d(TAG, "write length: " + data.length);
int retval = usbSerialPort.write(data, timeout);
Log.d(TAG, "actual write length: " + retval);
return retval;
usbSerialPort.write(data, timeout);
/* throws an exception if we didn't write all data successfully */
Log.d(TAG, "successfully written");
return data.length;
} catch (Exception e) {
Log.e(TAG, "Error in " + Thread.currentThread().getStackTrace()[2].getMethodName(), e);
return AndroidSerial.DC_STATUS_IO;
@ -313,8 +314,9 @@ public class AndroidSerial {
Log.d(TAG, "in " + Thread.currentThread().getStackTrace()[2].getMethodName());
try {
if ((direction | AndroidSerial.DC_DIRECTION_INPUT) > 0) readBuffer.clear();
boolean retval = this.usbSerialPort.purgeHwBuffers((direction | AndroidSerial.DC_DIRECTION_OUTPUT) > 0, (direction | AndroidSerial.DC_DIRECTION_INPUT) > 0);
return retval ? AndroidSerial.DC_STATUS_SUCCESS : AndroidSerial.DC_STATUS_IO;
this.usbSerialPort.purgeHwBuffers((direction | AndroidSerial.DC_DIRECTION_OUTPUT) > 0, (direction | AndroidSerial.DC_DIRECTION_INPUT) > 0);
/* throws exeption if an error occured or flush isn't supported */
return AndroidSerial.DC_STATUS_SUCCESS;
} catch (Exception e) {
Log.e(TAG, "Error in " + Thread.currentThread().getStackTrace()[2].getMethodName(), e);
return AndroidSerial.DC_STATUS_IO;

View File

@ -20,10 +20,85 @@ import android.content.Intent;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.util.Log;
import java.io.File;
import android.net.Uri;
import android.support.v4.content.FileProvider;
import android.support.v4.app.ShareCompat;
import android.content.pm.PackageManager;
import java.util.List;
import android.content.pm.ResolveInfo;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
// this is the main class that will be run at start
public class SubsurfaceMobileActivity extends QtActivity
{
// FileProvider declares an 'authority' in AndroidManifest.xml
private static String fileProviderAuthority="org.subsurfacedivelog.mobile.fileprovider";
// you can share one or two files
public boolean shareViaEmail(String subject, String recipient, String body, String path1, String path2) {
// better save than sorry
if (QtNative.activity() == null)
return false;
Log.d(TAG + " shareFile - trying to share: ", path1 + " and " + path2 + " to " + recipient);
// Can't get this to work building my own intent, so let's use the IntentBuilder
Intent shareFileIntent = ShareCompat.IntentBuilder.from(QtNative.activity()).getIntent();
shareFileIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
// recipients are always an array, even if there's only one
shareFileIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { recipient });
shareFileIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
shareFileIntent.putExtra(Intent.EXTRA_TEXT, body);
// now figure out the URI we need to share the first file
File fileToShare = new File(path1);
Uri uri;
try {
uri = FileProvider.getUriForFile(QtNative.activity(), fileProviderAuthority, fileToShare);
} catch (IllegalArgumentException e) {
Log.d(TAG + " shareFile - cannot get URI for ", path1);
return false;
}
Log.d(TAG + " shareFile - URI for file: ", uri.toString());
// because we allow up to two attachments, we use ACTION_SEND_MULTIPLE and so the attachments
// need to be an ArrayList - even if we only add one attachment this still works
ArrayList<Uri> attachments = new ArrayList<Uri>();
attachments.add(uri);
// if there is a second file name (that's for support emails) add it and set this up as support email as well
if (!path2.isEmpty()) {
fileToShare = new File(path2);
try {
uri = FileProvider.getUriForFile(QtNative.activity(), fileProviderAuthority, fileToShare);
} catch (IllegalArgumentException e) {
Log.d(TAG + " shareFile - cannot get URI for ", path2);
return false;
}
Log.d(TAG + " shareFile - URI for file: ", uri.toString());
attachments.add(uri);
}
shareFileIntent.setType("text/plain");
shareFileIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);
shareFileIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareFileIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
Log.d(TAG + " sendFile ", " create activity for the Intent");
// this actually allows sharing with any app that will take "text/plain" files, including Dropbox, etc
// in order for the recipient / subject to work, the user needs to be clever enough to share with an email app
QtNative.activity().startActivity(shareFileIntent);
return true;
}
public boolean supportEmail(String path1, String path2) {
return shareViaEmail("Subsurface-mobile support request",
"in-app-support@subsurface-divelog.org",
"Please describe your issue here and keep the attached logs.\n\n\n\n",
path1, path2);
}
public static boolean isIntentPending;
public static boolean isInitialized;
private static final String TAG = "subsurfacedivelog.mobile";

View File

@ -1,9 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <QFileInfo>
#include <QDir>
#include <QtConcurrent>
#include "exportfuncs.h"
#include "core/membuffer.h"
#include "core/dive.h"
#include "core/divelog.h"
#include "core/divesite.h"
#include "core/gettextfromc.h"
#include "core/tag.h"
@ -15,10 +14,47 @@
#include "core/picture.h"
#include "core/pref.h"
#include "core/sample.h"
#include "exportfuncs.h"
#include "core/selection.h"
#include "core/taxonomy.h"
#include "core/sample.h"
#include "profile-widget/profilescene.h"
#include <QDir>
#include <QFileInfo>
#include <QtConcurrent>
#include <memory>
// Default implementation of the export callback: do nothing / never cancel
void ExportCallback::setProgress(int)
{
}
bool ExportCallback::canceled() const
{
return false;
}
#if !defined(SUBSURFACE_MOBILE)
void exportProfile(QString filename, bool selected_only)
// Let's say that 800x600 is a "reasonable" profile size. Use four times that for printing.
static constexpr int profileScale = 4;
static constexpr int profileWidth = 800 * profileScale;
static constexpr int profileHeight = 600 * profileScale;
static void exportProfile(ProfileScene *profile, const struct dive *dive, const QString &filename)
{
QImage image = QImage(QSize(profileWidth, profileHeight), QImage::Format_RGB32);
QPainter paint;
paint.begin(&image);
profile->draw(&paint, QRect(0, 0, profileWidth, profileHeight), dive, 0, nullptr, false);
image.save(filename);
}
static std::unique_ptr<ProfileScene> getPrintProfile()
{
return std::make_unique<ProfileScene>((double)profileScale, true, false);
}
void exportProfile(QString filename, bool selected_only, ExportCallback &cb)
{
struct dive *dive;
int i;
@ -27,18 +63,23 @@ void exportProfile(QString filename, bool selected_only)
filename = filename.append(".png");
QFileInfo fi(filename);
int todo = selected_only ? amount_selected : divelog.dives->nr;
int done = 0;
auto profile = getPrintProfile();
for_each_dive (i, dive) {
if (cb.canceled())
return;
if (selected_only && !dive->selected)
continue;
if (count)
exportProfile(dive, fi.path() + QDir::separator() + fi.completeBaseName().append(QString("-%1.").arg(count)) + fi.suffix());
else
exportProfile(dive, filename);
cb.setProgress(done++ * 1000 / todo);
QString fn = count ? fi.path() + QDir::separator() + fi.completeBaseName().append(QString("-%1.").arg(count)) + fi.suffix()
: filename;
exportProfile(profile.get(), dive, fn);
++count;
}
}
void export_TeX(const char *filename, bool selected_only, bool plain)
void export_TeX(const char *filename, bool selected_only, bool plain, ExportCallback &cb)
{
FILE *f;
QDir texdir = QFileInfo(filename).dir();
@ -49,7 +90,7 @@ void export_TeX(const char *filename, bool selected_only, bool plain)
int i;
bool need_pagebreak = false;
struct membuffer buf = {};
struct membufferpp buf;
if (plain) {
ssrf = "";
@ -91,22 +132,23 @@ void export_TeX(const char *filename, bool selected_only, bool plain)
put_format(&buf, "\n%%%%%%%%%% Begin Dive Data: %%%%%%%%%%\n");
int todo = selected_only ? amount_selected : divelog.dives->nr;
int done = 0;
auto profile = getPrintProfile();
for_each_dive (i, dive) {
if (cb.canceled())
return;
if (selected_only && !dive->selected)
continue;
exportProfile(dive, texdir.filePath(QString("profile%1.png").arg(dive->number)));
cb.setProgress(done++ * 1000 / todo);
exportProfile(profile.get(), dive, texdir.filePath(QString("profile%1.png").arg(dive->number)));
struct tm tm;
utc_mkdate(dive->when, &tm);
const char *country = NULL;
dive_site *site = dive->dive_site;
QRegExp ct("countrytag: (\\w+)");
QString country;
if (site && ct.indexIn(site->notes) >= 0)
country = ct.cap(1);
else
country = "";
if (site)
country = taxonomy_get_country(&site->taxonomy);
pressure_t delta_p = {.mbar = 0};
QString star = "*";
@ -138,8 +180,8 @@ void export_TeX(const char *filename, bool selected_only, bool plain)
site ? put_format(&buf, "\\def\\%sgpslat{%f}\n", ssrf, site->location.lat.udeg / 1000000.0) : put_format(&buf, "\\def\\%sgpslat{}\n", ssrf);
site ? put_format(&buf, "\\def\\%sgpslon{%f}\n", ssrf, site->location.lon.udeg / 1000000.0) : put_format(&buf, "\\def\\gpslon{}\n");
put_format(&buf, "\\def\\%scomputer{%s}\n", ssrf, dive->dc.model);
put_format(&buf, "\\def\\%scountry{%s}\n", ssrf, qPrintable(country));
put_format(&buf, "\\def\\%stime{%u:%02u}\n", ssrf, FRACTION(dive->duration.seconds, 60));
put_format(&buf, "\\def\\%scountry{%s}\n", ssrf, country ?: "");
put_format(&buf, "\\def\\%stime{%u:%02u}\n", ssrf, FRACTION_TUPLE(dive->duration.seconds, 60));
put_format(&buf, "\n%% Dive Profile Details:\n");
dive->maxtemp.mkelvin ? put_format(&buf, "\\def\\%smaxtemp{%.1f\\%stemperatureunit}\n", ssrf, get_temp_units(dive->maxtemp.mkelvin, &unit), ssrf) : put_format(&buf, "\\def\\%smaxtemp{}\n", ssrf);
@ -149,21 +191,15 @@ void export_TeX(const char *filename, bool selected_only, bool plain)
dive->maxdepth.mm ? put_format(&buf, "\\def\\%smaximumdepth{%.1f\\%sdepthunit}\n", ssrf, get_depth_units(dive->maxdepth.mm, NULL, &unit), ssrf) : put_format(&buf, "\\def\\%smaximumdepth{}\n", ssrf);
dive->meandepth.mm ? put_format(&buf, "\\def\\%smeandepth{%.1f\\%sdepthunit}\n", ssrf, get_depth_units(dive->meandepth.mm, NULL, &unit), ssrf) : put_format(&buf, "\\def\\%smeandepth{}\n", ssrf);
struct tag_entry *tag = dive->tag_list;
QString tags;
if (tag) {
tags = tag->tag->name;
while ((tag = tag->next))
tags += QString(", ") + QString(tag->tag->name);
}
put_format(&buf, "\\def\\%stype{%s}\n", ssrf, qPrintable(tags));
std::string tags = taglist_get_tagstring(dive->tag_list);
put_format(&buf, "\\def\\%stype{%s}\n", ssrf, tags.c_str());
put_format(&buf, "\\def\\%sviz{%s}\n", ssrf, qPrintable(viz));
put_format(&buf, "\\def\\%srating{%s}\n", ssrf, qPrintable(rating));
put_format(&buf, "\\def\\%splot{\\includegraphics[width=9cm,height=4cm]{profile%d}}\n", ssrf, dive->number);
put_format(&buf, "\\def\\%sprofilename{profile%d}\n", ssrf, dive->number);
put_format(&buf, "\\def\\%scomment{%s}\n", ssrf, dive->notes ? dive->notes : "");
put_format(&buf, "\\def\\%sbuddy{%s}\n", ssrf, dive->buddy ? dive->buddy : "");
put_format(&buf, "\\def\\%sdivemaster{%s}\n", ssrf, dive->divemaster ? dive->divemaster : "");
put_format(&buf, "\\def\\%sdivemaster{%s}\n", ssrf, dive->diveguide ? dive->diveguide : "");
put_format(&buf, "\\def\\%ssuit{%s}\n", ssrf, dive->suit ? dive->suit : "");
// Print cylinder data
@ -171,7 +207,7 @@ void export_TeX(const char *filename, bool selected_only, bool plain)
qty_cyl = 0;
for (i = 0; i < dive->cylinders.nr; i++){
const cylinder_t &cyl = *get_cylinder(dive, i);
if (is_cylinder_used(dive, i) || (prefs.display_unused_tanks && cyl.type.description)){
if (is_cylinder_used(dive, i) || (prefs.include_unused_tanks && cyl.type.description)){
put_format(&buf, "\\def\\%scyl%cdescription{%s}\n", ssrf, 'a' + i, cyl.type.description);
put_format(&buf, "\\def\\%scyl%cgasname{%s}\n", ssrf, 'a' + i, gasname(cyl.gasmix));
put_format(&buf, "\\def\\%scyl%cmixO2{%.1f\\%%}\n", ssrf, 'a' + i, get_o2(cyl.gasmix)/10.0);
@ -219,7 +255,6 @@ void export_TeX(const char *filename, bool selected_only, bool plain)
dive->maxdepth.mm ? put_format(&buf, "\\def\\%sdepth{%.1f\\%sdepthunit}\n", ssrf, get_depth_units(dive->maxdepth.mm, NULL, &unit), ssrf) : put_format(&buf, "\\def\\%sdepth{}\n", ssrf);
put_format(&buf, "\\%spage\n", ssrf);
}
if (plain)
@ -234,8 +269,7 @@ void export_TeX(const char *filename, bool selected_only, bool plain)
flush_buffer(&buf, f); /*check for writing errors? */
fclose(f);
}
free_buffer(&buf);
cb.setProgress(1000);
}
void export_depths(const char *filename, bool selected_only)
@ -246,7 +280,7 @@ void export_depths(const char *filename, bool selected_only)
int i;
const char *unit = NULL;
struct membuffer buf = {};
struct membufferpp buf;
for_each_dive (i, dive) {
if (selected_only && !dive->selected)
@ -272,7 +306,6 @@ void export_depths(const char *filename, bool selected_only)
flush_buffer(&buf, f); /*check for writing errors? */
fclose(f);
}
free_buffer(&buf);
}
#endif /* ! SUBSURFACE_MOBILE */
@ -292,9 +325,9 @@ std::vector<const dive_site *> getDiveSitesToExport(bool selectedOnly)
return res;
}
res.reserve(dive_site_table.nr);
for (int i = 0; i < dive_site_table.nr; i++) {
struct dive_site *ds = get_dive_site(i, &dive_site_table);
res.reserve(divelog.sites->nr);
for (int i = 0; i < divelog.sites->nr; i++) {
struct dive_site *ds = get_dive_site(i, divelog.sites);
if (dive_site_is_empty(ds))
continue;
if (selectedOnly && !is_dive_site_selected(ds))
@ -305,14 +338,14 @@ std::vector<const dive_site *> getDiveSitesToExport(bool selectedOnly)
/* walk the dive site list */
int i;
const struct dive_site *ds;
for_each_dive_site (i, ds, &dive_site_table)
res.push_back(get_dive_site(i, &dive_site_table));
for_each_dive_site (i, ds, divelog.sites)
res.push_back(get_dive_site(i, divelog.sites));
#endif
return res;
}
QFuture<int> exportUsingStyleSheet(QString filename, bool doExport, int units,
QString stylesheet, bool anonymize)
QFuture<int> exportUsingStyleSheet(const QString &filename, bool doExport, int units,
const QString &stylesheet, bool anonymize)
{
return QtConcurrent::run(export_dives_xslt, filename.toUtf8(), doExport, units, stylesheet.toUtf8(), anonymize);
}

View File

@ -7,22 +7,19 @@
struct dive_site;
void exportProfile(QString filename, bool selected_only);
void export_TeX(const char *filename, bool selected_only, bool plain);
// A synchrounous callback interface to signal progress / check for user abort
struct ExportCallback {
virtual void setProgress(int progress); // 0-1000
virtual bool canceled() const;
};
void exportProfile(QString filename, bool selected_only, ExportCallback &cb);
void export_TeX(const char *filename, bool selected_only, bool plain, ExportCallback &cb);
void export_depths(const char *filename, bool selected_only);
std::vector<const dive_site *> getDiveSitesToExport(bool selectedOnly);
QFuture<int> exportUsingStyleSheet(QString filename, bool doExport, int units, QString stylesheet, bool anonymize);
QFuture<int> exportUsingStyleSheet(const QString &filename, bool doExport, int units, const QString &stylesheet, bool anonymize);
// prepareDivesForUploadDiveLog
// prepareDivesForUploadDiveShare
// WARNING
// exportProfile uses the UI and are therefore different between
// Desktop (UI) and Mobile (QML)
// In order to solve this difference, the actual implementations
// are done in
// desktop-widgets/divelogexportdialog.cpp and
// mobile-widgets/qmlmanager.cpp
void exportProfile(const struct dive *dive, const QString filename);
#endif // EXPORT_FUNCS_H

View File

@ -29,6 +29,7 @@ void cliDownloader(const char *vendor, const char *product, const char *device)
data->setForceDownload(false);
data->setSaveLog(true);
data->setSaveDump(false);
data->setSyncTime(false);
diveImportedModel.startDownload();
diveImportedModel.waitForDownload();

View File

@ -1,6 +0,0 @@
if(NO_USERMANUAL)
message(STATUS "building without usermanual")
add_definitions(-DNO_USERMANUAL)
else()
list(APPEND QT_EXTRA_COMPONENTS WebKitWidgets)
endif()

View File

@ -1,8 +1,7 @@
# Generate the ssrf-config.h every 'make'
file(WRITE ${CMAKE_BINARY_DIR}/version.h.in
"#define GIT_VERSION_STRING \"@GIT_VERSION_STRING@\"
#define CANONICAL_VERSION_STRING \"@CANONICAL_VERSION_STRING@\"
#define MOBILE_VERSION_STRING \"@MOBILE_VERSION_STRING@\"
"#define CANONICAL_VERSION_STRING \"@CANONICAL_VERSION_STRING@\"
#define CANONICAL_VERSION_STRING_4 \"@CANONICAL_VERSION_STRING_4@\"
")
file(COPY cmake/Modules/version.cmake

View File

@ -34,5 +34,9 @@
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Subsurface needs access to your Bluetooth peripherals in order to download dive information directly from BLE enabled dive computers.</string>
</dict>
</plist>

View File

@ -18,6 +18,7 @@ if(NOT NO_DOCS)
COMMAND
mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ &&
rm -rf ${CMAKE_BINARY_DIR}/Documentation/images &&
rm -rf ${CMAKE_BINARY_DIR}/Documentation/mobile-images &&
ln -sf ${CMAKE_SOURCE_DIR}/Documentation/images ${CMAKE_BINARY_DIR}/Documentation/images &&
ln -sf ${CMAKE_SOURCE_DIR}/Documentation/mobile-images ${CMAKE_BINARY_DIR}/Documentation/mobile-images
)

View File

@ -1,23 +1,31 @@
execute_process(
COMMAND sh ${CMAKE_TOP_SRC_DIR}/scripts/get-version linux
COMMAND bash ${CMAKE_TOP_SRC_DIR}/scripts/get-version.sh 4
WORKING_DIRECTORY ${CMAKE_TOP_SRC_DIR}
OUTPUT_VARIABLE GIT_VERSION_STRING
OUTPUT_VARIABLE CANONICAL_VERSION_STRING_4
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND sh ${CMAKE_TOP_SRC_DIR}/scripts/get-version full
COMMAND bash ${CMAKE_TOP_SRC_DIR}/scripts/get-version.sh 3
WORKING_DIRECTORY ${CMAKE_TOP_SRC_DIR}
OUTPUT_VARIABLE CANONICAL_VERSION_STRING_3
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND bash ${CMAKE_TOP_SRC_DIR}/scripts/get-version.sh
WORKING_DIRECTORY ${CMAKE_TOP_SRC_DIR}
OUTPUT_VARIABLE CANONICAL_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(MOBILE_VERSION_STRING "3.2.0")
configure_file(${SRC} ${DST} @ONLY)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
execute_process(
COMMAND cat ${CMAKE_TOP_SRC_DIR}/packaging/windows/subsurface.nsi.in
COMMAND sed -e "s/VERSIONTOKEN/${GIT_VERSION_STRING}/"
COMMAND sed -e "s/PRODVTOKEN/${CANONICAL_VERSION_STRING}/"
COMMAND sed -e "s/VERSIONTOKEN/${CANONICAL_VERSION_STRING}/"
COMMAND sed -e "s/PRODVTOKEN/${CANONICAL_VERSION_STRING_4}/"
OUTPUT_FILE ${CMAKE_BINARY_DIR}/staging/subsurface.nsi
)
endif()

View File

@ -18,11 +18,9 @@ void addDive(dive *d, bool autogroup, bool newNumber)
execute(new AddDive(d, autogroup, newNumber));
}
void importDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
struct device_table *devices, struct filter_preset_table *presets,
int flags, const QString &source)
void importDives(struct divelog *log, int flags, const QString &source)
{
execute(new ImportDives(dives, trips, sites, devices, presets, flags, source));
execute(new ImportDives(log, flags, source));
}
void deleteDive(const QVector<struct dive*> &divesToDelete)
@ -264,9 +262,9 @@ int editBuddies(const QStringList &newList, bool currentDiveOnly)
return execute_edit(new EditBuddies(newList, currentDiveOnly));
}
int editDiveMaster(const QStringList &newList, bool currentDiveOnly)
int editDiveGuide(const QStringList &newList, bool currentDiveOnly)
{
return execute_edit(new EditDiveMaster(newList, currentDiveOnly));
return execute_edit(new EditDiveGuide(newList, currentDiveOnly));
}
void pasteDives(const dive *d, dive_components what)
@ -276,12 +274,12 @@ void pasteDives(const dive *d, dive_components what)
void replanDive(dive *d)
{
execute(new ReplanDive(d, false));
execute(new ReplanDive(d));
}
void editProfile(dive *d)
void editProfile(const dive *d, int dcNr, EditProfileType type, int count)
{
execute(new ReplanDive(d, true));
execute(new EditProfile(d, dcNr, type, count));
}
int addWeight(bool currentDiveOnly)
@ -314,6 +312,11 @@ int editCylinder(int index, cylinder_t cyl, EditCylinderType type, bool currentD
return execute_edit(new EditCylinder(index, cyl, type, currentDiveOnly));
}
void editSensors(int toCylinder, int fromCylinder, int dcNr)
{
execute(new EditSensors(toCylinder, fromCylinder, dcNr));
}
// Trip editing related commands
void editTripLocation(dive_trip *trip, const QString &s)
{
@ -381,14 +384,9 @@ void addPictures(const std::vector<PictureListForAddition> &pictures)
execute(new AddPictures(pictures));
}
void removeDevice(int idx)
void editDeviceNickname(struct divecomputer *dc, const QString &nickname)
{
execute(new RemoveDevice(idx));
}
void editDeviceNickname(int idx, const QString &nickname)
{
execute(new EditDeviceNickname(idx, nickname));
execute(new EditDeviceNickname(dc, nickname));
}
void createFilterPreset(const QString &name, const FilterData &data)

View File

@ -2,17 +2,23 @@
#ifndef COMMAND_H
#define COMMAND_H
#include "core/dive.h"
#include "core/divelog.h"
#include "core/equipment.h"
#include "core/pictureobj.h"
#include "core/taxonomy.h"
#include <QVector>
#include <QAction>
#include <vector>
struct divecomputer;
struct divelog;
struct dive_components;
struct dive_site;
struct dive_trip;
struct event;
struct DiveAndLocation;
struct FilterData;
struct filter_preset_table;
struct device_table;
// We put everything in a namespace, so that we can shorten names without polluting the global namespace
namespace Command {
@ -24,8 +30,9 @@ void clear(); // Reset the undo stack. Delete all commands.
void setClean(); // Call after save - this marks a state where no changes need to be saved.
bool isClean(); // Any changes need to be saved?
QAction *undoAction(QObject *parent); // Create an undo action.
QAction *redoAction(QObject *parent); // Create an redo action.
QString changesMade(); // return a string with the texts from all commands on the undo stack -> for commit message
QAction *redoAction(QObject *parent); // Create a redo action.
QString changesMade(); // Return a string with the texts from all commands on the undo stack -> for commit message.
bool placingCommand(); // Currently executing a new command -> might not have to update the field the user just edited.
// 2) Dive-list related commands
@ -34,10 +41,7 @@ QString changesMade(); // return a string with the texts from all commands on
// If newNumber is true, the dive is assigned a new number, depending on the
// insertion position.
void addDive(dive *d, bool autogroup, bool newNumber);
void importDives(struct dive_table *dives, struct trip_table *trips,
struct dive_site_table *sites, struct device_table *devices,
struct filter_preset_table *filter_presets,
int flags, const QString &source); // The tables are consumed!
void importDives(struct divelog *log, int flags, const QString &source); // The tables are consumed!
void deleteDive(const QVector<struct dive*> &divesToDelete);
void shiftTime(const std::vector<dive *> &changedDives, int amount);
void renumberDives(const QVector<QPair<dive *, int>> &divesToRenumber);
@ -90,10 +94,16 @@ int editDiveSite(struct dive_site *newValue, bool currentDiveOnly);
int editDiveSiteNew(const QString &newName, bool currentDiveOnly);
int editTags(const QStringList &newList, bool currentDiveOnly);
int editBuddies(const QStringList &newList, bool currentDiveOnly);
int editDiveMaster(const QStringList &newList, bool currentDiveOnly);
int editDiveGuide(const QStringList &newList, bool currentDiveOnly);
void pasteDives(const dive *d, dive_components what);
void replanDive(dive *d); // dive computer(s) and cylinder(s) will be reset!
void editProfile(dive *d); // dive computer(s) and cylinder(s) will be reset!
enum class EditProfileType {
ADD,
REMOVE,
MOVE,
EDIT,
};
void replanDive(dive *d); // dive computer(s) and cylinder(s) of first argument will be consumed!
void editProfile(const dive *d, int dcNr, EditProfileType type, int count);
int addWeight(bool currentDiveOnly);
int removeWeight(int index, bool currentDiveOnly);
int editWeight(int index, weightsystem_t ws, bool currentDiveOnly);
@ -105,6 +115,7 @@ enum class EditCylinderType {
GASMIX
};
int editCylinder(int index, cylinder_t cyl, EditCylinderType type, bool currentDiveOnly);
void editSensors(int toCylinder, int fromCylinder, int dcNr);
#ifdef SUBSURFACE_MOBILE
// Edits a dive and creates a divesite (if createDs != NULL) or edits a divesite (if changeDs != NULL).
// Takes ownership of newDive and createDs!
@ -141,8 +152,7 @@ void addPictures(const std::vector<PictureListForAddition> &pictures);
// 8) Device commands
void removeDevice(int idx);
void editDeviceNickname(int idx, const QString &nickname);
void editDeviceNickname(struct divecomputer *dc, const QString &nickname);
// 9) Filter commands

View File

@ -1,13 +1,16 @@
// SPDX-License-Identifier: GPL-2.0
#include "command.h"
#include "command_base.h"
#include "core/divelog.h"
#include "core/globals.h"
#include "core/qthelper.h" // for updateWindowTitle()
#include "core/subsurface-qt/divelistnotifier.h"
#include <QVector>
namespace Command {
static QUndoStack undoStack;
static QUndoStack *undoStack;
// forward declaration
QString changesMade();
@ -15,39 +18,41 @@ QString changesMade();
// General commands
void init()
{
QObject::connect(&undoStack, &QUndoStack::cleanChanged, &updateWindowTitle);
undoStack = make_global<QUndoStack>();
QObject::connect(undoStack, &QUndoStack::cleanChanged, &updateWindowTitle);
QObject::connect(&diveListNotifier, &DiveListNotifier::dataReset, &Command::clear);
changesCallback = &changesMade;
}
void clear()
{
undoStack.clear();
undoStack->clear();
}
void setClean()
{
undoStack.setClean();
undoStack->setClean();
}
bool isClean()
{
return undoStack.isClean();
return undoStack->isClean();
}
// this can be used to get access to the signals emitted by the QUndoStack
QUndoStack *getUndoStack()
{
return &undoStack;
return undoStack;
}
QAction *undoAction(QObject *parent)
{
return undoStack.createUndoAction(parent, QCoreApplication::translate("Command", "&Undo"));
return undoStack->createUndoAction(parent, QCoreApplication::translate("Command", "&Undo"));
}
QAction *redoAction(QObject *parent)
{
return undoStack.createRedoAction(parent, QCoreApplication::translate("Command", "&Redo"));
return undoStack->createRedoAction(parent, QCoreApplication::translate("Command", "&Redo"));
}
QString diveNumberOrDate(struct dive *d)
@ -61,7 +66,7 @@ QString diveNumberOrDate(struct dive *d)
QString getListOfDives(const std::vector<struct dive*> &dives)
{
QString listOfDives;
if ((int)dives.size() == dive_table.nr)
if ((int)dives.size() == divelog.dives->nr)
return Base::tr("all dives");
int i = 0;
for (dive *d: dives) {
@ -80,21 +85,41 @@ QString getListOfDives(QVector<struct dive *> dives)
return getListOfDives(std::vector<struct dive *>(dives.begin(), dives.end()));
}
// return a string that can be used for the commit message and should list the changes that
// were made to the dive list
// keep in mind that the changes could have been a number of undo commands, so we might have
// to go backwards from the last one written; this isn't perfect as a user could undo a command
// and then do something else instead of redoing that undo - the undo information is then lost
// for the changelog -- but of course the git history will show what happened
QString changesMade()
{
static int nextToWrite = 0;
int curIdx = undoStack->index();
QString changeTexts;
for (int i = 0; i < undoStack.index(); i++)
changeTexts += undoStack.text(i) + "\n";
if (curIdx > nextToWrite) {
for (int i = nextToWrite; i < curIdx; i++)
changeTexts += undoStack->text(i) + "\n";
} else if (curIdx < nextToWrite) { // we walked back undoing things
for (int i = nextToWrite - 1; i >= curIdx; i--)
changeTexts += "(undo) " + undoStack->text(i) + "\n";
} else if (curIdx > 0) {
// so this means we undid something (or more than one thing) and then did something else
// so we lost the information of what was undone - and how many things were changed;
// just show the last change
changeTexts += undoStack->text(curIdx - 1) + "\n";
}
nextToWrite = curIdx;
return changeTexts;
}
static bool executingCommand = false;
bool execute(Base *cmd)
{
if (cmd->workToBeDone()) {
undoStack.push(cmd);
executingCommand = true;
undoStack->push(cmd);
executingCommand = false;
emit diveListNotifier.commandExecuted();
return true;
} else {
@ -103,6 +128,9 @@ bool execute(Base *cmd)
}
}
bool placingCommand()
{
return executingCommand;
}
} // namespace Command

View File

@ -7,6 +7,7 @@
#include "core/divesite.h"
#include "core/trip.h"
#include "core/dive.h"
#include "core/owning_ptrs.h"
#include <QUndoCommand>
#include <QCoreApplication> // For Q_DECLARE_TR_FUNCTIONS
@ -153,26 +154,6 @@ QVector<T> stdToQt(const std::vector<T> &v)
// We put everything in a namespace, so that we can shorten names without polluting the global namespace
namespace Command {
// Classes used to automatically call the appropriate free_*() function for owning pointers that go out of scope.
struct DiveDeleter {
void operator()(dive *d) { free_dive(d); }
};
struct TripDeleter {
void operator()(dive_trip *t) { free_trip(t); }
};
struct DiveSiteDeleter {
void operator()(dive_site *ds) { free_dive_site(ds); }
};
struct EventDeleter {
void operator()(event *ev) { free(ev); }
};
// Owning pointers to dive, dive_trip, dive_site and event objects.
typedef std::unique_ptr<dive, DiveDeleter> OwningDivePtr;
typedef std::unique_ptr<dive_trip, TripDeleter> OwningTripPtr;
typedef std::unique_ptr<dive_site, DiveSiteDeleter> OwningDiveSitePtr;
typedef std::unique_ptr<event, EventDeleter> OwningEventPtr;
// This is the base class of all commands.
// It defines the Qt-translation functions
class Base : public QUndoCommand {

View File

@ -1,61 +1,33 @@
// SPDX-License-Identifier: GPL-2.0
#include "command_device.h"
#include "core/divelog.h"
#include "core/subsurface-qt/divelistnotifier.h"
namespace Command {
RemoveDevice::RemoveDevice(int indexIn) : index(indexIn)
EditDeviceNickname::EditDeviceNickname(const struct divecomputer *dc, const QString &nicknameIn) :
nickname(nicknameIn.toStdString())
{
const device *dev = get_device(&device_table, index);
if (!dev)
index = get_or_add_device_for_dc(divelog.devices, dc);
if (index == -1)
return;
setText(Command::Base::tr("Delete device %1 (0x%2)").arg(QString::fromStdString(dev->model),
QString::number(dev->deviceId)));
}
bool RemoveDevice::workToBeDone()
{
return get_device(&device_table, index) != nullptr;
}
void RemoveDevice::redo()
{
dev = *get_device(&device_table, index);
remove_from_device_table(&device_table, index);
emit diveListNotifier.deviceDeleted(index);
}
void RemoveDevice::undo()
{
index = add_to_device_table(&device_table, &dev);
emit diveListNotifier.deviceAdded(index);
}
EditDeviceNickname::EditDeviceNickname(int indexIn, const QString &nicknameIn) :
index(indexIn), nickname(nicknameIn.toStdString())
{
const device *dev = get_device(&device_table, index);
if (!dev)
return;
setText(Command::Base::tr("Set nickname of device %1 (0x%2) to %3").arg(QString::fromStdString(dev->model),
QString::number(dev->deviceId,1 ,16), nicknameIn));
setText(Command::Base::tr("Set nickname of device %1 (serial %2) to %3").arg(dc->model, dc->serial, nicknameIn));
}
bool EditDeviceNickname::workToBeDone()
{
return get_device(&device_table, index) != nullptr;
return get_device(divelog.devices, index) != nullptr;
}
void EditDeviceNickname::redo()
{
device *dev = get_device_mutable(&device_table, index);
device *dev = get_device_mutable(divelog.devices, index);
if (!dev)
return;
std::swap(dev->nickName, nickname);
emit diveListNotifier.deviceEdited(index);
emit diveListNotifier.deviceEdited();
}
void EditDeviceNickname::undo()

View File

@ -12,24 +12,9 @@ struct device;
// We put everything in a namespace, so that we can shorten names without polluting the global namespace
namespace Command {
class RemoveDevice final : public Base {
public:
RemoveDevice(int index);
private:
// for undo
device dev;
// for redo
int index;
void undo() override;
void redo() override;
bool workToBeDone() override;
};
class EditDeviceNickname final : public Base {
public:
EditDeviceNickname(int index, const QString &nickname);
EditDeviceNickname(const divecomputer *dc, const QString &nickname);
private:
// for redo and undo
int index;

View File

@ -2,11 +2,11 @@
#include "command_divelist.h"
#include "core/divelist.h"
#include "core/divelog.h"
#include "core/qthelper.h"
#include "core/selection.h"
#include "core/subsurface-qt/divelistnotifier.h"
#include "qt-models/filtermodels.h"
#include "../profile-widget/profilewidget2.h"
#include "core/divefilter.h"
#include <array>
@ -18,7 +18,7 @@ static void remove_trip_from_backend(dive_trip *trip)
{
if (trip->selected)
deselect_trip(trip);
remove_trip(trip, &trip_table); // Remove trip from backend
remove_trip(trip, divelog.trips); // Remove trip from backend
}
// This helper function removes a dive, takes ownership of the dive and adds it to a DiveToAdd structure.
@ -78,9 +78,9 @@ dive *DiveListBase::addDive(DiveToAdd &d)
// dives have been added, their status will be updated.
res->hidden_by_filter = true;
int idx = dive_table_get_insertion_index(&dive_table, res);
int idx = dive_table_get_insertion_index(divelog.dives, res);
fulltext_register(res); // Register the dive's fulltext cache
add_to_dive_table(&dive_table, idx, res); // Return ownership to backend
add_to_dive_table(divelog.dives, idx, res); // Return ownership to backend
invalidate_dive_cache(res); // Ensure that dive is written in git_save()
return res;
@ -211,7 +211,7 @@ DivesAndSitesToRemove DiveListBase::addDives(DivesAndTripsToAdd &toAdd)
addedTrips.reserve(toAdd.trips.size());
for (OwningTripPtr &trip: toAdd.trips) {
addedTrips.push_back(trip.get());
insert_trip(trip.release(), &trip_table); // Return ownership to backend
insert_trip(trip.release(), divelog.trips); // Return ownership to backend
}
toAdd.trips.clear();
@ -234,7 +234,7 @@ DivesAndSitesToRemove DiveListBase::addDives(DivesAndTripsToAdd &toAdd)
if (!change.newShown.empty() || !change.newHidden.empty())
emit diveListNotifier.numShownChanged();
return { res, sites };
return { std::move(res), std::move(sites) };
}
// This helper function renumbers dives according to an array of id/number pairs.
@ -301,7 +301,7 @@ static void moveDivesBetweenTrips(DivesToTrip &dives)
for (OwningTripPtr &trip: dives.tripsToAdd) {
dive_trip *t = trip.release(); // Give up ownership
createdTrips.push_back(t);
insert_trip(t, &trip_table); // Return ownership to backend
insert_trip(t, divelog.trips); // Return ownership to backend
}
dives.tripsToAdd.clear();
@ -431,7 +431,7 @@ AddDive::AddDive(dive *d, bool autogroup, bool newNumber)
allocTrip.reset(trip);
}
int idx = dive_table_get_insertion_index(&dive_table, divePtr.get());
int idx = dive_table_get_insertion_index(divelog.dives, divePtr.get());
if (newNumber)
divePtr->number = get_dive_nr_at_idx(idx);
@ -452,27 +452,25 @@ void AddDive::redoit()
currentDive = current_dive;
divesAndSitesToRemove = addDives(divesToAdd);
sort_trip_table(&trip_table); // Though unlikely, adding a dive may reorder trips
sort_trip_table(divelog.trips); // Though unlikely, adding a dive may reorder trips
// Select the newly added dive
setSelection(divesAndSitesToRemove.dives, divesAndSitesToRemove.dives[0]);
setSelection(divesAndSitesToRemove.dives, divesAndSitesToRemove.dives[0], -1);
}
void AddDive::undoit()
{
// Simply remove the dive that was previously added...
divesToAdd = removeDives(divesAndSitesToRemove);
sort_trip_table(&trip_table); // Though unlikely, removing a dive may reorder trips
sort_trip_table(divelog.trips); // Though unlikely, removing a dive may reorder trips
// ...and restore the selection
setSelection(selection, currentDive);
setSelection(selection, currentDive, -1);
}
ImportDives::ImportDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
struct device_table *devices, struct filter_preset_table *filter_presets, int flags,
const QString &source)
ImportDives::ImportDives(struct divelog *log, int flags, const QString &source)
{
setText(Command::Base::tr("import %n dive(s) from %1", "", dives->nr).arg(source));
setText(Command::Base::tr("import %n dive(s) from %1", "", log->dives->nr).arg(source));
// this only matters if undoit were called before redoit
currentDive = nullptr;
@ -481,7 +479,7 @@ ImportDives::ImportDives(struct dive_table *dives, struct trip_table *trips, str
struct dive_table dives_to_remove = empty_dive_table;
struct trip_table trips_to_add = empty_trip_table;
struct dive_site_table sites_to_add = empty_dive_site_table;
process_imported_dives(dives, trips, sites, devices, flags,
process_imported_dives(log, flags,
&dives_to_add, &dives_to_remove, &trips_to_add,
&sites_to_add, &devicesToAddAndRemove);
@ -515,19 +513,19 @@ ImportDives::ImportDives(struct dive_table *dives, struct trip_table *trips, str
// When encountering filter presets with equal names, check whether they are
// the same. If they are, ignore them.
if (filter_presets) {
for (const filter_preset &preset: *filter_presets) {
QString name = preset.name;
auto it = std::find_if(filter_preset_table.begin(), filter_preset_table.end(),
[&name](const filter_preset &preset) { return preset.name == name; });
if (it != filter_preset_table.end() && it->data == preset.data)
continue;
filterPresetsToAdd.emplace_back(preset.name, preset.data);
}
// Consume the table for analogy with the other tables.
filter_presets->clear();
for (const filter_preset &preset: *log->filter_presets) {
std::string name = preset.name;
auto it = std::find_if(divelog.filter_presets->begin(), divelog.filter_presets->end(),
[&name](const filter_preset &preset) { return preset.name == name; });
if (it != divelog.filter_presets->end() && it->data == preset.data)
continue;
filterPresetsToAdd.emplace_back(preset.name, preset.data);
}
free(dives_to_add.dives);
free(dives_to_remove.dives);
free(trips_to_add.trips);
free(sites_to_add.dive_sites);
}
bool ImportDives::workToBeDone()
@ -547,16 +545,14 @@ void ImportDives::redoit()
divesToAdd = removeDives(divesAndSitesToRemove);
// Select the newly added dives
setSelection(divesAndSitesToRemoveNew.dives, divesAndSitesToRemoveNew.dives.back());
setSelection(divesAndSitesToRemoveNew.dives, divesAndSitesToRemoveNew.dives.back(), -1);
// Remember dives and sites to remove
divesAndSitesToRemove = std::move(divesAndSitesToRemoveNew);
// Add devices
for (const device &dev: devicesToAddAndRemove.devices) {
int idx = add_to_device_table(&device_table, &dev);
emit diveListNotifier.deviceAdded(idx);
}
for (const device &dev: devicesToAddAndRemove.devices)
add_to_device_table(divelog.devices, &dev);
// Add new filter presets
for (auto &it: filterPresetsToAdd) {
@ -580,19 +576,16 @@ void ImportDives::undoit()
divesAndSitesToRemove = std::move(divesAndSitesToRemoveNew);
// ...and restore the selection
setSelection(selection, currentDive);
setSelection(selection, currentDive, -1);
// Remove devices
for (const device &dev: devicesToAddAndRemove.devices) {
int idx = remove_device(&device_table, &dev);
if (idx >= 0)
emit diveListNotifier.deviceDeleted(idx);
}
for (const device &dev: devicesToAddAndRemove.devices)
remove_device(divelog.devices, &dev);
// Remove filter presets. Do this in reverse order.
for (auto it = filterPresetsToRemove.rbegin(); it != filterPresetsToRemove.rend(); ++it) {
int index = *it;
QString oldName = filter_preset_name_qstring(index);
std::string oldName = filter_preset_name(index);
FilterData oldData = filter_preset_get(index);
filter_preset_delete(index);
emit diveListNotifier.filterPresetRemoved(index);
@ -616,17 +609,17 @@ bool DeleteDive::workToBeDone()
void DeleteDive::undoit()
{
divesToDelete = addDives(divesToAdd);
sort_trip_table(&trip_table); // Though unlikely, removing a dive may reorder trips
sort_trip_table(divelog.trips); // Though unlikely, removing a dive may reorder trips
// Select all re-added dives and make the first one current
dive *currentDive = !divesToDelete.dives.empty() ? divesToDelete.dives[0] : nullptr;
setSelection(divesToDelete.dives, currentDive);
setSelection(divesToDelete.dives, currentDive, -1);
}
void DeleteDive::redoit()
{
divesToAdd = removeDives(divesToDelete);
sort_trip_table(&trip_table); // Though unlikely, adding a dive may reorder trips
sort_trip_table(divelog.trips); // Though unlikely, adding a dive may reorder trips
// Deselect all dives and select dive that was close to the first deleted dive
dive *newCurrent = nullptr;
@ -654,8 +647,8 @@ void ShiftTime::redoit()
}
// Changing times may have unsorted the dive and trip tables
sort_dive_table(&dive_table);
sort_trip_table(&trip_table);
sort_dive_table(divelog.dives);
sort_trip_table(divelog.trips);
for (dive_trip *trip: trips)
sort_dive_table(&trip->dives); // Keep the trip-table in order
@ -665,7 +658,7 @@ void ShiftTime::redoit()
emit diveListNotifier.divesChanged(dives, DiveField::DATETIME);
// Select the changed dives
setSelection(diveList, diveList[0]);
setSelection(diveList, diveList[0], -1);
// Negate the time-shift so that the next call does the reverse
timeChanged = -timeChanged;
@ -701,7 +694,7 @@ void RenumberDives::undoit()
dives.reserve(divesToRenumber.size());
for (const QPair<dive *, int> &item: divesToRenumber)
dives.push_back(item.first);
setSelection(dives, dives[0]);
setSelection(dives, dives[0], -1);
}
bool RenumberDives::workToBeDone()
@ -723,14 +716,14 @@ bool TripBase::workToBeDone()
void TripBase::redoit()
{
moveDivesBetweenTrips(divesToMove);
sort_trip_table(&trip_table); // Though unlikely, moving dives may reorder trips
sort_trip_table(divelog.trips); // Though unlikely, moving dives may reorder trips
// Select the moved dives
std::vector<dive *> dives;
dives.reserve(divesToMove.divesToMove.size());
for (const DiveToTrip &item: divesToMove.divesToMove)
dives.push_back(item.dive);
setSelection(dives, dives[0]);
setSelection(dives, dives[0], -1);
}
void TripBase::undoit()
@ -796,7 +789,7 @@ AutogroupDives::AutogroupDives()
dive_trip *trip;
bool alloc;
int from, to;
for(int i = 0; (trip = get_dives_to_autogroup(&dive_table, i, &from, &to, &alloc)) != NULL; i = to) {
for(int i = 0; (trip = get_dives_to_autogroup(divelog.dives, i, &from, &to, &alloc)) != NULL; i = to) {
// If this is an allocated trip, take ownership
if (alloc)
divesToMove.tripsToAdd.emplace_back(trip);
@ -859,7 +852,7 @@ void SplitDivesBase::redoit()
unsplitDive = removeDives(diveToSplit);
// Select split dives and make first dive current
setSelection(divesToUnsplit.dives, divesToUnsplit.dives[0]);
setSelection(divesToUnsplit.dives, divesToUnsplit.dives[0], -1);
}
void SplitDivesBase::undoit()
@ -869,7 +862,7 @@ void SplitDivesBase::undoit()
splitDives = removeDives(divesToUnsplit);
// Select unsplit dive and make it current
setSelection(diveToSplit.dives, diveToSplit.dives[0] );
setSelection(diveToSplit.dives, diveToSplit.dives[0], -1);
}
static std::array<dive *, 2> doSplitDives(const dive *d, duration_t time)
@ -907,8 +900,9 @@ SplitDiveComputer::SplitDiveComputer(dive *d, int dc_num) : SplitDivesBase(d, sp
setText(Command::Base::tr("split dive computer"));
}
DiveComputerBase::DiveComputerBase(dive *old_dive, dive *new_dive, int dc_nr_after_in) : dc_nr_before(dc_number),
dc_nr_after(dc_nr_after_in)
DiveComputerBase::DiveComputerBase(dive *old_dive, dive *new_dive, int dc_nr_before, int dc_nr_after) :
dc_nr_before(dc_nr_before),
dc_nr_after(dc_nr_after)
{
if (!new_dive)
return;
@ -942,11 +936,9 @@ void DiveComputerBase::redoit()
diveToAdd = removeDives(diveToRemove);
diveToRemove = std::move(addedDive);
dc_number = dc_nr_after;
// Select added dive and make it current.
// This automatically replots the profile.
setSelection(diveToRemove.dives, diveToRemove.dives[0]);
setSelection(diveToRemove.dives, diveToRemove.dives[0], dc_nr_after);
std::swap(dc_nr_before, dc_nr_after);
}
@ -958,13 +950,13 @@ void DiveComputerBase::undoit()
}
MoveDiveComputerToFront::MoveDiveComputerToFront(dive *d, int dc_num)
: DiveComputerBase(d, make_first_dc(d, dc_num), 0)
: DiveComputerBase(d, make_first_dc(d, dc_num), dc_num, 0)
{
setText(Command::Base::tr("move dive computer to front"));
}
DeleteDiveComputer::DeleteDiveComputer(dive *d, int dc_num)
: DiveComputerBase(d, clone_delete_divecomputer(d, dc_num), std::min((int)number_of_computers(d) - 1, dc_num))
: DiveComputerBase(d, clone_delete_divecomputer(d, dc_num), dc_num, std::min((int)number_of_computers(d) - 1, dc_num))
{
setText(Command::Base::tr("delete dive computer"));
}
@ -1015,7 +1007,7 @@ MergeDives::MergeDives(const QVector <dive *> &dives)
// like the best option.
int idx = get_divenr(dives[0]);
int num = dives.count();
if (idx < 0 || idx + num > dive_table.nr) {
if (idx < 0 || idx + num > divelog.dives->nr) {
// It was the callers responsibility to pass only known dives.
// Something is seriously wrong - give up.
qWarning("Merging unknown dives");
@ -1023,7 +1015,7 @@ MergeDives::MergeDives(const QVector <dive *> &dives)
}
// std::equal compares two ranges. The parameters are (begin_range1, end_range1, begin_range2).
// Here, we can compare C-arrays, because QVector guarantees contiguous storage.
if (std::equal(&dives[0], &dives[0] + num, &dive_table.dives[idx]) &&
if (std::equal(&dives[0], &dives[0] + num, &divelog.dives->dives[idx]) &&
dives[0]->number && dives.last()->number && dives[0]->number < dives.last()->number) {
// We have a consecutive set of dives. Rename all following dives according to the
// number of erased dives. This considers that there might be missing numbers.
@ -1039,15 +1031,15 @@ MergeDives::MergeDives(const QVector <dive *> &dives)
// consecutive, and the difference will be 1, so the
// above example is not supposed to be normal.
int diff = dives.last()->number - dives[0]->number;
divesToRenumber.reserve(dive_table.nr - idx - num);
divesToRenumber.reserve(divelog.dives->nr - idx - num);
int previousnr = dives[0]->number;
for (int i = idx + num; i < dive_table.nr; ++i) {
int newnr = dive_table.dives[i]->number - diff;
for (int i = idx + num; i < divelog.dives->nr; ++i) {
int newnr = divelog.dives->dives[i]->number - diff;
// Stop renumbering if stuff isn't in order (see also core/divelist.c)
if (newnr <= previousnr)
break;
divesToRenumber.append(QPair<dive *,int>(dive_table.dives[i], newnr));
divesToRenumber.append(QPair<dive *,int>(divelog.dives->dives[i], newnr));
previousnr = newnr;
}
}
@ -1071,7 +1063,7 @@ void MergeDives::redoit()
unmergedDives = removeDives(divesToMerge);
// Select merged dive and make it current
setSelection(diveToUnmerge.dives, diveToUnmerge.dives[0]);
setSelection(diveToUnmerge.dives, diveToUnmerge.dives[0], -1);
}
void MergeDives::undoit()
@ -1081,7 +1073,7 @@ void MergeDives::undoit()
renumberDives(divesToRenumber);
// Select unmerged dives and make first one current
setSelection(divesToMerge.dives, divesToMerge.dives[0]);
setSelection(divesToMerge.dives, divesToMerge.dives[0], -1);
}
} // namespace Command

View File

@ -99,9 +99,7 @@ private:
class ImportDives : public DiveListBase {
public:
// Note: dives and trips are consumed - after the call they will be empty.
ImportDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
struct device_table *devices, struct filter_preset_table *filter_presets, int flags,
const QString &source);
ImportDives(struct divelog *log, int flags, const QString &source);
private:
void undoit() override;
void redoit() override;
@ -114,7 +112,7 @@ private:
// For redo
std::vector<OwningDiveSitePtr> sitesToAdd;
std::vector<std::pair<QString,FilterData>>
std::vector<std::pair<std::string,FilterData>>
filterPresetsToAdd;
// For undo
@ -239,7 +237,7 @@ class DiveComputerBase : public DiveListBase {
protected:
// old_dive must be a dive known to the core.
// new_dive must be new dive whose ownership is taken.
DiveComputerBase(dive *old_dive, dive *new_dive, int dc_nr_after);
DiveComputerBase(dive *old_dive, dive *new_dive, int dc_nr_before, int dc_nr_after);
private:
void undoit() override;
void redoit() override;

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "command_divesite.h"
#include "core/divelog.h"
#include "core/divesite.h"
#include "core/subsurface-qt/divelistnotifier.h"
#include "core/qthelper.h"
@ -154,8 +155,8 @@ void DeleteDiveSites::undo()
PurgeUnusedDiveSites::PurgeUnusedDiveSites()
{
setText(Command::Base::tr("purge unused dive sites"));
for (int i = 0; i < dive_site_table.nr; ++i) {
dive_site *ds = dive_site_table.dive_sites[i];
for (int i = 0; i < divelog.sites->nr; ++i) {
dive_site *ds = divelog.sites->dive_sites[i];
if (ds->dives.nr == 0)
sitesToRemove.push_back(ds);
}
@ -404,7 +405,7 @@ ApplyGPSFixes::ApplyGPSFixes(const std::vector<DiveAndLocation> &fixes)
siteLocations.push_back({ ds, dl.location });
}
} else {
ds = create_dive_site(qPrintable(dl.name), &dive_site_table);
ds = create_dive_site(qPrintable(dl.name), divelog.sites);
ds->location = dl.location;
add_dive_to_dive_site(dl.d, ds);
dl.d->dive_site = nullptr; // This will be set on redo()

View File

@ -5,10 +5,15 @@
#define COMMAND_DIVESITE_H
#include "command_base.h"
#include "core/gpslocation.h"
#include <QVector>
struct DiveAndLocation {
struct dive *d;
location_t location;
QString name;
};
// We put everything in a namespace, so that we can shorten names without polluting the global namespace
namespace Command {

View File

@ -2,8 +2,10 @@
#include "command_edit.h"
#include "core/divelist.h"
#include "core/divelog.h"
#include "core/fulltext.h"
#include "core/qthelper.h" // for copy_qstring
#include "core/sample.h"
#include "core/selection.h"
#include "core/subsurface-string.h"
#include "core/tag.h"
@ -156,7 +158,8 @@ void EditBase<T>::undo()
// Send signals.
DiveField id = fieldId();
emit diveListNotifier.divesChanged(stdToQt<dive *>(dives), id);
setSelection(selectedDives, current);
if (!placingCommand())
setSelection(selectedDives, current, -1);
}
// We have to manually instantiate the constructors of the EditBase class,
@ -306,6 +309,7 @@ void EditDuration::set(struct dive *d, int value) const
d->duration = d->dc.duration;
d->dc.meandepth.mm = 0;
d->dc.samples = 0;
fake_dc(&d->dc);
}
int EditDuration::data(struct dive *d) const
@ -325,6 +329,7 @@ void EditDepth::set(struct dive *d, int value) const
d->maxdepth = d->dc.maxdepth;
d->dc.meandepth.mm = 0;
d->dc.samples = 0;
fake_dc(&d->dc);
}
int EditDepth::data(struct dive *d) const
@ -547,7 +552,7 @@ void EditTagsBase::undo()
// Send signals.
DiveField id = fieldId();
emit diveListNotifier.divesChanged(stdToQt<dive *>(dives), id);
setSelection(selectedDives, current);
setSelection(selectedDives, current, -1);
}
// Undo and redo do the same as just the stored value is exchanged
@ -561,7 +566,7 @@ QStringList EditTags::data(struct dive *d) const
{
QStringList res;
for (const struct tag_entry *tag = d->tag_list; tag; tag = tag->next)
res.push_back(tag->tag->name);
res.push_back(QString::fromStdString(tag->tag->name));
return res;
}
@ -597,22 +602,22 @@ QString EditBuddies::fieldName() const
return Command::Base::tr("buddies");
}
// ***** DiveMaster *****
QStringList EditDiveMaster::data(struct dive *d) const
// ***** DiveGuide *****
QStringList EditDiveGuide::data(struct dive *d) const
{
return stringToList(d->divemaster);
return stringToList(d->diveguide);
}
void EditDiveMaster::set(struct dive *d, const QStringList &v) const
void EditDiveGuide::set(struct dive *d, const QStringList &v) const
{
QString text = v.join(", ");
free(d->divemaster);
d->divemaster = copy_qstring(text);
free(d->diveguide);
d->diveguide = copy_qstring(text);
}
QString EditDiveMaster::fieldName() const
QString EditDiveGuide::fieldName() const
{
return Command::Base::tr("dive master");
return Command::Base::tr("dive guide");
}
static void swapCandQString(QString &q, char *&c)
@ -630,8 +635,8 @@ PasteState::PasteState(dive *dIn, const dive *data, dive_components what) : d(dI
memset(&weightsystems, 0, sizeof(weightsystems));
if (what.notes)
notes = data->notes;
if (what.divemaster)
divemaster = data->divemaster;
if (what.diveguide)
diveguide = data->diveguide;
if (what.buddy)
buddy = data->buddy;
if (what.suit)
@ -685,6 +690,10 @@ PasteState::PasteState(dive *dIn, const dive *data, dive_components what) : d(dI
}
if (what.weights)
copy_weights(&data->weightsystems, &weightsystems);
if (what.number)
number = data->number;
if (what.when)
when = data->when;
}
PasteState::~PasteState()
@ -699,8 +708,8 @@ void PasteState::swap(dive_components what)
{
if (what.notes)
swapCandQString(notes, d->notes);
if (what.divemaster)
swapCandQString(divemaster, d->divemaster);
if (what.diveguide)
swapCandQString(diveguide, d->diveguide);
if (what.buddy)
swapCandQString(buddy, d->buddy);
if (what.suit)
@ -725,6 +734,10 @@ void PasteState::swap(dive_components what)
std::swap(cylinders, d->cylinders);
if (what.weights)
std::swap(weightsystems, d->weightsystems);
if (what.number)
std::swap(number, d->number);
if (what.when)
std::swap(when, d->when);
}
// ***** Paste *****
@ -756,7 +769,7 @@ void PasteDives::undo()
// Send signals.
DiveField fields(DiveField::NONE);
fields.notes = what.notes;
fields.divemaster = what.divemaster;
fields.diveguide = what.diveguide;
fields.buddy = what.buddy;
fields.suit = what.suit;
fields.rating = what.rating;
@ -767,6 +780,8 @@ void PasteDives::undo()
fields.chill = what.chill;
fields.divesite = what.divesite;
fields.tags = what.tags;
fields.datetime = what.when;
fields.nr = what.number;
emit diveListNotifier.divesChanged(divesToNotify, fields);
if (what.cylinders)
emit diveListNotifier.cylindersReset(divesToNotify);
@ -781,7 +796,7 @@ void PasteDives::redo()
}
// ***** ReplanDive *****
ReplanDive::ReplanDive(dive *source, bool edit_profile) : d(current_dive),
ReplanDive::ReplanDive(dive *source) : d(current_dive),
when(0),
maxdepth({0}),
meandepth({0}),
@ -811,7 +826,7 @@ ReplanDive::ReplanDive(dive *source, bool edit_profile) : d(current_dive),
std::swap(source->cylinders, cylinders);
std::swap(source->dc, dc);
setText((edit_profile ? Command::Base::tr("Replan dive") : Command::Base::tr("Edit profile")) + diveNumberOrDate(d));
setText(Command::Base::tr("Replan dive"));
}
ReplanDive::~ReplanDive()
@ -842,10 +857,12 @@ void ReplanDive::undo()
QVector<dive *> divesToNotify = { d };
// Note that we have to emit cylindersReset before divesChanged, because the divesChanged
// updates the DivePlotDataModel, which is out-of-sync and gets confused.
// updates the profile, which is out-of-sync and gets confused.
emit diveListNotifier.cylindersReset(divesToNotify);
emit diveListNotifier.divesChanged(divesToNotify, DiveField::DATETIME | DiveField::DURATION | DiveField::DEPTH | DiveField::MODE |
DiveField::NOTES | DiveField::SALINITY | DiveField::ATM_PRESS);
if (!placingCommand())
setSelection({ d }, d, -1);
}
// Redo and undo do the same
@ -854,6 +871,81 @@ void ReplanDive::redo()
undo();
}
// ***** EditProfile *****
QString editProfileTypeToString(EditProfileType type, int count)
{
switch (type) {
default:
case EditProfileType::ADD: return Command::Base::tr("Add stop");
case EditProfileType::REMOVE: return Command::Base::tr("Remove %n stop(s)", "", count);
case EditProfileType::MOVE: return Command::Base::tr("Move %n stop(s)", "", count);
case EditProfileType::EDIT: return Command::Base::tr("Edit stop");
}
}
EditProfile::EditProfile(const dive *source, int dcNr, EditProfileType type, int count) : d(current_dive),
dcNr(dcNr),
maxdepth({0}),
meandepth({0}),
dcmaxdepth({0}),
duration({0}),
dc({ 0 })
{
const struct divecomputer *sdc = get_dive_dc_const(source, dcNr);
if (!sdc)
d = nullptr; // Signal that we refuse to do anything.
if (!d)
return;
maxdepth = source->maxdepth;
dcmaxdepth = sdc->maxdepth;
meandepth = source->meandepth;
duration = source->duration;
copy_samples(sdc, &dc);
copy_events(sdc, &dc);
setText(editProfileTypeToString(type, count) + " " + diveNumberOrDate(d));
}
EditProfile::~EditProfile()
{
free_dive_dcs(&dc);
}
bool EditProfile::workToBeDone()
{
return !!d;
}
void EditProfile::undo()
{
struct divecomputer *sdc = get_dive_dc(d, dcNr);
if (!sdc)
return;
std::swap(sdc->samples, dc.samples);
std::swap(sdc->alloc_samples, dc.alloc_samples);
std::swap(sdc->sample, dc.sample);
std::swap(sdc->events, dc.events);
std::swap(sdc->maxdepth, dc.maxdepth);
std::swap(d->maxdepth, maxdepth);
std::swap(d->meandepth, meandepth);
std::swap(d->duration, duration);
fixup_dive(d);
invalidate_dive_cache(d); // Ensure that dive is written in git_save()
QVector<dive *> divesToNotify = { d };
emit diveListNotifier.divesChanged(divesToNotify, DiveField::DURATION | DiveField::DEPTH);
if (!placingCommand())
setSelection({ d }, d, dcNr);
}
// Redo and undo do the same
void EditProfile::redo()
{
undo();
}
// ***** Add Weight *****
AddWeight::AddWeight(bool currentDiveOnly) :
EditDivesBase(currentDiveOnly)
@ -1000,11 +1092,6 @@ EditWeight::EditWeight(int index, weightsystem_t wsIn, bool currentDiveOnly) :
dives.clear();
return;
}
WSInfoModel *wsim = WSInfoModel::instance();
QModelIndexList matches = wsim->match(wsim->index(0, 0), Qt::DisplayRole, gettextFromC::tr(new_ws.description));
if (!matches.isEmpty())
wsim->setData(wsim->index(matches.first().row(), WSInfoModel::GR), new_ws.weight.grams);
}
EditWeight::~EditWeight()
@ -1015,6 +1102,7 @@ EditWeight::~EditWeight()
void EditWeight::redo()
{
for (size_t i = 0; i < dives.size(); ++i) {
add_weightsystem_description(&new_ws); // This updates the weightsystem info table
set_weightsystem(dives[i], indices[i], new_ws);
emit diveListNotifier.weightEdited(dives[i], indices[i]);
invalidate_dive_cache(dives[i]); // Ensure that dive is written in git_save()
@ -1039,7 +1127,8 @@ AddCylinder::AddCylinder(bool currentDiveOnly) :
setText(Command::Base::tr("Add cylinder"));
else
setText(Command::Base::tr("Add cylinder (%n dive(s))", "", dives.size()));
cyl = create_new_cylinder(dives[0]);
cyl = create_new_manual_cylinder(dives[0]);
indexes.reserve(dives.size());
}
AddCylinder::~AddCylinder()
@ -1054,22 +1143,23 @@ bool AddCylinder::workToBeDone()
void AddCylinder::undo()
{
for (dive *d: dives) {
if (d->cylinders.nr <= 0)
continue;
remove_cylinder(d, d->cylinders.nr - 1);
update_cylinder_related_info(d);
emit diveListNotifier.cylinderRemoved(d, d->cylinders.nr);
invalidate_dive_cache(d); // Ensure that dive is written in git_save()
for (size_t i = 0; i < dives.size(); ++i) {
remove_cylinder(dives[i], indexes[i]);
update_cylinder_related_info(dives[i]);
emit diveListNotifier.cylinderRemoved(dives[i], indexes[i]);
invalidate_dive_cache(dives[i]); // Ensure that dive is written in git_save()
}
}
void AddCylinder::redo()
{
indexes.clear();
for (dive *d: dives) {
add_cloned_cylinder(&d->cylinders, cyl);
int index = first_hidden_cylinder(d);
indexes.push_back(index);
add_cylinder(&d->cylinders, index, clone_cylinder(cyl));
update_cylinder_related_info(d);
emit diveListNotifier.cylinderAdded(d, d->cylinders.nr - 1);
emit diveListNotifier.cylinderAdded(d, index);
invalidate_dive_cache(d); // Ensure that dive is written in git_save()
}
}
@ -1086,34 +1176,11 @@ static bool same_cylinder_size(const cylinder_t &cyl1, const cylinder_t &cyl2)
cyl1.type.workingpressure.mbar == cyl2.type.workingpressure.mbar;
}
static bool same_cylinder_pressure(const cylinder_t &cyl1, const cylinder_t &cyl2)
{
return cyl1.start.mbar == cyl2.start.mbar &&
cyl1.end.mbar == cyl2.end.mbar;
}
// Flags for comparing cylinders
static const constexpr int SAME_TYPE = 1 << 0;
static const constexpr int SAME_SIZE = 1 << 1;
static const constexpr int SAME_PRESS = 1 << 2;
static const constexpr int SAME_GAS = 1 << 3;
static bool same_cylinder_with_flags(const cylinder_t &cyl1, const cylinder_t &cyl2, int sameCylinderFlags)
{
return (((sameCylinderFlags & SAME_TYPE) == 0 || same_cylinder_type(cyl1, cyl2)) &&
((sameCylinderFlags & SAME_SIZE) == 0 || same_cylinder_size(cyl1, cyl2)) &&
((sameCylinderFlags & SAME_PRESS) == 0 || same_cylinder_pressure(cyl1, cyl2)) &&
((sameCylinderFlags & SAME_GAS) == 0 || same_gasmix(cyl1.gasmix, cyl2.gasmix)));
}
static int find_cylinder_index(const struct dive *d, const cylinder_t &cyl, int sameCylinderFlags)
{
for (int idx = 0; idx < d->cylinders.nr; ++idx) {
if (same_cylinder_with_flags(cyl, *get_cylinder(d, idx), sameCylinderFlags))
return idx;
}
return -1;
}
static constexpr int SAME_TYPE = 1 << 0;
static constexpr int SAME_SIZE = 1 << 1;
static constexpr int SAME_PRESS = 1 << 2;
static constexpr int SAME_GAS = 1 << 3;
EditCylinderBase::EditCylinderBase(int index, bool currentDiveOnly, bool nonProtectedOnly, int sameCylinderFlags) :
EditDivesBase(currentDiveOnly)
@ -1131,12 +1198,24 @@ EditCylinderBase::EditCylinderBase(int index, bool currentDiveOnly, bool nonProt
cyl.reserve(dives.size());
for (dive *d: dives) {
int idx = d == current ? index : find_cylinder_index(d, orig, sameCylinderFlags);
if (idx < 0 || (nonProtectedOnly && is_cylinder_prot(d, idx)))
if (index >= d->cylinders.nr)
continue;
if (nonProtectedOnly && is_cylinder_prot(d, index))
continue;
// We checked that the cylinder exists above.
const cylinder_t &cylinder = *get_cylinder(d, index);
if (d != current &&
(!same_cylinder_size(orig, cylinder) || !same_cylinder_type(orig, cylinder))) {
// when editing cylinders, we assume that the user wanted to edit the 'n-th' cylinder
// and we only do edit that cylinder, if it was the same type as the one in the current dive
continue;
}
divesNew.push_back(d);
indexes.push_back(idx);
cyl.push_back(clone_cylinder(*get_cylinder(d, idx)));
// that's silly as it's always the same value - but we need this vector of indices in the case where we add
// a cylinder to several dives as the spot will potentially be different in different dives
indexes.push_back(index);
cyl.push_back(clone_cylinder(cylinder));
}
dives = std::move(divesNew);
}
@ -1167,6 +1246,7 @@ void RemoveCylinder::undo()
for (size_t i = 0; i < dives.size(); ++i) {
std::vector<int> mapping = get_cylinder_map_for_add(dives[i]->cylinders.nr, indexes[i]);
add_cylinder(&dives[i]->cylinders, indexes[i], clone_cylinder(cyl[i]));
cylinder_renumber(dives[i], &mapping[0]);
update_cylinder_related_info(dives[i]);
emit diveListNotifier.cylinderAdded(dives[i], indexes[i]);
invalidate_dive_cache(dives[i]); // Ensure that dive is written in git_save()
@ -1211,24 +1291,7 @@ EditCylinder::EditCylinder(int index, cylinder_t cylIn, EditCylinderType typeIn,
else
setText(Command::Base::tr("Edit cylinder (%n dive(s))", "", dives.size()));
// Try to untranslate the cylinder type
QString description = cylIn.type.description;
for (int i = 0; i < tank_info_table.nr; ++i) {
if (gettextFromC::tr(tank_info_table.infos[i].name) == description) {
description = tank_info_table.infos[i].name;
break;
}
}
// Update the tank info model
TankInfoModel *tim = TankInfoModel::instance();
QModelIndexList matches = tim->match(tim->index(0, 0), Qt::DisplayRole, gettextFromC::tr(cylIn.type.description));
if (!matches.isEmpty()) {
if (cylIn.type.size.mliter != cyl[0].type.size.mliter)
tim->setData(tim->index(matches.first().row(), TankInfoModel::ML), cylIn.type.size.mliter);
if (cylIn.type.workingpressure.mbar != cyl[0].type.workingpressure.mbar)
tim->setData(tim->index(matches.first().row(), TankInfoModel::BAR), cylIn.type.workingpressure.mbar / 1000.0);
}
// The base class copied the cylinders for us, let's edit them
for (int i = 0; i < (int)indexes.size(); ++i) {
@ -1256,6 +1319,7 @@ EditCylinder::EditCylinder(int index, cylinder_t cylIn, EditCylinderType typeIn,
void EditCylinder::redo()
{
for (size_t i = 0; i < dives.size(); ++i) {
set_tank_info_data(&tank_info_table, cyl[i].type.description, cyl[i].type.size, cyl[i].type.workingpressure);
std::swap(*get_cylinder(dives[i], indexes[i]), cyl[i]);
update_cylinder_related_info(dives[i]);
emit diveListNotifier.cylinderEdited(dives[i], indexes[i]);
@ -1269,6 +1333,45 @@ void EditCylinder::undo()
redo();
}
EditSensors::EditSensors(int toCylinderIn, int fromCylinderIn, int dcNr)
: d(current_dive), dc(get_dive_dc(d, dcNr)), toCylinder(toCylinderIn), fromCylinder(fromCylinderIn)
{
if (!d || !dc)
return;
setText(Command::Base::tr("Edit sensors"));
}
void EditSensors::mapSensors(int toCyl, int fromCyl)
{
for (int i = 0; i < dc->samples; ++i) {
for (int s = 0; s < MAX_SENSORS; ++s) {
if (dc->sample[i].pressure[s].mbar && dc->sample[i].sensor[s] == fromCyl)
dc->sample[i].sensor[s] = toCyl;
// In case the cylinder we are moving to has a sensor attached, move it to the other cylinder
else if (dc->sample[i].pressure[s].mbar && dc->sample[i].sensor[s] == toCyl)
dc->sample[i].sensor[s] = fromCyl;
}
}
emit diveListNotifier.diveComputerEdited(dc);
invalidate_dive_cache(d); // Ensure that dive is written in git_save()
}
void EditSensors::undo()
{
mapSensors(fromCylinder, toCylinder);
}
void EditSensors::redo()
{
mapSensors(toCylinder, fromCylinder);
}
bool EditSensors::workToBeDone()
{
return d && dc;
}
#ifdef SUBSURFACE_MOBILE
EditDive::EditDive(dive *oldDiveIn, dive *newDiveIn, dive_site *createDs, dive_site *editDs, location_t dsLocationIn)
@ -1306,8 +1409,8 @@ EditDive::EditDive(dive *oldDiveIn, dive *newDiveIn, dive_site *createDs, dive_s
changedFields |= DiveField::ATM_PRESS;
if (oldDive->dive_site != newDive->dive_site)
changedFields |= DiveField::DIVESITE;
if (!same_string(oldDive->divemaster, newDive->divemaster))
changedFields |= DiveField::DIVEMASTER;
if (!same_string(oldDive->diveguide, newDive->diveguide))
changedFields |= DiveField::DIVEGUIDE;
if (!same_string(oldDive->buddy, newDive->buddy))
changedFields |= DiveField::BUDDY;
if (oldDive->rating != newDive->rating)
@ -1324,7 +1427,7 @@ EditDive::EditDive(dive *oldDiveIn, dive *newDiveIn, dive_site *createDs, dive_s
changedFields |= DiveField::CHILL;
if (!same_string(oldDive->suit, newDive->suit))
changedFields |= DiveField::SUIT;
if (get_taglist_string(oldDive->tag_list) != get_taglist_string(newDive->tag_list)) // This is cheating. Do we have a taglist comparison function?
if (taglist_get_tagstring(oldDive->tag_list) != taglist_get_tagstring(newDive->tag_list)) // This is cheating. Do we have a taglist comparison function?
changedFields |= DiveField::TAGS;
if (oldDive->dc.divemode != newDive->dc.divemode)
changedFields |= DiveField::MODE;
@ -1386,8 +1489,8 @@ void EditDive::exchangeDives()
QVector<dive *> dives = { oldDive };
timestamp_t delta = oldDive->when - newDive->when;
if (delta != 0) {
sort_dive_table(&dive_table);
sort_trip_table(&trip_table);
sort_dive_table(divelog.dives);
sort_trip_table(divelog.trips);
if (newDive->divetrip != oldDive->divetrip)
qWarning("Command::EditDive::redo(): This command does not support moving between trips!");
if (oldDive->divetrip)
@ -1399,7 +1502,7 @@ void EditDive::exchangeDives()
emit diveListNotifier.divesChanged(dives, changedFields);
// Select the changed dives
setSelection( { oldDive }, oldDive);
setSelection( { oldDive }, oldDive, -1);
}
void EditDive::editDs()

View File

@ -6,6 +6,7 @@
#include "command_base.h"
#include "command.h" // for EditCylinderType
#include "core/divecomputer.h"
#include "core/subsurface-qt/divelistnotifier.h"
#include <QVector>
@ -229,7 +230,7 @@ public:
QString fieldName() const override;
};
// Fields that work with tag-lists (tags, buddies, divemasters) work differently and therefore
// Fields that work with tag-lists (tags, buddies, dive guides) work differently and therefore
// have their own base class. In this case, it's not a template, as all these lists are base
// on strings.
class EditTagsBase : public EditDivesBase {
@ -276,7 +277,7 @@ public:
QString fieldName() const override;
};
class EditDiveMaster : public EditTagsTemplate<DiveField::DIVEMASTER> {
class EditDiveGuide : public EditTagsTemplate<DiveField::DIVEGUIDE> {
public:
using EditTagsTemplate::EditTagsTemplate; // Use constructor of base class.
QStringList data(struct dive *d) const override;
@ -289,7 +290,7 @@ struct PasteState {
dive *d;
dive_site *divesite;
QString notes;
QString divemaster;
QString diveguide;
QString buddy;
QString suit;
int rating;
@ -301,6 +302,8 @@ struct PasteState {
tag_entry *tags;
struct cylinder_table cylinders;
struct weightsystem_table weightsystems;
int number;
timestamp_t when;
PasteState(dive *d, const dive *data, dive_components what); // Read data from dive data for dive d
~PasteState();
@ -332,8 +335,7 @@ class ReplanDive : public Base {
int salinity;
public:
// Dive computer(s) and cylinders(s) of the source dive will be reset!
// If edit_profile is true, the text will be changed from "replan dive" to "edit profile".
ReplanDive(dive *source, bool edit_profile);
ReplanDive(dive *source);
~ReplanDive();
private:
void undo() override;
@ -341,6 +343,23 @@ private:
bool workToBeDone() override;
};
class EditProfile : public Base {
dive *d;
int dcNr;
depth_t maxdepth, meandepth, dcmaxdepth;
duration_t duration;
struct divecomputer dc;
public:
// Note: source must be clean (i.e. fixup_dive must have been called on it).
EditProfile(const dive *source, int dcNr, EditProfileType type, int count);
~EditProfile();
private:
void undo() override;
void redo() override;
bool workToBeDone() override;
};
class AddWeight : public EditDivesBase {
public:
AddWeight(bool currentDiveOnly);
@ -384,6 +403,7 @@ public:
~AddCylinder();
private:
cylinder_t cyl;
std::vector<int> indexes; // An index for each dive in the dives vector.
void undo() override;
void redo() override;
bool workToBeDone() override;
@ -421,6 +441,22 @@ private:
void redo() override;
};
class EditSensors : public Base
{
public:
EditSensors(int cylIndex, int fromCylinder, int dcNr);
private:
struct dive *d;
struct divecomputer *dc;
int toCylinder;
int fromCylinder;
void mapSensors(int toCyl, int fromCyl);
void undo() override;
void redo() override;
bool workToBeDone() override;
};
#ifdef SUBSURFACE_MOBILE
// Edit a full dive. This is used on mobile where we don't have per-field granularity.
// It may add or edit a dive site.

View File

@ -7,6 +7,7 @@
namespace Command {
EditTripBase::EditTripBase(dive_trip *tripIn, const QString &newValue) : trip(tripIn),
current(current_dive),
value(newValue)
{
}
@ -26,6 +27,7 @@ void EditTripBase::undo()
value = old;
emit diveListNotifier.tripChanged(trip, fieldId());
setTripSelection(trip, current);
}
// Undo and redo do the same as just the stored value is exchanged

Some files were not shown because too many files have changed in this diff Show More