summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2011-09-01Add ability to 'save' divesGravatar Linus Torvalds
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>
2011-09-01gasmix: stop tracking nitrogen percentagesGravatar Linus Torvalds
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>
2011-09-01libdivecomputer does crazy gas mixes tooGravatar Linus Torvalds
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>
2011-09-01Start parsing gas mixesGravatar Linus Torvalds
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>
2011-09-01Get rid of our 'ignore' rulesGravatar Linus Torvalds
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>
2011-09-01xml parsing: start traversing properties tooGravatar Linus Torvalds
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>
2011-09-01Rename some files to be more appropriateGravatar Linus Torvalds
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>
2011-08-31Add some extended dive info fieldsGravatar Linus Torvalds
.. and tweak the basic info layout a bit. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Make the main display sanerGravatar Linus Torvalds
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>
2011-08-31Boiler-plate code for opening/saving a fileGravatar Linus Torvalds
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>
2011-08-31Add a top 'File' menuGravatar Linus Torvalds
It doesn't actually *do* anything, but what else is new? Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Do something half-way sane (no SIGSEGV) when there are no divesGravatar Linus Torvalds
It just leaves ugly blank areas, but whatever. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Start cleaning up dive accessorsGravatar Linus Torvalds
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>
2011-08-31Use a 'notebook' for Info vs ProfileGravatar Linus Torvalds
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>
2011-08-31Add some more dive info - and actually update itGravatar Linus Torvalds
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>
2011-08-31dive parsing: enforce maxdepth and dive durationGravatar Linus Torvalds
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>
2011-08-31dive profile plot: use saner minimum limitsGravatar Linus Torvalds
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>
2011-08-31plot a fancier 'filled' depth profileGravatar Linus Torvalds
Now I'm just dicking around with cairo. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Plot dive profile slightly more intelligently.Gravatar Linus Torvalds
This actually creates a bounding box and some scale markers. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Add fake 'info' frame contentsGravatar Linus Torvalds
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>
2011-08-31Use a gtk table instead of hboxGravatar Linus Torvalds
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>
2011-08-31Add 'repaint_dive()' prototype, and fix dependenciesGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Teach the thing to actually track the currently selected diveGravatar Linus Torvalds
.. 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>
2011-08-31Re-do the tree selection code with a selection callbackGravatar Linus Torvalds
Learnign gtk by looking at cairo examples? It's one way. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Don't newline-terminate the dive nameGravatar Linus Torvalds
That resulted in ugly lists, and it was wrong to begin with. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Split up divelist scroll window generation into its own fileGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Get rid of now unused 'show_dive()' functionGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Split up profile frame generation into its own file.Gravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31Draw some kind of profile for the (first) diveGravatar Linus Torvalds
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>
2011-08-31Fix depth parsingGravatar Linus Torvalds
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>
2011-08-30Make the dive list scrollable (and put it in a vbox)Gravatar Linus Torvalds
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>
2011-08-30Show the dives as a gtk list/tree widgetGravatar Linus Torvalds
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>
2011-08-30Generate a default name for a dive, if it doesn't have one alreadyGravatar Linus Torvalds
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>
2011-08-30Create a gtk windowGravatar Linus Torvalds
It doesn't *do* anything, but some day it will. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30Add .gitignore file for current stateGravatar Linus Torvalds
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30Start moving some of the non-parsing stuff out of 'parse.c'Gravatar Linus Torvalds
Create a 'main.c' with the main routine and argument "parsing" etc. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30Split up dive data structure declarations into 'dive.h'Gravatar Linus Torvalds
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>
2011-08-30Clean up dive reportingGravatar Linus Torvalds
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>
2011-08-30Add some more parsing functionsGravatar Linus Torvalds
.. 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>
2011-08-30Don't report dives as they are parsed: sort them at the end and report them thenGravatar Linus Torvalds
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>
2011-08-30Add 'datetime' parsing for libdivecomputer xml filesGravatar Linus Torvalds
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>
2011-08-30Fix up temperature conversionGravatar Linus Torvalds
Oops. No, the water temperature wasn't really 500 degC. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30Start actually reporting the numbers we parsedGravatar Linus Torvalds
.. 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>
2011-08-30Add 'verbose' flagGravatar Linus Torvalds
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>
2011-08-30Start parsing numeric fieldsGravatar Linus Torvalds
Depth, pressure, and sample times. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30Start parsing dive datesGravatar Linus Torvalds
.. only the suunto XML format, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30Move the "text" nodename hackery out of 'nodename()'Gravatar Linus Torvalds
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>
2011-08-30Fix stupid mis-initialization of current sampleGravatar Linus Torvalds
.. 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>
2011-08-30Start showing unparsed entriesGravatar Linus Torvalds
(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>
2011-08-30Fill in dummy parse target codeGravatar Linus Torvalds
.. 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>