This is a user request: add local time of dive to the tooltip.
Showing a localized time was surprisingly complex. First I had
to add a function that decomposes a timestamp into h/m/s. Then
the QLocale time-string has to be stripped of the timezone.
Fixes#3469.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of rendering in a membuffer, directly format into the
QString. We have the qasprintf_loc() function, which is equivalent
to put_format_loc(). Thus, this is a manual search/replace job.
However, this means that the formatting is done in UTF-8 and
then piecewise transformed into QString's (inane) UTF-16.
In the future we might think about directly using QString's
formatting function.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Format strings of the type "SAC: %.*f%s/min" were put through
the translation machinery. This seems like a bad idea, and indeed
we had crashes owing to translators messing these up.
Therefore, translate only actual words/abbreviations, in the
case above "SAC" and "min". This has one significant advantage:
compile-time checking of the parameters.
However, it also has one significant disadvantage: lack of support
of right-to-left languages (e.g. semitic languages). If these
should be supported, I would suggest to use QString-style format
strings, i.e. "SAC: %1%2/%3" with appropriate documentation strings.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Arguably, string handling in C is painful. Move the function
that formats the "tooltip" of the current spot on the profile
to the C++ string-format.cpp.
Note: the actual code stays C with a few necessary adaptions
concerning the translation machinery.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This was a mess of plain pointers. For example to generate
the "entryToolTip", an item in the "toolTips" vector was
created, then deep-copied and then the "toolTips" vector
was cleared.
Instead, replace the "addToolTip" by a "makeToolTip" function
and replace plain pointers by unique_ptrs. Makes this thing
a bit more manageable.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In divetooltipitem.cpp, the pointer entryToolTip.first is tested
for NULL twice, but it is always initialized in the constructor.
This makes no sense - remove the dead code.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The Qt Company apparently didn't feel the need to have the correct
tags in all of the module directories. So this now has to manually
pick the correct SHA. What a pain.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
State requirements for email address and
password format within cloud preferences UI
If email address or password entered in cloud
preferences, raise a warning within a
QMessageBox instead of the less-visible
report_error method
Signed-off-by: Jon Massey <jon.massey@thedatalab.org>
The liter symbol is written as 'ℓ'. To allow searching for
that, normalize unicode strings to their base letter. This
corresponds to the 'compatibility' mode.
We might also think about stripping diacritics.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This should avoid build failures on platforms where we don't know if
QtWebKit will be available or not.
The options for printing and user manual are awkward to work with. This
all needs to be cleaned up at some point. Right.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code works ok falling back to just Perdix and Petrel 2, but
it looks confusing to the user to see an incorrect name in the
connection drop down.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This really only matters for my build automation setup, but since I
build from the files in the repo... I have to push this into master.
Otherwise my build processes stall until the builds on the COPR site
finish. Which isn't useful.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's confusing to have the same name refer to two different models.
Unfortunately, that's what Aqualung is doing by simply changing the
model number and serial number, but not the external branding.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of trying to find matching cylinders, trigger on the cylinder
number first and then only edit that n-th cylinder if it matches the one
in the current dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In a sign how few people use these additional properties AND use multiple
dive computers, this took a couple of years to get noticed... but yes, we
do need to merge those properties as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When computing plan variations, deco can get shorter when
staying longer when the last step is actually already at
off gasing depth. FRACTION forces unsiged, so this introduces
a sign aware version of FRACTION that returns a sign character
in addition.
Reported-by: Patrick Naujoks <p.naujoks@me.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This allows having 3m depth grid for metric users.
* All original properties ( named diferently ) were renamed to three_m_based_grid everywhere to be consistent.
* Plus other small changes requested during review.
Signed-off-by: Vlad A. <elf128@gmail.com>
Signed-off-by: Vlad A <elf128@gmail.com>
The extra trailing 'dot' broke the cmake build on Rawhide.
This also tries to give more consistent Summary and Description text for
the Subsurface and Subsurface-test repos on copr.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Even on platforms that don't have the new git version, yet.
And using the convoluted way to create an environment variable that should
point to our checked out tree in the GitHub Action. The more obvious ways
have resulted in failed builds for obscure reasons.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Seac importer was getting samples based only on dive number,
which was causing samples from different computers but with the
same dive number to become interleaved.
To correct this, the SQL statement was updated to use the
dive_id to query for samples. The table schema uses dive_id
as a primary key, which will enforce uniqueness.
Additionally, deviceid is hashed from the the device_id string.
Reported-by: David Brebera <david.brebera@gmail.com>
Signed-off-by: Jim Wobser <james.wobser@gmail.com>
The calculation of the deco steps shown in the profile
infobox is somewhat independent of the planner. When
set to imperial units, the distance between deco stops
should be 10ft rather than 3m as 15m is only 49ft.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
The cylinder_with_sensor_sample() function only tests "do we have a mapping to
this cylinder for this sample". It also needs to test if there are any tank
pressure readings for that cylinder.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While I clearly recall that in the past the couple of cmake modules
that were installed when building the dependencies were found, in my
latest tests on macOS 12 with the latest cmake this seems to fail.
This seems like a cheap quick way to ensure that things behave as
expected.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It does seem a bit odd, but the arch command actually doesn't
return a reasonable architecture on macOS. So let's use the
uname -m command to get the right answer that makes this script
work both on an m1 and an Intel Mac.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Arguably every dive should at least have one cylinder, but an imported
dive from divelogs.de might end up without one. Sadly, that breaks
assumptions that we make in the cylinder remapping.
To work around it, force at least on cylinder to be assumed in the merge
code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>