Commit graph

2095 commits

Author SHA1 Message Date
Miika Turkia
172982b860 Display divelogs.de upload status to the user
This shows a dialog indicating the success or failure of divelogs.de
upload. Currently the raw XML returned from the SOAP request is
also displayed.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-27 21:00:11 -07:00
Miika Turkia
5c4a7c7498 Use SSL on divelogs.de upload
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-27 21:00:10 -07:00
Miika Turkia
cc1d661881 A hook for DM4 XML import
This will take the DM4 XSLT into use.

In the future it is quite likely that we will have to start using
something more specific on top of the root element name to identify dive
log formats. But as "Dive" is currently a unique root element name for
us, this suffices for now.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-22 09:07:04 -07:00
Miika Turkia
cfa36448a1 XSLT for importing individual DM4 dives
This XSLT can be used when exporting single dives from DM4 and importing
them to Subsurface.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-22 09:07:00 -07:00
Miika Turkia
a727f55c67 Retain event sort order on restart
The events that had same time stamp were reversed in order on every new
load of the log file. This patch will keep the order static. (Changing
order is annoying when using version control to store the logs.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-22 09:06:17 -07:00
Dirk Hohndel
d5af4e2ff9 Simplistic filtering by tags
This only allows for a logical "AND" - so only dives that all of the
selected tags are displayed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-21 17:53:24 -07:00
Dirk Hohndel
2aabcf398a Add Gtk dialog to select the dives tags for which dives are shown
This literally just creates the dialog and does not hook things up with
the dive list.

The idea is to abstract out the idea behind the invalid dives to allow the
user to select / deselect all kinds of dives and then do statistics on
the selected ones.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-21 17:12:35 -07:00
Dirk Hohndel
e4a31e1e41 Move creation of dive and dive trip date string into helper functions
This allows this code to easily be shared by Gtk and Qt UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-21 16:27:42 -07:00
Dirk Hohndel
d25de98b7c Separate Gtk related code from core logic: statistics
Fairly straight forward, so far just one tiny bit of code restructuring,
everything else separated cleanly.

Added statistics-gtk.c and statistics.h

This should make no difference to functionality.

Cherry-picked from Qt branch; fixed merge issues mostly caused by
dive_tags and Makefile changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-15 21:52:41 -07:00
Dirk Hohndel
4c775289a7 Separate Gtk related code from core logic: info
Surprisingly straight forward, just a couple of places where we really mix
significant logic with UI code (for example setting the window title).

I had to move amount_selected from display-gtk.h to display.h - I guess
the number of dives that are selected is UI independent. But I wonder if
we still will track this as a global variable in a Qt UI (since the Gtk
selection logic is the main reason this existed in the first place).

Added a new info.h files for the necessary declarations.

This should make no difference to functionality.

Cherry-picked from Qt branch; fixed merge issues mostly caused by
dive_tags and Makefile changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-15 21:49:14 -07:00
Dirk Hohndel
bfe21343ca Remove second dive_trip_list definition and douplicate helper function
dive_trip_list is simply a global variable, declared in dive.h.

The clear_trip_indexes() helper is purely logic and was moved to
divetrip.c - but then not deleted in divetrip-gtk.c

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-15 07:16:36 -07:00
Dirk Hohndel
0a9ad49f0a Fix selection handling for invalid dives
This is the downside of having to track our own selection state. We now
have a class of dives that potentially isn't known to Gtk as we aren't
adding them to the TreeView. So we need to make sure that their selection
state is consistent by deselecting them (either when they are marked as
invalid OR when we change preferences to no longer show invalid dives).

And because Gtk sends out another set of selection events when clearing
the TreeView (not sure why), we also need to make sure that their
selection state isn't reset to selected by mistake when the divelist is
recreated.

A bit of a pain, but it seems to work now and be consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-10 10:04:50 -07:00
Dirk Hohndel
a9055049f1 Add four more tags
Student (training), Instructor (teaching), Photo and Video

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-10 08:49:11 -07:00
Dirk Hohndel
5778d090a4 Only show tags checkboxes if all edited dives have same tags
This is trivially true if there is only one dive.

With this change the logic which tags apply after editing is much easier
to understand.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-10 08:44:25 -07:00
Dirk Hohndel
0a64844abd Turn tag checkboxes code into a simple loop
This makes the code much cleaner and also reuses the strings in the
dtag_names array. This means the tag names are all lower case everywhere,
but that seems like an acceptable trade-off.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Suggested-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-10 08:21:30 -07:00
Henrik Brautaset Aronsen
593a0a7a60 Add missing divelogs check for LIBZIP and XSLT
I forgot that in commit 5f03a6f.  Oops.

Reported-by: Ďoďo <dodo.sk@gmail.com>
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-10 07:37:40 -07:00
Anton Lundin
186c27f17c Add a simple table-based cns calculations
For dives where divecomputers haven't provided us with a cns, we
calculate our cns accumulated during that dive based on a simple table.

We also check if we did a dive in the prior 12 ours and grab the cns
from it and calculate how much of that still affects us.

[Dirk Hohndel: a couple of small changes: remove unnecessary check of cns
               values in the samples of the first dive computer, changed
	       the way we determine the 'previous dive' and used the end
	       time of that previous dive for the decay calculation]

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 20:42:52 -07:00
Dirk Hohndel
3611b0ae2d Automatically show Freshwater tag (but don't set it)
If the salinity is 10000 we show (but do not set) the Freshwater tag.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 19:46:05 -07:00
Henrik Brautaset Aronsen
51c4a5335b Add tags for night and freshwater
Also trim the redundant "Dive" text from "Lake Dive", "Pool Dive", ....

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 16:13:28 -07:00
Dirk Hohndel
83a313f1ee Correctly conditionalize compilation for menu structure
Only call upload_all_dives_divelogs_cb() if we have both libzip and xslt.

Reported-by: Jozef Ivanecký (dodo.sk@gmail.com)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 16:01:17 -07:00
Pierre-Yves Chibon
7cacbdf762 Add lake and river to the list of supported tags
[Dirk Hohndel: minor cleanups]

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 13:56:33 -07:00
Henrik Brautaset Aronsen
5f03a6f631 Add menu entry for divelogs.de upload
The menu entry for upload to divelogs.de was missing. Also renamed
the divelogs context menu entry to something less generic.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 13:27:36 -07:00
Dirk Hohndel
9e4f9fad19 Store the tag names instead of an opaque number
And as we need the names for that, simplify the way we show the tags in the
Dive Info tab (and mark them for translation while we are at it).

In the process I renamed the constants to DTAG_ from DTYPE_ (and made
their nature as being just bits more obvious).

Also mark the box on the Info tab "Dive Tags", not "Dive Type".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 13:06:30 -07:00
Ďoďo
ed3f67bc33 Add dive tags and support invalid dives
This started out as a way to keep dives in the dive list but being able to
mark them as 'invalid' so they wouldn't be visible (with an option to
disable that feature).

Now it supports an (at this point, fixed) set of tags that can be assigned
to a dive with 'invalid' being just one of them (but one that is special
as it gets some additional support for hiding such dive and marking dives
as (in)valid from the divelist).

[Dirk Hohndel: merged with the latest code and minor changes for coding
	       style and consistency. Ensure divelist is marked as
	       modified when changing 'invalid' tag]

Signed-Off-By: Jozef Ivanecký (dodo.sk@gmail.com)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 10:31:36 -07:00
Miika Turkia
68545465ba Switch to UTF-8 on .DLD export
Let's use the shiny new UTF-8 encoding on divelogs.de export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 06:25:36 -07:00
Dirk Hohndel
8fae0031bc Forgot to add planner-gtk.c
Oops

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-08 09:38:03 +02:00
Dirk Hohndel
f86b13102c Separate Gtk related code from core logic: planner
Relatively straight forward, just a handful of places where we call
show_error() (a UI function) from the logic code. In the process I noticed
a few places where error returns weren't dealt with correctly.

Added a new planner.h files for the necessary declarations.

This should make no difference to functionality.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-08 09:37:38 +02:00
Dirk Hohndel
a70a889872 Fix some of the gcc-4.8 warnings
Most of the warnings are IMHO false positives:
e.g.: an enum variable is initialized in a switch statement that has a case for
      each possible enum value - yet gcc 4.8 warns that it could be used
      uninitialized;
or:   two variables are initialized together in the code - second one of them
      is previously initialized to -1 at declaration time, both are initialized
      in an if (second one == -1) clause - so they are guaranteed to both be
      initialized...
I did not "fix" those as the code is actually correct.

But there are three spots where it catches things that could indeed go wrong
(with odd input data in one of them).

This commit also adds a check to only call g_type_init() for older versions of
glib as in newer ones it is deprecated.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-07 20:31:49 -07:00
Dirk Hohndel
387dbe510f Merge branch 'cleanup-from-Qt-branch' of github.com:henrik242/subsurface 2013-04-07 09:08:49 -07:00
Dirk Hohndel
07c08eafac Continue to separate Gtk related code from core logic: divelist
Move some more logic out of the divelist-gtk.c file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-07 17:37:09 +02:00
Dirk Hohndel
983a77780c Separate Gtk related code from core logic: divelist
This is simplistic & brute force: any function that touches Gtk related
data structures is moved to divelist-gtk.c, everything else stays in
divelist.c.

Header files have been adjusted so that this still compiles and appears to
work. More thought is needed to truly abstract this out, but this seems to
be a good point to commit this change.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-07 17:37:09 +02:00
Alberto Mardegan
68119c5b54 Move set_filename() calls outside of parse_file()
Remove the boolean parameter from parse_file; the code is more readable
by having an explicit call to set_filename() where necessary, rather
than a boolean parameter.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
2013-04-07 17:37:09 +02:00
Dirk Hohndel
eba62d3cf1 Windows installer needs libsqlite
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-03 14:22:53 -07:00
Anton Lundin
0b8462bd58 planning: Add option to have last stop at 6m/20ft
When diving in areas where there are risk of boats passing above you,
its common practise to do the last stop at 6m to better stay out of
harms way. When doing o2-deco, it doesn't matter for the deco time if
you are doing all the time at 6m, due to that you don't have any inert
gas in your breathing gas.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-02 10:55:19 -07:00
Linus Torvalds
218fd994ee Fix cylinder pressure interpolation
The pressure interpolation code mostly worked for the simple cases, but
got terminally confused for some more complex gas change situations,
resulting in nonsensical interpolations.

This simplifies and clarifies the code a bit, and in the process fixes a
few special cases where the gas interpolation segments didn't end up
having the end conditions set.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-28 13:47:36 -07:00
Linus Torvalds
1b05d28944 Use the new get_o2()/get_he() helper functions more widely
They do the "02=0 means air" thing autmatically, and make for less
typing.  So use them more widely in places that looked up the o2 and he
permille values of a gasmix.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-28 13:47:31 -07:00
Linus Torvalds
99070c49e2 Fix get_cylinder_index() gasmix comparisons
get_cylinder_index() looks up which cylinder to use based on the
gaschange event that describes the mix.  However, it was both buggy and
not very good.

It was buggy because it didn't understand about our air rules, and it
was not very good because it required an exact match (after rounding our
permille-based numbers to percent).

So fix it to use the right permille values, and look for a closest match
(using the normal sum-of-squares distance function - although I wonder
if we should consider helium percentages to be "more important" and give
them a stronger weight).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-28 13:47:28 -07:00
Linus Torvalds
f2f29665d4 When merging dives, match up the cylinders to each other using gasmix
.. so that different computers that have different ordering of the same
cylinders will see the end result the same way.

This also fixes up the sample sensor index and generates special initial
tank change events for the dive computers that had their cylinder
indexes renamed on them.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-28 13:47:23 -07:00
Robert C. Helling
c083ec45a9 Make relative times default in planner 2
In planning you usually plan lengths of segments rather than runtimes to
leave a level.

This patch superseeds a previous one with a similar name and (even more)
broken spacing.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 19:30:38 -07:00
Lubomir I. Ivanov
2a6fded3b7 gtk-gui.c: Some small whitespace indentation fixes
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 19:26:55 -07:00
Lubomir I. Ivanov
c2520125d1 Store the main window maximized state in the configuration
In save_window_geometry() use gdk_window_get_state() to retrieve
the window maximized state and store it in the user configuration.
Then in restore_window_geometry() restore the maximized state with
gtk_window_maximize(), if needed.

To achieve good results we also need to override "window-state-event"
for the main window and define an extra couple of configuration parameters:
"vpane_position_maximized" and "hpane_position_maximized".
Then store two different pane states for maximized and restored window each
time the user makes a switch.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 19:26:43 -07:00
Miika Turkia
ed9c9051d2 Check if DLD contains non-ascii characters
Valid divelogs.de export might contain non-ascii characters in CDATA
fields as long as these characters are found in iso-8859-1. So we'll
have to test to make sure the content is fully ascii before calling
xmlStringLenDecodeEntities to decode possible character references.

Acked-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 13:15:38 -07:00
Lubomir I. Ivanov
61473080a5 B/W Print: Make sure that all colors are monochrome
Some colors such as the ones for ceiling were still green on B/W
print. This patch makes all colors in the second row
of profile.c:profile_color monochrome.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:55:56 -07:00
Miika Turkia
5533cd749f Fix end pressure on DLD export
While working on UDDF export I noticed that the grabbing of last
sample pressure was not working properly. This will fix it for DLD
export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:52:39 -07:00
Miika Turkia
ac5881c3fe Fix pressures on UDDF export
Examples on UDDF specification indicate that pressures are reported in
Pascal. Also prefer the sample data from first dive computer for start
and end tank pressures.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:52:30 -07:00
Miika Turkia
b18f9fa057 Gases and events support for UDDF export
This patch generates a gases section on UDDF export. The section
consists of all the unique gas mixes sawn on the dive log.

The latter part includes events to the export. Gas change and heading
events are properly translated to respective UDDF naming. Other events
are copied over as is. Some of the events are the same (ascent, deco,
rbt, surface) in UDDF some are not available.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:51:19 -07:00
Lubomir I. Ivanov
23ec2a9cb4 Print dialog: Fix inaccessible controls on Windows
The window which holds the custom print options tab appears to have
unchangeable dimensions on Windows OS (unless hacked in some way).
This makes the sliders in the custom tab not accessible unless
we add the entire dialog into a GtkScrolledWindow and return that
for the "create-custom-widget" event.

The patch also makes the contents of the "Layout Options" frame
packed vertically (with a GtkVBox) instead of horizontally, so that
the entire tab contents are "mostly" scrollable vertically instead
of horizontally.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:13:19 -07:00
Lubomir I. Ivanov
578851bef3 Color print: Show SAC lines in a color different from white
Also make the profile border color the same as the depth grid color.

Fixes #97

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 12:12:54 -07:00
Dirk Hohndel
826401a39c Add macros for text sizes
This replaces the hardcoded sizes all over the sources.

Make the size in the text_render_options_t a double - With this you can
compile Subsurface with

make CLCFLAGS=-DTEXT_SCALE=1.5

and the fonts in the profile are 50% bigger. Very nice on a high-pixel
density display.

Also remove the unused text_render_options for event text.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-25 18:05:45 -07:00
Miika Turkia
12d5ab4ce3 Export dives to UDDF file
This patch implements exporting dives from Subsurface to UDDF format.
Events and cylinder info are the most remarkable things still missing
from the export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-24 06:37:56 -07:00