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>
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>
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>
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>
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>
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>
-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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>