]> git.tdb.fi Git - ext/subsurface.git/log
ext/subsurface.git
12 years agoRemove the ability to 'Import' .SDA files
Dirk Hohndel [Mon, 3 Oct 2011 15:27:36 +0000 (08:27 -0700)]
Remove the ability to 'Import' .SDA files

We can instead 'Open' these files as they are just bastardized XML files.

This gets us back to a more consistent point where 'Import' gets data
directly from the dive computer (and hopefully soon we will add the
ability to load a dive directly from a uemis SDA to libdivecomputer),
and 'Open' loads a file from the filesystem of the computer we are
running on (this last sentence phrased so awkwardly as the uemis Zurich
SDA is a computer and presents a file system when connected via USB - it
just doesn't have the dive data in an accessible format in that file
system).

As a bonus we get to throw away quite a bit of code (the uemis specific
file handling, mini-XML parser with helper functions, the file open dialog
in the importer). Yay!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoIntegrate loading of uemis SDA files into the regular xml parsing
Dirk Hohndel [Mon, 3 Oct 2011 04:59:54 +0000 (21:59 -0700)]
Integrate loading of uemis SDA files into the regular xml parsing

There are a few interesting issues with this:

- this requires a change to the SDA file format; thankfully I control that
  format, too (the default files are not valid XML files)
- once again, the fact that adding samples can change the dive pointer
  messes with me - I decided to change the interface of ALL of the
  XXX_dive_match functions to take a struct dive**
  I know this is not ideal as all the other functions don't need that -
  but I would have hated the inconsistency
- there is the issue that we now overload two _different_ uemis formats in
  the same function - that's certainly a potential point of confusion
- a minor detail is the problem that the SDA format is kinda odd to parse
  and that we trigger on the duration field by it being the only float.
  Yeah, that's not ideal - but again, I control the format, so I _know_
  this is true.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoFirst steps towards integrating SDA files into the default XML loading
Dirk Hohndel [Mon, 3 Oct 2011 00:47:20 +0000 (17:47 -0700)]
First steps towards integrating SDA files into the default XML loading

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoprepare_sample reallocs the dive - don't keep pointers around
Dirk Hohndel [Sun, 2 Oct 2011 17:30:02 +0000 (10:30 -0700)]
prepare_sample reallocs the dive - don't keep pointers around

Thanks Valgrind

This diff looks pointless at first until you see that I reference dive
again earlier in the loop and then after the end of the loop.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoWe forgot to pick up the 'value' field of a dive event
Linus Torvalds [Sat, 1 Oct 2011 04:55:51 +0000 (21:55 -0700)]
We forgot to pick up the 'value' field of a dive event

Just missed that one entirely in the xml parser for some reason.
Probably because the fields don't have much semantic meaning, so I
didn't even realize that I had missed one of the random integer values
in an event.

On my suunto, the 'value' field seems to contain things like the new
Oxygen percentage of a gas change event etc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDistinguish internally between min pressure and end pressure
Dirk Hohndel [Fri, 30 Sep 2011 13:49:24 +0000 (06:49 -0700)]
Distinguish internally between min pressure and end pressure

And don't artificially end dives on min pressure

This may be a problem for dive computers like Linus' Suunto Vyper Air
where the failure mode seems to be _high_ pressure readings (that's scary,
btw). If the transmitter fails at the end of the dive the pressure plot
ends with incorrect high pressure. But that's simply a bug with the dive
computer and not something that subsurface should hack around. Maybe we
should offer a way to edit the incorrect data points instead.

Always ending on the minimum pressure is definitely wrong as it causes
bogus plots when you do a valve shutdown during the dive (which means that
valid data gets plotted incorrectly).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoFix the profile coloring
Dirk Hohndel [Fri, 30 Sep 2011 05:49:12 +0000 (22:49 -0700)]
Fix the profile coloring

We were missing the last sample (which is usually a fast ascent).
Also, reduced the velocity smoothing to 15 seconds as the 30 seconds were
hiding too much valid information

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoCorrectly parse the braindamaged tank size information from uemis
Dirk Hohndel [Fri, 30 Sep 2011 05:12:42 +0000 (22:12 -0700)]
Correctly parse the braindamaged tank size information from uemis

Admittedly the cuft ratings are stupid, but still, it's not that hard.
In order to correctly describe a tank based on the cuft system you need to
know the cuft AND the working pressure. But the uemis Zurich always
assumes that the working pressure is 200bar. That's pretty close to
3000psi and therefore works "good enough" for Aluminum tanks - but in
general this will of course fail (e.g. for HP or LP tanks).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoFix uemis parser to work with base64 data that isn't a multiple of 3
Dirk Hohndel [Fri, 30 Sep 2011 01:01:58 +0000 (18:01 -0700)]
Fix uemis parser to work with base64 data that isn't a multiple of 3

I had forgotten the '=' sign as valid character in base64 code

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoYes Linus, gas pressure can indeed go up during a dive
Dirk Hohndel [Fri, 30 Sep 2011 00:45:26 +0000 (17:45 -0700)]
Yes Linus, gas pressure can indeed go up during a dive

At first glance it seems logical to make the ending pressure be the
lowest pressure observed during a dive. But if you do valve shut down
drills with a tech setup (where you have a fully redundant double
tank setup with two valves, two regulators and a manifold in between),
then you continue to breath from what is indeed the same "tank", but still
the valve on which your air pressure transmitter sits does get shut down
and de-pressurized. So your pressure goes down by quite a bit, and then
comes back up when the valve is turned back on.

And the ending pressure of the dive (which is used for things like the SAC
calculation) is indeed potentially higher than the lowest pressure
observed during a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoAllow larger tanks (change maximum from 200 to 300 cuft)
Dirk Hohndel [Fri, 30 Sep 2011 00:42:58 +0000 (17:42 -0700)]
Allow larger tanks (change maximum from 200 to 300 cuft)

We don't handle doubles any different than single tanks - so while
200 cuft was a sane maximum size for a tank, once you dive with
doubles this logic fails.

We may or may not decide to implement special handling for doubles at some
point, but for now simply allow for tanks all the way up to double-150.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoRemove average depth from print
Dirk Hohndel [Wed, 28 Sep 2011 22:53:16 +0000 (15:53 -0700)]
Remove average depth from print

It looks confusing in black and white

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMerge branch 'ui' of git://github.com/dirkhh/subsurface
Linus Torvalds [Wed, 28 Sep 2011 03:27:28 +0000 (20:27 -0700)]
Merge branch 'ui' of git://github.com/dirkhh/subsurface

* 'ui' of git://github.com/dirkhh/subsurface:
  The notebook pages can only be dropped back into the main notebook
  Linus would like to be less on the bleeding edge of Gtk+
  Use the correct signal to avoid Gtk-CRITICAL error message
  Clean up the drag and drop code and allow ripping off the Dive Profile

12 years agoThe notebook pages can only be dropped back into the main notebook
Dirk Hohndel [Wed, 28 Sep 2011 02:47:19 +0000 (19:47 -0700)]
The notebook pages can only be dropped back into the main notebook

Disable the secondary notebooks that are created when ripping off a page
(dive_list or dive_profile) as drop targets for other pages.

Also fix the incorrect arguments for the drag callback function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoLinus would like to be less on the bleeding edge of Gtk+
Dirk Hohndel [Wed, 28 Sep 2011 00:11:08 +0000 (17:11 -0700)]
Linus would like to be less on the bleeding edge of Gtk+

So we go back to the old interfaces to identify the notebook as part of
one group - the one that was just recently deprecated

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoUse the correct signal to avoid Gtk-CRITICAL error message
Dirk Hohndel [Wed, 28 Sep 2011 00:03:15 +0000 (17:03 -0700)]
Use the correct signal to avoid Gtk-CRITICAL error message

We used the wrong signal - "data-drag-received" is intended to check
whether the target will accept the drop. What we want is the "drag-drop"
signal which tells the widget that something was dropped on it.

Also fix an embarrassing lack of NULL pointer checks in my string
comparisons...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoClean up the drag and drop code and allow ripping off the Dive Profile
Dirk Hohndel [Tue, 27 Sep 2011 23:23:59 +0000 (16:23 -0700)]
Clean up the drag and drop code and allow ripping off the Dive Profile

Linus had used some deprecated interfcase and didn't correctly untangle
the new window that he created (hiding it the window... very nifty).

I think I'm closer to the real solution with a data structure that keeps
track of the components of the new top level window that I need to be able
to untangle (and eventually, destroy) at the end.

The one error I also can't seem to get rid of is the
Clean up the drag and drop code and allow ripping of the Dive Profile

Gtk-CRITICAL **: IA__gtk_selection_data_set: assertion `length <= 0' failed

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoAdd note on dive computers using the same import engine
Linus Torvalds [Tue, 27 Sep 2011 21:09:21 +0000 (14:09 -0700)]
Add note on dive computers using the same import engine

Lots of dive computers are just variations on a theme, or sometimes even
just rebadged copies of each others with different manufacturer and
model names.  The import dialog may not mention your exact dive computer
by name, but that doesn't necessarily mean that you cannot import data
from it.

Make that clearer in the README, and list the rough list of dive
computers supported by libdivecomputer.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd drag-n-drop support to be able to re-integrate the dive list
Linus Torvalds [Tue, 27 Sep 2011 19:54:53 +0000 (12:54 -0700)]
Add drag-n-drop support to be able to re-integrate the dive list

This is somewhat hacky, and there is clearly something I still don't
understand about gtk selections and drag-n-drop.  Dropping it back
works, but I get a nasty error when I do it:

   (subsurface:8512): Gtk-CRITICAL **: IA__gtk_selection_data_set: assertion `length <= 0' failed

even though I actually never set any selection at all directly.  So
there must be some internal gtk rule that I am violating, but I can't
see what it is.

I probably shouldn't commit it with a known ugly wart like that, but I
really have no clue.  Maybe somebody else can figure out what is up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't mark the divelist window transient
Linus Torvalds [Tue, 27 Sep 2011 18:38:31 +0000 (11:38 -0700)]
Don't mark the divelist window transient

That also makes it always stay in front of the other window, which is
just annoying.  I only did it because I wanted to make sure it dies when
the main window does, but since we just kill the main loop when closing
either window, that just isn't an issue.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'otu-tracking-v2' of git://github.com/dirkhh/subsurface
Linus Torvalds [Tue, 27 Sep 2011 18:05:39 +0000 (11:05 -0700)]
Merge branch 'otu-tracking-v2' of git://github.com/dirkhh/subsurface

* 'otu-tracking-v2' of git://github.com/dirkhh/subsurface:
  Store options in gconf
  Add preference option to chose if SAC and/or OTU should be in divelist

Fix up trivial conflicts in gtk-gui.c (cleanup in gtk dialog wrt
gtk_dialog_get_content_area() having introduced a new 'vbox' widget)

12 years agoA Makefile 'clean' target is quite standard.
Cristian Ionescu-Idbohrn [Tue, 27 Sep 2011 16:43:53 +0000 (18:43 +0200)]
A Makefile 'clean' target is quite standard.

Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStore options in gconf
Dirk Hohndel [Tue, 27 Sep 2011 17:46:59 +0000 (10:46 -0700)]
Store options in gconf

While it's not the most elegant way to do this I opted to store the
options with "inverted polarity" - i.e., the options that are supposed to
default to "True" are stored inverted since gconf reports an unset option
(first time the user runs the program) as "False".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMerge branch 'otu-tracking-v2' of git://github.com/dirkhh/subsurface
Linus Torvalds [Tue, 27 Sep 2011 17:46:42 +0000 (10:46 -0700)]
Merge branch 'otu-tracking-v2' of git://github.com/dirkhh/subsurface

* 'otu-tracking-v2' of git://github.com/dirkhh/subsurface:
  Make OTU column invisible by default
  Add OTU to divelist
  Calculate OTUs for every dive

Fix up trivial conflicts in dive.h (due to dive event handling also
adding a field to the dive structure)

12 years agoMake the dive list start as a plain notebook page
Linus Torvalds [Tue, 27 Sep 2011 17:38:07 +0000 (10:38 -0700)]
Make the dive list start as a plain notebook page

I've been wondering how to make 'subsurface' work better on a small
screen (I used to travel with a crappy netbook - I may have upgraded my
laptop since, but it is still a design goal of mine to make sure it all
works fine in that kind of environment).

And ever since the dive list was made much wider and moved below the
notebook, it's annoyed me how much room it all takes if I want to have
both a reasonable plot window and several dives visible at the same
time.

The solution seems to be to just make the dive list be a notebook page.
That makes the default layout very dense.

At the same time, when you have the pixels, it's horrible, because you
would want to see the dive list and move between dives while at the same
time also seeing the dive profile change.  But that is solvable by
simply making the dive list notebook page be detachable, so if you have
a nice big screen, just detach the dive list page and now you have
independent windows for the dive list and the dive info.

NOTE! I don't have any way to re-attach the dang thing.  I think I'd
need to learn about drag-and-drop targets etc.  So once you've detached
the dive list, it stays detached.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd preference option to chose if SAC and/or OTU should be in divelist
Dirk Hohndel [Tue, 27 Sep 2011 17:16:40 +0000 (10:16 -0700)]
Add preference option to chose if SAC and/or OTU should be in divelist

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMake OTU column invisible by default
Dirk Hohndel [Mon, 26 Sep 2011 23:05:24 +0000 (16:05 -0700)]
Make OTU column invisible by default

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoUpdate Mares IconHd parsing to current libdivecomputer interface
Linus Torvalds [Mon, 26 Sep 2011 20:14:41 +0000 (13:14 -0700)]
Update Mares IconHd parsing to current libdivecomputer interface

The libdivecomputer interfaces are pure crap.  There are no generic
"open the dive computer" or "create a parser for the dive computer"
interfaces, instead each dive computer you support has its own open and
parser generator interface.

And they change.  Happily fairly seldom, but they change.  And two days
ago, Jef changed the interface for the Mares Icon HD computer in order
to support the newer HD Net Ready variant.

I've asked Jef to make a sane interface for "open the dive computer" and
"just create the parser" for libdivecomputer, but he claims that he
cannot just track the device model details internally.  Which is
obviously a completely bogus claim, since the way *we* track the model
details is to just feed it back from the silly event.

libdivecomputer should just do that internally and not bother us with
its crazy internal model numbers.  But whatever.

In the meantime, work around this braindamage, and hope that
libdivecomputer comes to its senses some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStop libdivecomputer import when we start seeing old dives
Linus Torvalds [Mon, 26 Sep 2011 20:04:14 +0000 (13:04 -0700)]
Stop libdivecomputer import when we start seeing old dives

I don't know about other dive computers, but the Suunto Vyper Air is
slow as hell to import all the dives from.  And libdivecomputer seems to
be importing dives "most recent first", so this just makes it stop
importing dives when it finds a dive that we've already seen.

Caveat: libdivecomputer has this fancy notion of "dive fingerprints",
and claims that's the way to do things.  That seems to be overly
complicated, and not worth the bother.

If you worry about the import finishing early due to already having some
dives with the same date in your dive list, just import starting from an
empty state, and thus get a pure "dive computer only" state with no
early out.  Then you can just load the old dives afterwards, and depend
on subsurface merging any duplicates.

But for normal operation, when you just want to import a couple of new
dives from your dive computer, the "exit import early when you see a
duplicate" is the right thing to do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a copy of the GPL v2 to the project
Linus Torvalds [Mon, 26 Sep 2011 18:18:28 +0000 (11:18 -0700)]
Add a copy of the GPL v2 to the project

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd the version to the Makefile
Linus Torvalds [Mon, 26 Sep 2011 18:04:50 +0000 (11:04 -0700)]
Add the version to the Makefile

Not quite the same format as for the kernel, but I want to do the normal
"edit the makefile before making a release" model that I'm used to.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUpdate README to reflect the fact that /dev/ttyUSB0 is no longer hardcoded
Linus Torvalds [Mon, 26 Sep 2011 17:06:00 +0000 (10:06 -0700)]
Update README to reflect the fact that /dev/ttyUSB0 is no longer hardcoded

Yay.  It's not like we're all done, but the hardcoded dive computer
location was one of those "I don't want to release 1.0 with this".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a GtkEntry to allow editing of the device name
Linus Torvalds [Mon, 26 Sep 2011 16:44:27 +0000 (09:44 -0700)]
Add a GtkEntry to allow editing of the device name

Ok, so some file chooser widget with a popup dialog would have been more
professional, but I'm lazy.  Plus I suspect the popup would look
horrible when populated with /dev entries, and I don't think there is
any sane filter function.

So this works, and means that you don't *have* to recompile the whole
program just because you have your dive computer on something else than
a USB serial line.

I suspect I should save the default name as a config variable too.
Maybe a setting in the preferences dialog.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a "Dive Computer" frame around the dive computer choice in import
Linus Torvalds [Mon, 26 Sep 2011 16:19:30 +0000 (09:19 -0700)]
Add a "Dive Computer" frame around the dive computer choice in import

I'll add a widget to allow the user to select the device too, so let's
name things to make them more obvious.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd a xml file filter to the file open dialog
Linus Torvalds [Mon, 26 Sep 2011 16:18:23 +0000 (09:18 -0700)]
Add a xml file filter to the file open dialog

My home directory is a mess.  Don't show all the crap, just the stuff
that might be relevant.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd an 'About' dialog
Linus Torvalds [Sat, 24 Sep 2011 22:48:13 +0000 (15:48 -0700)]
Add an 'About' dialog

It's really just about the logo, but whatever.  Dirk tells me I need one
of these in order to call it 1.0.  And I'm not going to fall into the
trap of thinking that 1.0 needs to be something polished, it just needs
to be working well enough..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse 'gtk_dialog_get_content_area()' instead of accessing dialog directly
Linus Torvalds [Sat, 24 Sep 2011 22:26:37 +0000 (15:26 -0700)]
Use 'gtk_dialog_get_content_area()' instead of accessing dialog directly

I'm reading gtk docs, and trying to clean things up a bit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoShow events on the dive profile
Linus Torvalds [Fri, 23 Sep 2011 04:15:36 +0000 (21:15 -0700)]
Show events on the dive profile

This is *really* ugly.  We really should just create some kind of widget
that when moused over will show the event.  Or something.  Rather than
putting text on top of other text: the events - when they happen - are
usually bunched together (PO2 warnings, max depth, fast ascent leading
to mandatory safety stop, you name it).

But at least this way we see that the data is there, even if we see it
in ugly ways.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd cheesy "install" target
Linus Torvalds [Fri, 23 Sep 2011 03:59:10 +0000 (20:59 -0700)]
Add cheesy "install" target

It just puts the subsurface binary in $(HOME)/bin.

.. and then the binary won't find the icon file, so this is really not
enough of an install to get it really working, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDrop surface events when reading from an XML file too
Linus Torvalds [Fri, 23 Sep 2011 03:51:03 +0000 (20:51 -0700)]
Drop surface events when reading from an XML file too

Remember those useless surface events that we ignore when we import a
dive from a dive computer? Yeah, they exist in the libdivelog xml files
too.  So ignore them when we see them there too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge latitude and longitude data properly
Linus Torvalds [Fri, 23 Sep 2011 03:50:07 +0000 (20:50 -0700)]
Merge latitude and longitude data properly

When merging two identical dives and one of them has lat/long data, pick
it up correctly for the merged dive.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge dive events correctly too
Linus Torvalds [Fri, 23 Sep 2011 03:28:04 +0000 (20:28 -0700)]
Merge dive events correctly too

It's very similar to the sample merging.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart handling dive events
Linus Torvalds [Fri, 23 Sep 2011 01:02:54 +0000 (18:02 -0700)]
Start handling dive events

Parse them, save them, take them from libdivecomputer.

This doesn't merge them or show them in the profile yet, though.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoProperly merge dive buddies and divemaster information
Linus Torvalds [Fri, 23 Sep 2011 01:01:01 +0000 (18:01 -0700)]
Properly merge dive buddies and divemaster information

When we merge dives, we didn't merge these fields properly. Do it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoImprove libdivecomputer event printout
Linus Torvalds [Thu, 22 Sep 2011 23:55:55 +0000 (16:55 -0700)]
Improve libdivecomputer event printout

Ignore surface events - they are meaningless anyway and just add noise.

Print out other events properly, including correct time offset etc.

We still don't actually *save* the events, but now it might be worth
doign so.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoClean up event handling from libdivecomputer
Linus Torvalds [Thu, 22 Sep 2011 23:45:28 +0000 (16:45 -0700)]
Clean up event handling from libdivecomputer

This just moves the event handling out into its own helper function.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix progress bar during libdivecomputer imports
Linus Torvalds [Thu, 22 Sep 2011 23:38:24 +0000 (16:38 -0700)]
Fix progress bar during libdivecomputer imports

As reported by Mauro Dreissig, the progress bar doesn't work and causes
a SIGSEGV due to a missing allocation.  The code broke when Dirk
separated out the GUI from the core code, and I hadn't tried
divecomputer downloads since.

Reported-by: Mauro Dreissig <mukadr@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd OTU to divelist
Dirk Hohndel [Thu, 22 Sep 2011 21:02:26 +0000 (14:02 -0700)]
Add OTU to divelist

and change OTUs to be tracked as int, not double

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoCalculate OTUs for every dive
Dirk Hohndel [Thu, 22 Sep 2011 20:45:53 +0000 (13:45 -0700)]
Calculate OTUs for every dive

The calculation assumes that the cylinderindex in each sample tells us
which PO2 the dive was breathing at that time. This needs to be verified
with dives where there is an actual gas switch.

No idea where to display them, yet. Far fewer people will care about this
than care about SAC - does this still rate a spot in the dive_list?
I guess I could make it part of the dive_info - but it's not editable.
It doesn't seem to fit with the equipment page (even though this is the
one editable field that is related - nitrox %)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoUpdate the README a bit
Linus Torvalds [Thu, 22 Sep 2011 22:20:26 +0000 (15:20 -0700)]
Update the README a bit

Update for the current library situation, and notes about
libdivecomputer installation location.

And remove the "we don't interface directly with libdivecomputer", since
that is obviously not true any more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'alignment-change' of git://github.com/dirkhh/subsurface
Linus Torvalds [Thu, 22 Sep 2011 19:56:47 +0000 (12:56 -0700)]
Merge branch 'alignment-change' of git://github.com/dirkhh/subsurface

* 'alignment-change' of git://github.com/dirkhh/subsurface:
  Minor change to the alignment of the divelist columns

12 years agoMinor change to the alignment of the divelist columns
Dirk Hohndel [Thu, 22 Sep 2011 19:25:44 +0000 (12:25 -0700)]
Minor change to the alignment of the divelist columns

Just seems to look nicer this way. And actually implements consistent
alignment management for the columns to begin with.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoClean up library handling
Linus Torvalds [Thu, 22 Sep 2011 19:21:20 +0000 (12:21 -0700)]
Clean up library handling

.. and pick up libusb-1.0 automatically if it's installed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPut the location last in the dive list
Linus Torvalds [Thu, 22 Sep 2011 18:02:28 +0000 (11:02 -0700)]
Put the location last in the dive list

The whole auto-expansion of an entry in the middle thing really doesn't
work very well in gtk. Give up on it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPut the default focus on the dive list at startup
Linus Torvalds [Thu, 22 Sep 2011 17:28:57 +0000 (10:28 -0700)]
Put the default focus on the dive list at startup

This is some crazy stuff.  Apparently the only sane way to do this is by
hooking into the "realize" callback for the dive list widget.

Whatever. Dirk did the googling to figure this all out.

Suggested-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix up some minor whitespace issues
Linus Torvalds [Thu, 22 Sep 2011 15:21:32 +0000 (08:21 -0700)]
Fix up some minor whitespace issues

Dirk clearly isn't as anal as I am about pretty whitespace.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSelect the first dive after filling the dive list
Linus Torvalds [Thu, 22 Sep 2011 15:19:34 +0000 (08:19 -0700)]
Select the first dive after filling the dive list

We should always strive to have a dive selected, so pick the first one
(that was how the dive list logic worked anyway, it just wasn't truly
selected at the tree-view level, so it wasn't *visibly* the selected
dive).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMake the dive list searching act on the location
Linus Torvalds [Thu, 22 Sep 2011 15:17:23 +0000 (08:17 -0700)]
Make the dive list searching act on the location

It used to be "index 0" which originally was the date string, but not
only has that changed (it's now just the dive index), it's kind of
pointless to search for a date string.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoDon't do individual 'gtk_widget_show()' calls
Linus Torvalds [Thu, 22 Sep 2011 15:12:55 +0000 (08:12 -0700)]
Don't do individual 'gtk_widget_show()' calls

This is left-overs from an earlier age when we did this.  But we just do
the "show_all" at the end.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoIn divelist maxdepth column, only show depth unit
Linus Torvalds [Thu, 22 Sep 2011 15:11:12 +0000 (08:11 -0700)]
In divelist maxdepth column, only show depth unit

Show "m" or "ft" instead of "max/m" vs "max/ft".  The column really
doesn't want to be that wide.  The column header is already the widest
part of it even with this short name (due to the sort order arrow
thing).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoIn summary printout, show divemaster if there was no buddy
Linus Torvalds [Thu, 22 Sep 2011 15:09:21 +0000 (08:09 -0700)]
In summary printout, show divemaster if there was no buddy

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge branch 'quit-handling' of git://github.com/dirkhh/subsurface
Linus Torvalds [Wed, 21 Sep 2011 19:28:20 +0000 (12:28 -0700)]
Merge branch 'quit-handling' of git://github.com/dirkhh/subsurface

* 'quit-handling' of git://github.com/dirkhh/subsurface:
  Use the last (or only) filename on command line as default for saving
  Show the "save changes" dialog before the main window is destroyed
  Check for changes at regular 'quit' events as well
  Catch changes to the info of the current dive when quitting
  Tracking changes to tanks is trivial
  Simplistic first attempt to get changes saved when quitting subsurface

12 years agoSmall printing tweaks
Linus Torvalds [Wed, 21 Sep 2011 19:16:08 +0000 (12:16 -0700)]
Small printing tweaks

It's getting to the point where I'm happy with this.  This just makes
the spacing between the location and the notes a bit bigger to visually
separate them more, and adds units ("min") to the dive duration (and
removes the seconds, that really didn't make any sense at an overview
level).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd helper function for doing depth unit calculations
Linus Torvalds [Wed, 21 Sep 2011 19:12:54 +0000 (12:12 -0700)]
Add helper function for doing depth unit calculations

.. and use it for printing too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix dive location width problem
Linus Torvalds [Wed, 21 Sep 2011 18:54:18 +0000 (11:54 -0700)]
Fix dive location width problem

For really long dive locations, we now limit the width to the same size
as the date and time, and force it to a single line - with an ellipsis
if it ends up being too big.

Also, since we no longer use any markup anywhere, we migth as well show
the dive buddy information too, as we don't need no stinking quoting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoUse the last (or only) filename on command line as default for saving
Dirk Hohndel [Wed, 21 Sep 2011 04:50:26 +0000 (21:50 -0700)]
Use the last (or only) filename on command line as default for saving

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoShow the "save changes" dialog before the main window is destroyed
Dirk Hohndel [Wed, 21 Sep 2011 17:31:03 +0000 (10:31 -0700)]
Show the "save changes" dialog before the main window is destroyed

By using the delete-event callback instead of the destroy callback we are
able to display our dialog (and the file-save dialog) while the program
window is still being displayed. Much nicer this way.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoCheck for changes at regular 'quit' events as well
Dirk Hohndel [Wed, 21 Sep 2011 17:16:33 +0000 (10:16 -0700)]
Check for changes at regular 'quit' events as well

Also make the dialog box less offensively ugly

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoCatch changes to the info of the current dive when quitting
Dirk Hohndel [Wed, 21 Sep 2011 14:34:00 +0000 (07:34 -0700)]
Catch changes to the info of the current dive when quitting

As the application shuts down we do one more check to see if the dive that
is currently being displayed has been modified (we previously just checked
as we switch dives)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoTracking changes to tanks is trivial
Dirk Hohndel [Wed, 21 Sep 2011 04:37:49 +0000 (21:37 -0700)]
Tracking changes to tanks is trivial

That's the one I should have started with.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoSimplistic first attempt to get changes saved when quitting subsurface
Dirk Hohndel [Wed, 21 Sep 2011 04:29:09 +0000 (21:29 -0700)]
Simplistic first attempt to get changes saved when quitting subsurface

Track whether things changed in the global dive_list

So far this actually works if changing dive info (but only if dive
selected was changed after the dive info was changed).

We are not tracking changes to the cylinder information, yet.

also remove the duplicate static dive_list

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoDo the pango text layout in multiple chunks
Linus Torvalds [Wed, 21 Sep 2011 17:27:21 +0000 (10:27 -0700)]
Do the pango text layout in multiple chunks

This way we can avoid the need for quoting, since we can just use text
rendering instead of markup for the free-form fields.  And we will want
to make the pango layout width different for the date and location,
since we want to fit the depth/duration to the right of them.

I still haven't set the different width for the date/location, but this
at least is going in the rigth direction.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSue me: I'm not a fan of Serif
Linus Torvalds [Wed, 21 Sep 2011 17:07:35 +0000 (10:07 -0700)]
Sue me: I'm not a fan of Serif

The default cairo font seems to be sans, but the default pango font is
serif.  Maybe it has something to do with my system font settings, but I
doubt it: my desktop font settings are all sans-serif.  So I think pango
is just showing bad taste.

Anyway, this just hardcodes the font to "Sans".  Maybe somebody wants to
make this all part of preferences some day, or pick it from their
desktop font preferences.  In the meantime, just fix the pango brain-damage.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix array underrun when calculating velocity
Linus Torvalds [Wed, 21 Sep 2011 15:29:08 +0000 (08:29 -0700)]
Fix array underrun when calculating velocity

That code is messy. And it was buggy. Noticed by valgrind.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix up printing some more
Linus Torvalds [Wed, 21 Sep 2011 15:21:14 +0000 (08:21 -0700)]
Fix up printing some more

This makes things slightly prettier and adds back the depth and duration
details to the printout.

Still a few known problems: font choice, and the depth/duration thing
can end up overlapping with a long location name.  But it looks pretty
good on the whole.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSeptember comes before October
Tero Roponen [Wed, 21 Sep 2011 12:44:34 +0000 (15:44 +0300)]
September comes before October

This patch fixes the ordering of month names.

Signed-off-by: Tero Roponen <tero.roponen@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix 'struct plot_info' memory leak
Linus Torvalds [Wed, 21 Sep 2011 05:47:12 +0000 (22:47 -0700)]
Fix 'struct plot_info' memory leak

The plot_info was never freed, so every time you'd plot something, we'd
leak memory.

I'm running valgrind to see if there's anything bad going on.  So far it
all looks fairly benign.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPrinting: use pango markup for text generation
Linus Torvalds [Wed, 21 Sep 2011 05:09:38 +0000 (22:09 -0700)]
Printing: use pango markup for text generation

This gets us text wrapping etc.  I think I have some serious memory leak
somewhere, though, because if I print out all my dives it eventually
ends up with broken dives and doesn't complete.  But I am going to
commit this as a "it kind of works" point.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd completely BS dive text printing
Linus Torvalds [Wed, 21 Sep 2011 02:30:38 +0000 (19:30 -0700)]
Add completely BS dive text printing

The layout is crap, the handling of long lines in notes (or location) is
wrong, the dive number handling is wrong.

The thing is just a toy.

But it's a toy that kind of works, and gives a much better idea of what
a real dive log printout might look like.  With the right kind of dive
notes, it looks fine.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoTry printing six dives per page
Linus Torvalds [Wed, 21 Sep 2011 01:13:11 +0000 (18:13 -0700)]
Try printing six dives per page

Ok, so this may be too much, but I'm just playing around with layout.
It could be a runtime choice too, of course.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix up printing some more
Linus Torvalds [Wed, 21 Sep 2011 00:52:04 +0000 (17:52 -0700)]
Fix up printing some more

Use the actual degree sign for temperatures (°F and °C), and make sure
everything uses the proper "set_source_rgb[a]()" wrappers to set the
colors.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoPrint out only simplified depth profile
Linus Torvalds [Wed, 21 Sep 2011 00:20:54 +0000 (17:20 -0700)]
Print out only simplified depth profile

None of the colors, nothing like that.  Just a gray fill and a plain
black depth line.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoClean up and simplify depth plot
Linus Torvalds [Wed, 21 Sep 2011 00:17:30 +0000 (17:17 -0700)]
Clean up and simplify depth plot

Dirk wrote this before we have the 'plot_info' structure with the
cleaned-up dive info.  No need to maintain that separate array of depths
and seconds.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoStart fleshing out the dive printing a bit more
Linus Torvalds [Tue, 20 Sep 2011 23:46:28 +0000 (16:46 -0700)]
Start fleshing out the dive printing a bit more

Four dives per page sounds good.  Maybe even six? But dangit, the
default font choice for cairo printing sucks.  And I need to learn about
pango for actually printing the dive info.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org
12 years agoDon't show the smoothed dive profile or the min/max info
Linus Torvalds [Tue, 20 Sep 2011 23:45:33 +0000 (16:45 -0700)]
Don't show the smoothed dive profile or the min/max info

It was good for debugging, it's not something we really want to show people.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix divelist sorting
Linus Torvalds [Tue, 20 Sep 2011 21:10:28 +0000 (14:10 -0700)]
Fix divelist sorting

That was stupid.  The divelist column generation cleanup (commit
d3feb78df527: "Make helper function for creating TreeView columns in the
dive list") had a but too much copy-paste going on, and didn't always
have the right column indexes..  t still *looked* right, but sorting
didn't work at all.

Reported-by: Chris Lewis <chrislewis915@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix preferences dialog
Linus Torvalds [Tue, 20 Sep 2011 21:05:46 +0000 (14:05 -0700)]
Fix preferences dialog

Dirk took some old code when he did the merge of the newly split gui
code. Fix it up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoSeparate out the UI from the program logic
Dirk Hohndel [Tue, 20 Sep 2011 19:40:34 +0000 (12:40 -0700)]
Separate out the UI from the program logic

The following are UI toolkit specific:
gtk-gui.c   - overall layout, main window of the UI
divelist.c  - list of dives subsurface maintains
equipment.c - equipment / tank information for each dive
info.c      - detailed dive info
print.c     - printing

The rest is independent of the UI:
main.c i    - program frame
dive.c i    - creates and maintaines the internal dive list structure
libdivecomputer.c
uemis.c
parse-xml.c
save-xml.c  - interface with dive computers and the XML files
profile.c   - creates the data for the profile and draws it using cairo

This commit should contain NO functional changes, just moving code around
and a couple of minor abstractions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMake the divelist font configurable
Linus Torvalds [Tue, 20 Sep 2011 18:24:15 +0000 (11:24 -0700)]
Make the divelist font configurable

Instead of the hardcoding to "Sans 8", allow people to set it in the
preferences.

Also, make the unit choice be a frame in the preferences dialog instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge git://github.com/sirowain/subsurface
Linus Torvalds [Tue, 20 Sep 2011 17:12:24 +0000 (10:12 -0700)]
Merge git://github.com/sirowain/subsurface

* git://github.com/sirowain/subsurface:
  Fix Segmentation fault when trying to print an empty plot.
  Provide an icon for subsurface.
  Added a comment about libusb dependency in Makefile.

12 years agoMerge branch 'for-linus' of git://github.com/dirkhh/subsurface
Linus Torvalds [Tue, 20 Sep 2011 17:08:27 +0000 (10:08 -0700)]
Merge branch 'for-linus' of git://github.com/dirkhh/subsurface

* 'for-linus' of git://github.com/dirkhh/subsurface:
  Attempt to get the location column to resize in a sensible way
  Minor tweaks to column headers

[ Fixed up minor semantic merge conflict due to the change to make
  'dive_list' internal to divelist.c ]

12 years agoMake 'struct DiveList' entirely internal to divelist.c
Linus Torvalds [Tue, 20 Sep 2011 17:06:24 +0000 (10:06 -0700)]
Make 'struct DiveList' entirely internal to divelist.c

Passing it around is just annoying, and we only ever have one.  Let's
not burden all the users with the silly thing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAdd "Apply"/"Cancel" buttons to dive equipment page
Linus Torvalds [Tue, 20 Sep 2011 16:53:45 +0000 (09:53 -0700)]
Add "Apply"/"Cancel" buttons to dive equipment page

It's too damn easy to make mistakes and not even notice them (odd gtk
widget selection and keyboard input), or just start editing a cylinder
thing and realize it was wrong.

So instead of always saving the equipment information implicitly, add
explicit "Apply" and "Cancel" buttons that save the information (or
re-load it from the dive data structure)

So now you need to press an extra button for your changes to *really*
take effect.  It can be a bit annoying, but it's better than the silent
accidental equipment change that could happen before.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoAttempt to get the location column to resize in a sensible way
Dirk Hohndel [Tue, 20 Sep 2011 16:57:38 +0000 (09:57 -0700)]
Attempt to get the location column to resize in a sensible way

Previously the SAC column was the one that expanded which is silly

We also used to cut the location off at 16 characters

Now we try to make the location the one that expands and allow up to 40
characters, but there's something broken, still. If you manually shrink
the location column to its minimum size then subsequently resizing the
window gets the desired behavior. But if you don't manually resize the
location column it doesn't shrink correctly for windows that are smaller
than the space we need for all columns to fully display (instead we get a
horizontal scrollbar)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMinor tweaks to column headers
Dirk Hohndel [Tue, 20 Sep 2011 16:56:46 +0000 (09:56 -0700)]
Minor tweaks to column headers

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
12 years agoMake a separate "Log" menu
Linus Torvalds [Tue, 20 Sep 2011 16:37:37 +0000 (09:37 -0700)]
Make a separate "Log" menu

Instead o fhaving everything in the "File" menu, make a separate menu
for things that are very much specific about divelogs, rather than
"generic" things like open/save/import.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoFix Segmentation fault when trying to print an empty plot.
Riccardo Albertini [Tue, 20 Sep 2011 12:44:45 +0000 (14:44 +0200)]
Fix Segmentation fault when trying to print an empty plot.

When printing an empty plot, the function was missing nullability check for 'current_dive'. Now the print of an empty plot results with an empty blank page.
A better solution could be making unsensitive the Print entry in the menu, until a plot is loaded.

Signed-off-by: Riccardo Albertini <ssirowain@gmail.com>
12 years agoProvide an icon for subsurface.
Riccardo Albertini [Tue, 20 Sep 2011 10:32:40 +0000 (12:32 +0200)]
Provide an icon for subsurface.

I designed a simple blue icon for subsurface with a diver in the middle.
As suggested by Dirk Hohndel, I added the surface line above diver's head,
so that now the icon reflects better the new application name.

Signed-off-by: Riccardo Albertini <ssirowain@gmail.com>
12 years agoAdded a comment about libusb dependency in Makefile.
Riccardo Albertini [Tue, 20 Sep 2011 10:22:45 +0000 (12:22 +0200)]
Added a comment about libusb dependency in Makefile.

Due to libdivecomputer's dependency, can be necessary to add libusb to pkg-config in order to compile,
so I exported the pkg-config line in the subsurface target to LIBS variable, and added a comment about libusb.

Signed-off-by: Riccardo Albertini <ssirowain@gmail.com>
12 years agoReinstate the main window title
Linus Torvalds [Tue, 20 Sep 2011 05:09:47 +0000 (22:09 -0700)]
Reinstate the main window title

It got removed by some of my overly aggressive cleanup in commit
fefcbf125e89 ("Remove dive info frame") because the dive info frame
initialization also initialized the main window title..

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