The shadow variable causes properties only to be saved when
actual changed, therefore some test cases need update
Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
These were pointers into the global prefs object. The user must
not use these to modify the settings, therefore make them
pointers-to-const.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>
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>
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>
When installing for the first time cloudCredentials needs to be added,
this commit a problem with updating them correctly
this problem was caused by
da6e8a4cd5
Signed-off-by: Jan Iversen <jani@apache.org>
And add a fuction to parse tables that are not "relational", meaning
tables which are directly refered from Dives table.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
We can allocate fixed size arrays for smartrak tables as its size can
be known in advance. Simply reading table->num_rows is too dangereous
as smartrak tables have "holes" commonly. This is, they can look like:
Idx | Txt
1 | blablabla
2 | blebleble
4 | blobloblo
table->num_rows would give us 3, but we need to allocate 4 to get an
array like:
|0|blablabla |1|blebleble |2| |3|blobloblo
as the idea is to use the table index to reference the array data.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Dirk Hohndel (4):
garmin: ignore FIT files that aren't dives
garmin: extract the devinfo from the first FIT file we parse
garmin: adjust the model to reflect the FIT product code
Garmin: don't assume that the first device index is 0
Linus Torvalds (5):
Add support for DC_SAMPLE_TTS - time to surface in seconds
Garmin: add DC_SAMPLE_CNS reporting
garmin: don't suppress the time sample at zero time
garmin: start decoding notifications and gas change events
garmin: improve on debug log output for unknown fields
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In a previous commit all override-modifiers were thrown out owing
to warning floods caused by the inconsistent-missing-override
flag on clang.
Re-adding overrides is now very painful because it's an all-or-nothing
thing. Let's disable the warning for now. If we reastablished good
coverage with override, we might think about re-enabling the warning.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>
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>
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>
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>
If we don't auto-detect where the Garmin Descent is mounted, the user
can either just type in the correct path, or can use a file diealog to
specify it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
DiveTripModel (the model describing the dive-list) was destroyed
and recreated on every reset of the list. This seems excessive.
Instead - in analogy to most other models - make it a single
global object.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
All callers of FilterModelBase::updateList() sorted the items
(except the last one). Thus we can do the sorting inside the
function.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since FilterModelBase now contains complex data (counts and checked),
we might just as well make it a full model and keep track of
the name as well. I.e. do not derive from QStringListModel but from
QAbstractListModel and add the name to the item structure.
Implement proper reset / add / rename semantics. This is overkill at the
moment, as after all any modification the model will be reset, but
ultimately it will allow us to be smarter and only update rows when
needed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signals can be useful. In this case, a simple function call does
it. Thus, remove the signal. It can be readded later at an more
appropriate place.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Valgrind found use of some uninitialized variable (probably
ds->gf_low_pressure_this_dive ), see #1614. Zero is the correct
value to start with. Lacking a working version of valgrind I cannot
check this actually fixes the problem.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This requires the user to manually copy the large test file into the
dives directory (because I really don't want to add this to the repo);
instructions how to do that are displayed if the file is missing.
Next it uses the git version of that same file (but prefetches it to
try and remove the network speed from what is being measured).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
In the UI it is possible to remove a dive from a trip twice,
which leads to a crash, because trip is NULL (obviously).
Instead of doing a proper fix (don't show the "remove from
trip" entry in the first place), ignore dives without a
trip, since a rewrite of the undo-code is planned for the
medium future anyway.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This reverts commit 321a920a98.
It appears that the load_xxx functions aren't called, so while the correct
values are stored to the settings, they aren't retrieved. Let's revert while
this gets fixed.
Fixes#1609
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>