Commit graph

117 commits

Author SHA1 Message Date
Henrik Brautaset Aronsen
ce87c26c00 Move about icon to include file
Getting the about icon to display in various scenarios on MacOSX
was a pain.  Moving the icon to an include file solved the problem.

This commit also fixes the problem Dirk was having when converting
satellite.svg to a png in commit cf3c0266c2.  I couldn't
quite get ImageMagick to preserve transparency and color when
converting subsurface-icon.svg, though, so I used Gimp instead.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2013-02-02 21:27:19 +01:00
Henrik Brautaset Aronsen
459130009b Rename subsurface.svg to subsurface-icon.svg
In preparation for a subsurface-icon.h, this should avoid confusion
about whether "subsurface.h" is a core header file.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2013-02-02 21:27:15 +01:00
Dirk Hohndel
29e73be9f2 Fix the rules for creating the windows .nsi file
This was one of the reasons why I tagged version 2.9. I wanted to test all
the Makefile magic we added to get sane and automated versions on Windows
and Linux. And it turned out my sed script failed in rather obvious ways.

These changes appear to fix that - but of course you won't see that unless
you reset your git repository to the tag and manually apply this patch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 18:06:13 +11:00
Dirk Hohndel
5d9ed3f1b4 Bump version number to 2.9
This is intended as a visual sign that we are getting closer to 3.0.

We should consider this a "soft" code freeze / string freeze - I'm still
looking for a bunch of fixes, small additions and of course documentation,
but no new major features.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 17:48:55 +11:00
Dirk Hohndel
cf3c0266c2 Move flag icon to include file
Just like with the satellite icon we are creating a pixdata structure for
the flag.

The Makefile cleanup in commit df6a9ddd8a21 ("Auto-generate C file
dependencies, and make the build more quiet") removed the rules for
generating the .h file by mistake (I hope).

This adds a more generic rule back in and also makes sure that the data
structures get more useful names.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-01 17:25:41 +11:00
Dirk Hohndel
aef211030d Hide the error output from pkg_config if you don't have osm-gps-map
This became very obvious after commit df6a9ddd8a21 ("Auto-generate C file
dependencies, and make the build more quiet") went in; since not having
osm-gps-map is one of the few errors that aren't fatal for building it
seemed worth quieting this down.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 14:41:02 +11:00
Linus Torvalds
054abbaea2 Auto-generate C file dependencies, and make the build more quiet
This does some rough auto-generation of header file dependencies for all
the *.c files, rather than our file-by-file incomplete hardcoded ones.

It also stops showing the whole compile line, because it's ugly and
distracting.  Instead it just shows "CC file.c".  If you care about the
full thing, you still see them with "make -n".

Only tested on Linux.  It probably is missing some Windows or
OSX-specific header includes.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-31 14:35:41 +11:00
Linus Torvalds
32e497b574 Let's call them GTKCFLAGS, not GTK2CFLAGS
Maybe they will be for GTK3 some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-28 07:55:26 -08:00
Linus Torvalds
41027c2843 Make subsurface compile with -DGSEAL_ENABLE
This forces us to use the proper gtk accessor functions.  It may not be
worth it if people actually do the Qt conversion, but if we want to try
gtk3 at some point, this might help.

This all came about because I was trying to explain on G+ what an
immense pain this all was to even figure out, if you don't actually know
gtk at all.  Google and the gtk migration guide are almost useless, and
the gtk2 documentation itself actually uses the fields directly without
any accessor functions in several places.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-28 07:54:55 -08:00
Dirk Hohndel
002fe45dfd Try to automate the version number used in the windows installer
This adds a Makefile target to create the .nsi file from a template and to
hopefully create the right strings to magically get the correct version
strings in the Windows installer

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24 15:58:35 -08:00
Linus Torvalds
f36693322c Include git revision in version number
This makes sure that it's easy to tell from the about box whether this is
a released version or a development build.

If it is compiled at the exact location of the tag, "git describe
--tags" will just return the tag-name. Otherwise it will return
something like this

    v2.1-393-ge03f31525aab

which means "v2.1 plus 393 commits, git SHA1 of tip is e03f31525aab",
which is a nice combination of git-readable (only the actual SHA1
matters) and human-readable (393 commits on top of v2.1).

And if you don't build from git sources, and don't have git installed,
it falls back on the old "v$(VERSION)" string.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24 15:08:35 -08:00
Linus Torvalds
1f3024152c Satellite icon diet
[Dirk Hohndel: converted to png and .h]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22 22:25:03 -08:00
Dirk Hohndel
713c845e5a Add GPS icon to the location column for dive sites where we have GPS data
This replaces the really lame "italics text" from commit abe810ca1a29
("Mark locations that have GPS location data attached") with a marginally
less lame GPS icon.There's a reason why I am not making a living as
graphics artist. But I think this is a huge step forward from what we had
before...

The satellite.svg file is very loosely based on a different icon that I
found as public domain here http://www.clker.com/clipart-30400.html.
From that I created the PNG and then that was converted into the
GdkPixdata via gdk-pixbuf-csource; a rule for that was added to
the Makefile but commented out as I don't know if this tool will always be
available in the path. Having this icon included in the sources avoids
locating yet another icon file.

Better icons are certainly welcome!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22 20:11:13 -08:00
Dirk Hohndel
5c2d1af5ec Add CFLAGS to build rule for webservice.o
Otherwise it won't compile on MacOS X

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-19 16:06:24 -08:00
Lubomir I. Ivanov
592c23cd9c Updated the Makefile to support libsoup and include webservice.[c|h]
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17 22:29:41 -08:00
Dirk Hohndel
d0d4bbece7 Hack Makefile, gtk-gui.c and divelist.c to allow building w/o osm-gps-map
While we are waiting for an autotools generated Makefile, this should allow
people to build that don't have osm-gps-map.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17 11:17:48 -08:00
Pierre-Yves Chibon
8ff350387d Work on a dive localisation tool using GPS coordinates
For each dive recorded, place their GPS coordinates onto a map using the
OSM-GPS-MAP library.

This map is accessible via the "log" menu or the shortcut ctrl+M (M as map).

We check for the GPS coordinates "0, 0" which are the default when we do not
have real GPS coordinates set.

[Dirk Hohndel: fixed int/float math confusion, fixed some whitespace and
               coding style issues, cleaned up some comments, added a
	       missing cast to prevent a compiler warning]

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-13 10:08:07 -08:00
Linus Torvalds
e8a896b64d Update preference saving for numeric values
This does the "don't save defaults" for numeric values too.

Also, move the preferences loading/saving to a new "prefs.c" file.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-11 12:19:34 -08:00
Lubomir I. Ivanov
c4ae58d589 gtk-gui.c: Move the download dialog related code to a new file
A new file download-dialog.c now contains all code related
to the download dialog, which was previously defined in gtk-gui.c.

Also, a new file callbacks-gtk.h now has two macros
OPTIONCALLBACK, UNITCALLBACK shared only between
download-dialog.c and gtk-gui.c.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-11 05:54:35 -08:00
Linus Torvalds
ec38d3708d Move device_info handling into a new 'device.c' file
The legacy nickname wrappers (that use the device_info structure) are
left in gtk-gui.c.  We can slowly start moving away from them, we don't
want to start exporting that thing as some kind of generic interface.

This isn't a pure code movement - because we leave the legacy interfaces
alone, there are a few new interfaces in device.c (like "create a new
device_info entry") that were embedded into the legacy "create nickname"
code, and needed to be abstracted out.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-09 16:19:38 -08:00
Dirk Hohndel
d3570508b1 Move planner UI into planner.c
There should be NO other changes in this commit - just moving the code and
adjusting the includes (and adding the entry point to display-gtk.h).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-07 11:23:14 -08:00
Dirk Hohndel
cca847791a First stab at simplistic dive planning
This comes with absolutely no gui - so the plan literally needs to be
compiled into Subsurface. Not exactly a feature, but this allowed me to
focus on the planning part instead of spending time on tedious UI work.

A new menu "Planner" with entry "Test Planner" calls into the hard-coded
function in planner.c. There a simple dive plan can be constructed with
calls to plan_add_segment(&diveplan, duration, depth at the end, fO2, pO2)

Calling plan(&diveplan) does the deco calculations and creates deco stops
that keep us below the ceiling (with the GFlow/high values currently
configured). The stop levels used are defined at the top of planner.c in
the stoplevels array - there is no need to do the traditional multiples of
3m or anything like that.

The dive including the ascents and deco stops all the way to the surface
is completed and then added as simulated dive to the end of the divelist
(I guess we could automatically select it later) and can be viewed.

This is crude but shows the direction we can go with this. Envision a nice
UI that allows you to simply enter the segments and pick the desired
stops.

What is missing is the ability to give the algorithm additional gases that
it can use during the deco phase - right now it simply keeps using the
last gas used in the diveplan.

All that said, there are clear bugs here - and sadly they seem to be in
the deco calculations, as with the example given the ceiling that is
calculated makes no sense. When displayed in smooth mode it has very
strange jumps up and down that I wouldn't expect. For example with GF
35/75 (the default) the deco ceiling when looking at the simulated dive
jumps from 16m back up to 13m around 14:10 into the dive. That seems very
odd.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-04 23:56:55 -08:00
Dirk Hohndel
3c31d0401d First stab at deco calculations
This seems to give us roughly the right data but needs a lot more testing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-03 20:43:14 -08:00
Dirk Hohndel
10e64f0e17 Make it easier to pass macro definitions from make
This small change to the Makefile allows you to call

	make CLCFLAGS=-DDEBUG

or some other define directly from the command line. It gets added to the
CFLAGS without overwriting the CFLAGS.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-05 09:30:29 -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
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
4da3168768 Create the correct ceiling events for Uemis Zurich
The hold_depth field is rather misleading as it normally gives the safety
stop depth and only when the p_amb_tol goes "below the surface" does it
switch to showing the first deco stop depth.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-11-10 11:54:14 +01:00
Dirk Hohndel
48e7575741 Bump version to 2.1
Getting ready for the release

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-22 20:57:57 -07:00
Dirk Hohndel
e47b52ecdb Bump version to 2.1-rc3
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-21 01:27:49 -07:00
Dirk Hohndel
e6454f1773 Finally a fully working Mac dmg
The Makefile change simply gets us the same setup with make install-macosx
that we are getting from the gtk-mac-bundler - with the launcher script
and subsurface installed as subsurface-bin.

The changes in the README are what make the difference for getting a
working dmg - there are a bunch of .so files that are part of gtk that
didn't have their dependency load paths updated - and those made the
application either crash or at least not display its own icon correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-20 21:06:35 -07:00
Dirk Hohndel
f481622156 Yet more changes to create localized builds for Mac
It turns out that we need aliases for all the languages. And more fiddling
when creating the dmg. And a specialized MacPorts build with the install
path as prefix. What this basically means is that our app will be
correctly localized iff run as /Applications/Subsurface.app
Otherwise the gtk default texts (on buttons for example) may or may not be
translated.

One remaining issue is that apparently Gtk's Mac integration triggers on
the untranslated name Help the Menu tree in order to work. Yet we can't
easily tell the app not to translate that word as the translations are
done internally in gtk - we'd basicall have to build special subsurface.mo
files for Mac that don't contain a translation of the word "Help" for this
to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-19 12:58:59 -07:00
Henrik Brautaset Aronsen
228259ead6 Add temporary locate files to the "clean" target.
The update-po-files target creates backup files.  Let's add them
to the "clean" target.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-19 07:19:59 -07:00
Dirk Hohndel
4d649151b5 Bumped version to 2.1-rc2
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-18 22:33:36 -07:00
Dirk Hohndel
049f4aa8ac Add Makefile target to update po files
This is a bit of a hack to make my life easier.

make update-po-files

will extract the translation strings and merge them with the existing
translations - for all existing translations.

For good measure this commit includes the latest update of the po files
(but no new translations should be needed).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-18 14:53:27 -07:00
Henrik Brautaset Aronsen
9c62e223d3 Install all .mo files on all targets
Linux didn't have a locale install target, and Windows didn't install
aliased locale files.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-17 00:04:18 -07:00
Dirk Hohndel
40ae90920a Fix typo and make variable name more logical
[the macos/macosx typo was also found and a patch submitted by
 Henrik Brautaset Aronsen <subsurface@henrik.synth.no>]

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 23:55:35 -07:00
Dirk Hohndel
04c5e65b8c Redoing the Mac bundling
With the right tools in place you can now create a bundle from the
Makefile by calling "make create-macos-bundle"

In the process of this I also moved the locale directory where we stage
our .mo files to share/locale (which is much more logical).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 21:37:43 -07:00
Henrik Brautaset Aronsen
0d89d511bb Adjust locale path for install-macosx target
gtk-mac-bundler uses Contents/Resources/share/locale, and
the install-macosx target should do the same.

Also quiet down the make process a bit

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 13:11:12 -07:00
Dirk Hohndel
faff4d29dd Update version to 2.1-rc1
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 09:15:03 -07:00
Henrik Brautaset Aronsen
f45285d461 Support for language aliases.
Some languages have identifiers that gettext can't determine
automatically in all OS'es.  An example is Norwegian (no_NO, deprecated)
with its Bokmål (nb_NO) and Nynorsk (nn_NO) form.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 07:30:59 -07:00
Dirk Hohndel
a9f3655d1a Improved packaging for Windows
This commit adds an install-cross-windows target to the Makefile that
creates a staging directory for us under packaging/windows that contains
the required .mo files. This currently fails for the Norwegian translation
because of the no_NO.UTF-8 vs nb issue - right now we just use the first
component of our own localization filename to find the matching Windows
localization and that fails.

The subsurface.nsi file is updated accordingly and this now appears to
create working installers with sane paths for the localization files.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-16 04:08:33 -07:00
Dirk Hohndel
4b9a59a154 Merge branch 'gettext'
Bring all the localization changes into master in preparation for
Subsurface 2.1
2012-10-15 09:37:09 -07:00
Henrik Brautaset Aronsen
ef039c9d32 Support for gettext in MacOSX application bundle
The MacOSX applications bundle needs to be told where to bind the
text domain from.

Also copy the gettext .mo files in the install-macosx target.

[Dirk Hohndel: minor change in main(): move the path declaration to
               the beginning of the function]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-15 09:36:30 -07:00
Henrik Brautaset Aronsen
cfaa5563bf Better gettext build
My previous take at adding gettext to the Makefile wasn't very good,
since it always relinked the subsurface executable.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-12 12:17:09 -07:00
Henrik Brautaset Aronsen
f5de37dbcf Basic gettext support when building
Added basic support for building gettext locales in the Makefile.
The po file name should match the target locale.

[Dirk Hohndel: Used git mv to rename the German .po file]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 21:45:30 +09:00
Henrik Brautaset Aronsen
21dec2a134 More gtk-mac-bundler improvements
Without "-headerpad_max_install_names", gtk-mac-bundler would complain
with "changing install names or rpaths can't be redone for:
/Applications/.subsurface.app/Contents/MacOS/subsurface-bin (for
architecture x86_64) because larger updated load commands do not fit"

Also, libdivecomputer needs to be configured with --with-prefix=/opt/local

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-11 21:37:54 +09:00
Dirk Hohndel
14856aab4b Bump version to 2.0.1
That crash is far too easy to hit for people just trying out subsurface.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-10-07 21:02:48 +09:00
Dirk Hohndel
58ba24b84e Getting ready for the 2.0 release
Changing the version to 2.0-rc1

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-26 20:50:23 -07:00
Dirk Hohndel
43f122f9ff First implementation of native Uemis downloader
This includes one major hack that uses a private data structure from
libdivecomputer to allow us to show the Uemis Zurich as one computer the
user can import from.

Once the user has chosen the Uemis we don't use libdivecomputer but our
own downloader. Just like in the libdicecomputer case this runs in its own
thread and updates the import dialog with progress information.

The code also keeps track of the last dive that has been downloaded from a
Uemis computer so we only import new dives on subsequent downloads. And
since the Uemis Zurich gives us its device id, we make this a "per
divecomputer" property for people who dive with multiple Uemis Zurich
computers.

This uses the debugfile infrastructure to allow easily collecting
debugging output - especially on Windows where by default console output
is lost.

Known limitations: when the Uemis runs out of space (it uses its
filesystem for communication with the host computer) we have no graceful
way to reset things. This is why the code doesn't try to download ALL
dives on the computer but instead download them in increments of ten
dives. This clearly needs to be addressed once I understand how to reset
the device.

The Cancel button of the import dialog isn't correctly hooked up, yet.
I still need to figure out how to gracefully shut down a download without
potentially hanging the device.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-26 10:58:15 -07:00
Linus Torvalds
dce08deb34 Use a 64-bit 'timestamp_t' for all timestamps, rather than 'time_t'
This makes the time type unambiguous, and we can use G_TYPE_INT64 for it
in the divelist too.

It also implements a portable (and thread-safe) "utc_mkdate()" function
that acts kind of like gmtime_r(), but using the 64-bit timestamp_t.  It
matches our original "utc_mktime()".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-09-19 17:35:52 -07:00