Commit graph

9982 commits

Author SHA1 Message Date
Linus Torvalds
da47ee401d 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>
2011-09-26 09:44:27 -07:00
Linus Torvalds
acca9b1804 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>
2011-09-26 09:19:30 -07:00
Linus Torvalds
c3a4844197 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>
2011-09-26 09:18:23 -07:00
Linus Torvalds
d81553e151 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>
2011-09-24 15:48:13 -07:00
Linus Torvalds
f12684dcd7 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>
2011-09-24 15:26:37 -07:00
Linus Torvalds
bd0f274771 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>
2011-09-22 21:15:36 -07:00
Linus Torvalds
1e42dc10e5 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>
2011-09-22 20:59:10 -07:00
Linus Torvalds
d9ca1b6fbf 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>
2011-09-22 20:51:03 -07:00
Linus Torvalds
33b6d09000 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>
2011-09-22 20:50:07 -07:00
Linus Torvalds
a6f6e8d6ff Merge dive events correctly too
It's very similar to the sample merging.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 20:28:04 -07:00
Linus Torvalds
3a77eb8510 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>
2011-09-22 18:02:54 -07:00
Linus Torvalds
50c2bb7c71 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>
2011-09-22 18:01:01 -07:00
Linus Torvalds
d344d15a90 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>
2011-09-22 16:55:55 -07:00
Linus Torvalds
d463cace5e 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>
2011-09-22 16:45:28 -07:00
Linus Torvalds
c0adfdc41b 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>
2011-09-22 16:38:24 -07:00
Dirk Hohndel
d5c86ebe3d Add OTU to divelist
and change OTUs to be tracked as int, not double

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-22 16:29:49 -07:00
Dirk Hohndel
a93641b722 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>
2011-09-22 16:26:38 -07:00
Linus Torvalds
15463fdeb2 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>
2011-09-22 15:20:26 -07:00
Linus Torvalds
2d0267f0dd 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
2011-09-22 12:56:47 -07:00
Dirk Hohndel
99859dad54 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>
2011-09-22 12:25:44 -07:00
Linus Torvalds
b2f0912ee5 Clean up library handling
.. and pick up libusb-1.0 automatically if it's installed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 12:21:20 -07:00
Linus Torvalds
50fd8191f9 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>
2011-09-22 11:02:28 -07:00
Linus Torvalds
4c113ee016 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>
2011-09-22 10:28:57 -07:00
Linus Torvalds
68b666f50a 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>
2011-09-22 08:21:32 -07:00
Linus Torvalds
2df6149080 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>
2011-09-22 08:19:34 -07:00
Linus Torvalds
e11523110b 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>
2011-09-22 08:17:23 -07:00
Linus Torvalds
d7ca4c6554 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>
2011-09-22 08:12:55 -07:00
Linus Torvalds
7f6d13f866 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>
2011-09-22 08:11:12 -07:00
Linus Torvalds
1d36085b41 In summary printout, show divemaster if there was no buddy
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 08:09:21 -07:00
Linus Torvalds
d94fb7ca6b 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
2011-09-21 12:28:20 -07:00
Linus Torvalds
5148604068 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>
2011-09-21 12:18:38 -07:00
Linus Torvalds
515a917152 Add helper function for doing depth unit calculations
.. and use it for printing too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21 12:12:54 -07:00
Linus Torvalds
184eecf7c0 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>
2011-09-21 11:54:18 -07:00
Dirk Hohndel
a817f4b547 Use the last (or only) filename on command line as default for saving
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-21 11:35:20 -07:00
Dirk Hohndel
8a8ad3f997 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>
2011-09-21 11:29:13 -07:00
Dirk Hohndel
740e7119cd 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>
2011-09-21 11:29:13 -07:00
Dirk Hohndel
7a8fe91690 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>
2011-09-21 11:29:13 -07:00
Dirk Hohndel
189bec0c6b Tracking changes to tanks is trivial
That's the one I should have started with.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-21 11:29:13 -07:00
Dirk Hohndel
f459c2ec22 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>
2011-09-21 11:28:36 -07:00
Linus Torvalds
b4c4a29a11 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>
2011-09-21 10:33:36 -07:00
Linus Torvalds
924ad0e15e 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>
2011-09-21 10:07:35 -07:00
Linus Torvalds
fcc7a01c6e 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>
2011-09-21 08:29:08 -07:00
Linus Torvalds
74988c86de 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>
2011-09-21 08:24:12 -07:00
Tero Roponen
705d561bb1 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>
2011-09-21 07:41:14 -07:00
Linus Torvalds
6eefcf40e6 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>
2011-09-20 22:47:12 -07:00
Linus Torvalds
3fd66cc69b 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>
2011-09-20 22:09:38 -07:00
Linus Torvalds
d8d631aa84 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>
2011-09-20 19:30:38 -07:00
Linus Torvalds
ac80ff1c48 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>
2011-09-20 18:13:11 -07:00
Linus Torvalds
957aaf619f 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>
2011-09-20 17:56:56 -07:00
Linus Torvalds
368623113c 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>
2011-09-20 17:24:10 -07:00