To support the new filter code, add helper functions that turn timestamps
into year and day-of-week to core/time.c.
Internally, these functions simply call utc_mktime() to break down the
timestamp and then extract the wanted value. This may appear inefficient,
but testing shows that modern compilers are quite effective in throwing
away the unneeded calculations. FWIW in this respect clang10 outperformed
gcc10.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The cylinder model is used both in the planner and the
equipment tab. We have three preferences for the pO2 that
is used to compute MOD: In the planner, there is one for
the bottom part of the dive and another one for deco.
Those are set in the planenr UI. There is another value,
controlled in the Tec Prefernces. That one should be
used in the equipment tab rather than the one from
the planner.
Fixes#2984
Signed-off-by: Robert C. Helling <helling@atdotde.de>
I think we only have one dive computer that supports GPS data right now:
the Garmin Descent Mk1. It reports the dive coordinates as "GPS1" and
"GPS2" for the entry point and exit point respectively.
Often GPS1 is missing, because the dive computer may not have gotten a
GPS lock before the diver jumped into the water, so when that happens
we'll use GPS2 for the dive site location. But when GPS1 exists, we
should prefer that.
And that's what we already did in logic in dc_get_gps_location(), but
for the initial dive site created at download time, we just picked any
divecomputer reported string that started with "GPS". And since GPS2 is
reported after GPS1 by the Garmin Descent, it would end up overwriting
the entry point that we _should_ have preferred.
Add the same kind of "explicitly prefer GPS1" logic to the initial dive
download case as we already had elsewhere.
Reported-by: @brysconsulting
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
These are the instructions that I use at this point.
Removed a long obsolete script - it's been many, many years since that last was
useful (it was still using qmake to try to build Subsurface)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the dive timestamp changes, the dive could move in the dive list. But the
current dive actually doesn't change (it's still the same dive, right?). Yet
we need to update the dive list as well as the shown dive (especially if this
is after adding a dive, which is first inserted with the current time and then
updated with whatever the user enters).
Fixes: #2971
Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Update INSTALL to improve installation instructions for Fedora
and Raspberry Pi.
Fedora
Add 2 packages:
bluez-libz-devel
redhat-rmp-config
Raspberry Pi (untested)
Bump version numbers to Buster/20.04
Update package list to reflect Debian/Ubuntu
Added:
libbluetooth-dev
qtdeclarative5-dev
qtdeclarative-private-dev
Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
When attempting to compile under Debian and Ubuntu the build script would get
stuck looking for bluez. This change adds libbluetooth-dev to the suggested
install packages for Debian and Ubuntu.
Thus update also changes the yum install command in the Fedora instructions to
the newer dnf command as well as updating the versions listed of Debiand and
Ubuntu to the latest versions.
Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
gcc complained about two constructs of the kind
remote_id && SSRF_INFO("...");
And while I am not a fan of excessive warnings, I must say
it has a point here. That's just code obfuscation. In fact,
it appears that the condition was wrong - the SSRF_INFO
should probably be invoked if remote_id is NULL. The way
it was written it would be invoked if it was *not* NULL.
Change both instances to unfancy if statements.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The water type strings were static and therefore passed through
gettextFromC::tr() before main(). One would hope to get a warning
in such a case, but this is not the case.
Therefore, use the QT_TRANSLATE_NOOP macro to register the strings
in Qt's translation system and translate the list when needed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The clock is only valid in ascent. In each cycle of the
'critial volume algorithm' it re-initialized to the
bottom time at the beginning of deco. So the time spent
on bailout should be added to this bottom time.
Thanks to Coverty for spotting this.
Coverity-scan: CID-362079
Signed-off-by: Robert C. Helling <helling@atdotde.de>
When an undo command selected invisible dives, a current dive outside
of the list of selected dives was chosen. This could have the very
unfortunate effect that the current dive was set, though not selected.
From an UI point of view this meant that the dive was displayed, but
edits would not be registered.
Change the setClosestCurrentDive function to select the current dive.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
At some time, when introducing the global reset signal the filter
stopped being reloaded when loading a new log. This leads to very
strange UI behavior: dives disappear when editing fields unrelated
to the filter.
Therefore, when reloading the model, reset the filter. One might
argue whether this is the correct place. On the other hand, we
might even make the filter a sub-object of the dive-list model.
Let's think about this.
Partially solves #2961
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
I had missed this one in commit d73e0a0fb4
("build-system/packaging: add bluez dependency for Linux builds").
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For Android the Qt Bluetooth code seems to work just fine. And for macOS
nothing appears to work right now, but at least the Qt implementation compiles
and links.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Qt based implementation apparently got broken at some point and now fails
to connect to rfcomm dive computers like the Shearwater Petrel.
This uses the libdivecomputer rfcomm backend. Tested to work with bluez on
Linux as well as with the native Windows implementation.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
At least Shearwater Cloud seems to use multiple formats for sample time
recorded in the database. Sometimes the time is in seconds, sometimes in
milliseconds, and sometime it is something I have no idea about. Thus
switching to calculating the sample id myself and using sample interval
to calculate the actual sample time. Seems to be more reliable than
trying to guess what format Shearwater is using for this specific dive.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
ExifTools (and probably other meta-data editors) modifies the
mvhd creation date, but leaves the individual creation dates
in the tracks unchanged. Therefore, use the mvhd atom.
Reported-by: Eric Tanguy <erictanguy2@orange.fr>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This extends the uuid matching to the low-level characteristics too, so
that we can ignore the McLean Extreme characteristics that aren't
interesting.
It also renames the uuid matching to be about a "uuid_list" rather than
being about the service we're matching, since we're now using it for
other uuid's than just services.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Silly typo with a missing 'i' in 'uuid' that happened when I wrote this
code originally, and that compiled fine thanks to the error being
duplicated with cut-and-paste to all relevant places.
Fix it now, since I'll extend the uuid matching to the actual
characteristics for the McLean Extreme.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It turns out that contrary to what the documentation states, a few languages
are still only using the 'qt' translation. But those exist for all languages,
so we need to first search for the 'qtbase' translations, and only if that
fails do we try to load the 'qt' translations.
And even that will fail for languages in which Qt simply isn't localized (like
Dutch).
To make the code more readable, the check for 'US English' was moved earlier as
there is no point to look for a Qt translation for that (simply doesn't exist).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We were still using the 'qt' translations instead of 'qtbase' as we should have
been using since forever - it's a little unclear from reading the documentation
when in the Qt5 life cycle this happened, but definitely several years ago.
These are the strings used in situations where Qt already provides us with text
(e.g., the entries in the 'Subsurface' menu on Mac, or the button labels in
many dialogs).
Additionally we didn't try hard enough to find those translations in cases
where they are bundled with the app; so basically all scenarios except for
Linux distro specific packages or 'build from source' on macOS or Linux were
not going to work, even after addressing the qt->qtbase conversion.
But of course the developers pretty much all fall into those last two
categories. Still, I cannot believe we never fixed this in all those years...
To make it more obvious if we still aren't finding the Qt translations this
commit also makes that warning be shown in all cases, not just when running in
verbose mode.
Fixes#2954
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The logic to retrieve gas changes from Shearwater cloud database is
detecting only when the O2/He chnages. This change will grab the initial
gas. (Problem was only shown when there was a gas changee in the log, so
cingle cylinder dives were working fine.)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Gas change is done to the cylinder we just found and not the last
cylinder. Also switching the variable name to index as we are actually
using that value outside the loop.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Shearwater apparently stores correct pressures nowadays, so getting rid
of a hack to import double pressures.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This will ignore the gas changes that would be caused by Shearwater
cloud saving rows with 0 values in them.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
A sample log I received contains a lot of rows with 0 values in it. This
will ignore the obviously bogus ones. (However, we might miss the first
sample if that is recorded at time 0.)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Seems that Shearwater cloud gives the sample time in milliseconds
nowadays. Taking a wild guess, that this logic should suffice for us to
be able to import old and newer XML logs. (Assuming that if the
timestamp for the first sample is more than 100, timestamps are in
milliseconds, otherwise in seconds.)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This continues to be useless for other people as it requires my signing key,
but when signed like this I can then successfully submit the dmg for
notarization, so I'll update the signing script in order not to lose that
magic...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Usually people will install these via Homebrew, but when we need to build
everything ourselves (required for release binaries), then these two were
missing before.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>