Commit graph

14918 commits

Author SHA1 Message Date
Dirk Hohndel
a83a2d8b1f build-system: add Grantlee to our get dependency script
I actually don't know why this was missing...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-07 14:00:45 -07:00
Berthold Stoeger
424558cf89 Leak fix: free taxonomy data in delete_dive_site()
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-07 23:40:37 +03:00
Berthold Stoeger
a5ad550df5 CHANGELOG.md update
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-07 17:50:51 +03:00
Berthold Stoeger
df16866292 Statistics: only consider selected dives in HTML export statistics
If only selected dives were exported into HTML, the statistics would
nevertheless cover all dives. A counter-intuitive behavior. Fix by
adding a selected_only flag to calculate_stats_summary().

Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-07 17:50:51 +03:00
Berthold Stoeger
b61f6f66d8 Statistics: un-globalize stats_selection
The statistics of the selected dives were calculated
a) into a global objects and
b) at a completely different place than where they're used.

There's no plausible reason for either. There fore render
into a caller-provided structure at the place of use.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-07 17:50:51 +03:00
Berthold Stoeger
97991e2b9f Statistics: remove global state / calculate only when needed
Statistics were calculated into global variables every time the
current dive was changed.

Calculate statistics only when needed and into a structure
provided by the caller.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-07 17:50:51 +03:00
Jan Mulder
68fdc0b6f4 QML UI: set proper active background color for downloaded dives
And another simple one. Make the active background of the
dowloaded dives follow the theme.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
3c18618bfb QML UI, trivial: set proper background color GPS list
The background color was plain white, where we use a slightly different
color in other places.  In addition, the background when clicking on a row
did not follow the theme setting. Consistency fix.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
a8f45406bd QML UI, consistency: add text attribute for all actions
Something I only see on mobile-on-desktop, so at this point in time
not very relevant to the device apps. When hovering on the action
button, a toast message shows a hint box. These where empty in some
cases. So, just give the actions a text attribute where it was
missing.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
684e3eec6b QML UI, cleanup: remove usesless Item
Trivial cleanup. A QML Item is intendend for visual items, so embedding
a timer in it is plain useless.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Miika Turkia
f040912395 CSV import: import of last field
The last field ends with new line instead of field separator.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07 17:41:14 +03:00
Miika Turkia
3f5b5f7b3e CSV import: do not add quote to single word
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07 17:41:14 +03:00
Miika Turkia
d3239aed0f CSV import: support for quoted "
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07 17:41:14 +03:00
Miika Turkia
b3694faefc CSV import: support for quoted " within field
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07 17:41:14 +03:00
Miika Turkia
9540793552 CSV import: simplify code
These two cases were identical, so simplifying the code.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07 17:41:14 +03:00
Miika Turkia
f96d155759 CSV export: include unquoted quotable fields
Turns out that the initial quoting implementation discarded the fields
without quoting. This one ensures we should be getting also that data
exported.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07 17:41:14 +03:00
Miika Turkia
c44ece0ea1 CSV export: quote quotes
If a text field contains quotation mark ("), encode this with double
quote ("").

Fixes #1679

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07 17:41:14 +03:00
Berthold Stoeger
90b019bc8d Core: remove dive->downloaded flag
This flag had two distinct uses:
 - signal that dives were downloaded, not imported
 - use to mark imported dives

Both are not used anymore, therefore remove the flag.
The uemis downloaded misused the flag to mark deleted
dives. Instead misuse the "hidden_by_filter" flag.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-06 19:47:06 -07:00
Berthold Stoeger
6dc1dcaea5 Import: pass "downloaded" parameter to process_imported_dives()
process_imported_dives() is more efficient for downloaded than for
imported (from a file) dives, because it checks only the divecomputer
of the first dive.

This condition is checked via the "downloaded" flag of the first
dive. Instead, pass an argument to process_imported_dives().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-06 19:47:06 -07:00
Berthold Stoeger
e5dca8228e Import: remove dive->downloaded logic
Dive importing is now performed via a distinct table which is
merged into the main dive table. Thus, it is known which of the
dive is new and which is old. This information can now be
implicitely encoded in the parameter-position of merge_dive()
[i.e. pass old as first and new as second dive].

This makes marking of downloaded dives via a flag unnecessary.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-06 19:47:06 -07:00
Berthold Stoeger
ab14889563 Core: remove preexisting field from struct dive_table
Dives are now in all cases imported via distinct dive_tables.
Therefore the "preexisting" marker is useless. Remove.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-06 19:47:06 -07:00
Berthold Stoeger
810903bdb9 Import: pass a dive table to process_imported_dives()
Dives were directly imported into the global dive table and then
merged in process_imported_dives(). Make this interface more flexible,
by passing an independent dive table.

The dive table of the to-be-imported dives will be sorted and merged.
Then each dive is inserted in a one-by-one manner to into the global
dive table.

This actually introduces (at least) two functional changes:
1) If a new dive spans two old dives, it will only be merged to the
   first dive. But this seems like a pathological case, which is of
   dubious value anyway.
2) Dives unrelated to the import will not be merged. The old code
   would happily merge dives that were not even close to the
   newly imported dives. A surprising behavior.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-06 19:47:06 -07:00
Berthold Stoeger
c32e71e64d Dive information: fix surface interval calculation
The old surface interval calculation had fundamental issues:

1) process_all_dives(), which calculates the statistics over *all*
   dives was used to get the pointer to the previous dive.
2) If two dives in the table had the same time, one of those would
   have been considered the "previous" dive.
3) If the dive, for which the surface interval is calculated is
   not yet in the table, no previous dive would be determined.

Fix all this by creating a get_surface_interval() function and
removing the "get previous dive" functionality of process_all_dives().
Remove the process_all_dives() call from TabDiveInformation::updateData().

Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-07 05:41:48 +03:00
Dirk Hohndel
cec0b70365 Update libdivecomputer
More fixes for the Aqualung i770R.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-06 19:41:09 -07:00
Linus Torvalds
cd55344410 qt-ble: add support for libdivecomputer 'set_timeout()' function
Because some BLE operations can be very slow (device and service
discovery etc), we have some rather excessive default timeout for BLE
(currently set to 12 seconds).

But once we actually have started doing IO, that long timeout can be a
big performance problem, when the libdivecomputer backend has support
for retry and packet loss.

For that reason, libdivecomputer has a 'set_timeout()' function that
allows the divecomputer backend to say how quickly it expects the dive
computer to answer before the backend will start resending packets.

Let's just implement that for the actual IO side of BLE too.  The
default timeout value remains the general BLE timeout, and this only
affects the actual IO phase, but it improves things enormously for the
case where there is packet loss at that point.

For example, on the Aqualung i770R, the timeout for packet loss ends up
now being just one second rather than the full 12 seconds of default BLE
timeout.  Which gets the retry going much faster.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-06 19:38:28 -07:00
Linus Torvalds
88f4c06b99 qt-ble: add support to wait for descriptor write completion
When we enable notifications, we actually want to make sure to wait for
that write to have completed before we start communicating with the
device, because otherwise we might lose notification events.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-06 19:38:28 -07:00
Linus Torvalds
ec532b8f59 qt-ble: move basic uuid filtering back to service discovery
In commit 30fb7bf35c ("qt-ble: set up infrastructure for better
preferred service choice") I moved the service filtering from the
addService() callback into the "select_preferred_service()" function
that picks the right service for the device.

That was nice for debugging, since it meant that we showed the details
of _all_ services, but it also meant that we ended up starting service
discovery on _all_ services, whether they looked at all interesting or
not.

And that can make the BLE device discovery process quite a bit slower.

The debugging advantage is real, but honestly, service discovery can
generally be better done with specialized tools like the Nordic nRF app,
so the debugging advantage of just listing all the details of all the
services is not really worth the discovery slowdown in general.

So move the basic "filter by uuid" back to the service discovery phase,
and don't bother starting service detail discovery for the services that
we can dismiss immediately just based on the service UUID.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-06 19:38:28 -07:00
Linus Torvalds
ebee0c4c24 Fix error handling for libdivecomputer import
The error handling was incorrect for the case where we successfully
opened the libdivecomputer iostream in divecomputer_device_open(), but
the dc_device_open() call failed.

When the dc_device_open() failed, we would (correctly) not do the
dc_device_close() but we would _also_ not do the dc_iostream_close() to
close the underlying file descriptor, which is wrong.

Normally this isn't all that noticeable, partly because the common case
is that dc_device_open() succeeds if you actually do have a dive
computer connected, but also because most of the time it just leaked a
file descriptor or something like that.

However, particularly for the POSIX serial device case, libdivecomputer
does a

	ioctl(device->fd, TIOCEXCL, NULL)

call to make serial opens exclusive.  This is what we want - but if we
then fail at closing the serial file descriptor, we won't be able to
retry the import at all because now the next open will fail with EBUSY.

So the error handling was incorrect, and while it doesn't usually matter
all that much, it can be quite noticeable particularly when you have
transient errors.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-06 19:38:14 -07:00
Dirk Hohndel
432a324756 Update libdivecomputer
Fixes for Garmin Descent Mk1 and Aqualung i770R.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-05 22:53:57 +02:00
Berthold Stoeger
420aab9454 Cleanup: don't produce no-dives error message in libdivecomputer.c
If no dives were downloaded in do_libdivecomputer_import(), an
error message would be produced. To check for downloaded dives,
the function would access the global downloadTable instead of
the actual table the dives are imported to (at the moment the
same - but the interface allows for a different table).

Move the error-creation to the caller to avoid this situation.
An alternative option would be to check the actual table the
dives were supposed to be downloaded to. But from a program-logic
point of view "no dives" does not seem like an error condition.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-05 04:09:02 +03:00
Berthold Stoeger
8a18396104 Cleanup: don't access downloadTable directly in Uemis-downloader
The Uemis downloader determines the dive-number to be downloaded
by either checking the download-table [interrupted connection] or
the global dive table [fresh download].

The downloadTable is passed in the device data structure, but
in the function to determine the latest dive, the global
downloadTable is accessed directly [thus supposing that this
table was passed in device data].

Instead, use the table from device data to avoid funny surprises
should we change to a non-global download table.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-05 04:07:22 +03:00
Berthold Stoeger
5a78730561 Import: Make DiveLogImportDialog modal
By making this modal, we can use a local variable and remove the
nasty "deleteLater()" hack to reclaim the resources after the
dialog closes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-04 10:22:11 +02:00
Berthold Stoeger
3f51849dc3 Cleanup: move CSVApps into .cpp file
No point in having this in the header file as it is not used
outside.

Remove the CSVAPPS macro, as this was never used. One thing less
to maintain.

Remove the sentinel with name = NULL, as we can simply use
range-based for.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-04 10:22:11 +02:00
Berthold Stoeger
a4051749fd Import: import Poseidon MkVI logs via DiveLogImportDialog
Poseidon MkVI logs (.txt) were special cased in MainWindow.cpp,
which led to a user-interface inconsistency. In some cases
[user chooses ".txt" (non-Poseidon) and ".csv"], *two*
import-dialogs were shown.

Move handling of Poseidon MkVI logs into DiveLogImportDialog.
There are already other "special" cases handled in this dialog.

At the moment, this shows the first 10 depth-values, which is
kind of useless, as this will all be at surface level. We
might think about something more useful.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-04 10:22:11 +02:00
Berthold Stoeger
9788d73d48 Import: remove unnecessary processing of dives in DAN import
On DAN-file import after each dive except the first, the dive-list
was processed. This seem bogus and inefficient. An artefact from
old code? In any case, remove.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-04 07:37:28 +02:00
Dirk Hohndel
1ac90199e5 build-system: fix libdivecomputer build on macOS
In some Mac environments autotools somehow think that we have clock_gettime(),
even though it isn't supported. Somehow the previous workaround stopped working
as make ended up re-running ../configure and overwriting our change. This tries
to work around that problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-03 16:35:25 +02:00
Jan Mulder
42eae7e48b Mobile: simpify startup logic
When starting the mobile app, I noticed a short display of an empty
page with title "Cloud creditials" just before showing the
divelist. Simply a not nice visual effect.

This commit simplifies some logic and resolves this. As the code
in this part is fragile, this is tested for normal and clean
startup of the app, switching credentials, from no cloud to
valid account (which even nicely imports the no cloud dives:
this surprised me as I have never seen this working).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-02 22:27:19 +02:00
Dirk Hohndel
26de89364c Revert "Windows: build against user space FTDI library"
This reverts commit 53341c037d.

The commit isn't wrong, but it breaks Travis and I can't seem to get the
newer MXE build to work on Travis. So while I figure out how to work
around THAT, let's just revert this and come back to it once Travis is
ready.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-02 13:23:29 -07:00
Dirk Hohndel
ac8936004e update-manager: actually remember that we asked the user
Otherwise we get that annoying question every time the git version changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-02 13:20:44 -07:00
retiform
251d2589ad Fix typo in INSTALL file.
Changes git submoule to git submodule. In the INSTALL file.
Just a minor spelling fix.

Signed-off-by: Cole Rogers <colerogers@protonmail.com>
2018-10-02 19:28:18 +02:00
Jocke
b29f6ef2c0 Mobile: remove all related data when forgetting DCs
We need to delete all related data when forgetting dive computers or we will
have an issue if we connect a DC from the same vendor but of a different model.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-02 18:40:47 +02:00
Dirk Hohndel
c31d517b8f Update to latest libdivecomputer
Retry packet send for BLE connections for Aqualung i770R.

(oops, Linus pushed right when I pushed the previous update)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-01 16:32:47 -07:00
Dirk Hohndel
6a1d17534a Update to latest libdivecomputer
Add initial support (BLE only) for Aqualung i770R.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-01 15:59:08 -07:00
Dirk Hohndel
79d0185c62 Bluetooth: use_random_address helper isn't needed on Windows
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-01 15:55:19 -07:00
Jocke
a8953da02d Mobile download from DC: show the correct DC rather than the latest
Since we now keep track of up to 4 DCs we don't want to display the last used one
but rather the one that is connected.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-01 06:32:41 -07:00
Jocke
c504c08097 Mobile download from DC: improve selection logic
Improve the logic when auto selecting a DC for download.
Some USB cables only supply vendor information  but we can select the correct
model if we have downloaded from it before.
For BT/BLE our discovery process adds the device name to the address, so we need to keep that in mind when we try to match against what we seen before.
When we have a positive match for a DC we have seen before we deactivate the
corresponding button of our saved DCs.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-01 06:32:41 -07:00
Jan Mulder
9b199602c6 Mobile QML UI: bump Kirigami imports to 2.4
Primarily for reasens of keeping up with upstream. And hopefully
bugfixes and added functionality.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:29:46 -07:00
Jan Mulder
5681f686ba Revert "Revert "QML UI: newer Kirigami and fallout""
This reverts commit a5db03c2b3.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:29:46 -07:00
Jan Mulder
e321d1563e QML UI: clip divedetails Listview
A technically trival commit, but one with long story. This commit
basically reverts dd1d90b529 (1.5 year ago). While upgrading
Kirigami after Kirigami commit 26b8bdea24c39, we suddenly have
overlapping divelist and details pages in case they are both
on the pageStack (this occurrs when navigating from divedetails
to the divelist using breadcrumb navigation). At this point, its
not clear (to me) if this the by design of Kirigami, or an unintended
effect of the mentioned Kirigami commit.

This all said. Simply clipping resolves our issue of overlapping
pages, and it does not harm.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:29:46 -07:00
Jan Mulder
bec029c766 QML UI: trivial resize of datebox
Something that I simply overlooked earlier with respect to scaling the
divelist. The trip databox did scale a bit, but it was not nicely
related to the hight of the trip header. So there was a tiny
overflow on the small scale on a small device. Fixed here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:28:18 -07:00