We have a dive-site variable, therefore we probably should also
have a dive-trip variable.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To enable grouping by trip in the statistics module, split
the get_trip_title() function in a version that appends
a "(n dive(s)" string an one that doesn't. The statistics
module doesn't want that added string, since it displays
the number of dives in a different way.
Also, move the functions to string-format.h, where these
are collected. And rename them to camelCase. Yes, it's
ugly, but consistent with most other C++ code in the code
base.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
'constexpr' implies 'const' since it is a stronger guarantee,
so let's remove the redundant 'const'.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Let the compiler figure out the correct type...
Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When adding a cylinder, it was added at the end of the list.
This would make hidden cylinders visible as the new rule is
to only hide unused cylinders at the end of the list.
Therefore, add the cylinder after the last used cylinder,
i.e. before the first hidden cylinder.
This means that the position where the cylinder is added has
to be hidden in the undo command.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On the equipment tab, unused cylinders (automatically added,
no pressure data) could be hidden. This was implemented using
a QSortFilterProxyModel.
Apparently, it causes confusion if cylinders in the middle of
the list are hidden. Therefore, only hide cylinders at the end
of the list.
QSortFilterProxyModel seems the wrong tool for that job, so
remove it and add a flag "hideUnused" to the base model. Calculate
the number of cylinders when changing the dive.
This is rather complex, because the same model is used for
the planner (which doesn't hide cylinders) and the equipment
tab (which does). Of course, syncing core and model now becomes
harder. For instance, the caching of the number of rows was removed
in a37939889b and now has to be
readded.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
There is a warning when the code tries to access a non-existing
cylinder, since that indicates that something went out of sync.
However, this warning can never trigger because the bounds are
checked before. Remove the first of the two redundant checks.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In cb80ff746b internal columns
were added to the cylinder model. These were not hidden in
the planner. Nobody complained?
Remove this clutter from the UI by hiding the columns.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The logic did not consider the WORKINGPRESS_INT and SIZE_INT
columns added in cb80ff746b.
By some unknown magic this worked by routing everything
through the CylindersModelFiltered model.
Let's fix it and explicitly ignore these columns. Put
the test whether a column should be ignored in a function
to avoid inconsistencies should new columns be added.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The D in MOD, EAD, END, and EADD stands for "depth" and
as such these should be mm in int rather than double.
The intermediate fn2 and fhe2, however, as intermediate
value should not be rounded to an integer.
The upshot of this is a litle more numerical stability.
It should lead to more stable values in TestProfile
when run on architectures with different floating
point precision.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
The undo commands for depth and duration editing cleared
the samples of the dive computer. They relied on the profile
automatically creating a fake profile. However, at some point
that code got removed. Therefore, do it explicitly in the undo
command.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
CCRs are different. It does not make sense to compute
a depth dependent SAC. You could compute the rate of O2
consumption but even that is likely wrong (as O2 in the
diluent would enter that as well), so simply don't attempt
it.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
And while doing that, have all the cases where we already include
qthelper.h simply use a define in that header file - but keep the two
other instances of the define where the C++ source don't need qthelper.h
otherwise.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As of November 20201 the Google Play store now requires that new apps
target API level 30. The minimum API level remains 21 so we should
continue to support devices all the way back to Android 5.0 (Lollipop).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Very similar structure to the XML format. Raw data is again saved as a
hex string (which implicitly provides us with its length). The rest of
components are in a more human readable format.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We always use the global fingerprint table - maybe this should just not
be a parameter of the accessor functions?
The syntax is very simple - the raw data is encoded as a hex string, the
rest of the components are hex numbers.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In order to not break existing behavior, we still store fingerprints on disk, but
we first check the data in the in-memory table, and we remember the fingerprint data
in the fingerprint table as well (which is then saved as part of the dive log data).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This just adds the basic structures and the accessor functions needed to
manage a table of fingerprint data. The table is indexed by the hash of
the model name and binary serial number as created by libdivcecomputer.
This way the data is accessible when libdivecomputer fist accesses a
dive computer (which is the point in time when we need to use the
fingerprint.
The table also contains the corresponding device id and dive id so we
can verify that the current dive table still contains that dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In both places in the UI where we show the date of a dive during
download we are actually pressed for space. So let's use the short
version of the date string to save some space.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Most divecomputers download data dive by dive - so we get reasonably
frequent updates during the download (as new dives are found and posted
in the progress text area). But some (like the G2) download all of the
new dives at once and only then start parsing them. As a result the
download can look like it is hung.
As a compromise this shows updates on the data received in 10kB
increments. Which for most cases should never be shown and therefore not
make the user experience any worse - but for cases like the G2 will make
a huge difference.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.
The exactMatch in getVersion() was rather bogus, given the pattern.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.
The syntax for matches and captures has changed and needed to be
adjusted.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.
The syntax for matches has changed and needed to be adjusted.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.
The syntax for matches and captures has changed and needed to be
adjusted.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.
Much of this is a simple replacement of one class with the other, but
there are some changes to the way matches are tracked and captures are
created. Also, the exactMatch now needs to be implemented via anchors in
the regular expression itself.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt 6 will drop support for QRegExp.
Use QRegularExpression instead.
This is a straight forward replacement without any other code changes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt 6 will drop support for QRegExp.
When looking at replacing this use of a QRegExp it seemed like a much
better idea to simply switch to utilizing the taxonomy data instead.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The docker container for Tumbleweed has been broken for a while now.
Given the Hirsuite gives us Qt 5.15 testing, I guess it makes sense to
drop Tumbleweed for now.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Builds started to fail because v2.2.2 (about 18 months old) couldn't be
found anymore. That issue seems to have been fixed, but it was a good
reminder not to get completely disconnected from upstream here.
This switches things to the currently latest version of the Android USB
library (which coincidentally will also provide support for additional
USB-serial chipset - not that I think that any dive computers will
benefit from that).
Some of the interfaces changed in the upstream Java library and our code
had to be adjusted to accomodate this.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If cmake is called multiple times we can end up with a recursive set of
symbolic links that can confuse package build scripts.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In trying to avoid the wrath of the Google Play police I ended up giving
up too many permissions. And while in my test installs things continued
to work, in new installs on Android 10 or newer the lack of
FINE_LOCATION permission resulted in BLE scans no longer working.
The frustrating thing is that apparently installing an update with a
different set of permissions isn't enough to trigger either the bug or
the fix (at least not reliably). What appears to work is to uninstall
the existing app and then do a fresh install of a new app with the
correct permissions.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix a pair of warnings, which annoyed me for a long time:
For some reasons prefs.bottompo2 is an integer (mbar)
whereas prefs.modpO2 is a float (bar). This results
in mixed integer/floating point arithmetics when
conditionally using either of them. And ultimately
a warning, when storing a mbar value as an integer.
Fix this by an explicit cast to int after converting
modpO2 to mbar.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>