aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2018-09-10prefs: git_local_only is not a preferenceGravatar Dirk Hohndel
It's the current state of the app, so it should be a global variable, not a preference. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-10Profile: fix SAC calculation for air divesGravatar Berthold Stoeger
Commit f5b11daffd6f240268ce78d72c64be43670988ea changed gasmix arguments and return values to be passed by value instead of using pointers. Notably, get_gasmix() is fed a default-value and returns a new value. In the old code, NULL was passed in in a first loop iteration and non-NULL was always returned in the first iteration. Thus, an equality comparison of passed-in an returned gasmix would always fail in the first loop iteration. The new code passed in air as default. Now if air was also returned, then the matching gases were not calculated in calculate_sac(). To revert to the old behavior, pass in an invalid gasmix. Moreover, give names to the invalid and air gasmixes. Reported-by: tormento <turment@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-09Set desktop file name to avoid a broken icon under KDE WaylandGravatar Alexander Wilms
Signed-off-by: Alexander Wilms <f.alexander.wilms@gmail.com>
2018-09-09DLF import: document deco eventGravatar Miika Turkia
These are Deco N2 Low/High and Deco He Low/High events. They all appear to be recorded at the same time, different events at same second. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-09-09DLF import: comment measured HeGravatar Miika Turkia
Measured He is documented (in comment). Will need information if all measurements are needed or just start/end. First case would be added to dive prifle, possibly cluttering it, second would be extra data. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-09-09DLF import: Record battery statusGravatar Miika Turkia
This will record the ending battery status to extra data. Would need info from CCR divers whether this suffices or if we should record also the starting volatage or even every single reading. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-09-07core/settings: only sync values that are actually changedGravatar jan Iversen
Add a variable reflecting the current_state to all DISK_* macros, in order to check if the original variable in struct preferences is changed. Only save to disk if actually changed [Dirk Hohndel: merged Jan's commit and renamed the variable and adjusted the commit message... but fundamentally the commit is still what Jan wrote, so he should get the credit] Signed-off-by: Jan Iversen <jani@apache.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-07qPref: use helper function to ensure key/name groupingGravatar Dirk Hohndel
We had a couple of instances of names being incorrectly merged with their group, this should handle that better. It's a bit of a big hammer to use, but it seems to work (and it makes it easy to then git grep for cases that don't use the new helper function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-07Cleanup: constify get_units()Gravatar Berthold Stoeger
get_units() returns a pointer to the units struct in the preferences. Callers should not modify the preferences via this struct, therefore make the return value point to const. This is a small step in constifying the global preferences structure. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-07Preferences: more missing /Gravatar Jan Mulder
subsurface_webservice_uid ends up in the wrong group due missing /. Notice that this does not fix the issues I mentioned in #1648. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-06Garmin devices - like Shearwater - want random BLE addressingGravatar Linus Torvalds
We had a special-case for the Shearwater case, let's just make it slightly more generic and add Garmin to the list of vendors that want a random BLE address rather than a static one. The Bluez model of having to state this explicitly - but not giving the information to the user - is completely broken and this is all very annoying, credit goes to Wojciech Więckowski for pointing this out. Of course, right now we don't actually know how to parse the BLE stream from the Garmin Descent, but with this (and some libdivecomputer hackery) I actually get connected and start receiving data. That we then can't parse, but that's hopefully just a libdivecomputer update away. Pointed-out-by: Wojciech Więckowski <xplwowi@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-06core/settings: add missing / in default_filenameGravatar jan Iversen
Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-06Revert "core/tests: add loadFromCloud var to qPrefCloudStorage"Gravatar jan Iversen
This reverts commit b7a1bb670ce11b22e52361f4152b4853b97e13f5. Signed-off-by: Jan Iversen <jani@apache.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-06qPref: only save settings that aren't the defaultGravatar Dirk Hohndel
This brings us back to the previous behavior. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-03libdivecomputer: allow a "zero depth" deco stop depthGravatar Linus Torvalds
That just means that we're not in deco, the same way as giving a nonzero NDL value does. But if you don't have NDL, this is a much more convenient way of saying "not in deco". The Garmin Descent gives us stop information, but not necessarily NDL, and really wants this. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-09-03libdivecomputer: add support for DC_SAMPLE_TTS if it existsGravatar Linus Torvalds
libdivecomputer didn't use to have a TTS sample value, but we're adding one, so add conditional support for it if it exists. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-09-03core/windows.c: write logs to the user pathGravatar Lubomir I. Ivanov
Writing logs to the path where the executable is located, might not be possible if the current user doesn't have permissions to write there. Obtain the user path and write the log files to the user path instead - e.g.: c:\users\myuser\appdata\roaming\subsurface\subsurface_*.log Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-09-03code/windows.c: add method for converting from utf16 to utf8Gravatar Lubomir I. Ivanov
Modify the funcion system_default_path_append() to both receive and return wchar_t types. Remove fallback in system_default_path_append() as this is now redundant. Add a function utf16_to_utf8() and use that in places where system_default_path_append() needs to be converted to utf8. Move both utf16_to_utf8*() and utf8_to_utf16*() near the top of the file. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-09-01Cleanup: silence clang missing braces warning in core/color.cppGravatar Berthold Stoeger
C++11 initializer lists should be passed via {{ ... }}. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-30Parser: split out name-comparison from match() functionGravatar Berthold Stoeger
The match() function in parse-xml.c calls a very specific callback, which doesn't take a context-parameter. To be able to call other callbacks, split out the actual name-comparison. Moreover, remove the "plen" parameter, as this was called with strlen(pattern) in all cases anyway. Replace the old logic which potentially accessed a byte beyond the end of name with a simply classical C-style loop. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-30Parser: move match() into core/parse-xml.cGravatar Berthold Stoeger
The match() function compares a pattern with a name with a twist: The name may either end in '\0' or '.'. If pattern and name match, a parsing function is called on a buffer and a destination value. The result of the parsing is not checked. This seems awfully XML-specific and therefore move the function from the general parse.c to the specialized parse-xml.c unit and make it of local linkage. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-30core/settings: add missing load_* call in qPrefDisplayGravatar jan Iversen
Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-30core/settings: add READMEGravatar jan Iversen
Add simple explanation of how the program flow is. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-29parse "GPS" string fields and turn them into dive sites when downloadingGravatar Linus Torvalds
Dive computers that do GPS can report their GPS data as one or more string fields, and if the first tree letters of the description is "GPS", then we'll take the string and turn it into a dive site for that dive. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-28core: fix typo in preference nameGravatar Dirk Hohndel
In commit 1bc361b2ea ("core/tests: add uuidString to qPrefUpdateManager") a typo was introduced for the preference name. Reported-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27Add support for opening a DC_TRANSPORT_USBSTORAGE streamGravatar Linus Torvalds
This is part of the whole "let's support the notion of dive computers being exported as USB storage devices" push. With an older libdivecomputer, we'll just fall back on failing the operation, but we still want to support the generic notion of DC_TRANSPORT_USBSTORAGE since we have our own internal Uemis downloader. That one won't ever get to the open phase, since it's caught earlier. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27Make device enumeration use the device transport dataGravatar Linus Torvalds
This removes some special-case code for Uemis, replacing it with simply passing in the device transport information. This makes device enumeration work for the Garmin Descent (if it is listed by libdivecomputer as a USB storage device, that is). I don't actually do any of the libdivecomputer parsing yet, and only have a stub for the Garmin Descent, but now the directory selection works with that stub. The actual download obviously does not. [Dirk Hohndel: removed obsolete FIXME from code] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27Treat the "GARMIN" mount point exactly like the "UEMISSDA" oneGravatar Linus Torvalds
The logic for finding a mount point for the Garmin FIT devices is basically exactly the same as for the UEMISSDA, even if the rest of the sequence is not the same. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-25Merge branch 'filter8' of https://github.com/bstoeger/subsurfaceGravatar Dirk Hohndel
2018-08-25core/tests: add class var to qPrefGeneralGravatar jan Iversen
Add static class variables to qPrefGeneral (and remove QSettings from desktop-widgets) Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core/tests: add loadFromCloud var to qPrefCloudStorageGravatar jan Iversen
Add special property loadFromCloud + mail to qPrefCloudStorage this variable is used by qmlmanager.cpp Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core/tests: remove QSettings from testgitstorageGravatar jan Iversen
update testgitstorage.cpp to use qPrefProxy and qPrefCloudStorage remove core/prefs-macros.h since it is unused Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core: remove QSettings from qPrefDivePlannerGravatar jan Iversen
remove not needed include from qPrefDivePlanner Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core/tests: merge Animations and add vars. to qPrefDisplayGravatar jan Iversen
Add class variable tooltip_position to qPrefDisplay Add class variable lastDir to qPrefDisplay qPrefDisplay is updated to use new qPrefPrivate functions Adjust test cases incl. qml tests qPrefAnimations only has 1 variable, that really is a display variable Merge the variable into qPrefDisplay, to simplify setup (and avoid loading extra page in qml). correct theme to save in correct place, and make it a static class variable Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core: remove QSettings from qthelperGravatar jan Iversen
uiLanguage overloaded qPrefLanguage and used useSystemLanguage instead of use_system_language Replace local load using QSettings with qPrefLanguage Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core/tests: add uuidString to qPrefUpdateManagerGravatar jan Iversen
add static class variable uuidString to qPrefUpdateManager correct test cases Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core: qPrivate add handle macros for class variablesGravatar jan Iversen
Some variables are not in structure prefs, but are static class variables, these will not be synced on exit, because they can only be changed through the setter, but loaded on startup. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core: make methods in qPrefPrivate staticGravatar jan Iversen
Small cleanup, using static methods is simpler and faster Added propSetValue and propValue instead of exposing setting variable. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core: qPrefPrivate.h correct spaces before \ in macrosGravatar jan Iversen
the ending \ in macros have been expanded to many spaces, correct back to 1 space Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-23Cleanup: const-ify functions taking dives and divecomputersGravatar Berthold Stoeger
Another small step in making things const-clean. See also commit 605e1e19ed0c52a16580c95e36ae79e71b539351. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Parse: pass dive_table argument to parse_file()Gravatar Berthold Stoeger
To enable undo of divelog-importing it is crucial that parse_file() can parse into arbitrary dive tables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: user properly typed pointersGravatar Berthold Stoeger
A trivial cleanup: replace void by properly typed pointers in cylinder_none() and weightsystem_none(). Moreover, remove the unused function no_weightsystems(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23core: correct error in qPrefUpdateManagerGravatar jan Iversen
make next_check (in qPrefUpdateManager) long instead of string Correct test cases (compare time_t not strings) Add test case to check time_t works as expected Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-23core: correct error in qPrefLanguageGravatar jan Iversen
Correct mangled disk names Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-23Cleanup: const-ify functions taking pointers to eventsGravatar Berthold Stoeger
This is another entry in the series to make more things "const-clean" with the ultimate goal of merge_dive() take const pointers. This concerns functions taking pointers to events and the fallout from making these const. The somewhat debatable part of this commit might be that get_next_event() is split in a two distinct (const and non-const) versions with different names, since C doesn't allow overloading. The linker should recognize that these functions are identical and remove one of them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: const-ify parameters to trivial accessor functionsGravatar Berthold Stoeger
Accessor-functions without noticeable logic, such as depth_to_bar() can trivially be made "const-clean". Moreover, let get_dive_location() return a "const char *". The non-const version must have been an oversight, as the caller must not free() or overwrite the string. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: pass gasmix by valueGravatar Berthold Stoeger
In a previous commit, the get_gasmix_* functions were changed to return by value. For consistency, also pass gasmix by value. Note that on common 64-bit platforms struct gasmix is the size of a pointer [2 * 32 bit vs. 64 bit] and therefore uses the same space on the stack. On 32-bit platforms, the stack use is probably doubled, but in return a dereference is avoided. Supporting arbitrary gas-mixes (H2, Ar, ...) will be such an invasive change that going back to pointers is probably the least of our worries. This commit is a step in const-ifying input parameters (passing by value is the ultimate way of signaling that the input parameter will not be changed [unless there are references to said parameter]). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: unify get_gas_at_time() and get_gasmix()Gravatar Berthold Stoeger
There were two functions for getting gas-mixes at a certain timestamp: - get_gasmix() for repeated queries. - get_gas_at_time() for a single query. Since the latter is a special case of the former, simply call the former in the latter. Moreover, rename to get_gasmix_at_time() for consistency. Replace on get_gasmix() call, which was outside of a loop by the corresponding get_gasmix_at_time() call. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: return gasmix by valueGravatar Berthold Stoeger
Currently, get_gasmix_from_event() and get_gasmix() return pointers to either static or to (possibly changing) dive data. This seems like a dangerous practice and the returned data should be used immediately. Instead, return the gasmix by value. This is in preparation of const-ifying input parameters of a number of core functions, which will ultimately let the merge() function take const-arguments in preparation of undo of dive-merging. On common 64-bit systems gasmix (two "int"s) is the size of a pointer and can be returned in a register. On 32-bit systems a pointer to the struct to be filled out will be passed. Since get_gasmix() now returns a value, the first invocation is tested by a NULL-initialized "struct event *". Document this in a comment. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: fix memory leak on failed DLF importGravatar Berthold Stoeger
In the case of a failed dlf import, the memory of the read-in file was not freed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>