Commit graph

19139 commits

Author SHA1 Message Date
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 3a3089770a
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