subsurface/core
Linus Torvalds eff4059802 Start using the actual cylinder data for gas switch events
Now that gas switch events always have indices into the cylinder table,
start using that to look up the gas mix from the cylinders rather than
from the gas switch event itself.  In other words, the cylinder index is
now the primary data for gas switch events.

This means that now as you change the cylinder information, the gas
switch events will automatically update to reflect those changes.

Note that on loading data from the outside (either from a xml file, from
a git/cloud account, or from a dive computer), we may or may not
initially have an index for the gas change event.  The external data may
be from an older version of subsurface, or it may be from a
libdivecomputer download that just doesn't give index data at all.

In that case, we will do:

 - if there is no index, but there is explicit gas mix information, we
   will look up the index based on that gas mix, picking the cylinder
   that has the closest mix.

 - if there isn't even explicit gas mix data, so we only have the event
   value from libdivecomputer, we will turn that value into a gasmix,
   and use that to look up the cylinder index as above.

 - if no valid cylinder information is available at all, gas switch
   events will just be dropped.

When saving the data, we now always save the cylinder index, and the gas
mix associated with that cylinder (that gas mix will be ignored on load,
since the index is the primary, but it makes the event much easier to
read).

It is worth noting we do not modify the libdivecomputer value, even if
the gasmix has changed, so that remains as a record of the original
download.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:37:18 -07:00
..
subsurface-qt
android.cpp
checkcloudconnection.cpp
checkcloudconnection.h
cloudstorage.cpp
cloudstorage.h
CMakeLists.txt
cochran.c
cochran.h
color.cpp
color.h
compressibility.r
configuredivecomputer.cpp
configuredivecomputer.h
configuredivecomputerthreads.cpp
configuredivecomputerthreads.h
datatrak.c
datatrak.h
deco.c
deco.h
device.c
device.h
devicedetails.cpp
devicedetails.h
display.h
dive.c Start using the actual cylinder data for gas switch events 2016-04-04 22:37:18 -07:00
dive.h Make gas change events always have a cylinder index 2016-04-04 22:37:18 -07:00
divecomputer.cpp
divecomputer.h
divelist.c
divelist.h
divelogexportlogic.cpp
divelogexportlogic.h
divesite.c
divesite.cpp
divesite.h
divesitehelpers.cpp
divesitehelpers.h
equipment.c Make cylinder_nodata() take a const cylinder pointer 2016-04-04 22:37:18 -07:00
exif.cpp
exif.h
file.c
file.h
gas-model.c
gaspressures.c
gaspressures.h
gettext.h
gettextfromc.cpp
gettextfromc.h
git-access.c
git-access.h
gpslocation.cpp
gpslocation.h
helpers.h
imagedownloader.cpp
imagedownloader.h
isocialnetworkintegration.cpp
isocialnetworkintegration.h
libdivecomputer.c
libdivecomputer.h
linux.c
liquivision.c
load-git.c
macos.c
membuffer.c
membuffer.h
metrics.cpp
metrics.h
ostctools.c
parse-xml.c
planner.c Make gas change events always have a cylinder index 2016-04-04 22:37:18 -07:00
planner.h
pluginmanager.cpp
pluginmanager.h
pref.h
prefs-macros.h
profile.c Make gas change events always have a cylinder index 2016-04-04 22:37:18 -07:00
profile.h
qt-gui.h
qt-init.cpp
qthelper.cpp
qthelper.h
qthelperfromc.h
qtserialbluetooth.cpp
save-git.c Start using the actual cylinder data for gas switch events 2016-04-04 22:37:18 -07:00
save-html.c
save-html.h
save-xml.c Start using the actual cylinder data for gas switch events 2016-04-04 22:37:18 -07:00
serial_ftdi.c
sha1.c
sha1.h
statistics.c
statistics.h
strndup.h
strtod.c
subsurfacestartup.c
subsurfacestartup.h
subsurfacesysinfo.cpp
subsurfacesysinfo.h
taxonomy.c
taxonomy.h
time.c
uemis-downloader.c
uemis.c
uemis.h
units.h
version.c
version.h
webservice.h
windows.c
windowtitleupdate.cpp
windowtitleupdate.h
worldmap-options.h
worldmap-save.c
worldmap-save.h