]> git.tdb.fi Git - ext/subsurface.git/log
ext/subsurface.git
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>
12 years agoFix up temperature conversion
Linus Torvalds [Tue, 30 Aug 2011 23:58:07 +0000 (16:58 -0700)]
Fix up temperature conversion

Oops. No, the water temperature wasn't really 500 degC.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart actually reporting the numbers we parsed
Linus Torvalds [Tue, 30 Aug 2011 23:42:05 +0000 (16:42 -0700)]
Start actually reporting the numbers we parsed

.. which also showed that the sampletime thing had gotten a bit too much
copy-paste from the temperature parsing ;)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd 'verbose' flag
Linus Torvalds [Tue, 30 Aug 2011 23:28:59 +0000 (16:28 -0700)]
Add 'verbose' flag

Now that we actually parse some of the dives, don't spam stdout with the
list of stuff we can't parse by default.

Add a 'verbose' flag, which enables that output when set.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart parsing numeric fields
Linus Torvalds [Tue, 30 Aug 2011 23:23:47 +0000 (16:23 -0700)]
Start parsing numeric fields

Depth, pressure, and sample times.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart parsing dive dates
Linus Torvalds [Tue, 30 Aug 2011 22:22:48 +0000 (15:22 -0700)]
Start parsing dive dates

.. only the suunto XML format, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMove the "text" nodename hackery out of 'nodename()'
Linus Torvalds [Tue, 30 Aug 2011 21:38:39 +0000 (14:38 -0700)]
Move the "text" nodename hackery out of 'nodename()'

It's better to do it in the caller.  Debug users may well want the full
node name.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix stupid mis-initialization of current sample
Linus Torvalds [Tue, 30 Aug 2011 21:36:34 +0000 (14:36 -0700)]
Fix stupid mis-initialization of current sample

.. nice compiler warning hidden by the crazy gcc pointer sign warnings
that nobody wants to see (yes, we really do want to do 'strlen()' even
on unsigned strings, don't complain, crazy bitch compiler).

So this also makes our CFLAGS set -Wno-pointer-sign.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart showing unparsed entries
Linus Torvalds [Tue, 30 Aug 2011 20:58:19 +0000 (13:58 -0700)]
Start showing unparsed entries

(ie all of them)

This also shows the type of entry, which makes it clear that I've
screwed up the sample matching.  Oh well.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFill in dummy parse target code
Linus Torvalds [Tue, 30 Aug 2011 20:48:05 +0000 (13:48 -0700)]
Fill in dummy parse target code

.. but don't actually parse anything yet.  But hey - now it tells you
how many samples it (hasn't) parsed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMove the parser closer to being usable
Linus Torvalds [Tue, 30 Aug 2011 04:32:27 +0000 (21:32 -0700)]
Move the parser closer to being usable

Ok, so we have the dive split and the sample splits, so now we could
really just start filling in data.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoTurn the XML into something almost parseable.
Linus Torvalds [Tue, 30 Aug 2011 00:51:54 +0000 (17:51 -0700)]
Turn the XML into something almost parseable.

Of course, now the problem is that the different XML files have
different node names, but at least we've turned it into a half-way sane
format, and have a nice callback place per value.

Soon we could use that to actually fill in useful information.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the multi-dive files valid XML
Linus Torvalds [Mon, 29 Aug 2011 00:24:53 +0000 (17:24 -0700)]
Make the multi-dive files valid XML

They had multiple "root" entries (all called 'dive'), which makes baby
Jesus cry.

So just enclose them all in one root entry (called 'dives') that
magically turns it all into parseable xml.

Yeah, that really helps make the world a better place.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd crazy (bad) xml parser thing
Linus Torvalds [Sun, 28 Aug 2011 23:58:26 +0000 (16:58 -0700)]
Add crazy (bad) xml parser thing

It only works for the Suunto "one xml file per dive" format, not for the
libdivecomputer one that just puts many dives in one file.

Maybe there is some way for libxml2 to handle concatenated xml files
(start again on errors), but I don't know it yet.

I need to get stinking drunk before I look at more xml mess.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart archiving the stupid XML files
Linus Torvalds [Sun, 28 Aug 2011 23:18:53 +0000 (16:18 -0700)]
Start archiving the stupid XML files

(and add a reminder of how they came to be)

Gaah.  XML is *stupid*.  It's not easy to parse for humans or for
computers, and some of these XML files are just disgusting.  But maybe
they can be turned into something usable with libxml.

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