Commit graph

70 commits

Author SHA1 Message Date
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
Dirk Hohndel
e84cdf59bb make clean should remove subsurface.exe as well
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-13 14:43:34 -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
b1a747f537 Add some initial cochran CAN file parsing
It's broken, and currently only writes out a debug output file per dive.
I'm not sure I'll ever really be able to decode the mess that is the
Cochran ANalyst stuff, but I have a few test files, along with separate
depth info from a couple of the dives in question, so in case this ever
works I can at least validate it to some degree.

The file format is definitely very intentionally obscured, though.
Annoying.  It's not like the Cochran software is actually all that good
(it's really quite a horribly nasty Windows-only app, I'm told).

Cochran Analyst is very much not the reason why people would buy those
computers.  So Cochran making their computers harder to use with other
software is just stupid.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-27 12:43:40 -08:00
Linus Torvalds
a65b9b48e0 Add "native" Suunto SDE zip file reading
You need to have libzip-devel installed, and pkg-config needs to know about it
for the build to pick up on it.

On at least Fedora, a simple "yum install libzip-devel" will make things
work, although you may need to force a rebuild of subsurface too (the
"file.o" file in particular - the Makefile doesn't track system
dependencies).

Then, you can just do

   subsurface my-dives.SDE

to read the data directly from the SDE file.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-26 17:43:33 -08:00
Linus Torvalds
4d10bc017a Split up file reading from 'parse-xml.c' into 'file.c'
We're going to eventually import non-xml files too, so let's begin
splitting the logic up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-26 13:00:45 -08:00
Cristian Ionescu-Idbohrn
d34defc85b Link with libm for 'pow()'
Solves suddenly revealed linking error:

  divelist.c:400: error: undefined reference to 'pow'

Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-15 16:19:18 -08:00
Henrik Brautaset Aronsen
854391419f More Mac improvements
The startup shell script workaround isn't needed anymore. The preferences
hotkey didn't work. Remove left-over menu separators.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2012-01-03 20:19:57 +01:00
Linus Torvalds
1a83bf43b6 First try at converting user-manual to AsciiDoc
You can do "make doc" in the main directory to create the html version,
and if you want to play around with it, do "make show" in the
Documentation subdirectory to start firefox on the end result.

It's by no means perfect, but it gives somewhat reasonable results, and
this is enough initial work for people to play around with, I think.

NOTE! You need "asciidoc" installed to do this: it's a python program,
so it should be pretty easy even on non-Linux platforms.  And on Linux,
most distributions package it, so you just have to do something like

	yum install asciidoc

to get it (replace with apt-get/zypper/whatever).

Asciidoc can generate other output too (man-pages, LaTeX, etc), maybe
people want to play with that part too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-01 15:12:28 -08:00
Dirk Hohndel
605e063203 Turn subsurface into a real Mac application
To do this a few things needed to move into the os specific files, but the
overall change is fairly small and the difference on the Mac is amazing.

Subsurface now becomes a Mac app with Mac toolbar and useful default
fonts.

Changed the CFBundleIdentifier to be the reverse DNS of the subsurface
site (sadly, 'torvalds' is not yet a TLD).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-01 14:01:38 -08:00
Dirk Hohndel
6245b700a4 Improve Makefile for MacOS
Some macs appear to need "-framework CoreFoundation" added to the linking
step, others (which appear to have the exact same OS and tools installed),
don't. But as it doesn't appeart to hurt, I unconditionally add this.

Switched to using pkgconfig to find libdivecomputer on the Mac.

Tried to clean up the Makefile a bit

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Acked-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-12-14 11:22:12 -08:00
Linus Torvalds
c912e1fafb Subsurface 1.2
With the whole UI change (three-paned window and different look with new
colors), let's just make a new release, as Dirk points out.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-08 12:20:05 -08:00
Martin Gysel
46e72b698a makefile: use dumpmachine instead of grep for Target
grep for Target doesn't work on non english platforms
-dumpmachine is (hopefully) supposed to always return
the target machine tuple

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-27 12:14:07 -08:00
Dirk Hohndel
042c77c0fc Improve cross compile support and fix windows.c
This should make the Makefile much more robust when cross compiling.

The windows.c code is now compile tested but not functionally tested.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-24 22:34:39 -08:00
Dirk Hohndel
671f6544ac Split reading/writing preferences into OS specific files
This adds tested code for Linux and Mac OS, implementing the api that
Linus suggested.

The Windows code was moved into its own file, but hasn't even been compile
tested, yet.

In order to have just one interface to set or get a preference value we
encode TRUE as (void *) 1 and FALSE as NULL. This works consistently on
all platforms and regardless of whether we have 32 or 64 bit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-24 10:12:40 -08:00
Terrance Stanfield
c9df1f868c Fix the Makefile '-c' location, add XML2CFLAGS
I was getting the following error:

   dive.h:8:25: fatal error: libxml/tree.h: No such file or directory
   compilation terminated.

So I updated the Makefile to fix that error and follow the standard in
the file.

Signed-off-by: Terrance Stanfield <t@hollowcranium.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-19 13:11:22 -08:00
Miika Turkia
350462949d Use XSLT file to open JDiveLog logs
Open JDiveLog files by translating them to subsurface format using XSLT.
These files are identified by the name of the first element (JDiveLog)
and transform is applied to only these.

The XSLT feature is compiled in only if libxslt is installed. The
transformation files are installed globally in Linux under
/usr/share/subsurface/xslt. Windows and OSX still need appropriate Makefile
changes and testing.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-05 13:24:53 -07:00
Dirk Hohndel
619ab9e828 Add Info & Stats page to the notebook
This provides the relevant information for the currently selected dive
plus a bunch of statistics over all dives in the dive_table.

The visual design has lots of room for improvement
- right now the different fields change size
- it might be nice to have a more modern look for the entries
- the O2/He field is odd - for most divers the He value will
  always be 0, so maybe we should only show He if there's at least one
  dive that uses He? Also, we simply do a comma separated list of gases
  for all the tanks used

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02 12:27:12 -07:00
Linus Torvalds
5076397df0 Merge branch 'macosx-app-bundle-1' of git://github.com/henrik242/subsurface
* 'macosx-app-bundle-1' of git://github.com/henrik242/subsurface:
  Use the new packaging directory for MacOSX specific files, and provide shell script workaround to make the svg icon reachable.
  Ignore process serial number argument when run as native MacOSX app
  Add basic MacOSX app bundle install target
2011-10-31 17:12:59 -07:00
Roland Dreier
4d56123402 Don't run gtk-update-icon-cache if DESTDIR is set
We don't want to run gtk-update-icon-cache during a package build, when
we're installing into a staging directory just to create a tree that will
be packaged up and really installed later.  The standard heuristic seems
to be to skip gtk-update-icon-cache if DESTDIR is set (ie we're installing
to a different location than we're configured to run from).

Signed-off-by: Roland Dreier <roland@digitalvampire.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-31 17:06:41 -07:00
Henrik Brautaset Aronsen
b1a1376f3b Use the new packaging directory for MacOSX specific files, and provide shell script workaround to make the svg icon reachable.
- Make use of the new packaging directory.
- Set a current directory for subsurface to find the svg icon.  There might be a pretter solution to this.
- Somehow subsurface doesn't behave properly in the Dock.  Running it in the background without Dock integration until we figure out why.

Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-10-31 09:49:13 +01:00
Henrik Brautaset Aronsen
7c5bfff513 Add basic MacOSX app bundle install target
Native MacOSX app bundles are installed in /Applications.  We want a separate
install target for this, since some would probably prefer the regular unixy
way.

Signed-Off-By: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-10-31 09:48:56 +01:00
Dirk Hohndel
ae8bf9f6f4 Get rid of the terminal window that is displayed under Windows
Thanks to Michael Wiedmann I now know the magic incantation to get MinGW
to create a Windows executable that doesn't open two windows, a text
console and the actual gtk window.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-29 10:27:49 -07:00
Dirk Hohndel
7f0c866f48 Get icons working correctly under Windows
With this we are able to include both a separate .ico file that the
program can load at runtime and a .res file (that is created from the .rc
file, both in the packaging/windows directory) that is linked into the
executable and makes the Windows Explorer show the correct icon for
subsurface.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-29 09:14:15 -07:00
Dirk Hohndel
8961033574 Cleanup Makefile and make it work for cross compiling with MinGW
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-27 13:13:41 -07:00
Dirk Hohndel
6755d8c271 Annotate Makefile with hints about building under Windows
You can build subsurface with MinGW. It requires installing lots of random
packages, plus some things still don't work. One is that xml2-config
appears to be missing. So this annotates the Makefile to tell a person
building under Windows how to work around this. But we can't make this
platform conditional as this workaround is hardcoding the install path.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-24 14:35:54 -07:00
Linus Torvalds
7783387b97 Merge branch 'bugfixes' of git://github.com/dirkhh/subsurface
* 'bugfixes' of git://github.com/dirkhh/subsurface:
  Updated changes file
  Create packaging directory and add spec and changes file
  Makefile fixes
2011-10-24 13:53:19 +02:00
Dirk Hohndel
16461e9328 Makefile fixes
The stupid lib vs lib64 problem. I'm sure there's a more portable way to
handle this, but this at least seems to work.

Also fix the install target. Seriously, you create a directory with mode
644 and claim that this ever worked?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-24 04:12:44 -07:00
Linus Torvalds
bd275d73ac Subsurface 1.1
We've added a fair amount of features since 1.0 (like multi-tank) and
we've made things a lot prettier and supports editing much more
information.  So let's make a new release.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-24 10:23:09 +02:00
Martin Gysel
3c5f9ebd78 declare a var for libdivecomputer's cflags
This allows us the specifiy libdivecomputer's cflags (and also the
library, static or dynamic) outside of the Makefile

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-17 10:48:40 -07:00
Martin Gysel
e4d43901be create man dir before installing files in it
Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-17 10:48:40 -07:00
Martin Gysel
e9386057b6 use DESTDIR according to my understanding of GNU standards
make DESRDIR a prefix of everything according my understanding
of the GNU standards. This is also useful(/needed) for installing
in Gentoo. Declare BINDIR for bin/program directory.

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-17 10:48:40 -07:00
Linus Torvalds
f2c61aefa7 Don't use dynamic linking for libdivecomputer
Commit bd8948386d ("Since we don't want configure, use gnumake to find
libdivecomputer") was totally broken.  Sure, using GNU make features is
fine.  But then hiding in that commit is the fact that it also changed
it to use "-ldivecomputer" instead of just linking with the static
libdivecomputer archive.

And that's just a really bad idea.  Dynamic linking is useful for things
like libc, where it allows sharing of the code pages across all the
programs using it.  For something like libdivecomputer it's just a *bad*
idea, and doesn't even work.  The libdivecomputer interfaces aren't
stable enough to make it a good idea even if it *did* work, and the
libdivecomputer "make install" phase doesn't do the proper ldconfig etc
setup anyway.

Static linking is just simpler and better.  It also means that the
binary will work even if you move it around to another machine - since
libdivecomputer isn't exactly a "standard library"..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-14 16:06:13 +12:00
Dirk Hohndel
3fbc2de085 Install manpage
(and fix two white space issues)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-12 13:30:08 -07:00
Dirk Hohndel
4c4ef90794 Fix Makefile syntax error
it looks prettier, but we can't have a tab in front of the $(error)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-11 21:09:46 -07:00
Dirk Hohndel
7df7518625 Have "make install" act more as expected for a desktop application
I'm trying to get subsurface to get closer to becoming a "regular desktop
application"; so far this is based on the recommendations and guidelines
on OpenSUSE and Fedora.

The icon is now named subsurface.svg and make install installs it in the
correct location. At runtime subsurface first checks if an icon is
installed and if it is it uses that - otherwise it falls back to the old
code that tries to read the svg file from the current directory.

We also install a subsurface.desktop file

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-11 20:29:06 -07:00
Dirk Hohndel
089ab5e97c Make should expand $(DESTDIR) on install
This clearly was intentionaly - I just have no idea why you would want to
do it?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-10 19:43:28 -07:00
Dirk Hohndel
bd8948386d Since we don't want configure, use gnumake to find libdivecomputer
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-10 17:53:59 -07:00
Cristian Ionescu-Idbohrn
1bf28b68c9 A Makefile 'clean' target is quite standard.
Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-27 10:48:52 -07:00
Linus Torvalds
5c3bdd9fc8 Add the version to the Makefile
Not quite the same format as for the kernel, but I want to do the normal
"edit the makefile before making a release" model that I'm used to.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-26 11:04:50 -07:00
Linus Torvalds
1e42dc10e5 Add cheesy "install" target
It just puts the subsurface binary in $(HOME)/bin.

.. and then the binary won't find the icon file, so this is really not
enough of an install to get it really working, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 20:59:10 -07:00
Linus Torvalds
b2f0912ee5 Clean up library handling
.. and pick up libusb-1.0 automatically if it's installed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22 12:21:20 -07:00
Dirk Hohndel
682135838f Separate out the UI from the program logic
The following are UI toolkit specific:
gtk-gui.c   - overall layout, main window of the UI
divelist.c  - list of dives subsurface maintains
equipment.c - equipment / tank information for each dive
info.c      - detailed dive info
print.c     - printing

The rest is independent of the UI:
main.c i    - program frame
dive.c i    - creates and maintaines the internal dive list structure
libdivecomputer.c
uemis.c
parse-xml.c
save-xml.c  - interface with dive computers and the XML files
profile.c   - creates the data for the profile and draws it using cairo

This commit should contain NO functional changes, just moving code around
and a couple of minor abstractions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-20 12:48:56 -07:00
Riccardo Albertini
5b2f1c7914 Added a comment about libusb dependency in Makefile.
Due to libdivecomputer's dependency, can be necessary to add libusb to pkg-config in order to compile,
so I exported the pkg-config line in the subsurface target to LIBS variable, and added a comment about libusb.

Signed-off-by: Riccardo Albertini <ssirowain@gmail.com>
2011-09-20 12:22:45 +02:00
Linus Torvalds
8c18add46b Do libdivecomputer imports in a separate thread
This is the hackiest thing ever, unless you count the previous code that
was even hackier (and just called the gtk main routine at random
places).

The libdivecomputer library is not really set up to be part of the gtk
main loop, and cannot afford (for example) to have lots of mainloop
events while it's parsing.  Some dive computers are very timing
sensitive for the communication.

So just start a thread for doing the libdivecomputer stuff, and just
continually call the gtk main loop while that thread is running.  I'm
sure we could actually use some gtk signalling thing to make the thread
exit do the right thing, but instead we just poll the status every
100ms.

I did say it was hacky.  It does seem to work, though.  No more
temporary graying out of the windows when they don't react in a timely
manner because libdivecomputer does some blocking operation.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 22:58:02 -07:00
Linus Torvalds
3a6652634b Rename the project 'subsurface'
I never really liked 'diveclog' as a name - it's not like the C part is
all that important.  And while I could try to just make up another slang
word for despicable person (in the tradition of naming all my projects
after myself), I just can't see it.

So let's just call it "subsurface".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 09:43:14 -07:00
Dirk Hohndel
518ec33ba3 First pass to parse uemis Zurich '.SDA' files
This is missing a ton of the information in the .SDA files It only
parses the divelog.SDA file, not the dive.SDA file It ignores the
information on the gas(es) used and all the data on the tanks.

It still draws some strange artefacts at the end of the dive

But it correctly hooks into the import dialogue, it gives you a file
select box (somewhere, I'm sure, a gtk developer cries quietly) and then
parses enough of this file to serve as a proof of concept.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 08:52:55 -07:00
Linus Torvalds
ce86289eed Add the capability to print a dive profile
Ok, this is the ugliest f*&$ing printout I have ever seen in my life,
but think of it as a "the concept of printing works" commit, and you'll
be able to hold your lunch down and not gouge out your eyeballs with a
spoon.  Maybe.

I'm just doing the cairo display as-is for the printout, which is a
seriously bad idea.  I need to not try to do colors etc, and instead of
having white lines on a black background I just need to make thelines be
black on white paper.

But that would involve actually changing the current "plot()" routine,
which is against the point of the exercise right now.  This really is
just a demonstration of how to add printing capabilities.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 16:02:42 -07:00