Commit graph

3239 commits

Author SHA1 Message Date
Dirk Hohndel
e3e47b34a1 Automatically build translations
This runs lrelease against the .ts files and automatically recreates the .qm
files if any of the .ts files changes.

This also moves the .ts files into the translations directory.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-10 14:52:56 -07:00
Dirk Hohndel
f5423c48b8 Try harder to find the translation files
They could be below the data directory ("share") or next to it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-10 14:52:30 -07:00
Dirk Hohndel
8bd26af44e Work around a Qt Locale bug on Mac
With Qt4.8.5 Locale::uiLanguages() sometimes doesn't return the country, just
the language. This works around this by recreating the locale if this has
happened.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-10 13:00:23 -07:00
Dirk Hohndel
3b691d5d6e Fix some paths for Mac and add translations to bundle
'share' is under Subsurface.app - you don't need a 'subsurface' directory
under 'share'.

This also installs the processed translations.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-10 12:42:37 -07:00
Dirk Hohndel
44e43356e2 Fix typo in the Mac build instructions
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-10 07:53:35 -07:00
Lubomir I. Ivanov
6d75d82ab9 subsurface-gen-version.pri: pass the current OS to get-version
We check the current OS and pass it as 'darwin' (osx), 'linux'
or 'win' to the get-version shell script.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-10 07:15:39 -07:00
Lubomir I. Ivanov
8b517f8081 subsurface-configure.pri: disable auto-"silent" mode for win32
Certain versions of mingw32-make will try to "CreateProcess"
passing the contents of CC and CXX. On win32, with CONFIG += silent
CC and CXX become composite containing multiple commands
such as "@echo... && gcc", which produces undesired results.

For the time being, do not automatically enable "silent" mode
if the current OS is win32. Possibly a better solution can be
found later on.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-10 07:14:59 -07:00
Patrick Valsecchi
1dccf84c67 Added salinity to the Dive Info tab.
Took the opportunity to remove some copy&paste.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
2013-10-10 07:11:32 -07:00
Patrick Valsecchi
c5a15c6a45 Fixed mix of spaces and tabs in maintab.ui
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
2013-10-10 07:11:18 -07:00
Dirk Hohndel
3e31cdc7eb Add translation files
These were created by converting the exting translations from po to ts
lconvert po/xx_yy.po -o subsurface_xx_yy.ts
and then merging in the new strings
lupdate subsurface.pro

You convert those into .qm files with lrelease and then localization
should work. Of course a good bit of new strings are still untranslated -
and lots of Gtk strings are still included.

This still needs to be included in the build system.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-10 00:27:15 -07:00
Dirk Hohndel
86a80d37eb Dismbiguate gettext
Just to make sure there's no confusion - we are NOT calling gettext. We
are calling tr from a gettext like interface.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-10 00:18:26 -07:00
Dirk Hohndel
193d20c479 Next step towards working translations
This may seem like a really odd change - but with this change the Qt tools
can correctly parse the C files (and qt-gui.cpp) and get the context for
the translatable strings right.

It's not super-pretty (I'll admit that _("string literal") is much easier
on the eye than translate("gettextFromC", "string literal") ) but I think
this will be the price of success.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 22:51:59 -07:00
Dirk Hohndel
2d69d4a5ef Make sure we handle untranslated Subsurface correctly
At least on the Mac we otherwise switch to the next language which is not what
the user likely intended.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 17:55:31 -07:00
Thiago Macieira
1a98e049dc Try to read the libdivecomputer.la file (created by GNU libtool)
Getting dependency information for static libraries requires extra
files. Libtool creates .la files, which are "industry standard". qmake
has its own .prl files, but it can create .la in a pinch if necessary.

This change allows us to get the actual dependency information from
libdivecomputer, without having to guess whether it linked to something
else or not. If it changes in the future, we shouldn't have to do
anything.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 17:43:42 -07:00
Dirk Hohndel
cf2dc742f4 We already try to link against libusb anyway
No need for the special case here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 16:11:42 -07:00
Dirk Hohndel
7db3093b1b Try hard not to link against a shared libdivecomputer
Versioning is wrong. It's not a library shared with other projects. And at
least on Mac and Windows we bundle it with the app, anyway.

Requested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 16:07:18 -07:00
Lubomir I. Ivanov
a3d279b776 subsurface-configure.pri: add a libiconv dependency
This is a bit crude of a solution, but the Win32 version
of libxml (or at least some versions) seem to require libiconv,
thus we add the library with pkg-config if it is available.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 15:47:31 -07:00
Lubomir I. Ivanov
d63327469b subsurface-configure.pri: add another libxml/libxslt detection stage
libxml and libxslt use custom -config scripts which brake
qmake and make on Win32. The output of executing a .sh or .cmd
script with the same name produces garbled output. The output
of executables with the same name is untested, but a bit excessive
as a solution.

To work around the issue add another detection stage, which checks
if the previous output from (e.g.) xml2-config is empty and try
to use pkg-config instead.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 15:47:29 -07:00
Lubomir I. Ivanov
19c62bc509 subsurface-configure.pri: enable the libusb detection stage
The commented out step should work as expected (in theory).

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 15:47:23 -07:00
Lubomir I. Ivanov
a3ee9a1142 subsurface-configure.pri: pkg-config detection change
This is a small change, but it seems to work as expected on both
Linux and Win32. What happens if 2> NUL > NUL is used on Win32
for cmd.exe is that the output of both stdout and stderr seems
to pipe into NUL and pkg-config is always reported as missing.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 15:47:20 -07:00
Dirk Hohndel
9a37d64826 Now bundle install on the Mac works without sudo
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 13:44:44 -07:00
Dirk Hohndel
58db3e363a Correct Mac bundle path
Should be /Applications (plural)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 13:42:37 -07:00
Dirk Hohndel
fbb3d80d9b Don't set -Wno-maybe-uninitialized for clang
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 13:21:16 -07:00
Dirk Hohndel
3554e1de19 Small fixes to the build notes for Mac
Use the correct git tree for libdivecomputer.
Only build libmarble, not all of marble
Don't try make install for libmarble - it's bogus
Copy the correct marble headers
Only use sudo to write into /Applications

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 13:20:04 -07:00
Thiago Macieira
9f582f76d0 Turn down warnings with Clang too
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 10:34:10 -07:00
Dirk Hohndel
97f3b3b747 Turn down warnings (after going through them)
This was getting way too noisy with tons of false positives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 08:11:50 -07:00
Anton Lundin
cfbbf1bffe Link static to libdivecomputer
In previous build system we linked static to libdivecomputer, so start
doing that again.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 07:29:42 -07:00
Dirk Hohndel
bed44e65ec Only define TRUE and FALSE if they aren't defined already
We did this for some situations but not for all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 07:23:16 -07:00
Lubomir I. Ivanov
0b5b671dd9 windows.c: use the USERNAME enviroment variable
system_default_filename():
Use USERNAME, which should work for Windows XP and above.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 07:21:04 -07:00
Sergey Starosek
4fee6077af Remove unnecessary moc include
This fixes compilation issues with the new build system.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 06:58:41 -07:00
Dirk Hohndel
c74b286e70 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>
2013-10-09 00:15:46 -07:00
Dirk Hohndel
7f4e4b16ed 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>
2013-10-09 00:14:39 -07:00
Dirk Hohndel
83eb64a9ef Merge http://github.com/thiagomacieira/subsurface 2013-10-08 23:51:02 -07:00
Thiago Macieira
dddcd10162 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>
2013-10-08 23:45:38 -07:00
Thiago Macieira
f51f5d581e 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>
2013-10-08 23:44:45 -07:00
Thiago Macieira
3cbd961ce3 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>
2013-10-08 23:29:44 -07:00
Thiago Macieira
6c90fa7c64 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>
2013-10-08 23:29:44 -07:00
Thiago Macieira
603d65c961 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>
2013-10-08 23:29:44 -07:00
Thiago Macieira
245e29a72e 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>
2013-10-08 23:29:43 -07:00
Thiago Macieira
9294d5984c 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>
2013-10-08 23:29:43 -07:00
Thiago Macieira
2fedb100ca Add a tool to scan for dependencies on Windows
Similar to ldd on Linux.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-10-08 23:29:43 -07:00
Thiago Macieira
57994fa7a1 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>
2013-10-08 23:29:43 -07:00
Thiago Macieira
88b34b56db Add information that goes into the Windows .exe file
And drop the unnecessary .rc file.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-10-08 23:29:43 -07:00
Thiago Macieira
9e069371c6 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>
2013-10-08 23:29:43 -07:00
Thiago Macieira
1e7db5f77f Remove the old buildsystem
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-10-08 23:29:43 -07:00
Thiago Macieira
67e49d6480 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>
2013-10-08 23:29:33 -07:00
Dirk Hohndel
8e8a631cbc 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>
2013-10-08 23:24:44 -07:00
Dirk Hohndel
2e43769108 Avoid the memory leaks from translations
Instead use a hash to cache the translations (and allow for the ability to
clear the hash so we can even switch translations at runtime...).

Now Qt will keep track of the memory and release it for us when we are
done with it.

This avoids the memory leak introduced in commit 4ecb35bf5ff2 ("Make a
copy of the translated text").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-08 23:11:28 -07:00
Dirk Hohndel
7813ac86bf Load translations at run time
This doesn't enable translation switching, but at least we try and load
the correct translation at startup.

We create two global pointers for the currently active translations.

This also removes the remainders of the gettext()/glib based translation
system.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-08 23:11:25 -07:00
Dirk Hohndel
c260ec5c16 Make a copy of the translated text
Otherwise the translation will get freed (and often reused) before it
makes it to the screen.
The problem with this is that it leaks memory for every translation.

Reported-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-08 13:26:01 -07:00