summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-10-09build system: work around strange cmake issueGravatar Dirk Hohndel
On both Mac and Linux cmake 3.12 complained that there were "no sources given to target" for the Subsurface-mobile target, which made no sense at all (easy enough to add debug output to ensure there were, in fact, sources given in the call to add_executable()). But splitting this across two lines like this seems to make it work both for older and newer cmake versions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-09Mobile: factor out syncToCloud [3/3]Gravatar Jan Mulder
After the previous commits, we now have a preference that nicely preserves the state of the UI, and we have the well known git_local_only global, that is used to denote whether we want to use to local repo only, or we want to interact with the online cloud as well. This commit gets rid of the now superfluous syncToCloud logic. Instead we simply set the git_local_only directly. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09Mobile: preserve auto download status [2/3]Gravatar Jan Mulder
Hook up the new preference to the UI. So now, an earlier choice if automatic or manual download to the cloud is preserved in between sessions. Strictly speaking this fixes issue 1725. Notice that there is also a higly related syncToCloud thing present. As factoring out that seemingly duplicate piece of code is non-trivial, this will be done in a seperate commit. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09Prefs: add bool preference cloud_auto_sync [1/3]Gravatar Jan Mulder
With removal of the git_local_only from the preferences (see ae653703a5d3f), the users choice, in the mobile app, was not stored any more in between sessions. This resulted in issue 1725. So, in order to store that user preference, we need a new preference. This is added here, but its not yet hooked up in the app yet. This deals only with the preference handling. And adapted tests are included. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09Mobile: no switch to auto cloud in no-cloud modeGravatar Jan Mulder
We disabled the drawer menu button to switch between auto/manual sync when in no cloud mode. Unfortunately, disabeling does not give a visual cue to the user (like greyed out). Instead, just make this button invisable in no cloud mode. In conjunction a question. The manual sync to cloud menu item takes you to the Cloud Credetials page in case pressed in no cloud mode. While valid, this seems strange. This is not changed in this commit. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09Mobile: mark divelist changed on no-cloud to cloud accountGravatar Jan Mulder
This simple one-liner fixes an actual bug. On switching from a no-cloud account to a actual cloud account, the dives from the no-cloud are added to the actual cloud account. And indeed the dives appear correctly. However, when exiting the app right away, these added dives are not commited to the local storage. Simply, the divelist needs to be marked dirty. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-08macOS: check for system headers in SDKGravatar Murillo Bernardes
Starting with Xcode 10, system headers are located inside the macOS SDK. Add this location to the check for command line tools. Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-10-08Map: zoom on dive sites when flipping through dive site listGravatar Berthold Stoeger
The dive site list was connected to centerOnDiveSite(). Apparently, the currently selected dive site should have been shown in the map. Yet, this never worked, because the actual dive site of the selected dive had precedence in centerOnDiveSite(). It seems that centerOnDiveSite() had actually to purposes: 1) center on the passed in dive site 2) center on the dive sites of the selected dives Therefore, split this function in two separate functions for each of these use-cases. This allows us to remove some pre-processor magic (mobile vs. desktop) and to remove a parameter from the MainTab::diveSiteChanged() signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-08libdivecomputer: remove ifdefs for ancient versionsGravatar Dirk Hohndel
We bundle our version of libdivecomputer and don't expect Subsurface to work with a different version, certainly not with something older than 0.5. I kept the checks for SAMPLE_EVENT_STRING and DC_FIELD_STRING and DC_SAMPLE_TTS because maybe there's a situation where being able to compile with a current upstream version is useful. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-08Mobile: show temperature graph when no gas graphGravatar Jan Mulder
In commit bd0c99dfb71 (display pO2 and Setpoint for CCR dives) the choice was made: when CCR than never a temperature graph. While this seems reasonable, there is small group of mCCR divers that do not log their po2 digitally, so the only po2 they can display is the setpoint that is reported by the used DC. As this is a bit of a dull flat line, most of these divers do not display this. And this leaves room on the small mobile display for the temperature data. So effectively: show temperature or po2 graphs. Suggested-by: Peter Zaal <pzaal@xs4all.nl> Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-08Fix warning about unused variablesGravatar Linus Torvalds
Commit 810903bdb9db ("Import: pass a dive table to process_imported_dives()") introduced the variables struct dive *old_dive, *merged; into process_imported_dives(), but never used them. It seems to be an artifact of having split the function to use the try_to_merge_into() helper function (that has those same variable names and _does_ use them), but forgetting the original variables from the pre-split case. Gcc understandably warns about it: core/divelist.c: In function ‘process_imported_dives’: core/divelist.c:1351:26: warning: unused variable ‘merged’ [-Wunused-variable] struct dive *old_dive, *merged; ^~~~~~ core/divelist.c:1351:15: warning: unused variable ‘old_dive’ [-Wunused-variable] struct dive *old_dive, *merged; ^~~~~~~~ and the trivial fix is to just remove that line that declares the stale and unused variables. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-08ftdi: make the timeout be based on actual real timeGravatar Linus Torvalds
bperrybap reported on github that the ftdi timeouts can be excessive: "the timeout period while waiting for read data to be 10x or even 100x longer than it should be when there are read issues on the data cable particularly when using Android and USB OTG cables. i.e. a 5 second read timeout for not receiving data can be as long as 7 minutes" and the reason is that the code at one point tried to use the regular "gettimeofday()" to handle timeouts, but that doesn't exist in Windows. We already have Windows-specific code to sleep for a number of milliseconds in "ftdi_serial_sleep()", let's just extend that same concept and add a "ftdi_serial_get_msec()" that returns the number of msec's since some arbitrary point in time. On Windows, that's just "GetTickCount()", and in sane environments it's just a trivial wrapper around gettimeofday() to turn sec/usec into msec. NOTE! The actual msec value doesn't have any meaning. Only the difference between two calls to ftdi_serial_get_msec() is meaningful. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-08qt-ble: add 'get_name()' function to expose the BLE name to libdivecomputerGravatar Linus Torvalds
Some divecomputer backends (ok, right now really only the Aqualung i770R and i300C) want to know the bluetooth name of the dive computer they connect to, because the name contains identifying information like the serial number. This just adds the support for that to our Qt BLE code. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-07Travis: don't upload the MXE Subsurface binariesGravatar Dirk Hohndel
More specifically, don't upload them from the old Windows build - we just keep that one around for the smtk2ssrf binaries. The Subsurface binaries are now created in the container based Windows build. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-07Travis: build old style Windows without FTDI supportGravatar Dirk Hohndel
This way we can still get an smtk2ssrf build until that is added to the windows-container target. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-07MXE: enable building against userspace FTDI drivers againGravatar Dirk Hohndel
This still doesn't seem to work as expected and needs more testing. Also, it can be turned off via command line argument Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-07MXE: use libgit2 from MXEGravatar Dirk Hohndel
MXE has had a new enough libgit2 for a while now. No reason anymore to build our own. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-07Travis: add Windows build in a containerGravatar Dirk Hohndel
I expect this to become the default way to test Windows builds and create installers on Travis. The idea is that instead of downloading the pre-built MXE binaries we might as well use a container that has all this installed and can be used locally to test if things fail on Travis; which will allow us to have the exact same environment for testing locally as runs on Travis. At this point the container used is way too big - more effort needs to be spent on shrinking it. Right now this only deals with Subsurface and not with smtk2ssrf. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-07build-system: minor cleanup of build.shGravatar Dirk Hohndel
That qmake -query was added for debugging a long time ago. Since the comment clearly indicate that the edit of the Makefile is only for Travis, let's only do it when running on Travis. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-07build-system: remove support for local cloning in build.shGravatar Dirk Hohndel
It wasn't documented in the first place (magic first argument, anyone?). This used to be available for quite a few of the dependency and had somehow kept around only for Grantlee and Googlemaps. Let's just kill this and be consistent for all dependencies. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-07build-system: add Grantlee to our get dependency scriptGravatar Dirk Hohndel
I actually don't know why this was missing... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-07Leak fix: free taxonomy data in delete_dive_site()Gravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-07CHANGELOG.md updateGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-07Statistics: only consider selected dives in HTML export statisticsGravatar Berthold Stoeger
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-07Statistics: un-globalize stats_selectionGravatar Berthold Stoeger
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-07Statistics: remove global state / calculate only when neededGravatar Berthold Stoeger
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-07QML UI: set proper active background color for downloaded divesGravatar Jan Mulder
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-07QML UI, trivial: set proper background color GPS listGravatar Jan Mulder
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-07QML UI, consistency: add text attribute for all actionsGravatar Jan Mulder
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-07QML UI, cleanup: remove usesless ItemGravatar Jan Mulder
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-07CSV import: import of last fieldGravatar Miika Turkia
The last field ends with new line instead of field separator. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-10-07CSV import: do not add quote to single wordGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
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>