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>
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>
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>
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>
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>
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>
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>
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>
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>
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 096de0efd0.
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>
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>
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>
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>
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>
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>
`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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>