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