]> git.tdb.fi Git - ext/subsurface.git/log
ext/subsurface.git
12 years agoSanitize and fix cylinder pressure overview
Linus Torvalds [Mon, 5 Sep 2011 16:12:54 +0000 (09:12 -0700)]
Sanitize and fix cylinder pressure overview

Doing per-dive cylinder start/end pressures is insane, when we can have
up to eight cylinders.  The cylinder start/end pressure cannot be per
dive, it needs to be per cylinder.

This makes the save format cleaner too, we have all the cylinder data in
just one place.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoComment typo fix
Nikola Kotur [Mon, 5 Sep 2011 13:34:22 +0000 (15:34 +0200)]
Comment typo fix

Signed-off-by: Nikola Kotur <kotnick@gmail.com>
12 years agoZebra-color the divelist
Linus Torvalds [Sun, 4 Sep 2011 22:18:58 +0000 (15:18 -0700)]
Zebra-color the divelist

..as suggested by Nathan:

  "I also wanted to "zebra" color the divelist by setting the rules-hint
   to TRUE.  but I noticed it was already set explicitly to FALSE (even
   if this is the default).

   If this is just an accidental copy paste from some tutorial you can
   experiment (set it to TRUE) and see what you like most."

It was indeed just copy-paste from some tutorial, and the zebra-coloring
does look nicer, doesn't it?

Suggested-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'more-divelist-goodness' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 22:15:46 +0000 (15:15 -0700)]
Merge branch 'more-divelist-goodness' of https://github.com/nathansamson/diveclog

* 'more-divelist-goodness' of https://github.com/nathansamson/diveclog:
  Right align the numbers

12 years agoSave milli-units with variable precision
Linus Torvalds [Sun, 4 Sep 2011 22:08:31 +0000 (15:08 -0700)]
Save milli-units with variable precision

Instead of always using three decimal digits, use 1-3 digits.  But do
use at least one, even for integer numbers, just because it makes it so
much clearer that we're dealing with potential fractional values.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse common helper for printing milli-units
Linus Torvalds [Sun, 4 Sep 2011 21:56:21 +0000 (14:56 -0700)]
Use common helper for printing milli-units

I don't necessarily want to show three decimal digits when one or two
would do. So prepare for that by using a helper. This doesn't actually
change the printout yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoProperly save/restore cylinder description string
Linus Torvalds [Sun, 4 Sep 2011 22:07:47 +0000 (15:07 -0700)]
Properly save/restore cylinder description string

We saved it under the wrong name, and didn't restore it at all. Fix.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoParse uemis cylinder data
Linus Torvalds [Sun, 4 Sep 2011 21:29:57 +0000 (14:29 -0700)]
Parse uemis cylinder data

This is some seriously crazy stuff.  Instead of making sense as a
divelog, the uemis xml makes more sense as a "dive computer settings
dump".

And I guess I can see why they'd do that.  But it makes parsing it just
incredibly annoying.  The thing is more of a "these are the
configurations I support as a dive computer thing" than a "this was the
tank you were diving with".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRight align the numbers
Nathan Samson [Sun, 4 Sep 2011 21:09:19 +0000 (23:09 +0200)]
Right align the numbers

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
12 years agoMerge branch 'ui-tweaks' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 20:49:45 +0000 (13:49 -0700)]
Merge branch 'ui-tweaks' of https://github.com/nathansamson/diveclog

* 'ui-tweaks' of https://github.com/nathansamson/diveclog:
  Some UI beauty patches:

12 years agoMake a guess at the cylinder description from the size and pressure
Linus Torvalds [Sun, 4 Sep 2011 20:34:22 +0000 (13:34 -0700)]
Make a guess at the cylinder description from the size and pressure

I'll want to also add a way to override/set the cylinder type: both
manually by just setting a size in liters, and by picking from some list
of standard cylinder sizes.

For example, it looks like most of my dives are marked as having
12-liter cylinders.  That is probably some default from Suunto Dive
Manager, or from whatever Dirk did.  It's almost certainly not right for
any of them: as far as I know, the standard cylinders for Lahaina Divers
(which is likely most of the warm water dives) are AL72's for air, and
AL80's for Nitrox.

That would be a 10L and a 11.1L tank respectively, afaik.  I don't know
what a 12-liter tank would be or where that size comes from.

Anyway, the LP85+ tank designation for some of the dives looks more
likely: that's one of the common sizes I've used for local dives.  So
the size of that thing is much more probably correct.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge hbonse's UI tweaks, but fixing the compile warnings. Also bringing it up to...
Nathan Samson [Sun, 4 Sep 2011 20:15:55 +0000 (22:15 +0200)]
Merge hbonse's UI tweaks, but fixing the compile warnings. Also bringing it up to date with the master (and my own UI improvements)

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
12 years agoClean up 'fixup_dive()' a bit
Linus Torvalds [Sun, 4 Sep 2011 20:06:47 +0000 (13:06 -0700)]
Clean up 'fixup_dive()' a bit

We don't want to override potentially more exact values for water
temperature etc either.  The sample save interval may be longer than
some internally kept state of key per-dive values like that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoGenerate date string for the dive list dynamically
Linus Torvalds [Sun, 4 Sep 2011 19:09:48 +0000 (12:09 -0700)]
Generate date string for the dive list dynamically

.. and sort based on the 'time_t' value itself.

This allows us to use a more compact date format that doesn't need to
sort alphabetically, because sorting by date is always based on the date
value.  So we can use just a two-digit year, and skip the seconds, to
keep the column narrow, while still sorting correctly.

Also, "Depth" is a nice header string, but it is wider than the column
itself, which makes the whole column wider than necessary.  So put the
units in the header instead of in the string, keeping things narrow.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'ui-improvements' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 18:49:49 +0000 (11:49 -0700)]
Merge branch 'ui-improvements' of https://github.com/nathansamson/diveclog

* 'ui-improvements' of https://github.com/nathansamson/diveclog:
  Split the dive list in columns. Columns are sortable now (name = date, depth, duration)
  Remove the redundant frames in the notebook. Closes #9
  Use a pane so the dive list can be made wider or smaller to the users wishes

12 years agoMerge branch 'compiler-warning' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 18:46:39 +0000 (11:46 -0700)]
Merge branch 'compiler-warning' of https://github.com/nathansamson/diveclog

* 'compiler-warning' of https://github.com/nathansamson/diveclog:
  Removed the unused startemp and enttemp calculations. This fixes a compiler warning too.

Fix up trivial conflict in dive.c due to the temperature simplification
(commit 9961c7f89ce6: "Remove redundant temperature readings").

12 years agoAdd placeholder for cylinder type description
Linus Torvalds [Sun, 4 Sep 2011 18:32:30 +0000 (11:32 -0700)]
Add placeholder for cylinder type description

So we don't want to save working pressure, but cylinder type knowledge
would be lovely and useful.  And we can probably make a good initial
guess, or at least let people fill it in later.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't save cylinder working pressure
Linus Torvalds [Sun, 4 Sep 2011 18:23:41 +0000 (11:23 -0700)]
Don't save cylinder working pressure

It was a mistake to save it - and I did it just because other dive
managers did.  It's a totally nonsensical measure, and nobody cares.
The only thing that matters is the size of the cylinder, and the
*actual* pressures.  Those give actual air consumption numbers, and are
meaningful and unambiguous.

So the "working pressure" for a cylinder is pointless except for two
things:

 - if you don't know the actual physical size, you need the "working
   pressure" along with the air size (eg "85 cuft") in order to compute
   the physical size.  So we do use the working pressure on *input* from
   systems that report cylinder sizes that way.

 - People may well want to know what kind of cylinder they were diving,
   and again, you can make a good guess about this from the working
   pressure.  So saving information like "HP100+" for the cylinder would
   be a good thing.

But notice how in neither case do we actually want to save the working
pressure itself.  And in fact saving it actually makes the output format
ambiguous: if we give both size and working pressure, what does 'size'
mean? Is it physical size in liters, or air size in cu ft?

So saving working pressure is just wrong. Get rid of it.

I'm going to add some kind of "cylinder description" thing, which we can
save instead (and perhaps guess standard cylinders from input like the
working pressure from dive logs that don't do this sanely - which is all
of them, as far as I can tell).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRemove redundant temperature readings
Linus Torvalds [Sun, 4 Sep 2011 18:20:27 +0000 (11:20 -0700)]
Remove redundant temperature readings

I'm aiming to really differentiate in dive log software by making my XML
export files be *clean*, dammit.

That means that we don't have random names, we don't have crazy random
units, and we don't have redundant information.

So when the temperature doesn't change, just don't report it.  That's
already what "no sample" means, just clean things up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSplit the dive list in columns. Columns are sortable now (name = date, depth, duration)
Nathan Samson [Sun, 4 Sep 2011 18:14:33 +0000 (20:14 +0200)]
Split the dive list in columns. Columns are sortable now (name = date, depth, duration)

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
12 years agoSome UI beauty patches:
Hylke Bons [Sun, 4 Sep 2011 15:08:40 +0000 (17:08 +0200)]
Some UI beauty patches:

Uppercase first letter for each label word
Tweak the paddings for easier reading
Rename File menu to Log menu
Add a separator before Quit in the Log menu
Remove frame in extended diving info and add 6px padding

Signed-off-by: Hylke Bons <hylkebons@gmail.com>
12 years agoMerge branch 'master' into ui-improvements
Nathan Samson [Sun, 4 Sep 2011 17:06:47 +0000 (19:06 +0200)]
Merge branch 'master' into ui-improvements

12 years agoFix typo in Makefile (LDLAGS -> LDFLAGS)
Linus Torvalds [Sun, 4 Sep 2011 17:01:37 +0000 (10:01 -0700)]
Fix typo in Makefile (LDLAGS -> LDFLAGS)

Reported-by: Konrad Delong <https://github.com/konryd>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRemove the redundant frames in the notebook. Closes #9
Nathan Samson [Sun, 4 Sep 2011 17:01:30 +0000 (19:01 +0200)]
Remove the redundant frames in the notebook. Closes #9

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
12 years agoMerge branch 'fix-entries' of https://github.com/nathansamson/diveclog
Linus Torvalds [Sun, 4 Sep 2011 16:58:34 +0000 (09:58 -0700)]
Merge branch 'fix-entries' of https://github.com/nathansamson/diveclog

* 'fix-entries' of https://github.com/nathansamson/diveclog:
  Word wrap the info textview. Also do not show the scrollbars if not necessary.
  Change location to a text entry instead of text view.

12 years agoUse a pane so the dive list can be made wider or smaller to the users wishes
Nathan Samson [Sun, 4 Sep 2011 16:54:12 +0000 (18:54 +0200)]
Use a pane so the dive list can be made wider or smaller to the users wishes

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
12 years agoUpdate gitignore for the name-change of the executable
Linus Torvalds [Sun, 4 Sep 2011 16:52:40 +0000 (09:52 -0700)]
Update gitignore for the name-change of the executable

It's not called 'parse' any more.  And I think I should rename 'divelog'
too to something more unique.  Right now the working name for the
project is 'diveclog' (kind of like 'jdivelog') , but I'm not convinced
that the "C implementation" part is really important enough to make a
point of long-term.

"subsurface"? I don't know.  Maybe I should follow the "name all
projects after myself" mantra.  "divenut"?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoOops. I forgot to 'fclose()' the file after saving the xml
Linus Torvalds [Sun, 4 Sep 2011 16:50:31 +0000 (09:50 -0700)]
Oops. I forgot to 'fclose()' the file after saving the xml

It never actually triggered anything for me, but any buffered data might
be lost, especially if you force-exit the application after saving a
dive log.

This probably explains a corrupted (truncated) dive file report from
Nathan Samson.

Reported-by: Nathan Samson <https://github.com/nathansamson>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRemoved the unused startemp and enttemp calculations. This fixes a compiler warning...
Nathan Samson [Sun, 4 Sep 2011 10:59:54 +0000 (12:59 +0200)]
Removed the unused startemp and enttemp calculations. This fixes a compiler warning too.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
12 years agoWord wrap the info textview. Also do not show the scrollbars if not necessary.
Nathan Samson [Sun, 4 Sep 2011 13:08:01 +0000 (15:08 +0200)]
Word wrap the info textview. Also do not show the scrollbars if not necessary.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
12 years agoChange location to a text entry instead of text view.
Nathan Samson [Sun, 4 Sep 2011 12:38:01 +0000 (14:38 +0200)]
Change location to a text entry instead of text view.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
12 years agoAdd 'Quit' menu item, and fix invisible "File" on gtk2
Linus Torvalds [Sun, 4 Sep 2011 04:38:07 +0000 (21:38 -0700)]
Add 'Quit' menu item, and fix invisible "File" on gtk2

I didn't even notice that the "File" part of the file menu no longer
showed up, since the keyboard accelerator for ^S worked fine..  But
apparently there's no default label associated with GTK_STOCK_FILE in
gtk2, so the "File" text went away with the conversion to GtkUIManager
in commit 4d62478e14fe ("Use the newer GtkUIManager for menu creation.")

The addition of a Quit menu entry with the associated keyboard
accelerator also makes ^Q "just work".

Of course, if we actually tracked dirty state etc, we could perhaps ask
the user whether they wanted to save or something.  But I'm not exactly
famous for my GUI chops, so ..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge https://github.com/mrjbq7/diveclog
Linus Torvalds [Sun, 4 Sep 2011 03:55:02 +0000 (20:55 -0700)]
Merge https://github.com/mrjbq7/diveclog

* https://github.com/mrjbq7/diveclog:
  dive.c: Fix spelling.

12 years agoDon't bother saving n2 percentage
Linus Torvalds [Sun, 4 Sep 2011 03:50:11 +0000 (20:50 -0700)]
Don't bother saving n2 percentage

It's all calculated anyway, and for the same reason we don't bother even
parsing it at load time, we really shouldn't bother saving it either.

The only thing you can do with that value is "check if the percentages
add up to 100%", and so what?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoImprove the layout of the text entries in gtk3. For gtk2 this could also be useful
Nathan Samson [Sun, 4 Sep 2011 00:37:22 +0000 (02:37 +0200)]
Improve the layout of the text entries in gtk3. For gtk2 this could also be useful

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse the newer GtkUIManager for menu creation.
Nathan Samson [Sun, 4 Sep 2011 00:14:39 +0000 (02:14 +0200)]
Use the newer GtkUIManager for menu creation.

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDo better cylinder information management
Linus Torvalds [Sun, 4 Sep 2011 03:31:18 +0000 (20:31 -0700)]
Do better cylinder information management

Instead of just tracking gasmix, track the size and workng pressure of
the cylinder too.

And use "cylinder" instead of "tank" throughout.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agodive.c: Fix spelling.
John Benediktsson [Sun, 4 Sep 2011 01:48:39 +0000 (18:48 -0700)]
dive.c: Fix spelling.

12 years agoAdd 'mean depth' marker on dive plot
Linus Torvalds [Sat, 3 Sep 2011 20:55:36 +0000 (13:55 -0700)]
Add 'mean depth' marker on dive plot

Just because I can.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoOnly update mean/max depths with computed ones if they are way off
Linus Torvalds [Sat, 3 Sep 2011 20:36:25 +0000 (13:36 -0700)]
Only update mean/max depths with computed ones if they are way off

The computer may track "real" max depth more closely than it tracks
samples.  So we trust the non-computed mean/max depths more than the
computed ones.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd various dive fixups, and show pressure (if any) in the plot
Linus Torvalds [Sat, 3 Sep 2011 20:19:26 +0000 (13:19 -0700)]
Add various dive fixups, and show pressure (if any) in the plot

Now the dive profile plot *really* needs some units.  The pressure is
just a random line otherwise.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUpdate README a bit
Linus Torvalds [Sat, 3 Sep 2011 15:53:05 +0000 (08:53 -0700)]
Update README a bit

..since this is now on github, might as well tell people what they need
to compile it, and warn them about the state of the project.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd location note to the top bar too.
Linus Torvalds [Sat, 3 Sep 2011 03:00:10 +0000 (20:00 -0700)]
Add location note to the top bar too.

I really don't understand the packing rules.  This does not look like
what I intended.

Oh well.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDo a dive de-dup pass
Linus Torvalds [Fri, 2 Sep 2011 23:40:28 +0000 (16:40 -0700)]
Do a dive de-dup pass

If given multiple dives at the same time, just de-dup the dives.  This
happens when you've dumped the whole dive-computer several times, and
some dives show up in multiple dumps.

When de-duping, try to avoid dropping data.  So if one dive has notes
attached to it, and the other one does not, pick the notes from the dive
that does have them.  Obvious stuff like that.

The sample merge is also written so that it should be possible to merge
two dives. Which we don't actually do yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoImprove uemis xml parsing a bit
Linus Torvalds [Fri, 2 Sep 2011 22:01:53 +0000 (15:01 -0700)]
Improve uemis xml parsing a bit

It looks like the "units.pressure" setting is only about the units that
things are *shown* in on the wrist computer: the units in the file are
always in bar (or rather, centi-bar).

Which is definitely the right thing to do, and means that we shouldn't
care about parsing the units setting.  It's purely about how something
is shown, not about parsing.

That's probably true of the other units too, but let's see when I have
more data to go on.

Also, parse water temperatures and tank pressure.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSilently ignore zero pressure
Linus Torvalds [Fri, 2 Sep 2011 21:06:26 +0000 (14:06 -0700)]
Silently ignore zero pressure

Don't complain about them, they're just missing values

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse 'units' value instead of guessing based on integer/FP
Linus Torvalds [Fri, 2 Sep 2011 20:59:39 +0000 (13:59 -0700)]
Use 'units' value instead of guessing based on integer/FP

We still end up guessing based on magnitude of the value, though: it
might be 'bar' or 'mbar', we end up picking one or the other based on
just how big the value is.

I should make it look at any possible explicit units too, since at least
with good xml, they exist.  Of course, the only good xml I've seen so
far is the one we generate ourselves ;)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoHack up some very rudimentary support for the Uemis xml format
Linus Torvalds [Fri, 2 Sep 2011 18:32:48 +0000 (11:32 -0700)]
Hack up some very rudimentary support for the Uemis xml format

I think I'll need to re-organize the handling of per-format code, but
for now we just mix it all up.

The uemis conversion is also questionable even for just the small parts
I do.  Does it really do "centiPSI"? That sounds crazy.  I'm waiting for
Dirk to send me some actual human-readable output from the dives, right
now some of it is just rough guesses.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoShow temperature in the info summary
Linus Torvalds [Fri, 2 Sep 2011 05:22:25 +0000 (22:22 -0700)]
Show temperature in the info summary

If it exists, it really does help identify the dive.  At least it does
for me: "local or Maui"?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoGenerate 'watertemp' field from samples if required
Linus Torvalds [Fri, 2 Sep 2011 05:21:16 +0000 (22:21 -0700)]
Generate 'watertemp' field from samples if required

Sure, it's redundant, but it's convenient for the general dive info.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix wrongly nested watertemp xml entry
Linus Torvalds [Fri, 2 Sep 2011 05:18:44 +0000 (22:18 -0700)]
Fix wrongly nested watertemp xml entry

Too much cut-and-paste: the ending tag said "airtemp".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoWe can't save escape characters.
Linus Torvalds [Fri, 2 Sep 2011 03:28:17 +0000 (20:28 -0700)]
We can't save escape characters.

I think it should be legal xml, but whatever.  libxml2 is very unhappy,
and complains when loading - even if I escape them.  So let's just
replace the low escape characters with '?'.

The only thing to ever care was my test-case, I suspect.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSave and parse notes and locations
Linus Torvalds [Fri, 2 Sep 2011 02:56:04 +0000 (19:56 -0700)]
Save and parse notes and locations

It's pretty rough, but it seems to work.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDo gasmix as an empty element XML too
Linus Torvalds [Fri, 2 Sep 2011 00:44:13 +0000 (17:44 -0700)]
Do gasmix as an empty element XML too

Let's make it a goal that the XML we output is pretty.  That clearly was
never a goal for the Suunto XML, but we can be oh-so-much-better than that.

I still don't love XML, but let's try to make the best of a bad situation,
and take pride in what we do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoClean up save-file output a bit
Linus Torvalds [Fri, 2 Sep 2011 00:37:41 +0000 (17:37 -0700)]
Clean up save-file output a bit

Use the "empty element" form for samples that don't have any events
associated with them (and none do, right now).  This avoids that
annoying "</sample>" crud.

And output the units in the output helpers, so that you can't forget
them even if you try.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAlways use proper units when saving.
Linus Torvalds [Fri, 2 Sep 2011 00:17:19 +0000 (17:17 -0700)]
Always use proper units when saving.

When we see a number like 23.145, we'd better always also see a unit.
It's just good practice.  So add 'min' to duration (and use only two
digits for number of seconds), and 'm' to depth.

And write the date in international standard format.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoTeach the date parser to also parse the international standard date format
Linus Torvalds [Fri, 2 Sep 2011 00:13:39 +0000 (17:13 -0700)]
Teach the date parser to also parse the international standard date format

The standard way to write a date is yyyy-mm-dd, which is unambiguous and
sorts correctly.

We parsed that right in the 'datetime' case, but not in the normal date
case.  And we do want to use that in our output format, exactly because
it's standard.

And also parse 'duration' for the dive duration.  It's what we use when
saving, it just so happened that we ended up not parsing it right, but
then picking it up from the samples instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSave everything in our current dives and samples into the xml file
Linus Torvalds [Thu, 1 Sep 2011 23:59:10 +0000 (16:59 -0700)]
Save everything in our current dives and samples into the xml file

Now, as we start parsing more, we just need to also add the code to save
it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix up small details in input/output
Linus Torvalds [Thu, 1 Sep 2011 23:41:10 +0000 (16:41 -0700)]
Fix up small details in input/output

Be more careful with FP conversions, and with the Kelvin<->C offset.
And make sure to use the same names when saving as when parsing.

Now when we save a set of dives, then re-load them, and save again, the
second save image is identical to the first one.

Of course, we don't actually save everything we load, so we still do
lose information when we load and then save the result.  But at least we
now don't lose the information that we *do* save.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd ability to 'save' dives
Linus Torvalds [Thu, 1 Sep 2011 23:27:52 +0000 (16:27 -0700)]
Add ability to 'save' dives

This just generates another xml file.  Don't get me wrong: I still don't
like xml, but this way we can save in the same format we load things
from.  Except the save-format is a *lot* cleaner than the abortion that
is Suunto or libdivecomputer xml.

Don't bother with some crazy xml library crap for saving. Just do it!

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agogasmix: stop tracking nitrogen percentages
Linus Torvalds [Thu, 1 Sep 2011 23:26:11 +0000 (16:26 -0700)]
gasmix: stop tracking nitrogen percentages

The only thing you can do with that thing is screw things up (like
libdivecomputer did).  There's no value in tracking the "filler" gas,
since you can always just calculate it from the gases that actually
matter.

So just track Oxygen and Helium - and make sure they have sane values.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agolibdivecomputer does crazy gas mixes too
Linus Torvalds [Thu, 1 Sep 2011 20:46:24 +0000 (13:46 -0700)]
libdivecomputer does crazy gas mixes too

Did I just say "In comparison, the libdivecomputer output is nice and
sane"?

It turns out that libdivecomputer has been doing some drugs too when it
comes to gas mixes.  Like showing O2 percentages as 255.0% and N2
percentages as -155.0%.

Clearly libdivecomputer uses a 'unsigned char' for oxygen percentage,
and makes "-1" be "undefined".  And then it prints that non-existing mix
out, and in the process does MATH on the damn thing ("100-O2") to
"calculate" the nitrogen percentage.

Christ.

Just make the parser silently ignore the craziness, because printing out
"Strange percentage reading -155.0" a few hundred times just doesn't
make anything any better.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart parsing gas mixes
Linus Torvalds [Thu, 1 Sep 2011 20:32:52 +0000 (13:32 -0700)]
Start parsing gas mixes

The suunto xml is just completely crazy.  What's the helium percentage
companion to "o2pct"? Would it be "hepct"? No. It's "hepct_0".

Ok, so they didn't number the first o2pct, which could be seen as sane:
that's the only mix value that should always exist.  And they clearly
started their indexing with 0.  So with multiple mixes, you'd then
expect "o2pct_1" and "hepct_1", right?

Wrong! Because XML people are crazy, the second O2 mix percentage is
obviously "o2pct_2".  So the O2 percentages are one-based, with an
implicit one.  But the He percentages are zero-based with an explicit
zero.  So the second mix is "o2pct_2" and "hepct_1".

I'd like to ask what drugs Suunto people are on, but hey, it's a Finnish
company.  No need to ask.  Vodka explains everything.  LOTS AND LOTS OF
VODKA.

In comparison, the libdivecomputer output is nice and sane, and uses a
'gasmix' node.  Of course, now we have so many different XML nesting
nodes to check that I just made it an array of different noces.  That
also allows me to mark the suunto case, so that we only do the "check
for crazy alcoholic xml entries" when it's a suunto file.

The "type of file" thing is probably a good idea for deciding on default
units too. Some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoGet rid of our 'ignore' rules
Linus Torvalds [Thu, 1 Sep 2011 19:35:04 +0000 (12:35 -0700)]
Get rid of our 'ignore' rules

I'll start doing some kind of "save unparsed things as extended items"
thing, and the ignore rules were just there to get rid of some of the
noise from early parsing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoxml parsing: start traversing properties too
Linus Torvalds [Thu, 1 Sep 2011 18:22:05 +0000 (11:22 -0700)]
xml parsing: start traversing properties too

This requires us to change the way we match things up, because now we
can have things like

   dives.dive.sample.event.time

and

   dives.dive.sample.time

and they are different things (that "sample.event.time" is a 'time'
property of the 'event').

Now, this is always going to be ambiguous, since our linearized name of
the xml doesn't really care whether it's a xml node "child" or a
"property", but quite frankly, I don't care. XML just isn't worth the pain.

In fact, maybe this ambiguity can end up being a good thing.  We will
parse these two different lines of XML the same way:

  <dive><sample><time>50</time><depth>10.8</depth></sample></dive>

  <dive><sample time="50" depth="10.8"></sample></dive>

and the attribute approach seems to be the nicer one.  Maybe I'll use
that for the output format.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRename some files to be more appropriate
Linus Torvalds [Thu, 1 Sep 2011 17:09:53 +0000 (10:09 -0700)]
Rename some files to be more appropriate

The executable is now called 'divelog'.  If this gets useful enough to
actually *use*, I guess I'll have to come up with a real name some day.

Add a silly README, rename 'parse' to 'parse-xml'.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd some extended dive info fields
Linus Torvalds [Thu, 1 Sep 2011 03:36:51 +0000 (20:36 -0700)]
Add some extended dive info fields

.. and tweak the basic info layout a bit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the main display saner
Linus Torvalds [Thu, 1 Sep 2011 01:30:42 +0000 (18:30 -0700)]
Make the main display saner

This tweaks:
 - packing to be what you'd kind of expect
 - makes the "summary info" always visible
 - the "extended info" is now on a notebook page of its own
 - dive profile the first notebook page, since the summary
   information is visible regardless.
which all just seems a lot more logical.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoBoiler-plate code for opening/saving a file
Linus Torvalds [Thu, 1 Sep 2011 01:04:25 +0000 (18:04 -0700)]
Boiler-plate code for opening/saving a file

All just copied from the gtk docs.  No actual loading or saving is
taking place, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a top 'File' menu
Linus Torvalds [Wed, 31 Aug 2011 23:54:13 +0000 (16:54 -0700)]
Add a top 'File' menu

It doesn't actually *do* anything, but what else is new?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDo something half-way sane (no SIGSEGV) when there are no dives
Linus Torvalds [Wed, 31 Aug 2011 23:40:22 +0000 (16:40 -0700)]
Do something half-way sane (no SIGSEGV) when there are no dives

It just leaves ugly blank areas, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart cleaning up dive accessors
Linus Torvalds [Wed, 31 Aug 2011 23:33:20 +0000 (16:33 -0700)]
Start cleaning up dive accessors

I'm going to add a menu to import (and eventually export) dives, and so
we'd like to be able to start out with no dives at all.  Right now we
croak if that happens - it's not like the code has been written with
actual end users in mind.

So start cleaning things up.  First make the 'current_dive' macro work
right even for invalid dives.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse a 'notebook' for Info vs Profile
Linus Torvalds [Wed, 31 Aug 2011 23:10:11 +0000 (16:10 -0700)]
Use a 'notebook' for Info vs Profile

I dunno.  This seems a better interface at least if we get more info for
the dive, but I suspect I'll want to the add basic info to the profile
page too.

This makes the 'table' approach to layout be kind of pointless again,
and the table has become a fancy vbox.  Maybe I'll put the core info
back, and use the notebook 'Info' page for extended information.

I should just bite the bullet and start saving the dive data, and adding
editing functions for adding information.  But instead I'm playing
around with random gtk widgets.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd some more dive info - and actually update it
Linus Torvalds [Wed, 31 Aug 2011 22:35:28 +0000 (15:35 -0700)]
Add some more dive info - and actually update it

It's still the ugliest application ever, but now it at least gives you
some basic dive info.

I'd love to add a way to edit the dives to add new data (name, buddies,
location etc), but that would also require the ability to save the end
result.  Maybe some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agodive parsing: enforce maxdepth and dive duration
Linus Torvalds [Wed, 31 Aug 2011 21:36:53 +0000 (14:36 -0700)]
dive parsing: enforce maxdepth and dive duration

If we see samples from past the dive duration, update the dive duration.
Likewise with maxdepth.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agodive profile plot: use saner minimum limits
Linus Torvalds [Wed, 31 Aug 2011 21:35:31 +0000 (14:35 -0700)]
dive profile plot: use saner minimum limits

The time minimum was in seconds, not minutes, and we really do want to
show at least to 90ft to make shallow dives look shallow rather than
scaled to some full depth.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoplot a fancier 'filled' depth profile
Linus Torvalds [Wed, 31 Aug 2011 21:23:35 +0000 (14:23 -0700)]
plot a fancier 'filled' depth profile

Now I'm just dicking around with cairo.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPlot dive profile slightly more intelligently.
Linus Torvalds [Wed, 31 Aug 2011 21:15:50 +0000 (14:15 -0700)]
Plot dive profile slightly more intelligently.

This actually creates a bounding box and some scale markers.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd fake 'info' frame contents
Linus Torvalds [Wed, 31 Aug 2011 19:09:19 +0000 (12:09 -0700)]
Add fake 'info' frame contents

It should have depth, time, place etc information, but right now it only
has a fake depth that doesn't even get updated.  Just to show the idea
of the table usage.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse a gtk table instead of hbox
Linus Torvalds [Wed, 31 Aug 2011 18:52:16 +0000 (11:52 -0700)]
Use a gtk table instead of hbox

We'll want to add various dive statistics, so...  Without them, it all
looks pretty much the same, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd 'repaint_dive()' prototype, and fix dependencies
Linus Torvalds [Wed, 31 Aug 2011 18:10:17 +0000 (11:10 -0700)]
Add 'repaint_dive()' prototype, and fix dependencies

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoTeach the thing to actually track the currently selected dive
Linus Torvalds [Wed, 31 Aug 2011 18:07:31 +0000 (11:07 -0700)]
Teach the thing to actually track the currently selected dive

.. and repaint the profile when the selection changes.

Now, if it just wasn't so ugly, it might even be useful.  Except it
obviously needs to also show all the other dive information.  And allow
the user to fill in details.  And save the end results.

So no, it's not useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoRe-do the tree selection code with a selection callback
Linus Torvalds [Wed, 31 Aug 2011 17:46:28 +0000 (10:46 -0700)]
Re-do the tree selection code with a selection callback

Learnign gtk by looking at cairo examples? It's one way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't newline-terminate the dive name
Linus Torvalds [Wed, 31 Aug 2011 17:45:29 +0000 (10:45 -0700)]
Don't newline-terminate the dive name

That resulted in ugly lists, and it was wrong to begin with.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSplit up divelist scroll window generation into its own file
Linus Torvalds [Wed, 31 Aug 2011 17:27:58 +0000 (10:27 -0700)]
Split up divelist scroll window generation into its own file

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoGet rid of now unused 'show_dive()' function
Linus Torvalds [Wed, 31 Aug 2011 17:22:08 +0000 (10:22 -0700)]
Get rid of now unused 'show_dive()' function

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSplit up profile frame generation into its own file.
Linus Torvalds [Wed, 31 Aug 2011 17:20:46 +0000 (10:20 -0700)]
Split up profile frame generation into its own file.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDraw some kind of profile for the (first) dive
Linus Torvalds [Wed, 31 Aug 2011 15:47:13 +0000 (08:47 -0700)]
Draw some kind of profile for the (first) dive

This is all kinds of broken: it doesn't actually follow the selected
dive, and the profile isn't scaled properly etc.  But it shows something
new, and not just text.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix depth parsing
Linus Torvalds [Wed, 31 Aug 2011 15:45:43 +0000 (08:45 -0700)]
Fix depth parsing

The "decimal: it's meters, integer: it's feet" logic doesn't work.  It's
just always meters, because the xml ends up sometimes having whole meters.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the dive list scrollable (and put it in a vbox)
Linus Torvalds [Wed, 31 Aug 2011 04:18:47 +0000 (21:18 -0700)]
Make the dive list scrollable (and put it in a vbox)

This means you can actually see them all, and walk through them.

It doesn't make any of this *useful*, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoShow the dives as a gtk list/tree widget
Linus Torvalds [Wed, 31 Aug 2011 03:56:01 +0000 (20:56 -0700)]
Show the dives as a gtk list/tree widget

Ok, so I'm not very good at this.  I'll need to enclose the dang thing
in a scrollable window, and then make that scrollable thing just part of
the whole window.

But hey, it's pixels on the screen.  Pixels that show the names of the
dives we've parsed.  At least as many as will fit on screen at one time ;)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoGenerate a default name for a dive, if it doesn't have one already
Linus Torvalds [Wed, 31 Aug 2011 03:54:43 +0000 (20:54 -0700)]
Generate a default name for a dive, if it doesn't have one already

The name is a string containint date, time, depth and length.  So it's
useful even with nothing else going on.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoCreate a gtk window
Linus Torvalds [Wed, 31 Aug 2011 02:48:00 +0000 (19:48 -0700)]
Create a gtk window

It doesn't *do* anything, but some day it will.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd .gitignore file for current state
Linus Torvalds [Wed, 31 Aug 2011 01:42:57 +0000 (18:42 -0700)]
Add .gitignore file for current state

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart moving some of the non-parsing stuff out of 'parse.c'
Linus Torvalds [Wed, 31 Aug 2011 01:40:25 +0000 (18:40 -0700)]
Start moving some of the non-parsing stuff out of 'parse.c'

Create a 'main.c' with the main routine and argument "parsing" etc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSplit up dive data structure declarations into 'dive.h'
Linus Torvalds [Wed, 31 Aug 2011 01:23:59 +0000 (18:23 -0700)]
Split up dive data structure declarations into 'dive.h'

The dive parser should eventually be just a part of the program, not the
whole thing. So start preparing for that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoClean up dive reporting
Linus Torvalds [Wed, 31 Aug 2011 00:51:35 +0000 (17:51 -0700)]
Clean up dive reporting

Show date, max depth, and time by default.  The stuff that matters and
should always exist.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd some more parsing functions
Linus Torvalds [Wed, 31 Aug 2011 00:45:03 +0000 (17:45 -0700)]
Add some more parsing functions

.. and fix the 'duration' parsing: it can be either in seconds, or in
mm:ss format.  Floating point doesn't make any sense.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't report dives as they are parsed: sort them at the end and report them then
Linus Torvalds [Wed, 31 Aug 2011 00:18:33 +0000 (17:18 -0700)]
Don't report dives as they are parsed: sort them at the end and report them then

This makes it much easier to see the duplicates, but more importantly,
we do need to actually save the dives off to do any real work with them.

Also, require a verbosity level of 1 (-v) to show all the samples.
While (-vv) shows unparsed entries.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd 'datetime' parsing for libdivecomputer xml files
Linus Torvalds [Tue, 30 Aug 2011 23:59:03 +0000 (16:59 -0700)]
Add 'datetime' parsing for libdivecomputer xml files

I think this gets me dates on all my dives.  So now I could start
sorting them and removing duplicates.

But before I try to remove dups, I guess I should compare the
libdivecomputer ones against the suunto ones.  Because I bet they have
various "interesting" issues like using Bar vs Atm etc.

"But XML is portable". Crazy people.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>