If the user clicks on manage (or double clicks on the globe) and the
displayed_dive doesn't actually have a dive site associated with it (e.g.
because we are adding a dive or because it was imported or downloaded
without dive site information, then we need to make sure that there is an
empty dive site that we can make changes to.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Otherwise there are ugly spaces in the file names. This didn't break
anything, per se, it's mostly cosmetic.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The existing code was bogus as it used cur_dive->dc instead of cur_dc
(i.e., it always changed the first dive computer, even if the po2 was
found in a different one).
But fundamentally I consider this bogus. We are not doing the right thing
here - some dive computer send us pO2 values that are just the calculated
pO2 at a depth and NOT a setpoint, yet we pretend those are setpoints and
then turn these dives into CCR dives.
This needs to done differently.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And hook things up when double clicking the globe.
The user experience isn't consistent with what we do on the main tab
(i.e., no coloring of fields that are changed), but it seems to work.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With this all references to these members should be gone and all the code
should be switched over to the dive site infrastructure.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a bit awkward now. We are downloading what looks like fake dives
in the v2 format. So we create a dive site for every single fix.
After we merge those new dive sites into the existing dives we need to
throw away all the dive sites that weren't used.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix broken helper function, move helper functions into the .c file (there
really wasn't a good reason for these to be inline), fix the logic that
decides if we want to create a new dive site or use an existing one.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While the existing code worked with a couple of hand crafted examples it
turns out it did a poor job with most of my files. Oops.
Depending on whether we find name or coordinates first, we need to
identify existing sites in either case and do the right thing.
The challeng here are multiple dives at the same site with slightly
different GPS coordinates. If the name is read first, these all get merged
into one (and we warn about the different GPS data). But if GPS gets read
first, we create separate dive sites with the same name.
We need a sane UI to consolidate these - but we can't completely automate
this... it's possible that these ARE the same site and the GPS data is
just imprecise (for example, multiple dives at the same time with GPS
locations from the Subsurface companion app). The user should be able to
either pick one of the GPS locations, or keep multiple (for example,
different buoyes for the same site and you want to keep the different
markers).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since the last few dozen commits change the format in irreversible ways
and could therefore be destructive and lose data for testers of the
development version, let's try to be extra careful and create "special"
backup files that aren't overwritten by subsequent backups. At least this
way people can go back to the previous state.
Of course people using the git backend don't have to worry about this as
they always can go back to any earlier save.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It seems to make sense to only have them on the dive site screen. For the
main UI they were redundant (we have the map) and not all that useful. The
only time people would want them is if they wanted to manually add GPS
coordinates for a dive, but that should now be done via the dive site UI.
There are a couple of FIXMEs in the code and a few code blocks that have
been commented out as they will be needed in one form or another once this
GPS handling is done on the dive site UI, which right now it is NOT.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This simply tracks the names - if we have multiple dives sites with the
same name but different other data (e.g. different GPS), we could easily
get this right (well, somewhat easily, it's a UI question), but for that
we'd have to filter for dive site uuid instead of for dive location name.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If you want a specific one, you can always overwrite it, but a dive site
with a uuid of 0 breaks some of our assumptions.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Sometimes we want to create a dive site just based on a name, sometimes we
have both a name and GPS coordinates. Let's make a helper for either case.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This doesn't make the code necessarily more compact, but easier to read
and is consistent with our other patterns.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Read and write divesite sections in the XML file.
Read divelogs of version 2 and create dive site structures on the fly.
Read version 3 files that have divesiteid instead of location / gps.
Saves version 3 files where dives no longer have location and gps but
instead refer to a divesiteid
The commit contains quite a few fprintf(stderr,...) in order to allow
better monitoring of the parsing / transforming of locations and gps to
dive sites. This will need to be removed later.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the start of the preparations to edit the dive site,
passing a uuid so we can retrieve it later.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Name and coords of the current dive are copied to the edit dive site
screen.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>