Fix crash when cancelling 'Add Dive'

If selected_dive is -1 get_dive(selected_dive) will return NULL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Implement a qmake-based build for Subsurface

This is working for me, but requires a bit more testing. To build,
run:
  qmake [options]

Where options might be:
  V=1               disable "silent" build
  LIBDCDEVEL=1      use side-by-side libdivecomputer
  INCLUDEPATH+=xxx  add -Ixxx (e.g., INCLUDEPATH+=/usr/local/marble/include)
  LIBS+=xxx         add xxx to the linker flags (e.g. LIBS+=-L/usr/local/marble/lib)
  or any other qmake option, including debug and release options

If your distribution is already using qtchooser in place of qmake, you
may need to pass an extra option to qmake to select the a
cross-build. For example:

  qmake -qt=i686-w64-mingw32-qt4

If your distribution is not yet using qtchooser, then you need to file
a bug report requesting it and you need to run the full path to qmake.

Note:
 - there are some ### left in the buildsystem

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Remove the old buildsystem

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Add qmake rules to install Subsurface

This is probably the most complex part of the new buildsystem. This
adds the following targets:

 - Linux:
   make install - installs to $(prefix) (default: /usr)
   The install path can be changed during make install time.

 - Windows:
   make install - installs Subsurface and its dependencies to
                  packaging/windows.

 - Mac:
   make mac-deploy     - populates Subsurface.app with the dependencies
   make install        - mac-deploy + install Subsurface.app to /Application
   make mac-create-dmg - mac-deploy + creates Subsurface-$VERSION.dmg

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Add information that goes into the Windows .exe file

And drop the unnecessary .rc file.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
And let qmake create the Mac bundle on its own

It will even parse the Info.plist.in file for us and run sed on it.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Add a tool to scan for dependencies on Windows

Similar to ldd on Linux.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Disable the code that tries to find an alternate objdump

On Linux distros, it seems, objdump is configured to read Windows
executables (BFD architecture "pei-i386"), so we don't need to find an
alternate / cross-compile version. But leave the code here in case we
run into a distro that does things differently.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Use the $PATH environment variable to pass extra dirs for DLLs

Unix developers, look away... this is how it's done on Windows: the
binary loader searches $PATH for the DLLs, so let's reuse the same
variable. This simplifies the command-line a little.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Deploy some Qt plugins alongside the binary

Only implemented for Windows for now. On Mac, macdeployqt copies all
imageformat plugins on its own.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Fix the Marble data installation for Windows

Qt-only Marble expects the data to be on applicationDirPath() + "/data".

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Update the README and create an INSTALL file.

Let the README contain generic information and move the build
instructions to the INSTALL file.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Don't turn warnings on in Subsurface's build

We're getting a ton of them and they're mostly harmless. I've already
turned on the ones that are problematic (with -Werror even).

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Turn off exceptions in C++

We don't use them in our code and Qt doesn't throw either, so save a
few bytes and maybe a few setjump() calls on Windows.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Merge http://github.com/thiagomacieira/subsurface
Disable unused function

I am not removing this but leaving it around as this is useful for a
feature that we still need to enable - the ability to filter out which
events to display. This existed in 3.1 but is missing in the Qt version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix potential uninitialized variable

Most of the "possibly unitialized" warnings are bogus, but this one is a
potential real bug.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>