Commit graph

199 commits

Author SHA1 Message Date
Robert C. Helling
c1dc0c9ce0 Allow user to disable a cylinder in planner
In the cylinder table, the last column ("use") always showed
OC-GAS. Editing was enabled, but the user had to guess to enter
a small integer meaning dilluent or CCR oxygen cylingder. I guess,
nobody has ever done that.

This patch makes this column clickable. A click toggles if the cylinder
is used for planning or not. This wait it is much easier to investigate
the consequences of gas loss on a plan.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-23 22:11:51 -08:00
Dirk Hohndel
b15b3c195c QML UI: allow magic phrase for multiple buddies to be localized
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-22 18:20:03 -08:00
Linus Torvalds
e1ee577c4f Make event string translation when downloading from libdivecomputer more obvious
We had hardcoded the exact translation of the event numbers.  They
haven't changed (although we did have what appears to be a spurious
entry for "non stop time" at the end that libdivecomputer doesn't have
an enum for).

Instead, use an explicit array index initializer array, so that it's
obvious that the two match up (and if the sample event numbers ever
change, we should cope with it gracefully).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-17 09:15:50 -08:00
Linus Torvalds
fe5f15bdc5 Add support for libdivecomputer using DC_SAMPLE_GASMIX
New libdivecomputer versions use DC_SAMPLE_GASMIX to indicate a gas
change (which contains the cylinder index we're changing to) rather than
SAMPLE_EVENT_GASCHANGE*.

Unlike the old GASCHANGE model, and despite the name, DC_SAMPLE_GASMIX
does not actually say what the mix is, it only specifies a cylinder
index.  We had already extended SAMPLE_EVENT_GASCHANGE2 to have the
cylinder index in the otherwise unused "flags" field, so this is not all
that different from what we used to do.

And subsurface internally already had the logic that "if we know what
the cylinder index is, take the gas mix from the cylinder data", so
we've already been able to transparently use _either_ the actual gas mix
or the cylinder index to show the event.

But we do want to make it an event rather than some sample data, because
we want to show it as such in the profile.  But because we are happy
with just the cylinder index, we'll just translate the DC_SAMPLE_GASMIX
thing to the SAMPLE_EVENT_GASCHANGE2 event, and nothing really changes
for subsurface.

libdivecomputer has made other changes, like indicating the initial
cylinder index with an early DC_SAMPLE_GASMIX report, but we've seen
that before too (in the form of early SAMPLE_EVENT_GASCHANGE events), so
that doesn't really end up changing anything for us either.

HOWEVER, one thing that is worth noticing: do *not* apply this patch and
then use an old libdivecomputer library that sends both the
DC_SAMPLE_GASMIX samples _and_ the deprecated SAMPLE_EVENT_GASCHANGE
events.  It will all *work*, but since subsurface will take either,
you'll then get duplicate gas mix events.

It's not like that is in any way fatal, but it might be a bit confusing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-16 17:45:00 -08:00
Robert C. Helling
7725842383 Use real gas compressibility in planner
Modify formluas for gas use to take into account the
compressibility correction for real gases. This introduces
also the inverse formula to compute the pressure for a given
amount of gas.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-16 03:17:40 -08:00
Dirk Hohndel
1ab6e7fc8a Prevent crash on Mac when typing comma in GPS coordinates field
Our attempt to skip any white space after the comma causes an ASSERT (strangely
only on Macs).

This closes #158

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-14 09:09:58 -08:00
Linus Torvalds
638e7fb28f Add cylinder equipment tooltips with gas volume
This adds tooltips for the equipment tab for each cylinder, showing the
amount of gas used.

When you mouse over the size and working pressure fields, the tooltip will
show the amount of gas used (along with start and end gas volumes). And
when you mouse over the start and end pressures, it will show the start
and end gas volumes, and the Z factor used.

I started doing this because of the gas volume questions in the last day
or two (and a few from a few weeks ago). When even Robert Helling starts
wondering about the effects of compressibility on the SAC calculation, our
numbers are clearly too opaque.

With these tooltips, at least you can see what went into the used gas
calculations, instead of having to add debugging options to print out Z
factors.

[ This patch also adds a "rint()" to get the rounding right in the
  gas_volume() function.  Although rounding to the nearst milliliter
  really doesn't matter, it's the right thing to do after doing FP
  calculations ;^]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-12 14:17:09 -08:00
Anton Lundin
48b2b3d0b3 ostctools: Add support for profile version 0x24
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12 14:15:53 -08:00
Anton Lundin
983561b353 ostctools_import: Switch to using dc_parser_new2
Instead of creating the individual parsers, and keeping track of their
arguments, this just uses the "new" dc_parser_new2 function ment for
buffer parsing.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12 14:15:53 -08:00
Anton Lundin
70e2404492 Stop accessing the internals of dc_descriptor_t
This removes our own declaration of dc_descriptor_t and all our accesses
to its internals, and switches to use the libdivecomputer functions to
access those instead.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12 14:15:53 -08:00
Anton Lundin
d11dfd2f45 ostctools: Correct argument order to get_descriptor
This corrects the argument order, which was changed back in
00629c861c, but not on this place. Whups.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12 14:15:53 -08:00
Miika Turkia
aaa46c2465 Add some additional parameters to help text
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-06 20:44:02 -08:00
Robert C. Helling
935734100f Rename prefs.deco_mode to prefs.planner_deco_mode
This is to avoid confusion with planner.display_deco_mode.
When accessing the "current deco mode" use the decoMode()
helper function.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-06 20:43:23 -08:00
Robert C. Helling
bb4bf639c3 Fix deco_mode confusion
We have two prefernces determining the deco_mode (BUEHLMANN vs VPMB
vs RECREATIONAL): One for the planner (deco_mode) and one for
displaying dives (display_deco_mode). The former is set in the planner
settings while the latter is set in the preferences.

This patch clears up a confusion which of the two to use by introducing
a helper function that selects the correct variable.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-06 20:43:23 -08:00
Robert C. Helling
43599742a3 Display surface interval in diveplan
...instead of just stating "repetitive dive". As requested by
a user.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-03 22:28:18 -08:00
Miika Turkia
8766054581 Hooking up av1.xslt for log import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2016-12-31 09:56:08 +02:00
Robert C. Helling
10b8bda662 Fix picture hashing logic for pictures on the web.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-12-30 19:43:00 +01:00
Anton Lundin
38474f2d47 android: Add a subsurface_user_is_root for android
This is to compile the desktop ui for android

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28 22:40:18 -08:00
Anton Lundin
3b884c2e7c Use get_descriptor instead of hard-coded switch's
This starts using the newly lifted out get_descriptor in configure dive
computer, instead of previously hard-coded out of date
switch-statements.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28 22:40:18 -08:00
Anton Lundin
00629c861c Rename ostc_get_data_descriptor to get_descriptor
This renames and cleans up ostc_get_data_descriptor into get_descriptor,
for more generic use.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28 22:40:18 -08:00
Anton Lundin
db8e786f85 Lift ostc_get_data_descriptor out from ostctools.c
This is for later reuse of that function in other source files.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28 22:40:18 -08:00
Tomaz Canabrava
27b4ef321a Correctly open the resource file
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-27 08:27:21 -08:00
Robert C. Helling
3e4ea9e084 Get rid of debug messages
...that managed to sneak in in a previous commit.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-26 13:09:05 -08:00
Robert C. Helling
c1ef59c540 Indicate a repetitive dive in the diveplan
Fixes #1095

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-26 12:47:57 -08:00
Robert C. Helling
1ab5db3726 Empty image hashes are not valid
I don't know how those arose in the first place, but an
empty QByteArray is never a valid hash value for an image. So
we should not store those in our translation tables and also
get rid of them when loading the tables from disk.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-04 05:37:16 +09:00
Robert C. Helling
f03acb9e9a Fix effective GFs in notes
This patch fixes two bugs:

1) It first computes the effective gradient factors and then
composes the notes with the diveplan rather than the other way
around.

2) It does not try to fit a line through a single point.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-04 05:32:08 +09:00
Robert C. Helling
4d0d37b690 Show effective gradient factors for VPMB-plans
For each stop, this computes an effective gradient factor
that gives the same ceiling. Then, it does linear regression
to find values for GFlow and GFhigh that give a similar deco
profile.

Note that this optimises the average gradient factor. The
runtime however depends strongly at the gradient factor at
the last depth. So we don't necessarily to get the runtime
right.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-24 09:59:42 +09:00
Robert C. Helling
d1a0655613 Show runtime on top of diveplan
This is central information when planning a dive but often
scrolled out of the window for longer plans. So print it on
the top.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-24 09:59:32 +09:00
Robert C. Helling
20e211d337 Only consider non-zero average depth for statistics
Upon importing dives, the average depth can be undefined which we store as 0.
This zero should not contribute when computing the average depth for
the (yearly) statistics, only dives with average depth set now contribute.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-15 03:25:46 -08:00
Dirk Hohndel
9006802f72 Clean up some warnings in file.c
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-09 06:33:45 -08:00
Miika Turkia
66d9cc788c Parse multiple dives from single DL7 log file
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-09 06:29:24 -08:00
Anton Lundin
2497ecf16d configure ostc3: Correct typos
This fixes a copy-paste error made by me that caused
tempSensorOffset to first be set the wrong way and then overridden by
pressureSensorOffset.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-07 21:08:28 -08:00
Tomaz Canabrava
37e3e7e69a Deco mode for plannining is not deco mode for showing
We had (in the wrong place, imo) a new feature that
should differentiate the different deco_modes, you could
plan your dive in buelhman and see it in vpm-b, for instance
but both of them accessed the same pref.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:41:17 -07:00
Tomaz Canabrava
c110b4a238 More preference handling fixes
Remove a few uneeded lines and add more loading code for
the preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:40:43 -07:00
Tomaz Canabrava
ce8f621623 on first run, use system language.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:39:45 -07:00
Tomaz Canabrava
5da23065d6 Use default prefs for the prefs that where missing
This patch fixes all the cases that I didn't checked for
the default prefs.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:39:17 -07:00
Tomaz Canabrava
1dddf731ee use GET_* macros for getting settings
Those macros are nice because they take into consideration
the default preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:39:08 -07:00
Tomaz Canabrava
da2c6b208f Load use_system_language
Forgot to load use_system_language, wich borked the preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:38:49 -07:00
Tomaz Canabrava
fdb48f9efb Remember to load the language
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:38:21 -07:00
Tomaz Canabrava
df2dfa4706 Fix bug where the Font setting was ignored
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:37:52 -07:00
Tomaz Canabrava
92272311bf Preferences tests: fix Update Manager date loading
Date loading was incorrect, this unittest + fix deals with that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:34:47 -07:00
Tomaz Canabrava
3966f3e7dd Preferences tests: location updates & bug fix
Fixed loading the location preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:34:47 -07:00
Tomaz Canabrava
540075962c Correctly load the language based prefs
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-28 07:31:50 -07:00
Tomaz Canabrava
d7f339ade7 Load system Language
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-28 07:31:34 -07:00
Tomaz Canabrava
324b1d2dfc Fix default file behavior tests
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-28 07:31:17 -07:00
Tomaz Canabrava
eb6f9e263c Remember to look for the Group
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-28 07:30:39 -07:00
Rick Walsh
ebddf95252 ToolTipItem: show gf line based on correct gradient factor preferences
Calculate gfline using the gradient factor that is set by the planner
preferences when in the planner, and by the general prefs when not in the
planner. This is achieved by doing the gradient factor calculation in dive.c,
where buehlmann_config is defined.

Previously, the gfline was calculated using the general preferences gfhigh and
gflow, even when in the planner.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-27 20:36:14 -07:00
Tomaz Canabrava
713dd26d6c Added language testcase
Also, added a missing method / property

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-18 11:13:37 -07:00
Tomaz Canabrava
a42b05578f Tests for Units Preferences
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-18 11:12:33 -07:00
Tomaz Canabrava
9c4b0170bf Make all current written tests pass
Fixes a couple of issues with the tests.
Also, a type in prefs.h is "short" while it's actually
a boolean, this made me write the wrong testcase for this.

Fixed this by setting the Qt wrapper to bool, but I didn't
changed the c implementation because I tought I could break
something.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-15 12:24:05 -07:00