aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2018-06-17Dive computers: turn QMultiMap into sorted vectorGravatar Berthold Stoeger
The list of known dive computers was stored in a multi-map indexed by the device name. Turn this into a sorted QVector. Thus, no map-to-list conversion is needed in the device editing dialog, which distinctly simplifies the code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-17Cleanup: remove eplicit constructors and unused member variableGravatar Berthold Stoeger
Remove the explicit constructor in DiveComputerNode: Just use classical C-style struct initialization. Moreover, remove the empty constructor and destructor of DiveComputerList. The variable DiveComputerList::dcWorkingMap was unused. Remove. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-17Fix an error around translation of dive modes in the UIGravatar Stefan Fuchs
This fixes an mistake introduced in 3d1072f8862e4c329dc2678df52a24137b8d4704 Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-06-15DM5 import: support for larger sample sizeGravatar Miika Turkia
Suunto has updated SampleBlob to use 30 byte blobs. This adds support for the increased size. Note that this only parses the same fields we have parsed before. (Currently I have no idea what the increased size is used for.) Note also that I do not currently have data with the new format so I only tested this still works with old data. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-06-15core: make prefs-macros compile safe.Gravatar jan Iversen
add {} in each macro to secure it works as a single statement, to avoid problems like if (1) GET_TEXT(); Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-13Dive pictures: Make failure of loading images less noisyGravatar Berthold Stoeger
For debug reasons, failure to load the original image was spilled to the console, even if the local file was then found. Only print a message, when also the local image failed loading. This needed a bit of code reshuffling. To know when to print a failed-loading message, the URL is now checked at the Thumbnailer level, not the ImageDownloader level. The ImageDownloader is passed the URL and the original filename (if different). The image is loaded from the URL, but the signals send the original filename, so that the thumbnail can be associated to the proper image. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-09core: remove qml properties from downloadfromcthreadGravatar jan Iversen
Remove Q_OBJECT and qml properties from DCDeviceData class Remove DCDeviceData register from mobile-helper.cpp Change DCDeviceData constructor to be without parameters Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09core: update deviceData default from qmlGravatar jan Iversen
remove setting default in qml to C++ Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09mobile: add DCDeviceData properties to qmlmanagerGravatar jan Iversen
add DCDeviceData qml properties etc. to qmlmanager Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09core: remove qml properties from desktop compileGravatar jan Iversen
add #ifdef SUBSURFACE_MOBILE to secure qml macros are not compiled with desktop Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08Provide correct cylinder pressures for bailout divesGravatar Willem Ferguson
Calculate the correct cylinder pressures for rebreather dives with bailout. Currently the cylinder pressures for a dive are calculated assuming a single dive mode for that dive. Bailout indroduces more than one dive mode for a single dive, i.e. transitions from CCR or PSCR to OC and back. Currently the start and end pressures for each cylinder are used to interpolate cylinder pressures while that cylinder is used. However, the different gas consumption rates for OC, PSCR and CCR are not taken into account in this interpolation and the cylinder pressure is indicated by an averaged interpolation accross the rebreather and OC legs of the dive. Consequently the increased drop in cylinder pressure during OC is not shown. This PR allows differentiation between CCR/PSCR legs of the dive and the OC bailout segments, showing realistic interpolation that indicate the increased rate of gas use during OC. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-06-07Dive pictures: remove cache_picture() call in dive_add_picture()Gravatar Berthold Stoeger
When adding a picture to a dive, cache_picture() was called, which calculated the hash of the picture in a background-thread. This made tests occasionally fail, because the tests depended on the filename-to-localfilename being overwritten in a call running in a different thread. Depending on which thread finished first, the test succeeded or failed. The easiest way to circumvent this problem is to remove the cache_picture() call. The hash will be calculated anyway with the thumbnails. And the only function of the hash is the "find moved images" function. Which is not an issue here, because the user just loaded the images from disk. Reported-by: Jan Iversen <jani@apache.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-06Bugfix: Load PSC dive logsGravatar Willem Ferguson
The code changes to standardise the named of divemodes and to separate internal divemode names and UI divemode names introduced a bug that caused non-backward compatability with existing dive logs. The reason for this is the definition of the divemode_text strings in dive.c This change reverses that definition and brings about correct loading of PSCR dive logs as well as correct parsing of bailout events involving PSCR. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-06-05core: remove "static void copyPath" unusedGravatar jan Iversen
Remove copyPath since it is static and not called to avoid clang warning Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-04core: remove unused function getDetectedDeviceAddress()Gravatar jan Iversen
getDetectedDeviceAddress is not used in mobile or desktop version Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-04Cleanup: fold core/helpers.h into core/qthelper.hGravatar Berthold Stoeger
helpers.h included qthelper.h and all functions declared in helpers.h were defined in qthelper.h. Therefore fold the former into the latter, since the split seems completely arbitrary. While doing so, change the return-type of get_dc_nichname from "const QString" to "QString". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-04Cleanup: make copyPath() function of static linkageGravatar Berthold Stoeger
The function was only used in core/qthelper.cpp Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-30mobile: add timer to measure startup.Gravatar jan Iversen
Subsurface-mobile has a long startup time; in order to isolate the problem(s) a timer is added to see where time is "lost". The collected startup times are added to the clipboard together with the other logs, allowing test users to report back. All this is only enabled when compiling with -DENABLE_STARTUP_TIMING Closes #1340 [Dirk Hohndel: collapsed multiple commits and minor white space cleanups, added missing QMutex variable] Signed-off-by: Jan Iversen <jani@apache.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-28Planner: Don't store a setpoint unless we are in CCR modeGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-28Don't compute SAC if total gas use is unknownGravatar Robert C. Helling
If we breathe from a cylinder with invalid start or end pressures, we cannot reliably compute the total gas use and thus the SAC. So we should not pretend to do so. A better fix would compute the total SAC for only those segements that have valid start and end pressures. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-28Rename confusing variable nameGravatar Robert C. Helling
This is a struct dive pointer not a divepoint. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-28Distinguish between user and internal divemode namesGravatar Robert C. Helling
The former should be translated but not those that go to xml/git. ... and fix capitalization of pSCR. Suggested-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-27Remove unnecessary {}Gravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-05-27Shearwater import: avoid running atoi multiple timesGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-05-27Shearwater import: support for DC reported ceilingGravatar Miika Turkia
This adds support for DC reported ceiling when importing the Shearwater Desktop database. Both AI and non-AI versions are tested, but not all possible paths. For non-AI the DC reported ceiling was from firstStopDepth and for the AI version it was from the decoCeiling field. I do not currently know when each of these fields are used, but at least this works on my test data. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-05-27Dive pictures: automatically recalculate thumbnailsGravatar Berthold Stoeger
If a thumbnail and the original picture can be accessed and the modification date of the thumbnail is before the modification date of the picture, recalculate the thumbnail. This causes more disk access and might give strange effects for picture files with messed up file timestamps (i.e. lying in the future) or messed up computer clocks (i.e. running in the past). Therefore, add a preference option to disable the new behavior. Default is set to enabled. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-27Dive pictures: give user option to recalculate thumbnailsGravatar Berthold Stoeger
Even though hashes of image contents are calculated, the hashes are not compared to actual file contents in routine-operation. Therefore give the user the option to recalculate thumbnails, should they have edited the picture. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-26core: qt-ble.cpp remove postEvent for all platformsGravatar jan Iversen
the postEvent is only called when downloading from a dc with bluetooth, so in most it does not have an effect on the deleteLater() in the code. there are no reason to do special cleanup while waiting for bluetooth QEvent::DeferredDelete is not supported on iOS. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-26Dive pictures: Derive thumbnail file from picture filenameGravatar Berthold Stoeger
Since commit 6618c9ebfc6a7cebbef687fcb3aa74c70f504ff2, thumbnails are saved in individual files. The filename was simply the picture-hash. In a mailing-list discussion it turned out that in the future we might not hash images or change the hash. Therefore, derive the thumbnail filename from the image filename, using the SHA1 algorithm. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-26Cleanup: remove code related to pictures in the cloud-repositoryGravatar Berthold Stoeger
Storing pictures in the cloud never came to be, so remove the code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-24core: replace (void) with UNUSED(x) and include ssrf.hGravatar jan Iversen
Unused parameters in C are "silenced" by adding UNUSED(x) Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-24core/ssrf.h: add #pragma to avoid clang warning "-Wmissing-field-initializers"Gravatar jan Iversen
Add a #pragma to avoid getting warning when a struct is only initialized with one 0 and not one pr struct member Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-24core: add ssrf.h as global product headerGravatar jan Iversen
ssrf contains macros/includes etc. used in ssrf, but not related to dives (mainly in dive.h) currently the header is created to add the macro UNUSED later it will be used to remove non-dive related items from dive.h Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-24core: replace (void) with no parameter nameGravatar jan Iversen
Unused parameters in C++ are "silenced" by removing the name. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-24Cleanup: remove code related to picture-storage in git repositoriesGravatar Berthold Stoeger
Saving of pictures to git repositories was disabled. Finally remove this code and the corresponding load code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-21core/subsurface-qt: Change Q_UNUSED to no parameter nameGravatar jan Iversen
C++ permits use of parameters without name, which signals unused Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-21core: Change Q_UNUSED to no parameter nameGravatar jan Iversen
C++ permits use of parameters without name, which signals unused Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-21iOS: qt-ble.cpp remove unsupported event.Gravatar jan Iversen
QEvent::DeferredDelete is not supported in iOS Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-20core: marked unused parameterGravatar jan Iversen
Add Q_UNUSED to unused parameter Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-19build-system: don't always build qtserialbluetooth.cppGravatar Dirk Hohndel
This should only be built if we have BT support enabled. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-18core: solved PictureEntry defined as class and struct.Gravatar jan Iversen
PictureEntry was defined as class in imagedownloader.h and as struct in divepicturemodel.h A class has a vptr in front, so the difference is real at least for the clang compiler. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-18core: removed clang warnings from dive.hGravatar jan Iversen
interpolate, rel_mbar_to_depth, gas_mod and gas_mnd returns int but uses a function that returns long, causing clang to warn about conversion loss due to implicit conversion. Adding a cast, shows that it is correct. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-18core: removed clang warnings from units.hGravatar jan Iversen
lbs_to_grams and to_feet returns int but uses a function that returns long, causing clang to warn about conversion loss due to implicit conversion. Adding a cast, shows that it is correct. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-18Plannernotes: '\0'-terminate ICD-bufferGravatar Berthold Stoeger
When creating the ICD-notes the membuffer was not '\0'-terminated, leading to output of stale data. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-17core: corrected wrong default emailGravatar jan Iversen
Typo in email. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-17Bugfix: Saving divemode to xml and to gitGravatar Willem Ferguson
There is a space character missing in the xml generated by the present code. Insert a space character. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-16Dive pictures: don't attempt reading the same image twiceGravatar Berthold Stoeger
If loading of an image failed, we tried to see if we find a canonical filename in the cache. There's no point in rereading the picture if the canonical and the original filename are the same. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-16Dive pictures: Don't enter infinity loop on invalid picturesGravatar Berthold Stoeger
The recently committed refactoring of the dive-picture code introduced a severe bug: If an image couldn't be loaded from disk owing to an invalid file, the filename was interpreted as an url and loaded in the background. This succeeded, because the file actually exists. After download, the file would then still be invalid and the whole thing restarted, leading to an infinity loop. To fix this, do two things: 1) Don't even try to download local files. 2) If interpreting a downloaded file fails, don't try the downloading business again. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-14Rename enum dive_comp_type to divemode_tGravatar Robert C. Helling
...as the usuage is not anymore about a computer but a momentary dive mode. Rename the end indicator as well. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Planner: Make use divemode for consumed gas calculationGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>