summaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2019-03-24Cleanup: fix printGPSCoords signature and leaksGravatar Berthold Stoeger
The printGPSCoords() function returns a copied C-style string. Since the owndership is transferred to the caller, the correct return type is "char *" instead of "const char *". Thus a number of casts when calling free can be removed. Moreover a number of callers didn't free the string and thus were leaking memory. Fix them. Ultimately we might want two versions of the function: one for QString, one for C-style strings. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-03-20Core: simplify ConnectionListModelGravatar Dirk Hohndel
The complicated setup with the AddressRole is unnecessary. All we want to be able to do is get the index of a specific text in the list. In hindsight I am puzzled why I implemented this in such a complex fashion. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-19Misc: replace some FIXME commentsGravatar Dirk Hohndel
All these aren't actually things that need fixing, they are observations about the code. Given that LGTM.com reports FIXME comments as Alerts, let's change the ones that aren't about things that need fixing to something more harmless. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-18Desktop: fix yet another variable name conflictGravatar Robert C. Helling
Addresses LGTM.com issue. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-18Core: let TTS calculation use correct ascent velocitiesGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-18Core: change FIXME languageGravatar Robert C. Helling
Addresses LGTM.com issue. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-18Core: fix another variable name conflictGravatar Robert C. Helling
Addresses LGTM.com issue. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-18Core: remove variable name conflictGravatar Robert C. Helling
Addresses LGTM.com issue. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-18Cleanup: remove bit field demux in datatrak.cGravatar Berthold Stoeger
To test single bits, datatrak.c would transform bytes into malloc()ed char[8] buffers. Instead, simply introduce a function to test individual bits. This should make it distinctly easier for the compiler to optimize away. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-03-18Cleanup: unglobalize variables in datatrak.cGravatar Berthold Stoeger
It's a drop in the bucket, but let's remove some unnecessary global variables. With one exception these variables were only used in one function anyway. The other one can be passed as a parameter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-03-18Cleanup: remove unused global variables from datatrak.cGravatar Berthold Stoeger
lector_bytes and lector_word were used nowhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-03-17Core: remove variable name conflictGravatar Dirk Hohndel
Having a parameter with the same name as a global variable is potentially confusing. Found via LGTM.com Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-17Core: remove variable name conflictGravatar Dirk Hohndel
Having a parameter representing a location with the same name as a global variable representing our locale is confusing. Found via LGTM.com Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-17Core: remove variable name conflictGravatar Dirk Hohndel
Having a parameter with the same name as a global variable is potentially confusing. Found via LGTM.com Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-17Core: remove function list commentGravatar Dirk Hohndel
We don't do this anywhere else. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-17Core: remove variable name conflictGravatar Dirk Hohndel
Having a char parameter with the same name as a global char * variable is confusing. Found via LGTM.com Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-17Core: cast before multiplication to avoid potential overflowGravatar Dirk Hohndel
Found via LGTM.com Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-17Core: cast to the correct typeGravatar Dirk Hohndel
While in the specific calculations here there isn't really a risk that float might overflow, it seems odd to cast to float in order to assign to double. This caused an Alert via LGTM.com Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-17Bluetooth: don't free a resource created by newGravatar Dirk Hohndel
Found via LGTM.com Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-17Core: fix missing argument to report_errorGravatar Dirk Hohndel
The format requires a string argument. Found via LGTM.com Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-12Add backend support for statistics by depth and temperatureGravatar Doug Junkins
Added stats_t structures to summarize dive statistics by depth and by temperature. Process each dive to add the dive stats to the proper depth and temperature bucket. Buckets are defined using constants STATS_MAX_DEPTH, STATS_DEPTH_BUCKET, STATS_MAX_TEMP, and STATS_TEMP_BUCKET which are defined in statistics.h Signed-off-by: Doug Junkins <junkins@foghead.com>
2019-03-05Import: fix infinite loopGravatar Berthold Stoeger
Owing to a variable reuse in a nested loop, importing dive logs with new trips could lead to an infinite loop. Use a fresh index "j". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: remove DownloadFromDCThread::tripTableGravatar Berthold Stoeger
Since ff9506b21bbb9910256841dcb577bcb2e19047e8 the downloaders don't add dives to a new trip and therefore the tripTable field of DownloadFromDCThread became pointless. Remove it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: remove outdated comment in libdivecomputer.hGravatar Berthold Stoeger
The comment was mentioning a "progressbar_t", which doesn't exist anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: remove dc_user_device_t::preexistingGravatar Berthold Stoeger
This field appears to be unused for a long time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: remove dc_user_device_t::tripGravatar Berthold Stoeger
Since ff9506b21bbb9910256841dcb577bcb2e19047e8 the downloaders don't add dives to a new trip and therefore the trip field of dc_user_device_t became pointless. Remove it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Uemis: remove trip deletion on dive deletionGravatar Berthold Stoeger
Since ff9506b21bbb9910256841dcb577bcb2e19047e8 the downloaders don't add dives to a new trip, but the import code does. Remove the code in the Uemis downloader that would remove a dive from the trip. The code has been broken recently anyway (instead of testing for trip, it tested for the notrip flag, which make no sense whatsoever). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: put all function declarations in file.h in extern "C"Gravatar Berthold Stoeger
Some of the functions declarations were not in 'extern "C"', despite being C functions. This worked only because they weren't called from C++. Nevertheless, it seems like a dangerous proposition to have the same function declared once as C and once as C++. Therefore, always put them in extern "C" (if compiling in C++ mode, evidently). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: make dt_dive_parser() local to datatrak.cGravatar Berthold Stoeger
The function is only used in this translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: remove deletion of webservice dive sitesGravatar Berthold Stoeger
In the XML and git savers, unchanged webservice-dive sites were deleted. Since the webservice is not functional anymore, remove this code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: move get_divesite_idx() to divesite.cGravatar Berthold Stoeger
This function was defined in divelist.c, whereas it's better located in divesite.c. Move it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: make dive_set_geodata_from_picture() local to dive.cGravatar Berthold Stoeger
The function dive_set_geodata_from_picture() is only used in dive.c. Make it local to that translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Cleanup: uninline get_dive_site_by_uuidGravatar Berthold Stoeger
There seems to be no compelling reason to have this function inlined. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-14Mobile: only show dive computers in the Bluetooth connection listGravatar Dirk Hohndel
And offer an option to show all devices in the settings. This is intentionally not stored in the preferences as this should never be needed. We don't support BT or BLE dive computers that we don't recognize. This is a last resort in case a new firmware were to change the name or some other weird issue causes us not to recognize a dive computer - and that should be fixed instead of worked around. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-02-14Desktop: only show dive computers in the Bluetooth device listGravatar Dirk Hohndel
By default we'll only show devices that we believe to be dive computers, but the user can override that with the recently introduced check box. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-02-09Cleanup: remove unsused function clear_dive_site()Gravatar Berthold Stoeger
The last caller was removed in 11a211fb02ad5443342d91b6967f150cb4f6d34f Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-09Cleanup: remove unused function create_dive_site_from_current_dive()Gravatar Berthold Stoeger
The last caller was removed in 11a211fb02ad5443342d91b6967f150cb4f6d34f Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-09Cleanup: make create_divesite_uuid() of static linkageGravatar Berthold Stoeger
This function was not used outside of core/divesite.h Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-07Profile: add "synchronous" mode for picture plottingGravatar Berthold Stoeger
The thumbnails were fetched in the background to achieve a snappier UI. The problem with that is that on LaTeX etc. export only placeholder thumbnails were shown. Therefore, implement a synchronous mode. This only tries to fetch cached thumbnails or calculate thumbnails for images. Videos and remote files are not supported. Fixes #1963 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-05Add button to toggle deco info in info boxGravatar Robert C. Helling
The info box can get longish. Offer the user to turn off display of deco information (surface GF and individual ceilings). Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-02-05Include surface GF in infoboxGravatar Robert C. Helling
The most recent firmware of Shearwater computers shows this. This is a measure of absolute amout of tissue loadings in an easy to digest unit. Therefore it is useful to have. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-02-01facebook: remove the featute from the code baseGravatar Lubomir I. Ivanov
Remove from: - unit tests - desktop widgets - preferences - core intergration - cmakefiles - build scripts - icons - docs Also remove the plugins and social network integration. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2019-01-23Bluetooth: don't crash if BT is turned offGravatar Dirk Hohndel
At least on a Mac we can get here without a discoveryAgent if BT is off, so don't derefence the NULL pointer in that case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22BLE debug: make things less verboseGravatar Dirk Hohndel
Unless run with '-v -v -v'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22libdivecomputer: small wording change in a warningGravatar Dirk Hohndel
While in theory the DEVINFO event should give us the correct detected product, it's also possible that the code that usually detects the product gave up and returns an unknown model. Try to have the message reflect that situation more accurately. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-19Import: control process_imported_dives() by flagsGravatar Berthold Stoeger
process_imported_dives() takes four boolean parameters. Replace these by flags. This makes the function calls much more descriptive. Morover, it becomes easier to add or remove flags. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Import: don't add to new trip while downloadingGravatar Berthold Stoeger
Since process_imported_dives() can add dives to a newly generated trip, this need not be done in the downloading code. This makes data flow distinctly simpler, as no trip table and no add-new-trip flag has to be passed down to the libdivecomputer glue code. Moreover, since now the trip creation is done at the import step rather than the download step, the latest status of the "add to new trip" checkbox will be considered. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Import: add add_to_new_trip flag to process_imported_dives()Gravatar Berthold Stoeger
If this flag is set, dives that are not assigned to a trip will be assigned to a new trip. This flag is set if the user checked "add to new trip" in the download dialog of the desktop version. Currently this is a no-op as the dives will already have been added to a new trip by the downloading code. This will be removed in a subsequent commit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Dive import: fix logic of process_imported_dives()Gravatar Berthold Stoeger
The logic in process_imported_dives() was faulty: Dives are merged trip-wise in a loop. But if only autogenerated trips were supposed to be merged, the trip would not be added. Change the logic to always add the trip if it is not merged. To make the loop easier to read, factor out the merge-trip-into-existing-trips logic into a separate function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Dive download: add trip_table to device_data_tGravatar Berthold Stoeger
Since recent commits, dive-trips are not added directly to the core, but into separate trip tables (see ec37c71f5eeb7d4b0c4b8719b52583fadb0b8f4c). These commits did not finish the work for the download-from-dc case. Add an extra trip_table field to device_data_t. If trips are created (user selected "Download into new trip"), the trip will be created in that table. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>