Commit graph

622 commits

Author SHA1 Message Date
Dirk Hohndel
2d604ab2ff Mark missing translations
Reported-by: Pedro Neves <nevesdiver@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-29 20:00:53 +01:00
Stefan Fuchs
4e320cca5b Remove three obsolete preferences options for geocoding
These options are not used any longer/were never used and can be
removed to not confuse the users.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-29 11:07:52 -07:00
Salvador Cuñat
1095b78071 Planner: Do not translate VARIATIONS
This string is substituted with the runtime increments derived of slight
variations in depth or bottom time in:

diveplannermodel.cpp:1058:
displayed_dive.notes = strdup(notes.replace("VARIATIONS", QString(buf)).toUtf8().data());

Translating it avoids substitution and we just get the translated
string.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-10-28 08:19:18 +02:00
Berthold Stoeger
43a5cb3962 Clear error string when starting dive computer dowload.
Fixes minor interface inconsistency: After a failed download, the
error message was also shown on subsequent successful downloads.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-10-26 20:45:25 +02:00
Dirk Hohndel
6852c3b039 git save: create a better commit message for initial commit
When we create an empty repo we should simply state that in the commit message.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 20:44:02 +02:00
Dirk Hohndel
1be4435175 git save: don't save the git_id if just creating empty repo
Otherwise the following call to do_git_save will potentially have incorrect information
about the cache validity of the dives in the divelist.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 20:44:02 +02:00
Dirk Hohndel
bd54e94606 git save: remove redundant 'subsurface' from commit message
The user agent string already contains the (correctly capitalized) program name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 20:44:02 +02:00
Dirk Hohndel
5269f8ce40 git storage: print the actual error
It seems silly to not show what git told us went wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 20:44:02 +02:00
Dirk Hohndel
6f20d1a208 cloudstorage: handle invalid PIN correctly
If the server tells us that the PIN is invalid, we need to continue
to ask for a PIN.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 20:44:02 +02:00
Dirk Hohndel
95a8f951ba Remove bogus member that hides global variable
Inexplicably, commit 8b7427c56d ("Move CloudStorage out of the widgets")
didn't just move the code but added a local member 'verbose' that hides
our global variable...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 20:44:02 +02:00
Dirk Hohndel
405923ecfd Desktop UI: notify user if they need to enter a cloud PIN
This will need to be merged / cleaned up once the git storage fixes have
been merged.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 15:57:10 +02:00
Dirk Hohndel
3b92585a47 Don't show error if cloud credentials aren't set up
This became rather obvious with the change to immediately show errors.

The commit also fixes a small memory leak.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 15:52:58 +02:00
Dirk Hohndel
eccd4b993a Set error callback helper
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 14:37:39 +02:00
Dirk Hohndel
6ec7d2d877 Move error reporting into its own source file
This doesn't really seem to belong in save_git.c.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 14:37:38 +02:00
Dirk Hohndel
27c49fe3ad Silence random warnings
None of these seem to point to actual issues, so let's quiet them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-20 17:25:18 -04:00
Miika Turkia
4fe8eb6f65 Do not overwrite start and end pressures on cylinder
The pressure information of cylinder should be kept intact when
copy-pasting other cylinder related information from other dive.

According to Dirk, the gas mix is wanted to be changed as technical
divers might have always the same multiple cylinders and wish to copy
the gasmix information over.

Fixes #689

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-20 15:16:11 +02:00
Dirk Hohndel
bebee64ca9 Don't show localization warning unless verbose
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-20 06:51:51 -04:00
Lubomir I. Ivanov
e4a9787c5e dive.h: add handling of NULL in get_dive_dc()
This line:
    dc = &dive->dc
can SIGSEGV for a NULL 'dive' pointer.
return NULL if 'dive' is NULL.

Also handle NULL 'dc' in get_gasmix() and set 'ev' to NULL.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-19 22:03:51 -04:00
Robert C. Helling
a422957cd6 Use displayed_dc instead of current_dc
current_dc is a macro that determines the dive computer
based on the current dive number. When the planner is started
from an emtpy dive list, the dive number ends up being -1 and
that doesn't produce a valid dive computer. Use the divecomputer
of the displayed_dive instead. This is done via a macro that
can also be used in two other places. Without this patch, the
planner crashed when called on an empty dive list.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-19 14:57:02 -04:00
Stefan Fuchs
7a82103c99 CNS calculation fix
Identify previous dives for CNS calculation in a similar way as it
is done for previous dives for deco calculation.
This is done to identify the previous dives dynamically when moving
around date/time of a dive in the planner.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-18 23:19:13 +02:00
Stefan Fuchs
4158a4c7de init_deco correctly identify previous dives and report overlapping dives
When changing the date/time of a dive in the planner the dive may end
up in a totaly new position in respect to date/time of other dives in
dive list table. It can be moved to the past or the future before or after
other existing dives. It also could overlap with an existing dive.

This change enables identification of a new "virtual" dive list position
and based on this starts looking for previous dives.
Then it (as before the change) does init the deco calculation with any
applicable previous dive and surface interval.
If some of these applicable dives overlap it returns a neg. surface time
which is then used in the planner notes to prohibit display of results.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-18 23:19:13 +02:00
Stefan Fuchs
ba7be8f335 plannernotes.c coding style fixes
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-18 17:41:42 +02:00
Stefan Fuchs
94e563a94e Minimum gas calculation: Change text colors for delta value output...
and adapt the strings for translation to s.th. which can be handled more
easily.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-18 17:41:42 +02:00
Stefan Fuchs
90fcfca02c Taxonomy: Don't access empty entries when printing the tags
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-17 06:12:07 -04:00
Stefan Fuchs
884e690049 Tags for geo references: Nicer look, translations and warning message
For the geo references tags update the following:
- Nicer look w/o "Tags:" text and brackets when inside location UI
- Translation for "Tags:"
- Warning message when no dive site layout categories are set

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-17 06:12:07 -04:00
Jan Mulder
4406a6ccf9 Fix Android compile error
Trivial typo only visible on Android build.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-17 10:42:42 +02:00
Stefan Fuchs
180e51a906 Tidy up code in planner.c - create_dive_from_plan()
Tidy up the code which creates the first sample for time = 0 to make
clear that the info for this does NOT come from the first planner point (dp).
No functional change.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16 18:23:27 +02:00
Stefan Fuchs
f812dc5d9b Fix dump_plan debug code
This fixes some debug code to dump the diveplan which is usually
not compiled and used.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16 18:23:27 +02:00
Stefan Fuchs
4fa576526f Planner creating dive from plan: No pressure for 1st sample with new gas
In the planner when a dive is created from the diveplan every first
sample with a new gas shouldn't have a pressure value added.
Otherwise the interpolation code for the pressure graph in the profile
will draw the pressure graph incorrectly.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16 18:23:27 +02:00
Stefan Fuchs
3e67bfaea6 In planner prefer best_first_ascend_cylinder for gas breaks
Up to now the cylinder for gas breaks was hardcoded to first cylinder.
With this change the best_first_ascend_cylinder is used if its
O2 is <=32%.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16 17:14:17 +02:00
Stefan Fuchs
80a2cd7b1b Don't confuse cyl with same gasmix with best_first_ascend_gas
When calculating the dive plan in the planner don't accidently use
another gas with same gasmix instead of the gas stored as
"best_first_ascend_gas".
This is important if you have e.g. a bottom stage and back gas with
same gas mix because then you always want to start your ascent with
the gas you used in last entered dive planner point.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16 17:14:17 +02:00
Stefan Fuchs
df6933326d In dive.c make cylinder_renumber an external function...
instead of dc_cylinder_renumber() because it is the one which is really
useful elsewhere.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16 17:14:17 +02:00
Stefan Fuchs
c29456f0bb Used gas in dive planner points: Support for multiple cyl with same gas
In the planner if one adds two or more cylinders with the same gasmix
(e.g. back gas and bottom stage 18/45) the drop down and data in the
used gas column of the planner points table will be filled with a more
verbose string mentioning also the cyl number and the cyl type
description.
Makes it easier in such a case to select the right cylinder.

Introduces also a helper function which tells you if there is another
cylinder with the same gasmix as the provided cylinder.
This also has an option if it should consider unused cylinders or not.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16 17:14:17 +02:00
Stefan Fuchs
5b415ad8db Reverse geo lookup string for http://api.geonames.org corrected
Language selection should now work again with string "lang=xx".

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-16 03:43:02 -08:00
Dirk Hohndel
4d283bdd5f Android should support the Cobalt dive compouters
With an OTA adapter - sadly I can't test that. This driver opens a
specific USB device and will ignore the connection settings. It would be
better to get some visual feedback for that (in the QML UI), but I'll
leave that until this has been verified to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-15 21:31:28 -04:00
Dirk Hohndel
dd14e27820 BLE: try to enable on iOS
We can't use the localBtDevice on iOS, so hack around that and go straight to
discovery.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-14 04:32:50 -07:00
Jan Mulder
ba4058667a mobile: enable switching BT on/off during session.
This commit implements possible switching BT on and off during a session,
so not needing a restart of the app when the user forgot to switch
it on when starting the app.

For this, the following needed to be done: 1) create a handler that
reacts on local BT device status changes. 2) repopulate the connection
list in the download screen when a BT status change is detected.

Notice the subtile change of the Q_INVOKABLE btEnabled() function
to a Q_PROPERTY. This gives a nice dynamic behaviour when
switching BT on/off with the app open.

Fixes: #556

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-12 09:43:40 +02:00
Jan Mulder
fa5e685279 Add function for non-BT connection addresses
Simple rewrite of a piece of code separated to its own function
so that is can be used in other places as well. To avoid code
duplication for dynamic BT on/off switching on mobile.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-12 09:32:12 +02:00
Jan Mulder
8b8863b640 Add function to clear connectionModel data
Preparation primarily for mobile. When we want to switch in
one session from BT to cable connection and vise versa, we
need a way to clear the model data containing the possible
connections in use.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-12 09:32:12 +02:00
Lubomir I. Ivanov
56e755b711 Use lrint() for all degrees_t related rounding
In certain places the '(int)' cast is used, while in other the
llrint() or lrint() functions. Make the conversation from degrees
in the 'double' form to the 'int' degrees_t consistent using lrint().

lrint() is the function which should give the best results,
because it accepts a 'double' and results in a 'long'
even if degrees_t is 'int'. If the truncation from 'long' to 'int'
is discarding some of the precision then the next step
would be to turn degrees_t into a 64bit signed integer type.

Possible fix for #625.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-09 13:38:58 +03:00
Stefan Fuchs
78cda85444 Display units in dive list table based on prefs option
Add a preferences option which enables or disables display of units in the
main dive liste table.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-09 11:49:29 +03:00
Rick Walsh
f9d05a8038 VPM-B profile: calculate parameters when in planner mode
Calculating parameters when in the planner mode is necessary to display the correct ceiling.

Fixes #601

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-10-08 23:16:40 +02:00
Miika Turkia
04785f3c8b Fix crash when text empty
Exporting to divelogs.de triggered this bug when divesite name is empty.

Fixes #656

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-08 19:41:54 +03:00
Miika Turkia
6573132307 Store RBT value on DivingLog import
Fixed-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-07 22:38:49 -07:00
Linus Torvalds
d5a0184f71 Fix divinglog import temperature truncation
The code incorrectly divided the temperature by 10 as an integer,
causing unnecessary precision loss due to truncation.

Fix it, and update the test results for the now improved temperature
import.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 14:52:57 -07:00
Linus Torvalds
03b10383c9 Fix divinglog import limit checking
The divinglog import did horrible things with the strings returned from
the sqlite queries, and ended up using uninitialized values at the end
of the secondary profile data strings.

This rewrites the import logic to track the length of the strings
properly when importing the divinglog data.

We should run 'valgrind' a whole lot more than we do, I suspect.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 14:52:48 -07:00
Dirk Hohndel
56c82081a5 Make compile succeed without BT_SUPPORT
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 10:06:47 -07:00
Dirk Hohndel
7aacaf60da Move ConnectionListModel into its own source file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 10:06:47 -07:00
Miika Turkia
e78f89b0d8 Safeguards for Liquivision import
I have received one sample log where after parsing a bunch of dives
properly, the sample count hits zero, and after that it is astronomical.
In case of zero, the only data we have is dive date and time of a
duplicate dive that we already parsed with proper dive profile. So
preventing a crash with this hack without properly understanding the
weird file format.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-07 08:36:10 -07:00
Dirk Hohndel
3278953f86 Fix two bugs in taxonomy_set_country
The random coincidence that this code actually ended up working
in my tests is weird.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 08:16:53 -07:00