Commit graph

747 commits

Author SHA1 Message Date
Dirk Hohndel
fe32e51287 Import Divesuit information from DivingLog XML file
Trivial two-liner patch

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 20:22:37 -07:00
Dirk Hohndel
5b56aa1435 Minor Macos menu entry modification fix
We have removed a menu separator from the gtk gui and that was still
referenced in the Macos code. And just in case, we are now testing
for the widget for the other separator to be non-NULL before
destroying it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 19:54:27 -07:00
Dirk Hohndel
50f6c6d8bc When editing multiple files, don't override existing equipment entries
This parallels the logic used for all the string entries.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 19:52:04 -07:00
Linus Torvalds
d2d4364afc Merge branch 'fixes' of git://git.hohndel.org/subsurface
Pull dive selection fixes from Dirk Hohndel.

This hopefully fixes the common cases.  Dirk is cursing gtk.  We may
need some gtk selection guru to explain things.

* 'fixes' of git://git.hohndel.org/subsurface:
  Another selection fix
  More fiddling with the selection
2012-08-17 16:14:20 -07:00
Dirk Hohndel
9e9ba73b3d Another selection fix
The corner cases are getting more and more artificial. Without this patch,
the following can happen:
Select one or more dives in an (expanded) dive trip. Now collapse that
trip with the little triangle. Select a different trip. The previously
selected dive(s) are still part of the selection (as you can see, for
example, in the statistics tab).

With this patch the scenario above works as intended (all the dives in the
new trip are selected), but we have another corner case:
Just as before, select one or more dives in an expanded dive trip.
Collapse that trip and ctrl-click on another trip. Now you lose the
originally selected dives.

Frankly, if you ctrl-click to add more dives to your selection - just
don't collapse the trips the dives are in?

As this new corner case seems even more artificial than the previous one,
I consider this patch an improvement. But fundamentally I am just battling
all the ways in which gtk's selection handling is messed up. When I get
the selection call back I cannot tell if this is a new selection or an
incremental selection (i.e., a shift-click or ctrl-click).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 15:08:50 -07:00
Dirk Hohndel
bc1ff9a121 More fiddling with the selection
As expected, this is pretty subtle to get right. But with this change the
code becomes simpler and more straight forward, I think. If the dives in a
group are collapsed, we don't even try to make gtk keep track of their
selection status - we explicitly do so ourselves. This avoids the
artificial expand / collapse around our attempt to force gtk to allow us
to select children that are hidden. But if a dive is expanded, then we
trust gtk to get things right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 14:26:43 -07:00
Linus Torvalds
d0e27c6c53 Merge branch 'misc-fixes' of git://github.com/DataBeaver/subsurface
Pull miscellaneous fixes, mostly UI stuff from Mikko Rasa.

Both this and the pull from Pierre-Yves Chibon created a "Save As" menu
entry and logic.  As a result, there were a fair number of conflicts,
but I tried to make the end result somewhat reasonable.  I might have
missed some semantic conflict, though.

Series-acked-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>

* 'misc-fixes' of git://github.com/DataBeaver/subsurface:
  Add a separate "Save as" entry to the menu
  Changes to menu icons
  Improved depth info for dives without samples
  Divide the panes evenly in view_three
2012-08-17 10:57:24 -07:00
Linus Torvalds
589589c707 Merge branch 'change_quit2' of http://ambre.pingoured.fr/cgit/subsurface
Pull patches to change behavior on exit from Pierre-Yves Chibon.

Pierry-Yves explains:
 "When someone opens a file, change something in it and try to quit, the
  program asked whether the data should be saved.

  If 'Ok' then it shows the save-window and the user can choose to save
  the file or rename it.

  My habits in such case would be that since I opened a specific file, I
  want to save to that specific file, therefore, when I press 'Ok', I
  want it to save automatically to the file I opened.

  So I have been working on changes that do:
   - When a file has been opened by the user, save to this same file if
     the user is 'Ok' while closing.
   - Add a 'Cancel' option to the pop-up window that offers to save the
     file while closing.
   - Add a 'Save As' entry in the file menu."

* 'change_quit2' of http://ambre.pingoured.fr/cgit/subsurface:
  Add a 'Save As' entry in the menu.
  Allow to cancel while trying to quit and the data was changed.
  When the file has been opened rely on it to save.
2012-08-17 10:28:19 -07:00
Dirk Hohndel
aab94d07cc Fix string handling in get_combo_box_entry_text
Linus' code dropped the const qualifier from the start rating. While
fixing this I stared some more at get_combo_box_entry_text and realized
that the existing code could potentially change the "old" pointer and then
pass it to free(). Tsk-tsk-tsk.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-17 09:36:04 -07:00
Linus Torvalds
70f903c457 multi-dive editing: don't change fields that weren't changed for the master dive
Commit 2f773b97e0 ("multi-dive editing: don't change already set data
for other dives") didn't get the multi-dive editing quite right: even if
one of the dives in the list of changed dives has an empty field, we
should *not* fill it with the edit data unless that edit data was
actually changed.

So compare the new data with the original master data, and if they
match, do nothing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-17 07:39:50 -07:00
Pierre-Yves Chibon
9cb3685030 Add a 'Save As' entry in the menu.
Add a "Save As" entry in the "File" menu allowing the user to specify the file in which to save
the data. This is useful as we no longer offer this option through the "Save" entry while the data
had been opened from an existing file.

Signed-off-by: Pierre-Yves Chibon
2012-08-17 16:39:28 +02:00
Pierre-Yves Chibon
1a76951159 Allow to cancel while trying to quit and the data was changed.
So far, when trying to quit while the data was changed the offer
was "Save" or "Don't save". Now, you can also "Cancel" which will
bring you back to the main window.

This allows you to re-save the data in another file.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-17 16:39:28 +02:00
Pierre-Yves Chibon
76298c64e3 When the file has been opened rely on it to save.
When a file is opened, we keep it in memory and when you try to
quit while the data has been changed, propose to save back to
this same file.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2012-08-17 16:39:28 +02:00
Henrik Brautaset Aronsen
9451617760 Remove repetitions of "Show" in Preferences dialog
Instead of having "Show Temp", "Show Cyl", etc in the Preferences dialog,
rename the group as "Show Columns" and remove "Show " from all the
checkboxes.  The dialog is tighter/nicer this way.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2012-08-17 08:56:40 +02:00
Linus Torvalds
6fdeeb8c9f Merge branch 'tree2' of git://git.hohndel.org/subsurface
Pull selection tracking fixes from Dirk Hohndel:
 "I just gave up on gtk tracking our selection.  Way too much pain.  The
  implementation below has seen some testing with the debugging code
  enabled and seems to work - but it needs more banging onto it, I'm
  sure.

  Ideally I'd like to leave the debug code in, ask people on the mailing
  list to play with it and report any inconsistencies.  After that I'll
  be happy to remove it again."

* 'tree2' of git://git.hohndel.org/subsurface:
  Stop relying on gtk to track which dives are selected
2012-08-16 20:39:49 -07:00
Linus Torvalds
2f773b97e0 multi-dive editing: don't change already set data for other dives
When editing multiple dives at the same time, don't change fields that
have already been set for a dive, unless the old field contents match
the currently selected ("master") dive.

So when you edit multiple dives, you can set the dive master or buddy
(or suit etc) for all of them in one go, but if one of them already has
that field set, it won't be modified just because you set the other
ones.

Acked-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-16 20:30:32 -07:00
Dirk Hohndel
7cf0f6d5e1 Stop relying on gtk to track which dives are selected
We spend way too much effort trying to get gtk to manage the dives that
are selected. The straw that broke the camel's back is that gtk forces us
to expand any nodes that we want to select - so selecting a summary entry
for a dive trip forced us to expand all the dives in the dive trip. Which
as Linus pointed out really sucked from a user experience.

So instead we now completeley ignore gtk's weird idea of what is selected
and what isn't and simply track things ourselves. We still need to play
some games with gtk to make sure that the correct rows are SHOWN as
selected, but still, the overall code seems much cleaner.

This commit contains a bunch of debugging code that is ifdef'ed out -
this is extremely useful to make sure I didn't mess anything up, but
eventually I'll want to remove that again as it just looks ugly in the
code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-16 16:47:49 -07:00
Dirk Hohndel
f6dfb0094c Fix right click edit in Dive Notes area for multiple dives
This fixes the bug that triggered the SIGSEGV that Linus worked around
earlier. I had forgotten to update this call path to the
edit_multi_dive_info function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-16 12:51:32 -07:00
Linus Torvalds
673cf274f8 Avoid SIGSEGV when editing multiple dives
The multi-dive editing is broken if you right-click on the dive
text-fields (instead of the divelist).  This just avoids the SIGSEGV, it
doesn't really fix the editing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-08-16 11:03:39 -07:00
Linus Torvalds
9b72217f79 Merge branch 'tree2' of git://git.hohndel.org/subsurface
Pull dive-trip grouping from Dirk Hohndel:
 "This turned into an updated pull request for the tree2 branch where I
  implemented the date based grouping - but is actually a very different
  topic: this adds the ability to edit multiple dives (and fixes some
  issues with the dive editing overall).  The reason for that is that it
  reuses some of the infrastructure that I implemented in the tree2
  branch for tracking the selected dives.  More details in the commit
  messages."

* 'tree2' of git://git.hohndel.org/subsurface:
  Switch from date based to dive trip based grouping
  Redo dive editing
  Fix selecting and unselecting summary items
  Apply sort functions to the correct model, don't select summary entries
  Maintain selected rows when switching between list model and tree model
  Create duplicate list model so sorting by columns works again
  Improve tree model implementation
  Allow date based grouping
2012-08-16 10:46:30 -07:00
Linus Torvalds
91e7dcc555 Merge branch 'suit' of git://git.hohndel.org/subsurface
Pull exposure suit tracking from Dirk Hohndel.

* 'suit' of git://git.hohndel.org/subsurface:
  Add exposure protection tracking
2012-08-16 10:28:10 -07:00
Dirk Hohndel
e6ecddfa3d Switch from date based to dive trip based grouping
Linus HATED the date based grouping - too much wasted space visually
("three levels of grouping are way too much") and asked for dive trip
based grouping instead.

This is a quick change to do just that, with an assumption that no
dive in 3 days means it's a new trip.

This also changes the summary entry to display a location for the trip,
for now we pick the location of the (chronologically) first dive of the
trip.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-16 04:31:21 -07:00
Dirk Hohndel
621761233b Redo dive editing
This commit addresses two issues:

We now can add / edit / delete equipment from the edit dive dialog

We now can edit multiple dives at once

The latter feature has some interesting design constraints:
It picks the 'selected_dive' as the one to start the edit from - so if
this dive already has some information filled in, that information needs
to be overwritten before it is stored in all of the dives. Similarly, only
changes to the cylinders or weightsystems are recorded. Also, the notes
field is not editable in the multi dive edit mode (as that didn't seem
useful).

The workflow seems to work best if using the multi-edit right after
importing new dives from a dive computer. The user then can select all the
new dives and only needs to edit things like location, divemaster, buddy,
weights, etc. once.

This commit will create some obvious conflicts with the commit that adds
exposure protection tracking. It was implemented on top of the tree_view
changes as it reuses some of the infrastructure for tracking the selected
dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-15 15:32:36 -07:00
Dirk Hohndel
e8ec3df371 Add exposure protection tracking
For simplicity and shortness, throughout subsurface exposure protection is
simply referred to as "suit".

Add the fields to the data structures, add the column to the dive_list
and the preferences dialog (once again with it being turned invisible by
default). Support loading and saving of the suit information.

Display the suit information in the Dive Info pane (this may be a bit
controversial as people could argue this should be in the Equipment pane)
and allow editing of the suit info, with our usual support for completion
and drop down lists to pick from.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14 17:16:00 -07:00
Dirk Hohndel
77a903a6bb Fixed another memory leak
We need to free the string that gtk_tree_mode_get returns to us.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14 14:52:14 -07:00
Lubomir I. Ivanov
307240d6f6 Fixed a small memory leak in divelist.c
In fill_one_dive(), cylinder and location strings are obtained via
get_string(), which needs to allocated a litte bit of memory.

After passing the two pointers ('cylinder' and 'location') as arguments
to gtk_list_store_set() it is safe to release them.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2012-08-14 14:51:35 -07:00
Dirk Hohndel
822b6409d7 Fix selecting and unselecting summary items
The dive list now seems to behave intuitively.

In order to do this we had to intercept the select function in addition to
having a selection-changed callback. That way we can simulate the
multi-level selection and unselection that was missing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14 13:22:31 -07:00
Dirk Hohndel
5ba89c13ac Apply sort functions to the correct model, don't select summary entries
We only set up the column specific sort functions for the default (tree)
model, which caused us to not sort correctly in the list model.

This commit also somewhat cleans up the handling of selecting summary
lines in the tree model, which includes the very first selection made at
program start (which happens to be the very last dive).

But it still doesn't work the way I expect it to work (i.e., the correct
row is not highlighted). Fundamentally I would prefer clicks on the
summary lines to instead select (or as ctrl-click, possibly deselect) all
the dives under that summary entry. Still TODO.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14 12:43:16 -07:00
Dirk Hohndel
dc9d0e23e5 Maintain selected rows when switching between list model and tree model
We keep track of the DIVE_INDEX of all selected dives and simply re-select
those dives after changing model (date based sort or sort by other
column).

There are a few TODOs left. We lose the sort direction (ascending /
descending) when switching models. We also don't correctly deal with the
user selecting summary rows in the tree model.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14 12:43:16 -07:00
Dirk Hohndel
27a505e579 Create duplicate list model so sorting by columns works again
One major downside of the switch to a tree model is that sorting by
columns other than date was broken - it would sort the entries within each
date which is not all that useful.

After playing with some Gtk trickery that would allow us to filter out
those rows it quickly became clear that the much easier solution is to
simply maintain TWO models (and therefore two storages). This causes some
overhead and requires some careful tracking of all changes, but it turned
out to be rather straight forward to do.

dive_list now has three model related members:
 model     - current model displayed (which is one of the following two)
 treemodel - the tree model
 listmodel - the list model

One side effect is that the callbacks no longer can pass the model around
(as this could have changed since the callback was registered), but that
seems only a minor drawback and was easily addressed.

The implementation in this commit still has a couple of obvious flaws:
when switching back from the list model to the tree model all the
expansion state of the rows is lost and we end up with just a list of the
different years visible. Also, selections aren't maintained when switching
models.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14 12:43:15 -07:00
Dirk Hohndel
5f1e41de43 Improve tree model implementation
We now support three hierarchy levels: day, month, and year. Each
indicated by a negative DIVE_INDEX for -1 to -3. This allows a nice
compact overview when doing date based sorting (the default).

As indicated in the previous commit, things still go wrong with sorting by
other columns as the entries are only sorted within each day, not globally
across the whole dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-14 12:42:54 -07:00
Dirk Hohndel
1f3813eb3d Allow date based grouping
This is the very first rough cut. It switches things over to a tree model
so we can have date based summary nodes.

It uses a DIVE_INDEX of -1 for summary nodes to easily tell them apart
from actual dives. All the data functions are changed so the summary
nodes only show the date they cover.

The commit also adds a couple of debug functions to be able to easily peek
into the model from the debugger.

Lots of things left to do. There is no longer a first dive selected when
starting subsurface. Sorting by columns other than date is messed up. We
almost certainly want month and year summary entries as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-13 13:04:56 -07:00
Dirk Hohndel
3c542b5a41 Don't print a total weight of 0 in the weight column
For consistency with the rest of the dive_list we should interpret "no
weight systems recorded" as "no information" and therefore print nothing
instead of printing a total weight of "0" for these dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-10 13:43:16 -07:00
Dirk Hohndel
19621bf481 Add total weight column to divelist
This adds the total weight carried on the dive in different weight systems
to the divelist. The column is by default not shown, which can be changed
in the preferences. The column is sortable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-07 11:24:40 -07:00
Dirk Hohndel
39f606350b Fill the list of weightsystems from data in existing dives
This was simply an omission in the current implementation. All the
plumbing was there but never got hooked up with the fixup_dive function as
intended.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-06 14:03:24 -07:00
Dirk Hohndel
4912951e97 Remove weightsystem entry with no description
This existed in the initial implementation to deal with an implementation
problem that was long since resolved. So now it just created just an ugly
empty line in the drop down menu for weightsystems.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-06 13:56:46 -07:00
Dirk Hohndel
8cdf1ab59f Remember the last weight used per weightsystem
With this change, if the user adds a new weightsystem to a dive, on
subsequent edits the weight amount for this weightsystem no longer
defaults to 0 but to the last weight that was used with this weightsystem.

So when the program imports a set of dives from the divecomputer and the
user starts editing them, once they enter the weight for the "integrated"
weightsystem the first time, for each of the consecutive dives that same
weight is the default once "integrated" is selected - which usually will
be the correct amount.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-08-06 13:03:20 -07:00
Mikko Rasa
549708c6ea Add a separate "Save as" entry to the menu
The "Save" entry will now automatically save over the last used file.  If
no filename has been set, then that entry will also prompt the user for a
filename.

The filename is set when saving as well, so the next save will use the
same filename.

Signed-off-by: Mikko Rasa <tdb@tdb.fi>
2012-07-31 21:12:24 +03:00
Mikko Rasa
d8c8ada6c7 Changes to menu icons
It's customary for menu bars to not have icons.

Some items were lacking icons when there's perfectly good stock icons
available.  I was a bit torn between the "new" and "add" icons for the
"add dive" item, since what it really does is create a new dive, but
the "add" icon is an uninteresting sheet of paper in the default icon
theme so I decided to use the "add" icon.

Signed-off-by: Mikko Rasa <tdb@tdb.fi>
2012-07-31 21:12:21 +03:00
Mikko Rasa
a5e822a4d6 Improved depth info for dives without samples
This calculates a mean depth for the dive with a fixed ascent/descent
rate and an assumption that all of the bottom time is at the maximum
depth.  It's not much, but it allows some derived values such as SAC to
make more sense.

The depth profile for such dives is now also generated with the same
assumptions instead of putting the samples at fixed percentages of the
dive duration.

Signed-off-by: Mikko Rasa <tdb@tdb.fi>
2012-07-31 21:12:19 +03:00
Mikko Rasa
618a20ba5f Divide the panes evenly in view_three
There was a note by Linus that he doesn't know how to get the size, so
I'm fixing that.

Signed-off-by: Mikko Rasa <tdb@tdb.fi>
2012-07-31 21:11:58 +03:00
Andrew Clayton
7fe652ab57 file.c: Fix a file descriptor leak in readfile()
In file.c::readfile() the file was being opened once at fd declaration
time and then again a few lines later and only being closed once. Remove
the open() at fd declaration time leaving the later one where the fd check
is done.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-07-12 18:19:47 -07:00
Linus Torvalds
a3ead9fb86 Update for libdivecomputer pkg-config include file changes
Subsurface doesn't compile on OS X any more, because libdivecomputer
changed the way the header inclusion works: the include path from
pkg-config no longer includes the final "libdivecomputer" component, and
instead of doing

  #include <header.h>

for libdivecomputer headers, we're now supposed to do

  #include <libdivecomputer/header.h>

instead. Which is cleaner anyway.

The reason this only bit us on OS X is that I never trusted pkg-config
that much for non-system libraries on Linux (maybe it works, maybe it
doesn't, I've seen it go both ways), so on Linux we just used our own
version of the include path, and thus weren't affected by the
libdivecomputer config change.

Clean up the includes while at it - we no longer need (or want) the
device-specific header files, since we just use the generic functions.

Reported-by: Grischa Toedt <toedt@embl.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-07-10 12:33:44 -07:00
Linus Torvalds
4033625567 Fix a couple of possible divide-by-zero conditions in statistics
Several people reported the average time problem, but there's another
one lurking there too: if the dive duration is zero, you get bogus
average depth information too (but because that one was a floating point
divide, and by default they are unsignalling on x86, it didn't crash, it
just resulted in bogus results).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-30 20:12:11 -07:00
Linus Torvalds
03174992a8 Make the 'Add Dive' dialog at least slightly less butt-ugly
I still suspect that using spinbuttons for the time handling is the
wrong way, and I'm a bit surprised the Calendar widget doesn't have a
mode where you can see/set the time too.

But this makes things at least minimally prettier, and initializes the
time entries to the current time (which is obviously not what anybody
really wants, but looks a lot better than defaulting to "midnight" or
some other random time that *also* won't be what anybody actually
wants).

I think this might be something we can live with, although I hope
somebody with good taste comes along and say "don't use spinbuttons, do
this: xyzzy" and makes things look better yet.

Also, I have this suspicion that I should put the time/depth/duration
stuff to the right of the calendar.  Most displays are wider than they
are tall, so tall and skinny dialogs are bad especially if you have
limited vertical pixels.  I still have flashbacks to my netbook-using
days, hating applictions that did that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-27 18:56:41 -07:00
Linus Torvalds
162b36f4a5 Make it possible to do "Add Dive" from just the main dive menu
No need for right-clicks.  It's inconvenient on lots of laptops etc, so
allow just using the Dive menu as an alternative.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-27 18:09:26 -07:00
Linus Torvalds
a2c2c7e1a8 Add depth entry to new dive edit dialog
Christ, if you look up "Ugly dialog" on Wikipedia, I think it has a
picture of this "New dive" thing.  Or it should have.

But it kind of works.  Although with only a "max depth" entry, you can't
currently set average depths etc, so SAC-rates etc cannot be calculated
for these kinds of dives.

And the dive numbering is wrong.  We do auto-number new dives that get
added at the end, but we do it as we add them, so when you *edit* the
dive information (before it has been added) the dive number shows up as
"#0".

So there's certainly room for improvement here.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-27 14:29:29 -07:00
Linus Torvalds
e3bdfc2dc3 Rough "Add new dive" infrastructure in the divelist
Do a right-click to get a menu with the "Add dive" entry.  Should do
delete too, but that's for later.

What's also apparently for later is to make this *useful*.  It's the
butt-ugliest time entry field ever, and there's no way to set depth for
the dive either.  So this is more of a RFC than anything truly useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-27 13:11:54 -07:00
Linus Torvalds
d4b0ce1c86 Update to new sane libdivecomputer interfaces
This does mean that you have to build subsurface against a new version
of libdivecomputer, and that version is likely going to have various
slightly incompatible changes.  But the new interfaces allow for easily
adding new supported dive computers without subsurface having to be
updated for each new vendor and model, so some slight pain is definitely
worth it this time.

I'm not even going to try to have some backwards-compatible version
here, the libdivecomputer interface changes are so extensive.  Native
enumeration of devices is just the smallest part of it: the constants
and types that libdivecomputer uses now have much nicer names that all
start with DC_ or dc_, so you don't get the kinds of name clashes we had
with "gasmix_t" etc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-22 13:37:39 -07:00
Linus Torvalds
e96a1864be Fix cochran CSV pressure data import
The cochran CSV pressure data is actually in units of '4 psi', not in
just psi.  That seems to be the resolution cochran internally keeps
things in, and unlike the depth reading there's no conversion to
standard units in the export (for depth, the quarter-foot depth
resolution is converted to tenths of feet when exporting).

Yeah, none of this makes any sense to me either, but I knew it was the
case.  I had just forgotten that factor-of-four when I did the importer.

With this fix, I get the same subsurface data (modulo some rounding
differences particularly for temperature) whether I go through David
McNett's UDDF converter, or just import the CSV data directly.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-06-19 22:41:44 -07:00