Commit graph

11728 commits

Author SHA1 Message Date
Stefan Fuchs
e6d884cf26 Creation of dive duration string and surface interval string
Update the function to create the dive duration string in a way that
it can be used also in info and stats tab and added some more flexibility.

Changed layout for <1h freedives to "0:05:35" (w/o units) or "5:35min"
(with units and :) or "5min 35sec" (with units with space).

Add a new function to create the surface interval string.

Completely remove old function get_time_string() and get_time_string_s().

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-26 15:50:52 -07:00
Robert C. Helling
53a8075bd8 Fix right boundary when moving last handle in planner
There was a bug in the old code due to confusion between minutes
and seconds as the unit of the time axis. But rather than limiting
the time for the last handle in terms of the time axis (which
potentially includes long deco and allowing that for bottom time
quickly leads to dives many many hours long) limit it to 150%
of the previous bottom time.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26 15:46:41 -07:00
Robert C. Helling
7b18be2a50 Adopt planner state caching to new struct
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26 15:44:36 -07:00
Robert C. Helling
57ee5a5477 Assemble global state of planner in a struct
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26 15:44:36 -07:00
Robert C. Helling
b1ccd2fc43 Move planner notes to separate file
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26 15:44:36 -07:00
Thiago Macieira
6bfb1f5200 Adapt build.sh if qmake is already in PATH on a Mac
Some people (like me) have Qt elsewhere. So long as qmake is in PATH,
we should be able to support it.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-20 12:20:48 -07:00
Dirk Hohndel
f690a98228 Update Subsurface-mobile version
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-12 14:08:23 -07:00
Dirk Hohndel
b2c7e3e99f Latest translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-12 14:07:56 -07:00
Miika Turkia
a489b3fa42 Rounding imperial export for profile
Precision for the rounding is more than makes sense, but this satisfied
the test case.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-12 14:05:33 -07:00
Miika Turkia
726c9e859c Test case for CSV profile export to imperial and back
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-12 14:05:33 -07:00
Jan Mulder
f2e23e7815 Allow weight system name to be edited
Issue #272 lead to the introduction of a new private property of the
ComboBoxDelegate class (editable). This new property was not correctly
set when creating the weight system delegate. This corrects the (trivial)
error, and now allows edit of the weight system name.

Fixes: #392

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-05-09 07:40:26 -07:00
Miika Turkia
ccf916344b Include some extradata info on Seabear import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 21:36:50 -07:00
Dirk Hohndel
d7cf3408e5 Merge branch 'seabear-refactor'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-07 07:52:55 -07:00
Salvador Cuñat
75762e5f16 Datatrak import rework: Add another memory size ckeck
As a last minute addition, and for peace of mind and soul, add just
another size check, to run before reading values from buffer.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-05-07 07:48:12 -07:00
Salvador Cuñat
47dcc964b8 Datatrak import rework: main functions
datatrak_import() is the main function called from parse_file(), but
dt_dive_parser() is where the hard work is done, for both, drop file
seeking/reading and use memory pointers instead.

datatrak_import() now returns 0 on success or 1 on failure and abort
import if parser function fails instead of keeping on trying.

dt_dive_parser() emits a warning if libdc_model is zero (manual dives).
Do not parse profiles if libdc_model is zero, for unknown models we set
a fake 0xEE value coverted to Aladin Air X/Z libdc model number. Func
now takes a pointer to a buffer and moves along the dive, when done
returns a pointer to the actual memory position or NULL if something
went wrong.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-05-07 07:48:12 -07:00
Salvador Cuñat
618cd3fab4 Datatrak import rework: modify parsing macros
Change how parsing macros work to use memory pointers instead of file
descriptors.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-05-07 07:48:12 -07:00
Salvador Cuñat
ceb54e6e9e Datatrak import rework: changes on helper funcs
Remove dtrak_profile() profile parsing func as this work is left to
libdivecomputer.
Simplifies read_file_header() to return the number of dives in the log
file as we don't use the rest of header data.
Add dtrak_prepare_data() to achieve a device_data_t structure and get
the correct libdc model number for the device.
Remove checking macro substituted with JUMP in header file.
Add dt_libdc_buffer() to get a buffer parseable with libdivecomputer.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-05-07 07:48:12 -07:00
Salvador Cuñat
22f07f5ada Datatrak import rework: initial changes
Remove dtrakheader structure. In the end, we only make use of the number
of dives in the log file.

Define a models_table_t table which strores the known Uwatec's Aladin
models and its equivalence with libdivecomputer known models.

Add a macro to check that movements in memblock buffer don't get out of
the allocated memory.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-05-07 07:48:12 -07:00
Salvador Cuñat
25cec35d24 Datatrak import rework: changes of file.c and file.h
Datatrak import is called from parse_file() in file.c. This function
reads the full file to be imported into a memblock structure. It's
easier and more secure, to parse this buffer instead of the file itself.

These are the necessary changes in function datatrak_import()
declaration and call.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-05-07 07:48:12 -07:00
Miika Turkia
21cdc64712 Update Seabear test data to use proper times
Now that we parse them...

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 16:32:32 +03:00
Miika Turkia
0829d601c6 Change test case to use new Seabear parsing function
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 16:32:11 +03:00
Miika Turkia
c832973df5 Fix NDL and TTS for Seabear import
Apparently the refactoring changed these values to be returned directly
in seconds. Not sure why, but luckily we have test cases that discovered
the change.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 16:27:41 +03:00
Miika Turkia
d851549d9c Remove debug output
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 16:00:52 +03:00
Miika Turkia
221f67206b Make parsing of Seabear header more robust
This should work even if some header line is missing from some DC.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 15:53:35 +03:00
Miika Turkia
6e1c00078d Add dive mode support for Seabear import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 15:34:27 +03:00
Miika Turkia
cef56c6290 Import dive number from Seabear CSV file
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 14:19:58 +03:00
Miika Turkia
0dfa448d8c Refactor Seabear import
Moving the GUI independent Seabear import functionality to Subsurface
core. This will allow Robert to call it directly from download from DC.

Tested with H3 against released and daily versions of Subsurface. The
result differs somewhat, but it is actually fixing 2 bugs:
- Temperature was mis-interpreted previously
- Sample interval for a dive with 1 second interval was parsed
  incorrectly

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 13:53:52 +03:00
Miika Turkia
ab1813a445 Move intdup to qthelper
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 09:41:27 +03:00
Dirk Hohndel
92d24a2912 Consistently show dive duration based on preferences
We now respect the settings in the preferences and also only show
the duration as minutes and seconds if the dive is a free dive.

Fixes #361
Fixes #362

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06 17:43:32 -07:00
Dirk Hohndel
876b479d69 Wire up duration units preference UI
Now we track the preference, but we don't act on it, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06 13:49:36 -07:00
Dirk Hohndel
38b9185974 Add UI for duration preference
This isn't hooked up, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06 13:11:04 -07:00
Dirk Hohndel
ad5819c42e Save tags when manually adding dive
Tags are handled differently from other fields, we need to call
the special handling after the new dive was added and marked as
the current dive.

Fixes: #369

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06 12:47:04 -07:00
Dirk Hohndel
9e45999a01 Fix some warnings
Two unused variables and one case of sign confusion.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06 11:12:28 -07:00
Dirk Hohndel
38af1f2ab9 Check if we have an instance before dereferencing it
If we don't have a GPS service userid in the preferences and the GpsLocation class
isn't instantiated, this would cause a crash.

Fixes #367

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06 11:12:07 -07:00
Stefan Fuchs
67fbf6009a Test for adding a picture with data after JFIF EOI to a dive
Add one more picture to the already existing test.
This new picture is a JPEG and has data after JFIF EOI tag.

Suggested-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-06 10:31:09 -07:00
Robert C. Helling
462797396b File selector should filter images we can actually handle.
So better ask Qt about image formats known to it.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-06 08:07:16 -07:00
Stefan Fuchs
59bbaa7820 Image import: Make Exif handling more tolerant, better info,...
Changes to the "Add pictures to dive" function:
- Make Exif handling more tolerant by removing the JPG sanity
  check for EOI
- Give info to user if exif.cpp can't identify a Exif date/time
- Restrict file dialog filter for correct picture time by DC photo
  to JPG because Exif is only available from JPG

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-06 08:07:16 -07:00
Miika Turkia
0617308b39 More robust UDDF export test mode
When doing the xslt transformation for UDDF export, the C source does
actually give a parameter units with value 0. Thus we need to treat
that case as normal mode.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
b7c6998cf7 Enable test mode in UDDF export test
Using the units parameter to indicate test mode on UDDF export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
5f3f641977 Add test mode support for UDDF export XSLT
The current code that calls the export transformation supports parameter
units, so using it here to enable test mode.
2017-05-06 08:06:42 -07:00
Miika Turkia
95365292ef Grab DC model on UDDF import if available
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
ba5f10aaf2 Round sample depth on UDDF import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
63f034c92b Add model and nick for DC on UDDF import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
95895fc543 Import deviceid from UDDF file
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
e52d9c2846 Add UDDF export-import test
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
52426b8585 Fix memory leak
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
0d36b6e4e8 Due to clarity fix indentation in separate commit
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-04 10:51:36 -07:00
Miika Turkia
fe927139ec Import UDDF location without GPS data
Fixes #376

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-04 10:51:36 -07:00
Miika Turkia
6897c38fec Include one more way to parse buddy on UDDF import
Fixes #377

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-04 10:51:36 -07:00
Anton Lundin
f14ad7f183 Implement OSTC4 specific settings
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-05-04 10:50:15 -07:00