Commit graph

13380 commits

Author SHA1 Message Date
Miika Turkia
65c4891a71 Add support for air and water temps for CSV import
Add support of importing air and water temperatures from DC header
information.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
5046fa34a4 Add support for max and mean depths for CSV import
Add support of importing max and mean depths from DC header information.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
4a5b40c144 Update DL7 tests to current import
As we now parse dives without profile, we get 2 more dives from the
sample log import (3 in total). And naturally also the resulting XML to
compare against needs to be updated.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
f91f16a4b6 Dummy parse empty dives
Easiest way to get dives without profiles in, is to just parse empty csv
tags.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
9d65c5bcdd Stricter check we get dive profile
We should get either dive trailer or dive profile immediately after
header. Thus make sure that is the case.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
62d9728ebe Ignore empty dives
This is first step towards parsing "empty" dives properly. I.e. now the
updated test dive parses properly.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
e2197a56a4 Compare DL7 import to saved conversion
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
35778d9bbc Add converted DL7 file for test validation
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
87bab637fa Add two dive headers to DL7 sample
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
b808723f9c Refactor CSV import
Move CSV import related functions into import-csv.c.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
fbbca93d53 Add test for DL7 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
62779fa453 DL7/zxu sample dive
Manually crafted sample dive demonstrating parts of the DL7 format.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Jan Mulder
04626b0891 Fix small memory leak
When deleting a dive from the divelist model, also free the
pointed to DiveObjectHelper data. There seems no harm done
(other than a memory leak) by this missing free.

Found while (again) investigating the infamous crash occuring
when deleting a dive from the mobile app when deleting a dive
from the dive list.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-07 13:02:27 +01:00
Berthold Stoeger
e5980942aa Remove redundant call to clear_dive_file_data()
In QMLManager::saveCloudCredentials(), clear_dive_file_data() was
called just before calling openLocalThenRemote(). The latter calls
the former anyway, so remove the former.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-07 13:02:12 +01:00
Berthold Stoeger
785dcda0d5 Update CHANGELOG.md concerning cloud online/offline changes
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Berthold Stoeger
59526e948a Remove cloud_background_sync preferences option
The preferences flag cloud_background_sync used to be used heavily in
the mobile code, but is not used there anymore. Now, it is accessed
only in one place, but does not do what it actually says: If it is off,
the remote storage is not synced on save (but will be synced on next
load).

Syncing on save can also be prevented by unchecking the "Cloud online"
menu checkbox. Since the latter seems more logical and general
(support for non-cloud remote git repositories), remove the cloud_background_sync
option.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Berthold Stoeger
b3901aa8f9 Enable cloud-online menu entry only if connected to cloud
Enable the menu item cloud-online only if the current file is the
cloud storage. Since this has to be checked every time the current
file is set, factor this out into the new MainWindow::setCurrentFile()
function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Berthold Stoeger
bb64c6bda8 Turn take-cloud-online menu action into checkbox
Replace the "Take cloud storage online" menu entry by a "Cloud online"
checkbox. After this change, the user can also force going offline.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Berthold Stoeger
dbef391786 Sync cloud storage on take-cloud-online
When taking the cloud online, actually sync with the online cloud storage.
If there are no unsaved changes, do the same as "Open cloud storage".
If there are unsaved changes, ask the user if they want to commit them
(do the same as "Save to cloud storage") or if they want to sync manually.

If syncing failed, inform the user.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Berthold Stoeger
fd5a521b94 Sync with any remote git repository
Sync with remote git repository, even if this isn't the cloud storage.
There seems to be no point in remote git repositories if they aren't
synced.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Jan Mulder
97127e1652 Do not save WebserviceID in preferences until asked for
Do not save the WebserviceID in the preferences until we ask
for this. That is simply wrong.

This is definitely not a full fix for all the weirdness that is
going in related to the WebserviceID but saving the ID even
if we do not ask for it, adds to possible confusion.

To always automatically pull in the ID from the server based
on cloud credentials, just leave the ID field empty in the
network preferences.

Fixes: #1013 (well ... a tiny part of this mess)

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06 10:42:44 -08:00
Berthold Stoeger
b0fc718f65 Trivial: remove redundant declarations of downloadTable
downloadTable was declared twice in "dive.h". Remove one occurence.

Moreover, "uemis-downloader.c" also declared downloadTable. This can
likewise be removed, because "uemis-downloader.c" indirectly includes
"dive.h".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 09:21:33 +01:00
Jan Mulder
2371c6ada6 cleanup: use new urls
Just rename some old hohndel.org urls

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06 09:21:16 +01:00
Jan Mulder
fc7729eb78 cleanup: localize global variable
Not needed to be global.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06 09:21:16 +01:00
Jan Mulder
74eb7b21a8 Remove unused urls
They are unused, and a relic from earlier plans.
Just remove.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06 09:21:16 +01:00
Jan Mulder
70e0e80de5 GPS: use applyGpsLocation::applyLocations from core
Fixes a big duplication of code. The code to apply GPS locations
from the location service was already in core, and used from mobile,
but there was an almost literal copy in the desktop code.

See also commits 6f42ab46da and ee9531f76e, where only
one side of the duplicated code was fixed.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06 09:21:16 +01:00
Jan Mulder
e762d2a23e core: free() in a safe way, reverse geolookup unstability
A simple one line change that solves (for me) numerous hard crashes
when adding geo tags by reverse lookup from the dive site edit
screen. This is one of those crashes that is might not be
reproducible on any platform, or even between different builds
on one platform.

This said, I found that the free() on line 99 of divesitehelpers.cpp
tried to free pointers to random data, ie. not pointing to valid
taxonomy category strings. And those pointers where simply caused by
freeing the string earlier, and leaving the pointer around. So, this
change is nothing more than setting the just freed pointer to NULL,
to allow free() to be called later safely.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-05 09:03:25 -08:00
Dirk Hohndel
8e7983c027 Update libdivecomputer submodule
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-01-04 16:09:16 -08:00
Berthold Stoeger
c4c57b287e Increase size of name_buffer to fit any integer
In libdivecomputer.c, name_buffer is formatted with calls like
 snprintf(name_buffer, 9, "%d cuft", rounded_size);
This works fine in the regular case, but it generates compiler
warnings, since theoretically the integer might produce up to
11 digits, leading to a truncation of the string.

Increasing the size of name_buffer to 17 chars silences these
warnings. This may seem like pointless warning-silencing.
Nevertheless, in the case of invalid data, it might make debugging
easier since, in the above case, the "cuft" is never truncated.
In total, it seems that this is a benign change with potential,
though in a very unlikely case, positive effects.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-05 00:29:20 +01:00
Berthold Stoeger
90ba4e5dca Don't define cur_setting in header file
The object cur_setting was defined in core/pref.h. Instead, declare
it as extern and define it in core/parse.c. This silences a compiler
warning, since inclusion of core/pref.h would define the object, which
was then left unused in tests/testparse.cpp.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-05 00:29:20 +01:00
Berthold Stoeger
5960718075 parse-xml.c: add get_bool() function
The boolean "autogroup" was parsed as an integer. In principle OK, but
let's make the type more explicit by introducing a get_bool() function.

Suggested-by: "Lubomir I. Ivanov" <neolit123@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Berthold Stoeger
40fa148548 Replace BEHAVIOR macro by initializer lists
The macro BEHAVIOR expanded to "QList<int>()". This was used to
generate temporary QList<int>s with constructs such as
  BEHAVIOR << COLLAPSED << EXPANDED
Instead, simply use initializer lists such as
  {COLLAPSED, EXPANDED}

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Berthold Stoeger
f8517c583b Replace macro TOGGLE_COLLAPSABLE by function toggleCollapsible()
There was no reason to do this in a macro. Let the compiler decide
if it wants to inline or not. Note that for consistency with the
Qt functions, collapsAble was replaced by collabsIble.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Berthold Stoeger
b4e36c5912 Use set_autogroup() function
Since this function exists, use it instead of setting the global
variable directly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Berthold Stoeger
956cb53cd5 Turn autogroup from short into bool
All users of autogroup are clearly expecting a boolean value, so
let the type reflect this.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Berthold Stoeger
e414e0b334 mark_divelist_changed(): only update title if necessary
Only change the title if the changed status was updated.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Berthold Stoeger
a17d1c7b85 Turn dive_list_changed into bool
All callers of mark_divelist_changed() were passing a bool. Therefore,
let mark_divelist_changed() take a bool and make dive_list_changed a bool.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Jan Mulder
47bf5cf5e0 mobile: silence warnings in the app log
The new SHA mysteriously caused more than 300 extra warnings in the
app log. It was caused by a code change in Kirigami. The way to
suppress it is, in hindsight, after some hours of searching, trivial.
A Kirigami.BasicListItem shall have an icon defined. And as we do
not care about any icon here, just define it empty.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-03 14:04:08 +01:00
Jan Mulder
a5b44362c6 mobile: newer Kirigami SHA
This commit consists of the following 3 parts:
1. There are 2 source files added, adapt our build process
accordingly.
2. Due to a change in icon and kirigami QML prefixes, we need to
adapt for this as well. Changed mobile-resources.qrc for that.
When this would not be changed, the icons will not be found.
3. To further prepare for the future, abandon the iconName
property in favour of the new icon grouped property, which
can have more attributes than only the name. But currently
it is only a syntactic change.

Tested on Android device, and no visible changes.

Signedoff-by: Jan Mulder <jlmulder@xs4all.nl
2018-01-03 14:04:08 +01:00
Dirk Hohndel
7a48149868 Update CHANGELOG.md
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-01-02 09:15:30 -08:00
Stefan Fuchs
34d1dd469c Enable translation of ctrl key name for tool tip in dive notes
This really enables the translation of the ctrl key name.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-02 09:12:31 -08:00
Stefan Fuchs
b7494bfb2e Cleanup: Rename preferences ui file names according the standard
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-02 09:12:31 -08:00
Stefan Fuchs
ecd6dcaf6d Remove leading space from kg/l units for salinity
Change this according to our standard of NOT having a leading space
before any unit.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-02 09:12:31 -08:00
Jan Mulder
e16b58ee08 Desktop: follow autogroup setting in UI
When importing a dive (using import from logfile) and it is a
ssrf/xml file that contains the autogroup setting, the autogroup
is effectuated in the dive list. Not sure that I like this
behavior, but thats the way it currently is. Simply wrong
is that in this case the menu item toggle is not adapted
so we end up with a dive list that is autogrouped, but
the menu toggle is off.

This can be solved by setting the UI toggle in a more central
location.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-02 06:47:53 +02:00
Jan Mulder
ac505600f3 desktop: clear tags when hitting new logbook
A very simple commit to start 2018. When hitting new logbook from
a currently open logbook, and the current dive has tags filled in,
they stayed around in the UI. Just clear them. Further, delete
an unused variable.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-01 10:26:13 +01:00
Lubomir I. Ivanov
c4e1e96032 divesite.c: use union in create_divesite_uuid()
The return produces a warning about "strict-aliasing rules".
Use a union to fit the hash and the uint32_t into the same
block of memory, which obeys the GCC strict-aliasing rules.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-12-31 07:58:45 -08:00
Berthold Stoeger
779292a322 Workaround for invalid bluetooth device names
Owing to bug #1002 invalid bluetooth device addresses of the form
"devicename (deviceaddress)" or "deviceaddress (devicename)" may
have found their way into the preferences. Recognize such names
and extract the correct address.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-31 07:56:33 -08:00
Berthold Stoeger
3c022d8673 Get Bluetooth device nam from preferences if dialog wasn't shown
If the BT dialog hasn't been shown, the device name was taken from
the text field, which contained a formatted string. The device open
would then fail.

Fixes #1002

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-31 07:56:33 -08:00
Dirk Hohndel
a1cd2f2e7a Use our fork of uploadtool
And use the 'correct' URL to obtain the actual file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-30 11:10:40 -08:00
Dirk Hohndel
1e20bc9c73 Cleanup: consistently handle file open failures
In part based on

Coverity CID 45129

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-30 09:32:12 -08:00