summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-10-07CSV import: support for quoted "Gravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07CSV import: support for quoted " within fieldGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07CSV import: simplify codeGravatar Miika Turkia
These two cases were identical, so simplifying the code. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07CSV export: include unquoted quotable fieldsGravatar Miika Turkia
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-07CSV export: quote quotesGravatar Miika Turkia
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-06Core: remove dive->downloaded flagGravatar Berthold Stoeger
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-06Import: pass "downloaded" parameter to process_imported_dives()Gravatar Berthold Stoeger
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-06Import: remove dive->downloaded logicGravatar Berthold Stoeger
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-06Core: remove preexisting field from struct dive_tableGravatar Berthold Stoeger
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-06Import: pass a dive table to process_imported_dives()Gravatar Berthold Stoeger
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-07Dive information: fix surface interval calculationGravatar Berthold Stoeger
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-06Update libdivecomputerGravatar Dirk Hohndel
More fixes for the Aqualung i770R. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-06qt-ble: add support for libdivecomputer 'set_timeout()' functionGravatar Linus Torvalds
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-06qt-ble: add support to wait for descriptor write completionGravatar Linus Torvalds
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-06qt-ble: move basic uuid filtering back to service discoveryGravatar Linus Torvalds
In commit 30fb7bf35c9e ("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-06Fix error handling for libdivecomputer importGravatar Linus Torvalds
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-05Update libdivecomputerGravatar Dirk Hohndel
Fixes for Garmin Descent Mk1 and Aqualung i770R. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-05Cleanup: don't produce no-dives error message in libdivecomputer.cGravatar Berthold Stoeger
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-05Cleanup: don't access downloadTable directly in Uemis-downloaderGravatar Berthold Stoeger
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-04Import: Make DiveLogImportDialog modalGravatar Berthold Stoeger
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-04Cleanup: move CSVApps into .cpp fileGravatar Berthold Stoeger
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-04Import: import Poseidon MkVI logs via DiveLogImportDialogGravatar Berthold Stoeger
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-04Import: remove unnecessary processing of dives in DAN importGravatar Berthold Stoeger
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-03build-system: fix libdivecomputer build on macOSGravatar Dirk Hohndel
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-02Mobile: simpify startup logicGravatar Jan Mulder
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-02Revert "Windows: build against user space FTDI library"Gravatar Dirk Hohndel
This reverts commit 53341c037d5a5ecac6562933aa924b65c207104d. 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-02update-manager: actually remember that we asked the userGravatar Dirk Hohndel
Otherwise we get that annoying question every time the git version changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-02Fix typo in INSTALL file.Gravatar retiform
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-02Mobile: remove all related data when forgetting DCsGravatar Jocke
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-01Update to latest libdivecomputerGravatar Dirk Hohndel
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-01Update to latest libdivecomputerGravatar Dirk Hohndel
Add initial support (BLE only) for Aqualung i770R. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-01Bluetooth: use_random_address helper isn't needed on WindowsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-01Mobile download from DC: show the correct DC rather than the latestGravatar Jocke
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-01Mobile download from DC: improve selection logicGravatar Jocke
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-01Mobile QML UI: bump Kirigami imports to 2.4Gravatar Jan Mulder
Primarily for reasens of keeping up with upstream. And hopefully bugfixes and added functionality. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01Revert "Revert "QML UI: newer Kirigami and fallout""Gravatar Jan Mulder
This reverts commit a5db03c2b32115b14e4b83501a0771b186d87913. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01QML UI: clip divedetails ListviewGravatar Jan Mulder
A technically trival commit, but one with long story. This commit basically reverts dd1d90b5295b146e (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-01QML UI: trivial resize of dateboxGravatar Jan Mulder
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-09-30Windows: build against user space FTDI libraryGravatar Dirk Hohndel
This needs more testing, but should provide an alternative to relying on the Windows FTDI driver. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-30Windows: enable BLE supportGravatar Dirk Hohndel
This currently requires the wip/win branch of qtconnectivity. Eventually this should be merged into upstream Qt. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-30QML UI: correct trip separator lineGravatar Jan Mulder
Partially cosmetic and partially a bug fix. 1) the seperator line between trips and dives that are not in a trip was drawn in the background color => the line was invisible. 2) When looking very closely, there was a 1-2 pixel wide error between the seperator line between trips and dives that are not in a trip. 3) there was a comment that the trip separator needed to be extra thick. IMHO, this looks ugly, and is superfluous as there is a nice sidebar along the dives that belong to the trip. Finally, the line shall not be displayed when not in a trip. So, basically, the line (the QML rectangle) is completely rewritten, to take care of all issues. There is 1 hack: the line color is taken from the dive separator line. But its fully unclear to me where that color is defined in Qt/QML or Kirigami, so I hardcoded the proper color. That just works. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30QML UI: center delete from divelist buttonGravatar Jan Mulder
A small cosmetic change. The delete from divelist button was "glued" to the top of the line. Not nice, so just center it vertically, and make the button a tiny bit smaller, so that it fits nicely on the line. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30QML UI, cleanup: no reason for 2 overlapping mouseareasGravatar Jan Mulder
Fully usure why the code was as it was. The trip header had 2 overlapping mouse areas, to expand the trip and vise versa. Simply remove the smallest one. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30QML UI, cleanup: do not use iconSizes for unrelated sizingGravatar Jan Mulder
A very unimportant change, but found when looking through the code for places where size of icons where used. The one changed here has nothing to do with icon related placement of a string, so its replaced by a way more logical placement of the affected string. Simply center the "no dives in the dive list" for an empty logbook on the screen, instead of at some random place in the upper left corner. Like I said: very unimportant, but it just looks nicer in the UI. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30Bluetooth: don't use random addresses on WindowsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-30Bluetooth: use standard Qt code on WindowsGravatar Dirk Hohndel
We shouldn't need our hand crafted code anymore. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-29Cleanup: split out free_dive() function from delete_single_dive()Gravatar Berthold Stoeger
Currently, we can only delete dives that are indexed in the main dive table. In the future, we will have to delete dives outside of this table (e.g. for undo). Therefore, split out the free_dive() function from delete_single_dive(), which takes an index into the main dive table. In the process, adopt the dive freeing-code from clear_dive(), which frees more data than the code in delete_single_dive(). This potentially fixes a memory-leak. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-29Cleanup: reinstate override modifiersGravatar Berthold Stoeger
This reverts commit 1c4a859c8d0b37b2e938209fe9c4d99e9758327a, where the override modifiers were removed owing to the noisy "inconsistent override modifiers" which is default-on in clang. This warning was disabled in 77577f717f5aad38ea8c4c41c10c181486c4337f, so we can reinstate the overrides. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-29Cleanup: Devirtualize WebServices::downloadTimedOut()Gravatar Berthold Stoeger
This member function was not overriden in a derived class. No point in it being virtual. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-29Cleanup: don't derive UserSurveyServices from WebServicesGravatar Berthold Stoeger
UserSurveyServices derives from WebServices and therefore has to define three pure virtual functions [startDownload(), startUpload(), buttonClicked()] as no-ops. Interestingly, a comment in the header says "need to declare them as no ops or Qt4 is unhappy" which is of course not true as these functions are not declared by Qt. There seems to be no point in deriving from WebServices, therefore don't do it. These function definitions can then be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>