Commit graph

1355 commits

Author SHA1 Message Date
Linus Torvalds
ffa3fd551c Clarify (and fix) dive trip auto-generation
This makes the dive trip auto-generation a separate pass from the
showing of the dive trips, which makes things much more understandable.
It simplifies the code a lot too, because it's much more natural to
generate the automatic trip data by walking the dives from oldest to
newest (while the tree model wants to walk the other way).

It gets rid of the most annoying part of using the gtk tree model for
dive trip management, but some still remains.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-26 09:30:27 -08:00
Linus Torvalds
85f0749c85 Remove 'when_from_file' field from dive trip
It had become a write-only field (apart from some now useless debugging)
when simplifying the remove_autogen_trips() function.

So remove it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-26 09:28:34 -08:00
Linus Torvalds
544a8b9d77 Rewrite 'remove_autogen_trips()' without the gtk tree model walking
I'm trying to remove (or at least simplify) the gtk tree model usage for
our trip handling, but I'm doing it in small chunks.  The goal is to
just do all our trip handling logic explicitly using our own data
structures, and use the gtk tree model purely for showing the end
result.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-26 09:27:54 -08:00
Linus Torvalds
ba3e6bcc51 Associate each dive trip with the dives in that trip
We already kept a count of dives per trip in order to figure out when
there are no more dives left and the trip needs to be freed.  Now we
explicitly keep track of the list of dives associated with the trip too,
which simplifies the "find the time of the trip" logic.

We may want to sort it in time, but for now this is mainly about trying
to keep track of the divetrip relationships explicitly.  I want to move
away from the whole "use the gtk tree model to keep track of things"
approach.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-26 09:27:24 -08:00
Linus Torvalds
2f82ec39b8 Fix dive trip selection for merging
When picking the "better" trip, we stupidly looked not at the trip
location, but at the _dive_ location.

Which obviously didn't actually pick the "better" trip information at
all, since it never actually looked at the trip itself.

Oops.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-26 09:26:57 -08:00
Dirk Hohndel
61e040898b Don't compile unused code to determine offset between samples
Commit bb6b6b49a6d4 "Start merging dives by keeping the dive computer data
from both dives" created a compile time warning. This simply adds an #if /

Yes, this might accelearate bit rod in the code, but I just dislike the
warning message when compiling Subsurface.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-25 15:10:03 -08:00
Linus Torvalds
42240a83ff Be much saner about merging dive computer data
Now that we have dive computer device ID fields etc, we can do a much
better job of merging the dive computer data.

The rule is

 - if we actually merge two disjoint dives (ie extended surface interval
   causing the dive computer to think the dive ended and turning two of
   those dives into one), find the *matching* dive computer from the
   other dive to combine with.

 - if we are merging dives at the same time, discard old-style data with
   no dive computer info (ie act like a re-download)

 - if we have new-style dive computers with identifiers, take them all.

which seems to work fairly well.

There's more tweaking to be done, but I think this is getting to the
point where it largely works.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-25 13:05:32 -08:00
Linus Torvalds
7bfc8de55e Do not set the water salinity of a dive unless libdivecomputer supports it
It's annoying to see water salinity data in the XML that isn't relevant,
and adding the default value just because the dive got downloaded from
libdivecomputer is definitely wrong.

We should set the water salinity explicitly only if we have it
explicitly set on the dive computer.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-25 13:05:14 -08:00
Linus Torvalds
1ca1fe7994 Improve on divecomputer data handling
This simplifies the vendor/product fields into just a single "model"
string for the dive computer, since we can't really validly ever use it
any other way anyway.

Also, add 'deviceid' and 'diveid' fields: they are just 32-bit hex
values that are unique for that particular dive computer model.  For
libdivecomputer, they are basically the first word of the SHA1 of the
data that libdivecomputer gives us.

(Trying to expose it in some other way is insane - different dive
computers use different models for the ID, so don't try to do some kind
of serial number or something like that)

For the Uemis Zurich, which doesn't use the libdivecomputer import, we
currently only set the model name.  The computer does have some kind of
device ID string, and we could/should just do the same "SHA1 over the
ID" to give it a unique ID, but the pseudo-xml parsing confuses me, so
I'll let Dirk fix that up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-25 13:05:11 -08:00
Linus Torvalds
1b861ba20e Start merging dives by keeping the dive computer data from both dives
Also, note that we do *not* do the "find_sample_offset()" any more when
we merge two dives that happen at the same time - since we just keep
both sets of dive computer data around.

But we keep the function to find the best offset around, because we may
well want to use it later when *showing* the dive, and trying to match
up the different sample data from the multiple dive computers associated
with the dive.

Because of that, this causes warnings about the now unused function.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-25 13:05:08 -08:00
Linus Torvalds
5a4640cf44 Match newly downloaded dives against dive computer information
Now that we have more complete dive computer information, we can use
that to match the dives we download, and stop with the hacky "Would we
merge this" check.

For XML files without the explicit dive computer information, go back to
checking the exact dive time.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-25 13:05:04 -08:00
Linus Torvalds
c019da8fd5 Add basic divecomputer info setup with xml parsing and saving
This also knows how to save and restore multiple dive computers in the
XML data, but there's no way to actually *create* that kind of
information yet (nor do we display it).  Tested by creating fake XML
files with multiple dive computers by hand so far.

The dive computer information right now contains (apart from the sample
and event data that we've always had):

 - the vendor and product name of the dive computer
 - the date of the dive according to the dive computer (so if you change
   the dive date manually, the dive computer date stays around)

Note that if the dive computer date matches the dive date, we won't
bother saving the redundant information in the XML file.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-25 13:04:59 -08:00
Linus Torvalds
8d62f20aa0 Fix "prefer downloaded" dive sample merging case
When we have a preferred dive computer that overrides old information
when merging two dives, we just copy the dive computer data over.
However, we need to clear the source of the dive computer data so that
we then don't free the sample data when that old source of the newly
merged dive gets free'd.

This fixes a memory scribble (and likely SIGSEGV) for the "prefer
downloaded" case.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-25 13:04:47 -08:00
Miika Turkia
27f7e58493 Improvements on JDiveLog import
If dive computer does not record the sample interval, but records time
stamps on the samples, we use those.

A couple of corner cases fixed that were noticed in new log samples.
Also fixes when importing dives logged in imperial units.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-24 09:00:56 -08:00
Miika Turkia
2feaf1e815 Fix error message (parsing weight here)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-24 09:00:30 -08:00
Linus Torvalds
25b4fee655 Move events and samples into a 'struct divecomputer'
For now we only have one fixed divecomputer associated with each dive,
so this doesn't really change any current semantics.  But it will make
it easier for us to associate a dive with multiple dive computers.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-23 19:36:27 -08:00
Linus Torvalds
a9786564c2 Allocate dive samples separately from 'struct dive'
We used to avoid some extra allocations by just allocating the dive
samples as part of the 'struct dive' allocation itself, but that ends up
complicating things, and will make it impossible to have multiple
different sets of samples (for multiple dive computers).

So stop doing it. Just allocate the dive samples array separately.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-23 19:33:39 -08:00
Dirk Hohndel
10ce60e212 Fix "prefer download" behavior
When this was first implemented the assumption was that a downloaded dive
that is to be merged with an existing dive would have the same time stamp.
But as Linus pointed out even back then, this does fail if a dive has been
merged with a download from a different dive computer before (think:
download from computer a, then download same dive from b, then improve
something in the parsing from computer a and try to redownload; the time
stamp could have changed).

This commit also fixes a silly omission in the merge_dives() function
(which ended up ALWAYS prefering the downloaded dive) and finally
implements the necessary changes to mark dives downloaded from a Uemis SDA
as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-21 15:34:04 -08:00
Dirk Hohndel
d872a5c8aa Make sure there are no invisible selected dives after import / download
Prior to this commit, gtk often decided to collapse the trip with the
selected dive after the user imported or downloaded additional dives.
Since Subsurface tracks dives as being selected even after gtk collapses a
trip (which clears all selection state as far as gtk is concerned) this
could lead to the strange situation that the user could click on a new
dive to select it without unselecting the already selected dive - and
suddenly edit or delete did things that were entirely unwanted.

With this change we explicitly save and then restore the tree state around
import and download operations. This ensures that the same dive(s) stay
selected and trips stay expanded and therefore avoids the issues described
here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-21 13:53:36 -08:00
Dirk Hohndel
a8d413551e Allow the user to cancel a dive computer download
The code pretended to support this for libdivecomputer based downloads,
but it had never been hooked up when the native Uemis downloader was
implemented. When I finally decided to close that feature gap I realized
that the original code was, shall we say, "aspirational" or "completely
bogus" and therefore never worked.

So instead of just hooking up the code for the Uemis downloader I instead
implemented this correctly for the first time for both libdivecomputer and
the native Uemis downloader.

In order not to have to mess with multithreaded Gtk development I simply
opted for a helper function that fires on a 100ms timeout and have it end
the dialog without a response. This way we can run the dialog while
waiting for the download to finish, still update the progress bar and
respond in a useful manner to the user clicking cancel.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-20 11:42:01 -08:00
Salvador Cuñat
d1571ead2d Improving table print output.
- Create a grid for each dive printed.
- We change justify "center" to "left" wich contributes to diferentiate each component of the array.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-20 08:39:19 -08:00
Linus Torvalds
2c3850110b When downloading from a dive computer, stop at mergeable dives
The divecomputer download code will stop at a matching dive (unless
you check the "Download all dives" option when downloading).

However, the matching dive is an *exact* match, which works well when
you have a single dive computer, but is a big pain when you have
multiple. What happens is that the date of the dive will be determined
by whatever dive computer you used first, and then downloading from
other dive computers will not match exactly, but will merge (if the
computers are within a minute of each other).

And that will continue to happen every time you try to download from
that other dive computer.

So use the same logic as for the automatic dive merging: consider
"within one minute" to be a matching dive. So don't download dives
that will be merged - unless the user asks for it.

We do want to have some way of saying "force download of all dives
from today" or something like that, I suspect. Because while I don't
want to re-download *every* dive, I might want to force-merge the last
<N> dives.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 20:56:16 -08:00
Dirk Hohndel
cfaa494452 Merge branch 'uemis-downloader-fixes' 2012-11-19 20:50:39 -08:00
Dirk Hohndel
8e4d4970ec Fix another off by one error in Uemis native downloader
And again buffer_insert contained the blatant bug.

The code wasn't copying the trailing '\0' when extending the string, which
usually didn't end up blowing up the code (and therefore kept the bug
hidden until now) because of the way realloc reused memory - we just had
trailing garbage strings. But sometimes we weren't so lucky and the strlen
in a subsequent call of buffer_insert would run past the end of the
allocated buffer.

Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 20:49:45 -08:00
Dirk Hohndel
f3d87a2b16 Fix stupid off by one error in Uemis downloader
We are accessing offset 24 in an array of length 24. To make things easier
for the base64 conversion we just treat this as an off by three error and
instead create an array large enough for 27 elements and convert a
sufficient number of base64 chars to initialize all of them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 20:05:04 -08:00
Dirk Hohndel
ad0f91deca Makefile hack to allow building with uninstalled libdivecomputer
Simply call "make LIBDCDEVEL=1" and the libdivecomputer includefiles are
expected in ../libdivecomputer/include and the actual library is linked
from ../libdivecomputer/src/.libs

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 16:26:16 -08:00
Dirk Hohndel
cdbdf40848 Clear 'force' flag when retrying download
This may seem like an esoteric corner case, but it will actually happen
reliably when re-downloading dives from the Uemis SDA:

If the user selects "Force downloada of all dives" in the "Download from
divecomputer" dialog and if the SDA runs out of space and needs to be
unmounted and remounted, then for the 'Retry' the 'force' flag should be
cleared - or the user will once again start from the first dive which
almost certainly is not what they expect.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 16:13:05 -08:00
Dirk Hohndel
4e02f5f3a3 Correctly reset the ANS file number when restarting Uemis download
If we ran out of space on the Uemis SDA during download and the user
unmounted, unplugged and replugged the SDA, we need to take care to
correctly reset the file number we use for finding the correct ANS file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 15:09:50 -08:00
Dirk Hohndel
ddebdc0982 Improve Uemis timeout handling
Start every step with much longer timeouts (until we get the first
response back), but then use shorter timeouts once we have started
receiving data.

This uses up fewer of the ANS files and allows us to get more dives
downloaded before the SDA has to be unplugged to reset communications,
yet at the same time it still improves the overall download time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 15:05:12 -08:00
Dirk Hohndel
a32f3857cb Tweaks to the Uemis debugging code
Make it less verbose to make it easier to follow the progress along.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 15:04:59 -08:00
Dirk Hohndel
fb60143d35 Mark divelist changed when downloading from Uemis SDA
This mirrors commit 59929fdb5d2a "Mark divelist changed as we download
dives from a dive computer" which only fixed things for the
libdivecomputer case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 15:04:50 -08:00
Linus Torvalds
2a78f3436c Fix the XML gps parsing and saving when using non-US locales
The GPS parsing and saving was using sscanf and sprintf respecively, and
since it is using floating point values (boo!) that affects both of
them.  In a C/US locale, we use a period for decimal values, while most
European locales use a comma.

We really should probably just fix things to use integer values (degrees
and nanodegrees?) but this is the simplest fix/workaround for the issue.

Probably nobody ever really noticed until I tested the Swedish locale
for grins, since we don't have a good way to actually set the GPS
coordinates yet.  I've got a few dives with GPS information that I
entered manually.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 12:03:44 -08:00
Linus Torvalds
8a45a3ffb9 When merging non-overlapping dives, add surface events in between
Most of the dive computers I have access to don't do the whole surface
event thing at the beginning or the end of the dive, so when you merge
two consecutive dives, you got this odd merged dive where the diver
spent the time in between at a depth of 1.2m or so (whatever the dive
computer "I'm now under water" depth limit happens to be).

Don't do that.  Add surface events at the end of the first dive to be
merged, and the beginning of the second one, so that the time in between
dives is properly marked as being at the surface.

The logic for "time in between dives" is a bit iffy - it's "more than 60
seconds with no samples".  If somebody has dive computers with samples
more than 60 seconds apart, this will break and we may have to revisit
the logic.  But dang, that's some seriously broken sample rate.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 12:02:30 -08:00
Linus Torvalds
d166e34fed Fix silly thinko in recent changes to "Delete dive" code
Commit 38c79d149d ("Simplify and clean up dive trip management")
simplified the code a bit *too* much, and removed the check for
"dive->selected".

As a result, trying to delete a dive resulted in *all* dives being
deleted.

Oops.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 12:02:09 -08:00
Linus Torvalds
804b22dcd9 Mark divelist changed as we download dives from a dive computer
"record_dive()" won't do that, since otherwise we'd mark the dive list
changed when we load it from an XML file.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-19 12:01:54 -08:00
Dirk Hohndel
a154d1ccdc Tweak partial pressure plot to avoid printing values ontop of eachh other
This still can look too busy on shallow long dives with moderate vertical
movement.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-12 20:01:12 -08:00
Linus Torvalds
4ce0ce153a Add support for zooming using the scroll-wheel
This allows zooming in with the scroll-wheel if you have one (or the
two-finger scrolling on a touchpad).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-12 18:53:01 -08:00
Dirk Hohndel
79798dc15b Improve visual appearance of temperature plot
Prervent tiny temperature changes from being exaggerated in the plot.

Also, shift pressure plot around a bit (if necessary) to prevent it from
ending in the same space as the temperature plato on the profile graph.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-12 18:46:14 -08:00
Dirk Hohndel
05b55542c8 Extract salinity for Uemis SDA and improve depth calculation
THe Uemis SDA allows the user to set it up for salt water and fresh water
use. We should take this into consideration for the water pressure to
depth conversion.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-12 21:17:52 +01:00
Dirk Hohndel
56f62cc4ab Store and parse salinity and surface pressure
In my excitement about extracting these from libdivecomputer I forgot to
actually store them and then parse them again. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-12 20:57:49 +01:00
Linus Torvalds
fbbdb834f9 Fix average temperature statistics
We generate the average temperature statistics by adding up the
(converted to user unites - not in millikelvin) temperatures and then
dividing by the number of dives we've added up over.

HOWEVER.

We did that summing of the temperatures into an integer variable, even
though the converted temperatures are floating point.  So things got
rounded down to integers and the average temperature was just bogus
(although reasonably close).

We could do the summing of the temperatures in millikelvin and only
doing the conversion to the user at the very end.  But the smaller patch
is to just change the accumulator to a double value.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 18:49:29 +01:00
Dirk Hohndel
ec042222f0 Handle dives without samples correctly
The code in commit f99e1b476b18 "Trim the dive to exclude surface time at
beginning and end" failed rather badly if a dive has no samples at all -
which is true for many of our test dives.

This makes sure that we don't exclude data points if we never set up start
and end times.

Reported-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 17:56:32 +01:00
Linus Torvalds
7fc1213aab Add back mysteriously deleted "} else {" line
Commit 6c52e8a2e5 ("Add plotting of the deco ceiling") for some
totally unexplained reason deleted one "else" statement, resulting in
some plot events not having a time at all.  Which causes various really
odd issues if you hit that situation, including divide-by-zero etc due
to the difference in times between events being nonsensical.

It's just some odd mistake that was entirely unrelated to the other
changes in that commit.

Add the missing line back in.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 17:22:18 +01:00
Linus Torvalds
9e2b8edb4d Make the "click-to-zoom" use a 2.5x zoom factor
I think I prefer the 2.5x zoom over the pure doubling.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 17:21:37 +01:00
Dirk Hohndel
502e2b0e86 Add more data to our tool-tip display in the profile window
This shows the values for all the graphs that are shown (depth,
temperature, tank pressure, pO2, pN2m pHe), but also correctly doesn't
display them when they are turned off or no data is available (prior to
this commit, tank pressure was always shown, even if no pressure samples
were available for the dive).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 17:18:14 +01:00
Linus Torvalds
b304562fa8 Be stricter about when we allow merging of dives
If the surface interval between two dives is more than half an hour,
don't try to call it a single dive.  Just the dive profile will be
looking ridiculous.

Things like tank refills etc could also be a good thing to check (again,
the dive profile would look ridiculous), but the cylinder pressure going
up a small amount is actually normal (ie cylinder warming up in warmer
water on the surface).  So I don't know what the proper limit for that
would be.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 15:09:00 +01:00
Linus Torvalds
80485114ba Fix possible array bound violation for insanely long dives
When we calculate the interval for the tick-marks for the dive, we need
to limit 'i' to be within the size of the array.  The code does that
with a "i < 8" check, but the fact is, we must never increment past the
last entry, which is 7 (the size of the array is 8, but the last valid
index is 7).

This only happens for unrealistically long dives.  Which you can trigger
either by inputting insane values for a manually created dive, or by
merging two dives that are consecutive, but not close to each other
time-wise (eg on different days ;)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 15:08:56 +01:00
Dirk Hohndel
96fb31bc01 Zoom with left mouse button
Linus convinced me that I was wrong to modify his commit 24690ce35f81
"Initial not-so-pretty profile zoom support" and so this changes it back
to use the left mouse button for zooming. It turns out that on some
touchpads there's a very nice way to hold down the click with one finger
and then pan with another finger, but that does not work if you do a two
finger click (and use one of those or a third to pan).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 14:45:33 +01:00
Linus Torvalds
01e8984d7d Create tool-tip with depth/pressure for the whole profile area
This extends on our current tooltip logic (which shows events when you
mouse over them) to show tooltips for the whole profile area.

If you mouse over an event, that is still shown in the tooltip, but
even in the absense of events, the tooltip will be active, and mousing
over the profile area will show the time, depth and pressure.

This can certainly be improved upon further, but even in this form it is
useful.

Fixes #9

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 14:44:10 +01:00
Dirk Hohndel
fe4f13f184 Add special download modes to force updates from the divecomputer
This will hopefully not be something we need often, but if we improve
support for a divecomputer (either in libdivecomputer or in our native
Uemis code or even in the way we handle (and potentially discard) events),
then it is extremely useful to be able to say "re-download things
from the divecomputer and for things that were not edited in Subsurface,
don't try to merge the data (which gives BAD results if for example you
fixed a bug in the depth calculation in libdivecomputer) but instead
simply take the samples, the events and some of the other unedited data
straight from the download".

This commit implements just that - a "force download" checkbox in the
download dialog that makes us reimport all dives from the dive computer,
even the ones we already have, and an "always prefer downloaded dive"
checkbox that then tells Subsurface not to merge but simply to take the
data from the downloaded dive - without overwriting the things we have
already edited in Subsurface (like location, buddy, equipment, etc).

This, as a precaution, refuses to merge dives that don't have identical
start times. So if you have edited the date / time of a dive or if you
have previously merged your dive with a different dive computer (and
therefore modified samples and events) you are out of luck.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-11 14:29:26 +01:00