Commit graph

4091 commits

Author SHA1 Message Date
Linus Torvalds
75cb94f067 Clean up type handling of cylinder pressure plot
Soon we'll show things in psi or bar depending on user choice.  Let's
not get confused about units before we do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 19:14:56 -07:00
Linus Torvalds
05857e0a05 Start "output unit management" support
This doesn't actually *do* anything yet, but it introduces the notion of
output units, and allows you to pick metric or imperial.

Of course, since the output doesn't currently care, the units you pick
are irrelevant.  But just wait..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 19:07:17 -07:00
Dirk Hohndel
a5a3cba574 Fix drawing artifacts with dives that have samples past the dive duration
The UEMIS Zurich SDA keeps recording samples for quite a while after the
dive ended.  These provide no additional information, but confuse our
drawing algorithm as they can cause us to draw both the depth and tank
pressure plots beyond the right edge of our canvas.

Stop drawing if sample->time.seconds is larger than dive->duration.seconds.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 18:37:57 -07:00
Linus Torvalds
d314b05301 Minimally parse some UDDF format dives
Dive dates (at least partial parsing), depths and times.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 17:33:52 -07:00
Linus Torvalds
4d19f42a4e Add framework for UDDF importer
There are several sample UDDF files around on the net, so we might as
well start importing some of it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 17:01:28 -07:00
Linus Torvalds
0e3bbd4102 Use 'cairo_translate()' instead of manual translation
I'd like to do 'cairo_scale()' too, but that messes up line sizes.  I'll
think about it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 15:41:02 -07:00
Linus Torvalds
dbfce3035e Merge branch 'dirk'
* dirk:
  Print starting and ending pressures

Fix up conflicts in profile.c due to different ways to set the text
formatting.  Dirk's 'text_format_options' thing is prettier than mine.
Use it.
2011-09-06 15:17:24 -07:00
Dirk Hohndel
dfe5133b57 Print starting and ending pressures
This is very simplistic as far as placement of the text goes.
It makes the plot_text function somewhat more generic.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 15:13:00 -07:00
Linus Torvalds
b6590150d6 Add some information about properly formatted commit messages
It does seem like a lot of github users are not used to good commit
message rules, and may never have used git for a project that actually
cares about good logs and nice summary lines.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 14:58:05 -07:00
Linus Torvalds
454a456172 Merge branch 'patch-1' of git://github.com/schacon/diveclog
* 'patch-1' of git://github.com/schacon/diveclog:
  Add more explicit contributing explanation
2011-09-06 14:54:06 -07:00
Linus Torvalds
93c21a4dbc Add some air usage statistics to the dive plot
Show "absolute volume" used, and SAC/m (surface-equivalent per minute).

I'm not going to guarantee the calculations.  And I show the result in
cubic feet.  Sue me.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 14:46:46 -07:00
Linus Torvalds
e88695ff72 Do cylinder pressure plot first, then depth, then text notes
Text notes need to be last, so that they don't get stepped on by the
other graph elements.

Also, separate the depth text plot out into a function of its own.
Tidier that way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 12:36:52 -07:00
Scott Chacon
dfa6a6e1d1 Add more explicit contributing explanation
Most developers on GitHub are not used to projects that use the Signed-off-by convention.
They do, however, tend to read the READMEs to see which conventions the author prefers
to follow.  If you are explicit about what you prefer in the README with easy to follow
instructions, it is more likely people will follow those conventions.

Signed-off-by: Scott Chacon <schacon@gmail.com>
2011-09-06 12:33:52 -07:00
Linus Torvalds
c0a429457a Tweak the "show depth in text" heuristic a bit
Use a 10-minute window *or* when the depth has reversed sufficiently to
make the max we've found interesting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 12:16:39 -07:00
Linus Torvalds
3b67a3ecb4 Plot some numerical depth markers
Add some actual numbers to the depth plot too.  Do it by finding the
deepest points (within a five-minute rolling window), and show the
depths of those points.

Sure, we could have just labeled the depth markers, but this seems
nicer. But what do I know - I'm not exactly famous for my GUI design.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 10:25:01 -07:00
Dirk Hohndel
d4db3e938b Fix drawing artifact with UEMIS xml data
Only draw the pressure line to the final data point
(duration / end.mbar) if we haven't already drawn samples
past that point (as the UEMIS records pressure data for a
number of additional samples after the actual dive has ended)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[ Changed to use 'last actual drawn sample time that had pressure
  data' instead of 'last sample time'  - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 07:30:48 -07:00
Linus Torvalds
f7a36cfefd Repaint the dives in dive_list_update_dives() instead of in callers
Each caller ends up needing it, and I missed another one.  So rather
than update the other caller, just do it in dive_list_update_dives() and
we can stop worrying about it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 20:50:52 -07:00
Dirk Hohndel
98d556c6f6 update UEMIS date_time parsing
Looks like Linus misinterpreted the first UEMIS xml files I sent him.

The date_time appears to be in local time - so the time zone info can be
ignored (that seems strange, but it worked for the dives I tested it
with)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 20:41:59 -07:00
Linus Torvalds
3cb360b514 Update dive info and profile after loading files
We did this when loading from the command line, but not when loading
through the file load menu item.

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 20:39:55 -07:00
Linus Torvalds
c24fd4b82c Merge branch 'open-files' of git://github.com/nathansamson/diveclog
* 'open-files' of git://github.com/nathansamson/diveclog:
  Report errors when opening files
  Make it possible to load multiple files at once.
  Open File works. I refactored the code and introduced a new type. I never used it as a pointer (their was no real reason), but I'm not really satisfied.
2011-09-05 14:44:27 -07:00
Linus Torvalds
8197d7f4d4 Add support from importing from Diving Log xml files
This is just a very rough draft.  It imports all the main stuff I
noticed, but I'm sure it drops a ton of other stuff.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 14:29:08 -07:00
Linus Torvalds
89593a542a Make the import source an enumeration
Instead of having each import source recognition routine set a separate
flag for that import source, just enumerate them and set them in one
variable.

I'm adding yet another xml importer - divinglog.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 13:45:14 -07:00
Nathan Samson
11becb8750 Report errors when opening files
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05 22:15:30 +02:00
Nathan Samson
65ef1bae20 Make it possible to load multiple files at once.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05 22:15:14 +02:00
Nathan Samson
21204926df Open File works. I refactored the code and introduced a new type. I never used it as a pointer (their was no real reason), but I'm not really satisfied.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05 21:12:58 +02:00
Linus Torvalds
4f5e3a06ab Parse Uemis cylinder data correctly.
There's a big comment there now about what is going on.  It took me a
while to understand how the crazy seven-tank uemis dive computer
information actually works.

So the Uemis computer has 4 different "tank profiles":
 - single tank air (0)
 - single tank nitrox (1)
 - two-tank nitrox (2)
 - three-tank nitrox (3)
and the computer always lists all seven tank cases (because that's how
you fill them in).

Depending on the "gas.template" you are supposed to then *use* just one
particular profile.  Why the computer doesn't just give you the tanks
for that one profile, who knows? It seems to be more of the same "Uemis
dive data isn't so much about the dive, it's about dive computer state"
mentality.

So we first get the profile information, and then based on that we need
to pick the right tanks from the set of seven that we're presented with.

All clear?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 10:58:53 -07:00
Linus Torvalds
04c98344b3 Turn dive depth, temperature and duration into xml attributes
This makes the xml save-file look way nicer: it's both smaller and
better organized.  Using individual xml nodes for random small details
is silly.

The duration even parses exactly the same, because it still ends up
being '.depth.duration' (now it's the 'duration' attribute of the dive
node, it used to be the 'duration' child node of the dive node).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 09:48:11 -07:00
Linus Torvalds
5f79a804b9 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>
2011-09-05 09:12:54 -07:00
Nikola Kotur
0f832f15d1 Comment typo fix
Signed-off-by: Nikola Kotur <kotnick@gmail.com>
2011-09-05 15:34:22 +02:00
Linus Torvalds
13a6d0c4c2 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>
2011-09-04 15:18:58 -07:00
Linus Torvalds
5c6aa56ff1 Merge branch 'more-divelist-goodness' of https://github.com/nathansamson/diveclog
* 'more-divelist-goodness' of https://github.com/nathansamson/diveclog:
  Right align the numbers
2011-09-04 15:15:46 -07:00
Linus Torvalds
d8cca5bed3 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>
2011-09-04 15:14:14 -07:00
Linus Torvalds
c66d60efa1 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>
2011-09-04 15:14:14 -07:00
Linus Torvalds
85921592b0 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>
2011-09-04 15:14:14 -07:00
Linus Torvalds
e58fa7b9b5 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>
2011-09-04 14:56:01 -07:00
Nathan Samson
5f7835a391 Right align the numbers
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 23:09:19 +02:00
Linus Torvalds
e007e70053 Merge branch 'ui-tweaks' of https://github.com/nathansamson/diveclog
* 'ui-tweaks' of https://github.com/nathansamson/diveclog:
  Some UI beauty patches:
2011-09-04 13:49:45 -07:00
Linus Torvalds
f8de487c2f 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>
2011-09-04 13:34:22 -07:00
Nathan Samson
6b075e0339 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>
2011-09-04 22:15:55 +02:00
Linus Torvalds
f448b68de0 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>
2011-09-04 13:06:47 -07:00
Linus Torvalds
aab4d593bd 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>
2011-09-04 12:19:20 -07:00
Linus Torvalds
230a13476d 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
2011-09-04 11:49:49 -07:00
Linus Torvalds
550eb862fa 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 9961c7f89c: "Remove redundant temperature readings").
2011-09-04 11:46:39 -07:00
Linus Torvalds
0917436729 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>
2011-09-04 11:34:50 -07:00
Linus Torvalds
ecff0922d4 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>
2011-09-04 11:34:44 -07:00
Linus Torvalds
9961c7f89c 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>
2011-09-04 11:20:27 -07:00
Nathan Samson
31123f63af Split the dive list in columns. Columns are sortable now (name = date, depth, duration)
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 20:14:39 +02:00
Hylke Bons
c4514b062a 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>
2011-09-04 19:37:23 +02:00
Nathan Samson
bcf12edfe9 Merge branch 'master' into ui-improvements 2011-09-04 19:06:47 +02:00
Linus Torvalds
23a6607ae7 Fix typo in Makefile (LDLAGS -> LDFLAGS)
Reported-by: Konrad Delong <https://github.com/konryd>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 10:01:37 -07:00