In certain situations git merge-base would report errors if the branch
you are working in is older than the latest CICD builds. This simply
hides those pointless errors.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Especially when adding new optional dependencies, you might want to have
neither REQUIRED nor QUIET there - this way we can see in the CICD where the
library is found and tested against.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I have not idea if this is enough to make parsing of raw files
work for the Ubuntu/Debian package.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The distinguished photographer shoots raw images. There is a
comprehensive library that can extract metadata and thumbnails
from these images. Let's use it if available.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Fixes build failing on Debian Buster (gcc 8.3.0) with:
/build/subsurface-beta-202409160411/./core/units.h: In function 'duration_t operator""_sec(long long unsigned int)':
/build/subsurface-beta-202409160411/./core/units.h:149:48: error: could not convert '{((int32_t)sec)}' from '<brace-enclosed initializer list>' to 'duration_t'
return { .seconds = static_cast<int32_t>(sec) };
Signed-off-by: Richard Fuchs <dfx@dfx.at>
We had a pattern where doubles were converted to long with
lrint() and then down-cast to a narrower int type.
Because this is unwieldy, introduce a function encapsulating
this.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Now that we have defined addition and subtraction on unit
classes, let's use them in a few examples.
Yes, some of these are a bit pointless, because they are
of the kind
a.mbar - b.mbar => (a-b).mbar
However, these probably should be further simplified
by storing the result in a unit type.
This commit is mostly a proof-of-concept.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When adding / subtracting unit objects it is completely
irrelevant with respect to which unit the data is stored.
Why should the user know this?
Therefore add addition / subtraction functions.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The goal here is to add general addition and scalar multiplication
functions to the unit types.
Thereto, we need a CRTP
(https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)
base class.
However, this breaks compound initialization, so we have to use
named initializers:
weight_t { 2000 } -> weight_t { .grams = 2000 }
The good thing is that this is exactly how these classes were
supposed to be used: make the unit explicit!
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Declaring everything at the begin of the function is a K&R
disease, that makes code very hard to follow.
Remove the last assignment to gaschange_after since that is
a noop (found by Coverity).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
It wants us to test for end of container when finding elements.
That is of course reasonable in "production" code, but a bit
pointless in the testing code. Oh well.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This was quite ominous: a 60-element fixed size table was
passed as argument to plan(). But there was no check for 60
anywhere? Use a dynamic vector instead.
The whole thing is weird, as the depth of the decostop table
doesn't seem to be used.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
I don't get the point of these calls to dp.clear().
The plan is overwritten immediately afterwards anyway.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Allow the initial gas of the dive to be edited through the context menu
in the dive profile, by right-clicking into the profile at the very
start of the dive.
Of course this will likely completely invalidate the decompression
calculation of any actually logged dives, but this is no different to
the addition and modification of gas changes during the dive that is
already possible.
Proposed by @harrydevil in #4291.
Signed-off-by: Michael Keller <github@ike.ch>
Still, mostly useful for me, but this correctly deals with relative path
names for the working directory (and gives a usage message).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix a bug introduced in #4245, causing an incorrect dive mode to be
selected when starting the dive planner from a CCR dive.
Signed-off-by: Michael Keller <github@ike.ch>
A reference to a unique_ptr<> was captured by a lambda used
to calculate variations in the background.
This is of course disastrous, because if the caller runs
first it will delete the object. It's a wonder that this
didn't crash regularly!?
The problem is that capturing unique_ptr<>s in lambdas
works, but makes the lambda non-copyable. Sadly, the
QtConcurrent::run() function wants to copy the lambda.
For now, do this by a release/reaquire pair. This is
not exception safe. However, sine Qt doesn't support
exceptions, we can live with that.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Improve the event loop architecture by making it set the divecomputer in
the constructor - using the same loop for multiple dive computers is not
intended to work.
Also change `next()` in `divemode_loop` to `at()` to make the name more
aligned with its function.
Signed-off-by: Michael Keller <github@ike.ch>
Fix an interger overflow warning when parsing setpoints.
@bstoeger: In the end it turned out that this parser was only used in
one place in the planner UI, and it was simplest to switch this to
using `QVariant.toFloat()` in the model itself, which is consistent how
the rest of the input values is parsed and validated.
Signed-off-by: Michael Keller <github@ike.ch>
When merging two dives, if a divesite is chosen that doesn't
have a GPS location, but another divesite has a GPS location,
then the GPS location of the former is set to that of the
latter.
However, that was done outside of the undo system, so that
it is not undone and the frontend is not made aware of the
change.
Fix this. To simplify things, move the code from the undo
machinery to the core.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
All callers were just using that member to set the dive_site
in the resulting dive. We might just do that in the called
function [merge_dives()].
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>