Commit graph

6427 commits

Author SHA1 Message Date
Anton Lundin
3519b75e4a Remove unused unquote function
In previous version of subsurfacesysinfo.cpp which came straight form Qt
the unquote function was used to clean strings.

Since f59b30ca5a ("OS Detection: Use QFile when reading
/etc/os-release") its not needed any longer so this removes that
function.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-08 11:21:08 -08:00
Anton Lundin
df42f78486 Add support for libdivecomputer DC_FIELD_DIVEMODE
libdivecomputer recently gained a api for telling us which mode the
divecomputer was running in, so this uses that to tell us if it was a OC
or CCR dive.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-08 11:20:38 -08:00
Anton Lundin
42d3ed0431 Move calculate_string_hash into DC_FIELD_STRING
The calculate_string_hash is only used if DC_FIELD_STRING is defined, so
this removes a warning for everybody who doesn't build against a
libdivecomputer with DC_FIELD_STRING support.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-08 11:20:04 -08:00
Anton Lundin
a7a022d8db Remove unused variables and code from seabear-csv
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-08 11:17:20 -08:00
Anton Lundin
0b0e5d834f Reorder initializers to be more c++-strict
c++ have some idea about in what order things should be initialized.
This makes us comply with that order.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-08 11:17:11 -08:00
Dirk Hohndel
082e59ea72 Add support for libdivecomputer's new TEMPERATURE fields
Parse air temperature and water temperature if available from the dive
computer. Subsurface happily tracks the temperatures in the dive samples,
but for water temperature in the header ("overall" water temperature) we
currently support only one field. So I ordered the code so that if it is
available, the minimum water temperature will be used, absent a minimum
water temperature we use the maximum water temperature.

Side note:
Since the libdivecomputer maintainer disagrees with the Subsurface
developers regarding a sane way to allow a consumer of his library to
detect if a feature is supported in a particular commit of the library,
the way we decide whether to build this code or not is decidedly hacky.
DC_GASMIX_UNKNOWN happens to be a #define we can check that was added
right around the time the temperature support was added. Sadly there is
no #define that we could check to see if temperature fields are supported.
How insane is that...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 22:55:38 -08:00
Dirk Hohndel
dbc7dbb074 Cleanup liquivision.c
strndup doesn't exist on Windows.
Mark / remove unused variables.
Plus codying style cleanup.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 21:20:02 -08:00
Linus Torvalds
0a27978014 Use the new DC_FIELD_STRING callback if it exists
This recognizes recognize some strigns (serial number and firmware
version), and the ones that it doesn't recognize it adds as extra data
using Dirk's new interface.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 20:55:18 -08:00
Robert C. Helling
cff413f14d The po2 argument of addS_segment is the setpoint, not the pO2 at that time
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:19:18 -08:00
Robert C. Helling
24c491053c Don't overwrite zero setpoints
As we agreed, in memory we don't zero repeated setpoints and thus zero
setpoints don't have to be overwritten by the last setpoint value.

This corrects the deco ceiling with CCR dives that bailout to OC.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:19:08 -08:00
John Van Ostrand
3fe310e529 Cleaned up file list in open and import dialogs
Lists were getting a little jumbled. I sorted the extensions and added
suitable human readable names.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:15:54 -08:00
John Van Ostrand
d4121fb42a Liquivision import fixes
Fixed rounding of temperatures
Fixed compile warnings

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:15:44 -08:00
John Van Ostrand
8136306911 Added import for Liquivision LVD log files
Support includes cylinder pressures and works for v3.0 log files.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:15:38 -08:00
Anton Lundin
09e8adf54e Convert volume calculations into floating point
The basic problem was that for gases containing more than 2147483648 ml
of nitrogen the calculations overflowed. This changes the code into
using floating point math for that calculation which will be more
accurate to.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:12:22 -08:00
Anton Lundin
450093df85 Remove leading spaces in buddy tags
The buddy list generated by the buddy tag logic gets separated by
,<space> so this trims away any leading spaces from the buddy name.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:11:36 -08:00
Dirk Hohndel
df0057d262 Extract some useful extra data from Uemis SDA
This is just a proof of concept for this patch series, mainly designed to
show how the extra data would be used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:01:58 -08:00
Dirk Hohndel
45251ec724 Show extra data in separate tab on MainTab
This way any extra data probided by the dive computer is visible to the
user (without other processing). This data cannot be edited by the user as
it reflects the information given by the dive computer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:00:58 -08:00
Dirk Hohndel
4ccddf95d7 Load and save extra data in git format
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:00:14 -08:00
Dirk Hohndel
d6b4109409 Load and save extra data in Subsurface XML format
Includes test dive to test missing attributes and the overall syntax.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 12:59:15 -08:00
Dirk Hohndel
9aefaa1ec8 Add helper function to add extra_data to dive computer
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 12:59:08 -08:00
Dirk Hohndel
77621ef7df Add list of string pairs to dive structure
This extra_data is designed to hold unstructured data from the dive
computer. Things like battery voltage. Deco algorithm. Whatever the dive
computer wants to report to us.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-06 22:00:25 -08:00
Miika Turkia
56bfa1b1be Reset counters when importing new MK6 log
Naturally the pressure counters and cylinder index must be reset to zero when
reading in a new Poseidon dive log.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-06 05:22:24 -08:00
Miika Turkia
676713335b Include po2 on Shearwater import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-06 05:22:20 -08:00
Dirk Hohndel
d643bde61a Always copy data in copy and paste mode
While in a multi dive edit we want to apply our usual semantics (only edit
things that are the same as in the current dive), when doing an explicit
copy and paste that doesn't seem to make sense. So we manually override
that behavior.

Fixes #753

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-05 07:13:20 -08:00
Dirk Hohndel
def9e3fc1b Make sure we don't use the 'changed' flag uninitialized
Valgrind reported this while I was testing the previous commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 15:05:35 -08:00
Dirk Hohndel
c9e7528370 Change tank editing behavior for multi dive edit
Previously we only applied the type of tank (description, volume, working
pressure) to all selected dives where the tank description matched.

With this patch we also copy the gas mix into all matching cylinders.

Additionally this addresses the issue that we should have a separate copy
of the cylinder description string for each dive.

Fixes #754

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 15:05:16 -08:00
Robert C. Helling
54692fb814 Use the CCR corrected gases for EAD and END calculations
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 11:45:32 -08:00
Robert C. Helling
20a9db779d Offer to save to a copy in replan mode
When replannig a dive, offer another button that creates a new
dive rather than overwriting the old. This should help in creating
several versions of a planned dive (longer/shorter, deeper/shallower
etc). Note that this makes dives that start at the same time not
influcence each other's deco.

Also, only the first of a row of simultaneous dives contributes to
the tissue loadings of later dives.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 07:21:34 -08:00
Robert C. Helling
06ddfc0122 Prepare for PSCR calculations
Calculations for passive semi-closed rebreathers are pretty much like OC
except the pO2 is lower bey a certain (SAC dependent) factor. This patch
introduces the corresponding calculations in case dctype == PSCR which is
so far never set and there is currently no UI for these calculations. As
pO2 is SAC dependent it takes a certain attempt at getting it and drops to
defaults from the prefs otherwise.

As there is no UI at this point and I also don't have any dives, this has
not received much testing, yet, but it compiles. At least.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 07:13:04 -08:00
Robert C. Helling
f31d34adfd Don't track gas consuption on CCR legs
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 07:05:23 -08:00
Robert C. Helling
b16cc78482 Replace alpha value of gray star with lighter gray
It seems, on Linux qrgba does not work properly making
stars with alpha red when selected. So the patch returns
to just rgb without transparency but decreases the contrast
to white by a factor of 5.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 07:03:54 -08:00
Dirk Hohndel
0dd87989a8 Correctly unselect trips when dive list filters change
Oddly Qt left the trips selected (but all dives where unselected in the
UI). This got our internal state rather confused. With this change we
clean up that mess and go back to just having those dives that were
originally selected and are still visible show up as selected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 17:52:04 -08:00
Dirk Hohndel
a3f1dc7681 Improve selection behavior of the multi filter
Only dives that remain visible stay selected. And if all selected dives
are removed by the filter, pick a new selected dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 17:32:12 -08:00
Robert C. Helling
7f7e25d586 Make invisible stars stand out less
As my wife kept pointing out for a long time, the greyed out stars
were heavier as images than the yellow selected stars. This patch
makes the grey stars semi-transparent.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Acked-by: Andrea Fischer-Helling <andrea@fraufischer.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 15:00:28 -08:00
Tomaz Canabrava
c65583671b Fix position and size of the Filter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 14:33:15 -08:00
Robert C. Helling
5fa2851bdf Start with 0 when computing maxdepth when fixing up
This is needed to get the correct maxdepth when replanning
leads to a shallower dive.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 14:32:17 -08:00
willem ferguson
40bdd607c0 Calculate nitrogen and helium gas pressures for CCR after import from CSV
Currently the gas pressures stored in structures of pressure are
calculated using the gasmix composition of the currently selected
cylinder. But with CCR dives the default cylinder is the oxygen
cylinder (here, index 0). However, the gas pressures need to
be calculated using gasmix data from cylinder 1 (the diluent
cylinder). This patch allows setting the appropriate cylinder
for calculating the values in the structures of pressure. It
also allows for correctly calculating gas pressures for any
open circuit cylinders (e.g. bailout) that a CCR diver may
use. This is performed as follows:

1) In dive.h create an enum variable {oxygen, diluent, bailout}

2) Within the definition of cylinder_t, add a member: cylinder_use_type
   This stores an enum variable, one of the above.

3) In file.c where the Poseidon CSV data are read in, assign
   the appropriate enum values to each of the cylinders.

4) Within the definition of structure dive, add two members:
   int oxygen_cylinder_index
   int diluent_cylinder_index
   This will keep the indices of the two main CCR cylinders.

5) In dive.c create a function get_cylinder_use(). This scans the
   cylinders for that dive, looking for a cylinder that has a
   particular cylinder_use_type and returns that cylinder index.

6) In dive.c create a function fixup_cylinder_use() that stores the
   indices of the oxygen and diluent cylinders in the variables
   dive->oxygen_cylinder_index and dive->diluent_cylinder_index,
   making use of the function in 4) above.

7) In profile.c, modify function calculate_gas_information_new()
   to use the above functions for CCR dives to find the oxygen and
   diluent cylinders and to calculate partail gas pressures based
   on the diluent cylinder gas mix.

This results in the correct calculation of gas partial pressures
in the case of CCR dives, displaying the correct partial pressure
graphs in the dive profile widget.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 14:13:55 -08:00
Dirk Hohndel
dfc7ee0b29 Delay replot of dive so changes aren't overwritten too early
When changing tanks we triggered a replot - but that overwrote the
displayed_dive with the current_dive before the remaining data from the
displayed_dive was used to edit the current_dive.

So now we delay this until later in the function, this way copy of paste
of both tanks and weights works.

Fixes #753

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 09:47:24 -08:00
Dirk Hohndel
3fab68dcd3 Fix two more potential crashes for dives without samples
This should be all of them (famous last words).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 07:50:30 -08:00
Dirk Hohndel
9eb55a0fc6 Prevent segfault for dive with gas change but no samples
Not quite sure where such a dive would come from, but anyway, just don't
dereference the pointer unless it's non-NULL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-02 10:38:09 -08:00
Dirk Hohndel
6ce0afb99c Don't call strdup on NULL by mistake
Hunting down a different issue I managed to cause a crash here when trying
to copy a string that ended up being NULL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 22:36:42 -07:00
willem ferguson
6cf3787a0e Remove code that zeroes out duplicate oxygen sensor and temperature values
Remove the code that changes all duplicate oxygen sensor, setpoint and
temperature values from a dive log to zero. One of the motivations is
that a zero setpoint value indicates an Open Circuit dive segment, not
Closed Circuit Rebreather. The code in dive.c is removed and the comments
for the corresponding restoration code that restores the last known values
into sensor or temperature with zero values is [fill_o2_values()
in profile.c] is changed to apply to the present situation.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 22:13:47 -07:00
willem ferguson
c9b4562a45 Replace Poseidon example dive log files in dives directory
The present example files have dives with some unusual
characteristics due to the fact that the dive pushes the
limits of the Poseidon recreational rebreather.
Replace these example files with a dive that does not have
any unusual characteristics. This facilitates debugging of the
Poseidon code. The xml file represents the same dive as the two
text files. The xml file will ultimately be removed.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 22:13:03 -07:00
Miika Turkia
dd73f422e0 Add pressures to cylinder declaration for MK6 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 22:09:36 -07:00
willem ferguson
9e2ce3d99a Remove code causing problems with CCR dive log rendering.
Currently, if there is a po2 given in the dive log, the dive is assumed
to be CCR. When a CCR dive has a fo2 of 100%, then the po2 is set as
the same as ambient pressure. This destroys the CCR po2 graph in the dive
profile that derives from oxygen with a fo2 of 100% in one of the
cylinders but which, after adding the dilent gas, has a po2 far below
ambient pressure. The calculation for 100% oxygen only applies to deco
using 100% o2 and then the dive computer calculates the appropriate po2.
This patch removes the setting of po2 to ambient when fo2 is 100%,
1) to enable accurate graphing of po2 values for CCR dives using 100% o2
   in the first cylinder.
2) To use the po2 value reported by the DC in the first place.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 22:05:13 -07:00
Gehad elrobey
e3be473a7f Fix inconsistent search result in HTML export
The advanced search drop down menu always showed the user selected
settings, even if this is a customized search (tag, location) that took
place by clicking on the search quick hyperlink.

This is fixed by saving the user default search preferences and changing
them temporarily when quick hyperlinks searching is used.

Fixes #723

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 22:03:01 -07:00
Tomaz Canabrava
4e9aff047e Show single buddies instead on the filter.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 22:01:33 -07:00
Dirk Hohndel
1f4b407323 Add modified strings to the translation source
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 09:29:48 -07:00
Tim Wootton
6fc32f6240 Capitalisation in file type list
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 09:27:33 -07:00
Tim Wootton
1e554d5451 Adjusts tissue graph button
Tool tip not needed, text already provided on mouse-over
Corrects captitalisation style

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 09:27:26 -07:00