Commit graph

4024 commits

Author SHA1 Message Date
Anton Lundin
2ebe03ab40 Port this code to work with Qt5
This code had parts that where Qt5-compatible, this introduces the last
bits that it needs to be completely compatible.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:49:44 +07:00
Anton Lundin
1363e28f8b Add some missing ; in the Qt5 path
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:49:43 +07:00
Anton Lundin
29a714acc3 Use the right Qt-module when building with Qt5
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:49:42 +07:00
Anton Lundin
93c73ccc68 Query pkg-config with libxml2 via default name to
On Ubuntu and in the source package, libxml2 defaults to naming its
pkg-config file to libxml-2.0.pc so query after the package with that
name to.
I don't know what platform ships it as libxml2, so that might be a typo.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:49:41 +07:00
Anton Lundin
11dd5bda57 Fix linking order of libxslt and libxml
libxslt depends on libxml, so we need xslt before xml on the linker-line.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:49:39 +07:00
Dirk Hohndel
9e70f556c5 After downloading GPS data show the new information
Recreate the labels in the marble window (this adds all the new locations
with the correct labels), center on the selected dive (this makes sense in
case this is one of the dives that got location information) and redisplay
the main tab (again, as this might now have location information).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:46:49 +07:00
Dirk Hohndel
78cdded902 Improve the download from Subsurface webservice dialog
- make the User ID input field wide enough
- use the progress bar for an explanatory text
- mark it as 100% completed once the download succeeds

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:33:04 +07:00
Tim Wootton
07c116ecd2 Add ISO 6709 co-ordinates to manual
And fix a typo

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:10:55 +07:00
Tim Wootton
df1391fde2 Adds Boris' Full Screen mode to the manual
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:08:36 +07:00
Rodrigo Severo
69d82acf9f Defining a logical tab order for Import CSV Dive Log Files widgets
Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 06:29:34 +07:00
Boris Barbulovski
7d741a0022 Add-main-window-full-screen-feature
This patch enables main window full screen mode by menu toggle or pressing
F11.

[Dirk Hohndel: whitespace cleanup]

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 06:28:01 +07:00
Rodrigo Severo
349f3e9cde More CSV import fixes
Pre-configured imports in Import Dive Log File for CSV files should also
be cleared when the field separator is changed by the user.

Promoted DiveLogImportDialog::unknownImports to slot as per Canabrava's
suggestion and Hohndel's request.

Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 05:56:34 +07:00
Rodrigo Severo
3a3d61ba53 Pre-configured CSV imports should also set the field separator
Pre-configured imports in Import Dive Log File for CSV files should also
set the pre-defined field separator.

[Dirk Hohndel: cleaned up hideous whitespace]

Signed-off-by:Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-14 21:18:28 +07:00
Tim Wootton
13d4c48e6a Changes test for ISO 6709 location format
As discussed with Mika this changes the ISO 6709 detection to use:
	1st non-whitespace character is a digit and
        number of commas is even.

The idea is that, as all the other formats seperate the lat from
long with a single comma, additional even numbers of commas could
ocour in locales where comma is used as a decimal point, but in
total an even number of commas (often 0) would indicate an ISO
format entry.

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-14 21:15:01 +07:00
Rodrigo Severo
2da8146b46 Include support for semicolon separated CSV files
Oceanic's Geo's companion software, OceanLog, when exporting as txt produces log files with the dives samples as semicolon separated CSV files.

Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-14 21:08:31 +07:00
Dirk Hohndel
3ce5520b9c Sort the list of dive computer vendors in the download dialog
This makes so much more sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-14 21:05:41 +07:00
Dirk Hohndel
fdf8c905d6 Save the divecomputer entries in a consistent order
This is the list of DCs in the settings. This way they don't keep
changing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-14 20:54:34 +07:00
Miika Turkia
e4f2c86c82 Improving matching of ISO 6709 GPS format
ISO 6709 format dictates that the format includes characters ° (degree),
' and ". If we only test for the coordinates starting with decimal, we
match also the decimal notation on this test. Thus adding test for the
degree sign not to match input as ISO 6709 when coordinates are given in
decimal notation.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-12 21:06:12 +07:00
Dirk Hohndel
23973e8abd Don't show tanks that aren't used during a dive
Some dive computers will always download all tanks that they store, not
just the ones used in a dive. Most people only want to see the tanks that
they actually used during the dive (and for the others there's an option
to go back to the old behavior, just in case).

All this is only in memory / during runtime. If the dive computer provided
the extra data we will not throw it away.

Fixes #373

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11 22:02:35 +07:00
Miika Turkia
f43a3052cb Ensure gaslist is NULL terminated
If buffer copying is restricted by the buffer size in strncpy or
snprintf, the copied string is not NULL terminated.  Add one to the end
just to make sure.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11 16:46:31 +07:00
Linus Torvalds
9fca37acec Properly handle user dive merge requests
When the user asks to merge dives in the divelist, we would always use
the "try tp find matching dive computers and merge at an offset" model.

That is incorrect if the intent is to actually merge two *identical*
dives (with different dive computers), as opposed to merging two short
dives into one longer one with a surface interval.

Normally this doesn't ever trigger (the "same dive" merging will have
been done automatically after downloading from the dive computer), but
if the dive computer times are off, and the user fixes them, and then
asks to merge dives, we should use the non-offset dive merging logic.

We already have that "likely_same_dive()" function that is used to
determine when downloaded dives get merged, so just use it for the user
merge case too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11 16:46:21 +07:00
Sergey Starosek
a8c0bf3e57 Fix app icon and title for yearly statistics
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11 06:40:20 +07:00
Dirk Hohndel
ab830b1d4f Merge branch 'v4.0-branch'
Bring in the tag, the translations changes and edits preparing for 4.0.2
into master. This should make "git describe" on master create something
reasonably sensible...
2014-01-10 19:41:37 +07:00
Miika Turkia
6037be946f Add a few more Suunto events
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10 16:13:32 +07:00
Miika Turkia
18e625129e Import tags from Suunto database file
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10 16:13:29 +07:00
Miika Turkia
b79ef63388 Do not plot temperatures on DM4 import if no info
If we do not have temperature readings, we do not want to plot the
temperature samples either.

See #415

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10 16:13:22 +07:00
Sergey Starosek
6a0f05eacc Make divelist search case insensitive
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10 16:12:50 +07:00
Sergey Starosek
7e7a1d29ad User manual: overlay search panel
Make search panel floating so that web view does not resize.

This commit also addresses following issues:
- search now wraps around document
- application icon and window title are now back

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10 16:12:44 +07:00
Sergey Starosek
8ded16fd1b Switch to new UserManual implementation
This enables search within user manual by pressing Ctrl-F.
Esc key closes search panel.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10 16:07:54 +07:00
Sergey Starosek
8b00f8ffe6 Extract user manual web view into a separate class
Provide search functionality which addresses ticket #391

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10 16:07:43 +07:00
Sergey Starosek
e5ae3fca7f Make Ctrl-F window shortcut
The shortcut may be used elsewhere, e.g. in user manual

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10 16:07:25 +07:00
Dirk Hohndel
a154858741 Update translations
I'm not the author, just importing the translations from Transifex.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 16:09:43 +08:00
Linus Torvalds
7ba167e1b3 Remove now stale arguments to "CHANGED()" macro
We now never remove units or percentage signs, and always just compare
the string data, so we should remove the hacky arguments that are no
longer used.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 15:51:21 +08:00
Linus Torvalds
1d2238b110 Add and use 'string_to_fraction()' helper converter function
This matches the pattern of unit conversion, and will allow us to remove
all the code that uses the old complex "CHANGED()" macro that tries to
remove units or percent signs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 15:51:18 +08:00
Linus Torvalds
4f982c1758 Add unit-aware cylinder size string parserc
Whittling down on the string parsing that doesn't check user-specified
units.  Still need to handle temperatures (and will do percentages to
match the pattern too), but this is getting us closer to always honoring
user-specified units.

With this you can say that you have a "10l" cylinder at "3000psi", and
it will do the right thing (it's basically a 72 cuft cylinder in
imperial measurements).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 15:51:03 +08:00
Linus Torvalds
0646f3e9ff Remove now stale arguments to "CHANGED()" macro
We now never remove units or percentage signs, and always just compare
the string data, so we should remove the hacky arguments that are no
longer used.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 15:48:33 +08:00
Linus Torvalds
3734bb9068 Add and use 'string_to_fraction()' helper converter function
This matches the pattern of unit conversion, and will allow us to remove
all the code that uses the old complex "CHANGED()" macro that tries to
remove units or percent signs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 15:48:22 +08:00
Linus Torvalds
a79ddde1b9 Add unit-aware cylinder size string parserc
Whittling down on the string parsing that doesn't check user-specified
units.  Still need to handle temperatures (and will do percentages to
match the pattern too), but this is getting us closer to always honoring
user-specified units.

With this you can say that you have a "10l" cylinder at "3000psi", and
it will do the right thing (it's basically a 72 cuft cylinder in
imperial measurements).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 15:46:03 +08:00
Dirk Hohndel
39fb3b2c13 Prepare for Subsurface 4.0.2 release
Update version numbers and add "new in 4.0.2" summary to ReleaseNotes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:43:31 +08:00
Linus Torvalds
110c07e27b Add unit-aware conversion of pressure data
This just adds (and uses) a string_to_pressure() to parse pressure units
correctly when filling in cylinder pressures.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:31:19 +08:00
Dirk Hohndel
0d93470c50 Change fake profile behavior
If no average depth is known the current fake profile behavior is rather
unintuitive (we make up an average depth).

Instead we should assume that this is a PADI style dive log and give the
user a "rectangular" profile (actually, it's a trapecoid as we at least
try to enforce a sane ascent / descent speed). If the dive is somewhat
longer or deeper (10 min / 10 m) we even add a 3m safety stop at 5m.

Added a new dives/test0b that tries to capture the typical cases to test
this.

Fixes #398

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:31:05 +08:00
Linus Torvalds
262bc9c84b Add a string_to_depth() helper function to match our string_to_weight one
It's currently only used for the setting of the cylinder switching
depth, but now that one should work with user-specified units (so you
can set a max depth in feet even if you use metric, and vice versa).

In the future, if we also make the unit preferences something you can
pass in (with user preferences as a default argument value), we might
want to use this for parsing the XML too, so that we'd honor explicit
units in the XML strings.  But the XML input unit preferences are not
necessarily at all the same as the user preferences, so that does
require us to extend the conversion functions to do possibly explicit
unit preference selection.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:30:35 +08:00
Linus Torvalds
1c72b8b054 const'ify our strtod() helper functions
The C library doesn't use const char pointers for legacy reasons (and
because you *can* modify the string the end pointer points to), but
let's do it in our internal implementation just because it's a nice
guarantee to have.

We actually used to have a non-const end pointer and replace a decimal
comma with a decimal dot, but that was because we didn't have the fancy
"allow commas" flags.  So by using our own strtod_flags() function, we
can now keep all the strings we parse read-only rather than modify them
as we parse them.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:30:25 +08:00
Linus Torvalds
b9d7e440fd Make 'string_to_grams()' use proper type safe types
Make it use 'weight_t' and hide the "grams" part inside the type.  That
was the whole point of the weight_t type, after all.  Returning a
"double" was always bogus, since we internally always do integer grams
(and the function actually used "rint()" to get all the rounding right
anyway).

As a result, it's now called "string_to_weight()".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:30:18 +08:00
Jef Driesen
8626778918 Write the event data to the libdivecomputer log.
For some devices, the event data contains important data that is
required for parsing the dives, but which is not present in the full
memory dump.

Signed-off-by: Jef Driesen <jefdriesen@telenet.be>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:30:05 +08:00
Lubomir I. Ivanov
7d56e404fd DownloadFromDCWidget: prevent possible leaks for log/dump files
If the 'logfile_name' and 'dumpfile_name' were NULL we can simply
strdup() them with a new value, but if there was a previous value
we need to free() first.

C99 6.7.8 allows us to keep said variables without the
explicit NULL initialiazation.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:29:40 +08:00
Lubomir I. Ivanov
065221aac7 libdivecomputer.c: Try not to pass NULL to fopen()
C99 7.1.4, says nothing about passing NULL to fopen(),
which means that it isn't portable and there are no guaranties
that the return will be a NULL pointer or that that a library
implementation will not assert or SYSSEGV in the middle of the
fopen() branch.

libdivecomputer.c's 'dumpfile_name' and 'logfile_name' could
cause problems in that regard.

A possible fix for #411

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:29:22 +08:00
Lubomir I. Ivanov
304f5e8569 windows.c: Fix possible assert when passing NULL to *open()
On Win32 subsurface_fopen() can reach an assert in windows.c:
utf8_to_utf16(), if NULL is passed for 'path'.

Let's return NULL/-1 for some of the *open() functions in there.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:29:10 +08:00
Tomaz Canabrava
7f4d1a9f32 Setting dive as 'current' when restoring selection
Restoring the selection was not setting the selected dive as current, and
thus, breaking keyboard navigation.

Fixes #402

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:28:45 +08:00
Tomaz Canabrava
0c3075dc41 Add CaseInsensitivity to all of the completers.
Just one of the completers had Qt::CaseInsentitive set,
setting for all of them.

Fixes #400

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09 09:28:31 +08:00