Thus, it is made clear that these member functions can only be
accessed from DiveListView itself. This should make debugging
easier.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Move this to the core so that desktop and mobile don't have
to call this explicitly. Matter of fact, mobile didn't call
this. It is unclear, whether that was even used on mobile,
though.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
It makes no sense to keep the device nodes if all the other data
is cleared. Let's do this automatically and not explicitly.
This ensures that the function is also called on mobile.
Currently it was only called on desktop.
Weirdly, the parser-tests were expecting that the device nodes
were not reset by clear_dive_file_data() and therefore divecomputers
were accumulating in the test results. Thus, the additional
computers had to be removed from the expected test results.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The filter sets the maximum date to now. This is so confusing when
you manually add a dive and it isn't shown, because it is slightly
in the future. Add seven days, that should help.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This only checks the first divecomputer as the semantics for
multiple dive computers with different dive modes are not
clear. Should we check them all?
The implementation is a bit hackish: the indexes [0...n] of the
combobox are mapped onto [-1...n-1], where -1 means don't filter
and n-1 is the last valid dive mode.
Implements #2329
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
It appears that some misguided compiler / library combinations crash
on &vector[0] for empty vectors. Even though very unfriendly, they are
technically correct, so let's remove these constructs.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
TabDiveInformation::updateProfile() does some statistics via the
per_cylinder_mean_depth function. It passes down arrays with one
entry per cylinder, which are allocated by means std::vector.
To pass the array, the expression "&vector[0]" is used. It seems
like some compilers through an assertion violation if vector
has no elements. They are technically correct in that this is
undefined, but still this appears like very unfriendly behavior.
After all, std::vector should behave just like a dynamic C-array
that is automatically freed, when going out of scope.
Replace the "&vector[0]" by "vector.data()" and don't do the
call if there aren't any cylinders for good measure.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Arguably, returning 0 for a dive with no cylinders is wrong, since the
0 is a valid cylinder id, however that cylinder doesn't exist. Instead,
return -1. All callers of explicit_first_cylinder() return early anyway
for dives with no cylinders.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since we removed MAX_CYLINDERS, we have the possibility of dives
with no cylinders. In such a case, setup_gas_sensor_pressure()
would do invalid read- and write-accesses. Therefore, return
early in such a case.
Reported-by: Chirana Gheorghita Eugeniu Theodor <office@adaptcom.ro>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Move the more commonly used filter to the left and the less
commonly used "purge unused sites" button to the right. Add
a spacer so that the filter-textbox doesn't extend over the
whole free space.
With apologies to sinistroverse users (is there an option to
make the layout direction depend on the locale?).
Suggested-by: Hartley Horwitz <hhrwtz@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
I'm not sure if Google used to show the POI marker at the center location in
the past or if this is actually a new feature. Either way this appears to do
the right thing in my testing.
Note that we need a 'plus' to connect the point of interest cooridnates,
but a 'comma' to connect the map center coordinates.
Reported-by: Chirana Gheorghita Eugeniu Theodor <office@adaptcom.ro>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code block was also for the OBS builds and is no longer needed now that we
have to separate make-package scripts.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Under some circustances values stored in this arrays may be NULL or even
previously freed. Check them to avoid further crashes.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
The d->cylinders created will be overriden by libdivecomputer parsing,
resulting in 0, 1 , may be 2 cylinders depending on DC data. This is not
what we want when importing a divelog, because we will miss all hand
entered tanks.
BTW, using get_cylinder() on tank number bigger than created, results in
a NULL pointer and a crash.
As we can't foresee how many tanks (or even it's positional numbers in
log) a diver has used, the full 10 tanks supported by SmarTrak can be
easily created and parsed using get_or_create_cylinder(), and unused
cleaned later.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
This brings the user manual in line with the recent changes to the
layout of the export panel.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
It seemed very odd to have those steps mixed in with the Ubuntu/Debian
instructions. Yes, there is a bunch of overlap, but this seems much cleaner.
This also updates the spec files to something that works for the current
sources.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This cleans up a lot of the ancient mess in that file.
It's still confusingly usable to push sources to OBS as well (but that's now
hidden behind an option) and it is still somewhat custom-made for me, but it
should be much easier to reuse for others now.
In addition to Subsurface and libdivecomputer we are inclooding the googlemaps
sources and libgit2 1.0.0 sources. Bionic is the only remaining distro that we
support that doesn't have a new enough version of libgit2 (0.26 is the minimum
we expect), but since we are linking statically against it, maybe it's best to
simply force all of these builds to include libgit2 1.0.0.
Handling of the debian/* files in the script has been changed quite a bit to
make it easier for others to create a working setup. It now updates all of the
files with the exception of the changelog files from the sources we are
building from. I am hoping that this will be a not-so-subtle incentive for me
to keep the bundled versions up to date.
Since we no longer do beta releases, I removed that part from the file.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't want to try to track every change to this file in our source repo, so
this starting point is as goos as any.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Perform slight reorganisation and rewording of the divelog export
panel. Specifically the wording is changed and expanded to make clear
the 2 types of export of profile data. All the CSV export options are
grouped together. With respect to profile export to CSV format, it is
made clear that one option concerns export of dive computer-related
profile data, whereas the other option involves export of computed
dive profile data from the Dive Profile panel.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Turns out that at least on Android libgit2 sometimes rejects valid
certificates. And I cannot quite figure out when and why. But since we
actually already checked the validity of the certificate when we called
canReachCloudServer() (and the Qt code handles certificates correctly),
we'll simply ignore this here and override the check to always return
true for our cloud server.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I would have bet money that Android used to send stderr to the logcat
log, but apparently it doesn't (anymore?). So in order to be able to
have a chance to debug weird cloud storage issues on Android, let's do
some wholesale replacement of fprintf(stderr,...) with our own version
of the INFO macro that we long ago borrowed from libdivecomputer (and
rename it to ensure we don't have a conflict there).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
free_plot_info_data() freed the pressure-data, but didn't set the
value to NULL. Thus, when the plot_info was reused, a double-free()
could ensue.
Crash condition: export the profiles of multiple dives with pressure
data.
Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
We still need to support Qt 5.9 for Ubuntu 18.04 / Bionic. This uses
deprecated calls to qrand() - but then qrand() wasn't deprecated in 5.9.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old test was broken in many ways and kept failing for a number of
reasons. Some of them were addressed in the previous commits (the
missing HEAD ref being the main one), the other one was that the tests
kept stepping on top of each other - as were potentially random users or
reviewers using the 'universal' test account.
This uses a random one of ten dedicated test accounts, and on top of
that uses a random branch name (instead of the fixed email address
associated with the account).
This also rewrites several of the tests dealing with offline changes to
correctly model going offline (but keeps one that directly writes to the
local cache).
Finally this change also tries to do a much better job cleaning up after
itself and not leaving data behind the the next run could stumble over.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will be used by the test to clean up test branches that are created
on the server. Since we aren't testing that functionality (it's not
something that Subsurface itself ever does) the helper prints out errors
it encounters, but doesn't report them back to the caller.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If you had one of the unfortunate local git caches with a local HEAD
just pointing to 'master', this will make note of that and then fix it
up to use the proper branch name in the cache repository.
[Dirk Hohndel: demoted from error to fprintf as most users won't care]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In create_and_push_remote(), we set up the remote tracking etc to use
the proper branch name, but never actually set up the initial local
branch for the new cache repository at all. So the repository would end
up with the default 'master' branch, instead of the branch name it
should have.
This went unnoticed, because most setups start by initializing the git
caches by cloning from the cloud, and that worked fine.
Debugged-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Some profilewidget classes hat protected members which can
be made private as there is no subclassing.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>