Commit graph

312 commits

Author SHA1 Message Date
Rex Dieter
fcf47552c6 Use target_link_libraries for Grantlee
This allows for finding headers when not in /usr/include (like
parallel-installable distribution-packaged grantlee5)

Signed-off-by: Rex Dieter <rdieter@fedoraproject.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Dirk Hohndel
ba55c60395 Cmake: fix BT definition
This was set twice, the first time before we checked that we have a new
enough Qt version installed.

Also fixed a typo.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-03 09:20:47 -08:00
Tomaz Canabrava
53a5f6d7a4 Make code compile in gnu11 and c++11
This is to make it possible to use some nice to have features of
c11 and c++11 like range based loops, delete default functions,
auto variable assignment. Talked to Dirk about this and he is ok
with the change, but he also states that he will not accept lambdas

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:51 -07:00
Tomaz Canabrava
7cd9e2b7bb Make icons work again
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:50 -07:00
Tomaz Canabrava
225ac07005 Clear the main CMake file
A bit of dust was setting here, when I moved tons of things around
I forgot to remove some bits.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
044e593957 CMake for tests in its own folder
Besides making it more simple to add a new test now since
you don't need to play hide and seek with the main cmake
this has another good thing: on IDE's that scan the cmake
to create targets on the project tree, the main project
was being popullated with test-targets on the main tree
and not inside the tests directory.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
1d6683f3e0 Move Profile widget out of desktop-widgets
The reason for that is, even if profile widget is made with qpainter
and for that reason it should be a desktop widget, it's being used
on the mobile version because of a lack of QML plotting library that
is fast and reliable.

We discovered that it was faster just to encapsulate our Profile in
a QML class and call it directly.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
50ec7200e6 Single CMake to handle the models
This one was pretty easy because of the work I did a few months
ago to separate the models from the UI.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
45c9764073 main.cpp -> {android-main, desktop-main}
This is needed to compile both in a single call to make. Also it will
help removing some of the mistakes in the current android version:
it always created the mainwindow, even without using it for anything,
so tons of memory will be freed now for the android version, making it
snappier and smoother.

This is a necessary move so we don't need to #ifdef all over the place
for the two different versions, and imo the changes needed to keep both
versions will not be that huge if we keep things in subsurface-core
sane.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
e49d6213ad Move qt-ui to desktop-widgets
Since we have now destkop and mobile versions, 'qt-ui' was a very
poor name choice for a folder that contains only destkop-enabled
widgets.

Also, move the graphicsview-common.h/cpp to subsurface-core because
it doesn't depend on qgraphicsview, it merely implements all the
colors that we use throughout Subsurface, and we will use colors on both
desktop and mobile versions

Same thing applies for metrics.h/cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
588abd019f Move the icons to the icons folder
There was no reason at all to keep those icons on the root
folder.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:48 -07:00
Tomaz Canabrava
6cd711a11b Modify code to make it compile after rebase
Did a git rebase and some stuff changed in the meantime;
This is a compatibility commit: Add a few include directories
on the cmake to quiet some ui_headers.h not being found (the
ones that are created automatically by uic) and a few noiseances
like models requiring interface functionality.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:48 -07:00
Tomaz Canabrava
4c0156e3d5 Move all core-functionality to subsurface-core
And adapt a new CMakeLists.txt file for it. On the way I've also
found out that we where double-compilling a few files. I've also
set the subsurface-core as a include_path but that was just to
reduce the noise on this commit, since I plan to remove it from
the include path to make it obligatory to specify something like

 include "subsurface-core/dive.h"

for the header files. Since the app is growing quite a bit we ended
up having a few different files with almost same name that did
similar things, I want to kill that (for instance Dive.h, dive.h,
PrintDive.h and such).

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:48 -07:00
Tomaz Canabrava
a079821423 Start to clean CMake
CMake can be a good system but if we keep everything into one big
cmake file things can go nuts really quick. Since I already took
quite a start on an subsurface layer separation some time ago, I'm
improving it by making each module on Subsurface depend on it's own
CMake module.

This first patch moves the qt-ui part to qt-ui/CMakeLists.txt file,
it cleans tons of the main cmake file ( moving all parts to the in
ternal folder ), and makes things more easily manageable by the
programmer that will change the ui bits, he doesn't need to play
hide and seek with the CMakeLists.txt file anymore, trying to figure
out where should he put his newly generated file.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:02 -07:00
Guillaume GARDET
f451387f8f Add subsurface.debug script to help debugging and install it (for Linux only)
This patch adds subsurface.debug script and install it for Linux.
Instead of running subsurface, you can run subsurface.debug which will launch
subsurface as usual, but will monitor subsurface exit and run gdb automatically
if subsurface crashes and it creates a crashlog in $HOME/.

Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-29 08:35:01 -07:00
Dirk Hohndel
5d8f3c1ebd Cmake: fix incorrect modification of a QT_LIBRARIES
It's a list, not a string. Treating it as a string creates all kinds of
exciting weird errors that make no sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-26 14:51:07 -07:00
Dirk Hohndel
3b0f38f24a Fix building without BT support
I guess no one had tried this in a while.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-26 06:51:47 -07:00
Dirk Hohndel
af45a2a072 Use hidapi on Mac
This allows us to support the Suunto EON Steel on Mac, assuming the matching
libdivecomputer version from the Subsurface-branch. If that was compiled with
the hdiapi lib then hopefully the build for Subsurface should find that library
as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-18 17:37:49 -07:00
Tomaz Canabrava
2eed9c0b9b Move the algorithm to divesite.cpp file
This shouldn't be on the maintab.cpp, this file is already too convoluted.

[Dirk Hohndel: slightly refactored this commit and the next one to make
               the code actually work and make the split across the two
               commits more reasonable]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 06:27:38 +01:00
Dirk Hohndel
05f4f9b533 Cmake: ensure marbledata is actually copied into the build directory
This can be done regarless of whether Marble is enabled or not. No harm
done.

Fixes #937

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 00:01:30 +01:00
Dirk Hohndel
cb112f9ac5 Add test for import, merge and renumbering
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-05 16:35:09 +01:00
Dirk Hohndel
a4a4276ed6 Make TestGitStorage run last
This can take a long time on slow connections so it makes sense to run all
the other tests first.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-04 13:52:31 +01:00
Dirk Hohndel
332cc0a418 Cmake: make libssh2 library path explicit
Under certain conditions on my Mac the build process will happily find libssh2
but then at link time can't figure out where it is. Making the path to the
library explicit seems to fix that issue.

This commit also adds the code to dump all visible variables at the end of the
cmake file (commented out). I have looked this up online, added it to address
an issue, and then removed it quite a few times... I figure I might as well
keep it there for the next time I need it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-28 07:46:44 -04:00
Lubomir I. Ivanov
0b0e203dbd Cmake: add LIBMARBLE_FROM_PKGCONFIG and some Marble related fixes
This patch adds the option to retrive Marble with pkg-config in a
similar way to Grantlee, libgit2, etc.

It reorganizes the "if(NO_MARBLE)" case to be the "else()" of
if(NOT NO_MARBLE).

Also, it adds the "-r" option to "rm" here:
add_custom_target(link_marble_data ALL COMMAND rm -rf ./marbledata ...

as otherwise it fails on Win32/Msys with "marbledata is a directory".

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-22 07:18:53 -07:00
Dirk Hohndel
34930c0110 Cmake: make Grantlee5 required
Otherwise printing doesn't work. And we get weird build errors.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-06 07:53:12 -07:00
Dirk Hohndel
181d5c5db9 Cmake: turn on printing by default
As we get closer to the 4.5 release we should try to make sure we build
with printing enabled everywhere and just turn it off if we no it's not
supported.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-01 09:52:52 -07:00
Tomaz Canabrava
ab32295f89 Add a new model: SsrfFilterProxyModel
Add a new Model, it's the QSortFilterProxyModel that accepts
functions to filter / sort. so instead of creating a new class
for each different sorting (overkill), now we can just create
a function and pass to this class.  I'll rework the filtering
system of subsurface to use this - in the meantime I've created
this to ease the creation of another filter: the dive sites
by gps coordinates.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:41:14 -07:00
Dirk Hohndel
1b37e0f1a4 Add test for dive site duplication bug
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 10:32:38 -07:00
Dirk Hohndel
4360cee196 Cmake: install grantlee plugins on Mac
And add a small message that two potential ERRORS that are thrown in the
deploy step are actually harmless.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 13:53:32 -07:00
Dirk Hohndel
6eed3155e6 Add simple test for git storage
This just makes sure that writing data to git storage and reading it back
gives you the same result. Without the fixed generation of initial dive
site UUIDs this fails.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:41 -07:00
Dirk Hohndel
e86fd45efd Cmake: fix cross compiling on Windows
Cmake has a bug that causes the moc process not being handed the necessary
defines for the architecture we are building for.

Also we were missing a library to make the BT implementation on Windows
work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-21 10:16:06 -07:00
Anton Lundin
8d73e4f81c Connect up serial_ftdi custom serial
This connects the serial_ftdi implementation to subsurface, and builds
libftdi1 for the android builds.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:59:54 -07:00
Anton Lundin
e2c98def26 Turn serial_ftdi.c into a custom_serial
This cleans up serial_ftdi.c from being a libdivecomputer source and
making it into a subsurface custom_serial.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:59:49 -07:00
Dirk Hohndel
aa48dfea27 Cmake: automatically create version for Mac bundle
The version info that is used for the Mac bundle is created at cmake run
time, not at make run time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17 08:45:15 -07:00
Dirk Hohndel
79f3f18ef6 Cmake: only link against libusb-1.0 if it was found
This should work much better as libusb is really only required if you want
support for all the dive computers (e.g., Atomics Aquatics Cobalt family).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16 12:33:28 -07:00
Tomaz Canabrava
ed30059183 Add DiveSitePicturesModel
This model should be used inside the Edit Dive Site mode.
It should display all photos from all dives that are part
of this dive site, ignoring trips.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15 04:59:01 -07:00
Dirk Hohndel
43798702ff Only enable Bluetooth support if building against Qt5.4 or newer
Also remove the quick hack from commit 947fda14c5 ("Bluetooth support:
quick build fix for Qt5.2"). I should have thought this through before
pushing that commit, but oh well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20 09:35:00 -07:00
Anton Lundin
db0da1656d Remove now unneeded define
This removes the extra Q_OS_ANDROID define to prevent a redefined
warning.

Somehow, the qt headers didn't define Q_OS_ANDROID previously, but how
does.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-18 06:40:04 -07:00
Grace Karanja
0c9756c5d7 QML UI: Implement showing of the dive profile on QML
Link the QMLProfile class to the DiveList.qml file. The profile is
displayed above the dive details.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-17 12:00:38 -07:00
Anton Lundin
9a754972ed Fix libssh libssl linker order for Android
We need to link things in the correct order, even on android.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16 14:09:31 -07:00
Dirk Hohndel
f8ce5788b8 Cmake: use correct variable to find make command
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16 13:31:32 -07:00
Dirk Hohndel
4dfb39cc49 Cmake: don't hardcode the make command
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14 14:53:15 -07:00
Dirk Hohndel
f35a271365 Android build: statically link against libssl and libcrypto
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13 15:21:16 -07:00
Dirk Hohndel
c2e1158cf7 Cmake: use the mobile icon for Android apk
The first attempt missed the second spot where this was set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-10 11:22:39 -07:00
Dirk Hohndel
cbda93ce11 Add different icon for mobile app
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-09 16:37:43 -07:00
Anton Lundin
9217a03ef3 Teach android build about subsurface-mobile
This teaches android build.sh and cmake about how to build the qml ui of
subsurface-mobile as a apk.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-09 15:10:48 -07:00
Anton Lundin
5cbbff0084 Use qt-android-cmake to produce a android apk
This introduces code to use qt-android-cmake to produce a working apk.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08 15:48:42 -07:00
Anton Lundin
1f112c7738 Make the libssh linking optional
Due to bugs in libgit2, we force linking with libssh2 to add
git-over-ssh support. On android we currency don't want libssh2 due to
its dependency chain, so this makes the libssh2 force linking opt-out.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08 15:48:30 -07:00
Dirk Hohndel
cf047466b5 Cmake: make Facebook support an actual option
This way we can selectively turn off Facebook support.

And turning off both Facebook support and support for the user manual
allows us to not rely on QWebKit which once again allows debugging
Subsurface with valgrind on Arch Linux.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-06 12:11:07 -07:00
Claudiu Olteanu
198cc41959 Implement the custom Bluetooth serial communication and use it
Create a custom Bluetooth serial communication using the QTBluetooth
API and use it when the Bluetooth download mode is enabled.
First try to connect on RFCOMM channel 1 because this is the default
RFCOMM channel of SPP service for most devices. If this doesn't work
try again on RFCOMM channel number 5 because it could be a Petrel2 device.

Add a fake open function for the custom implementation. This is
used when the selected device is HW OSTC 2N and the Bluetooth
mode is activated, then fake the open call of the serial device.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-06 08:37:42 -07:00
Claudiu Olteanu
dff4e5f33e Add a dialog for remote Bluetooth devices selection
Implement a dialog which can be used for remote Bluetooth devices
selection and to control the local Bluetooth device.
Functionalities of the widget:
 - expose information about the local BT device
 - scan for remote BT devices
 - pair/unpair with a remote BT device
 - turn on/off the local BT device
 - logging
 - save the selected BT device

The selection dialog is created when the bluetoothMode checkbox
is enabled.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-06 08:36:42 -07:00
Dirk Hohndel
35b4af913b Cmake: only build print related files if NO_PRINTING isn't set
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05 16:33:07 -07:00
Grace Karanja
db3a9abac9 Correctly include QtQuick when building for mobile
The changed introduced in d880040d breaks mobile builds by not correctly
linking with QtQuick. This change fixes that by fixing the incorrect line
in CMakeLists.txt so that the correct QtQuick headers will be found.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05 16:01:54 -07:00
Dirk Hohndel
9c6a3a7ff3 Merge branch 'custom-print' of github.com:neolit123/subsurface 2015-07-05 12:01:43 -07:00
Gehad elrobey
963e09ad7b Printing: add TemplateEdit form to source tree
The TemplateEdit class works to customize the tempalate before printing,
User can select the font-size, font-type, color-palette, linespacing
and editing the template HTML code.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-05 20:59:55 +03:00
Dirk Hohndel
35dc814105 Add simple test for the dive planner
This sets up a standard dive scenario (30 minutes at 260ft/79m, EAN36 and
Oxygen as deco gases, last stop at 20ft/6m) and calls the planner to set
up a dive plan given certain standard gases.

Instead of trying to verify the complete plans it checks that we switch to
the deco gases at the right depth and the complete duration of the dive
matches our expectation.

The test intentionally fails right now for imperial as we have the wrong
switch depth for Oxygen. See how useful tests are?

On the downside, the test does NOT produce the same plan as Subsurface
when I try to create a consistent setup for both - and I have not been
able to figure out why. There must be some other parameters that I'm not
setting, but I haven't identified them, yet. It's very small differences,
for example in the metric case the stops at 21m, 9m, and 6m are each one
minute shorter in the test than it what Subsurface calculates.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05 09:42:38 -07:00
Dirk Hohndel
f554c2d16c Merge branch 'taxonomy' 2015-07-02 07:03:03 -07:00
Dirk Hohndel
36657c019b Geo taxonomy: create some data structures and helper functions
This is designed to store taxonomy information for dive sites, including
information where the data came from.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 12:25:47 -07:00
Dirk Hohndel
b8ae4c50b4 Cmake support: remove a clearly broken line
This was intended to help us fine libssh2, but since it works as is now,
and the typo makes the entry pointless, I'm pretty sure that this isn't
needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 10:27:02 -07:00
Anton Lundin
d880040d0a Introduce CMake support for building for Android
This is the first step to be able to build Subsurface with CMake for
Android.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 09:00:48 -07:00
Anton Lundin
c3f6fcb0bf Fix NO_PRINTING when printing is disabled in Qt
Qt for android doesn't have any printing support, so this fixes
NO_PRINTING so we can build against a Qt without any printing support at
all.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 09:00:13 -07:00
Anton Lundin
eda0190e2a Group QT-quick options into one block
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 08:59:50 -07:00
Anton Lundin
82b51e8021 Re-introduce NO_USERMANUAL for Android building
This re-introduces the NO_USERMANUAL flag, which is needed due to the
fact that Qt-Android doesn't have a WebView to view the manual in.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 08:59:30 -07:00
Dirk Hohndel
186f8c6ac1 Cmake: missing quotes
I hate it when I do this

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-29 13:14:06 -07:00
Dirk Hohndel
da7fb2eff4 Cmake: another attempt to make things work with libssh2
This seems to work on all the systems I was able to test it on.
Famous last words.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-29 12:33:33 -07:00
Tomaz Canabrava
ab6e2cc9b4 Fix build with libssh from git
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-29 06:43:44 -07:00
Dirk Hohndel
9f86468c00 Make sure the output directory is created before we run asciidoc
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-27 15:28:27 -07:00
Dirk Hohndel
785f9ba835 Cmake support: the printer files are part of the UI
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 12:49:05 -07:00
Dirk Hohndel
217c6462f5 CMake support: turn building for mobile into an option
This way it can be easily turned on and off from ccmake.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 05:56:36 -07:00
Dirk Hohndel
ff906ba699 Cmake support: fix typo
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 05:48:10 -07:00
Grace Karanja
b7e4b35cde Add DiveListModel
This model will be used to show the dives in QML. This commit adds
the model, and the means to link it to QML.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:26:56 -07:00
Grace Karanja
e0a25289db Add QMLManager to the cmake
Build the QMLManager class when compiling for mobile.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:19:56 -07:00
Grace Karanja
48a54d0348 Add subsurface-mobile app to cmake
Add a subsurface-mobile entry to the CMakeLists.txt file. When cmake
is run with -DSUBSURFACE_MOBILE=True, the compiled app will be named
subsurface-mobile, and the initial page (main.qml) will automatically
be loaded.

This will
ensure that the mobile app will be linked to QtQuick.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:18:06 -07:00
Dirk Hohndel
f0706207df Cmake support: remove Documentation/images in build dir
In earlier versions we didn't simply create a link but actually copied the
directory and its contents. So for this to work smoothly for people who
have built earlier versions of Subsurface with cmake we need to no just
remove the link but be willing to recursively remove that directory.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 06:46:49 -07:00
Dirk Hohndel
0726d4c679 Cmake support: fix in tree builds
And add a message that we suggest that out of tree builds are a better
idea.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 06:06:32 -07:00
Dirk Hohndel
8ab7b5ea7f Windows installer: include grantlee plugins and printing templates
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-19 22:24:18 -07:00
Dirk Hohndel
7e216bcb0c Allow printing and HTML export to work when running from build directory
Yet more things that wouldn't work for a native build under Windows.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-19 21:33:29 -07:00
Gehad elrobey
c152314790 Printing: fix "if" condition clause in cmake file
Check for NO_PRINTING instead of checking for NOT NO_PRINTING.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:50 +03:00
Dirk Hohndel
226e9a7e85 Implement a standalone HTML exporter
This is mostly a proof of concept right now; it shows that it is possible
to create a headless server application that exports a git repository
based data file as html.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:09:21 -07:00
Dirk Hohndel
0692e24036 Separate initializing Qt from initializing the UI
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:05:09 -07:00
Dirk Hohndel
6a0e1cd9f6 HTML export: separate UI and logic code
In order to be able to initiate an HTML export from the core library we
need to separate the actual logic from the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:04:41 -07:00
Dirk Hohndel
854f55fd89 Move checking the cloud connection into its own files
This isn't UI related and shouldn't have been in a file full of UI
functionality.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 06:08:31 -07:00
Dirk Hohndel
0fa0eb2879 Code cleanup: implement window title update via signal
This seems quite convoluted to me but I can't seem to make a more straight
forward implementation work. The idea is that core code should never
directly call into the UI.

So instead the core code (this is C code) calls a helper function. That
helper function calls a member function of a class which in return emits a
signal. The UI code connects to that signal and acts accordingly when it
is received.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 06:04:34 -07:00
Anton Lundin
7a594e3ec5 Simplify distance calculations
This simplifies the distance calculations and removes a dependency.

This version uses propper math instead of my to simple previous version.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 21:08:11 -07:00
Dirk Hohndel
3ff3577eda Cloud storage: Require libcurl in order to support http proxies
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 06:10:19 -07:00
Dirk Hohndel
d541c2b601 Add helper function to determine the distance between two points
And use this to find a dive site within a certain radius of a GPS fix.
This will be used to figure out if dive sites might be the same.

This uses a new Qt5 component (Positioning) which was added in Qt5.2.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 11:51:15 -07:00
Dirk Hohndel
9d0f2a6571 Fix Ubuntu build
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 16:55:27 -07:00
Gehad elrobey
1cff998f84 Printing: Remove more obsolete code from printlayout
This code can be removed as we don't need QT printing code anymore.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:07:55 -07:00
Gehad elrobey
0307ae98c2 Printing: Change "NEW_PRINTING" to "NO_PRINTING"
If NO_PRINTING is not set, subsurface will require grantlee during
building. As Grantlee will be a hard dependency for Subsurface, so no
Grantlee means no printing.

[Dirk Hohndel: switched default for NO_PRINTING to ON]

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:07:41 -07:00
Gehad elrobey
6de5cfb7a4 Printing: Add Printer class that holds the rendering logic.
Render Html pages into a QWebView then print it using QPainter. the
Printer::print() is called that prepare the HTML file to be rendered by
the QWebView.
Printer::render() will do the rendering task.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:07:35 -07:00
Gehad elrobey
e2ad38189e Printing: Add TemplateLayout class
This is the main class to hold Grantlee engine logic.
TemplateLayout::generate() loads QT5Grantlee and initialize the
templates then returns a QString that contains the rendered HTML by
Grantlee library.

Also this class contains the Dive class which holds the logic that
formats the data before passing it to the templates.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:07:25 -07:00
Lubomir I. Ivanov
00f4b7b66b Cmake: add optional pkg-config for Grantlee
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:07:18 -07:00
Gehad elrobey
be7f8dde71 CMAKE: Require Grantlee library
-find Grantlee package
-install the printing_templates directory

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:07:06 -07:00
Dirk Hohndel
778204d662 Cmake: handle the case of local libgit2 but pkg_config for libssh2
Yes, it's kinda weird but that's what I happen to have on one of my
systems and this seems easy enough to implement.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 22:15:26 -07:00
Tomaz Canabrava
537dcb15e0 Use CMake to find libssh2
This works on my system, I hope I don't break others.
Another possibility is to pass -libssh2 directly if it's NOTFOUND.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:39:26 -07:00
Dirk Hohndel
0c2457d9dc Cloud storage: only make this available with new enough libgit2
The credential callback doesn't appear to work (at least not the way I
implemented it) with v0.22 and earlier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 09:58:09 -07:00
Tomaz Canabrava
266e309962 LocationInformationModel moved to qt-models
I forgot about this one, and we are going to use it
in the mobile version too.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:58:48 -07:00
Tomaz Canabrava
ec5717aaa1 Move DivePlotDataModel to qt-models
I think with this one I'm finished.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:14:43 -07:00
Tomaz Canabrava
ffc0c8ee99 Move DivePictureModel to qt-models
This class will surely be used on the mobile version, and it was very
tangled inside divepicturewidget.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:14:27 -07:00
Tomaz Canabrava
33918e6867 Move ProfilePrintModel to qt-models
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:13:32 -07:00
Tomaz Canabrava
60dc9f4ab3 Move TablePrintModel to Qt-models
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:13:12 -07:00
Tomaz Canabrava
85d4bb8a70 Move DiveTripModel to qt-models
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:13:00 -07:00
Tomaz Canabrava
7171d2e1eb Move the YearlyStatisticsModel to qt-models
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:12:48 -07:00
Tomaz Canabrava
9bc62748af Move TreeModel to qt-models
TreeModel is the base of some important models in Subsurface, the
statistics model and the dive list models, this second is the most
important one in the whole Subsurface universe.

This commit is another one in the series to make easy to create a mobile
version of Subsurface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:12:06 -07:00
Tomaz Canabrava
a56429d31e Move DiveComputerModel to qt-models
Another attempt to make it easyer to create the mobile version of
Subsurface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:11:52 -07:00
Tomaz Canabrava
257f8063c4 Move ExtraDataModel to qt-models
Another attempt to make it easyer to create the mobile version.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:11:26 -07:00
Tomaz Canabrava
d84ffa8fc3 Move WeightModel to qt-models
One more step to make it easyer to port the app to Mobile.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:11:12 -07:00
Tomaz Canabrava
a0f3c9992c Move WeigthSystem Info model to qt-models
This is another effort to make it easyer for the mobile
interface of Subsurface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:10:50 -07:00
Tomaz Canabrava
32b0afa3e7 Move Tankinfomodel to its own file
Another change to make it easier to program the mobile ui. This was a
fairly easy patch: just moved the contents of the file and fixed the
includes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:10:30 -07:00
Tomaz Canabrava
f432b764e7 Move DivePlannerModel and CylinderModel to qt-models
Still trying to make it easier for the Mobile Port:
This patch is a bit bigger than I hopped, but it was the smallest that I
could get.

A lot of TODO items where added where I broke the code because the current
implementation would break the QML implementtion on the designer. I'll
most probably fix those myself when I finish the transition to the models
to the new folder.

I only moved both models at once because there's an interdependency
between them (seems inevitable, tough, but I'll take a better look at it
later).

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:09:13 -07:00
Tomaz Canabrava
6e4aa7d044 Move CleanerTableModel to its own file
models.h / .cpp was getting too big (around 2.5k lines), and each change
triggered a rebuild in tons of parts of Subsurface, this is the first
commit trying to make the models code sane by removing them all of the
models.h/cpp file and also clearning code in the process.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:08:36 -07:00
Tomaz Canabrava
338c0f22aa Move the models to its own folder
This is an attempt to help share code between the desktop version of
Subsurface and the mobile version.
More code will be moved around and the models will be split in a way that
will help recompile times and also creation of different interfaces for
different form-factors.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:07:54 -07:00
Dirk Hohndel
95664af53b Add USE_LIBGIT23_API as cmake option
Just as we would expect, the libgit2 developers of course once again broke
their API. In order to compile against current master we need to remap
those APIs once again.

Simply call cmake with -DUSE_LIBGIT23_API

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 09:13:51 -07:00
Tomaz Canabrava
0fdb87b011 Use group of files to show the project hierarchy
This doesn't work on QtCreator yet - but it's the documented way in CMake
to display the project hierarchy in some IDEs (the one that I know that it
works with is Visual Studio). Even knowing that this doesn't work with
QtCreator, it's a valid change because someone can fix creator in the
future.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25 17:10:41 -07:00
Tomaz Canabrava
b59084dc1f Add a new class, QtWaitingSpinner, MIT Licensed.
from https://github.com/snowwlex/QtWaitingSpinner

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 15:00:25 -07:00
Tomaz Canabrava
5eb572b9c6 Move Locationinformation to its own file.
The SimpleWidgets file was getting too big, and location information will
also need a new model - a good way to do not mix everything is to put
things in a new file.

[Dirk Hohndel: added missing include of stdint.h]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:51:13 -07:00
Dirk Hohndel
e491f4a0db cmake: enable Facebook support
Not sure if we have this on Android, so right now I just enable it for
Linux, OS X, and Windows.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-01 19:17:22 -07:00
Dirk Hohndel
7704ed31ff cmake: missing space
This caused cut to fail and the whole dll dependency calculation went
wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-28 13:40:18 -07:00
Tomaz Canabrava
34c88f9a15 CMake needs hints that this will be a win32 or a mac bundle.
MACOSX_BUNDLE and WIN32 give hints to cmake for different
install behaviors. for instance, trying to copy frameworks
and other stuff to the correct places.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-26 12:17:17 -07:00
Dirk Hohndel
ac34413a35 cmake: don't always build tests
Only build the tests when running them. The downside of the way this is
implemented is that build errors for the tests actually show up as test
errors and are only seen in the test log - but this seemed worth not
having every build include the tests.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-24 11:23:50 -07:00
Dirk Hohndel
38ba7177c7 cmake: copy images / icons into the build Documentation folder
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-24 11:02:45 -07:00
Dirk Hohndel
c97e136435 cmake: include the git SHA in the Windows installer name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-24 07:18:11 -07:00
Dirk Hohndel
164170cfdf cmake: fix finding Marble
Silly bug. A lot of things in cmake are case insensitive. Some care about
case. Stupid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-21 18:19:16 -07:00
Lubomir I. Ivanov
82ff9fc9c8 cmake: more consitent multi-line calls
- don't put anything on the first line after the opening "("
- fix indentation of the closing "("

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:02:32 -07:00
Lubomir I. Ivanov
8fec4ab5e7 cmake: use uppercase for defined macros
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:02:23 -07:00
Lubomir I. Ivanov
8153c1560b cmake: fix message for NO_MARBLE
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:02:07 -07:00
Lubomir I. Ivanov
ea2ffd6c32 cmake: lowercase all built-in calls
e.g.
SET() -> set()
ELSEIF() -> elseif()

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:01:36 -07:00
Lubomir I. Ivanov
8c4ef161b2 cmake: generate clean ssrf-version.h
remoevs the extra white sapce in the generated
ssrf-version.h.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:01:14 -07:00
Lubomir I. Ivanov
cdd84bb188 cmake: whitespace cleanup
- indentation
- spaces near comments

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-18 08:00:17 -07:00
Lubomir I. Ivanov
ed4fbb92d0 cmake: add LIBGIT2_FROM_PKGCONFIG and LIBDC_FROM_PKGCONFIG
These two new options allow usage of pkg-config to retrieve
libdivecomputer and libgit2.

For some reason the variables *_LIBRARIES have to be set
to blank strings in the process, otherwise "-l" is passed to
the linker.

LIBGIT2_FROM_PKGCONFIG is a rename from PREFER_GIT_FROMSOURCE
for consistency. The IF() check is also fixed.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-17 15:25:47 -07:00
Lubomir I. Ivanov
39d0b5533d cmake: add the NO_MARBLE option
If NO_MARBLE is set to ON, the MARBLE package is not seeked.
If set to OFF the package is seeked, but if the find fails
the gcc definition -DNO_MARBLE is set and marble is disabled.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-17 15:25:33 -07:00
Lubomir I. Ivanov
1c71a90826 cmake: add the NO_TESTS NO_DOCS options
NO_TESTS: disable the tests
NO_DOCS: disable the docs

Both are set to OFF by default.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-17 15:24:51 -07:00
Dirk Hohndel
6662f2864f cmake: fix bug when using system libgit2
Simple omission in commit 7596db28b5 ("cmake: allow looking for optional
libraries").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-16 07:25:49 -07:00
Dirk Hohndel
5ecf4650b4 cmake: add extra -lpthread to fix Ubuntu builds
We shouldn't need this. Ubuntu is once again broken. What else is new.
But since this shouldn't hurt any of the sane Linux version, I'll just add
it for any Linux flavor.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-16 07:22:09 -07:00
Tomaz Canabrava
8e32faa866 cmake: remove references to LRELEASE
This is being taken care by Qt5::LinguistTool

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-14 10:28:58 -07:00
Dirk Hohndel
12b276d15c cmake: try to find the macdeployqt program
There is no variable for it, but we can abuse the variable that shows us where
moc is located.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-10 13:15:19 -07:00
Dirk Hohndel
6f997274f9 cmake: improve test for variable
CMake still confuses me. When testing if a variable was set it sometimes needs
to want "DEFINED", but sometimes I need to compare it to an empty string. Let's
do both (this seems to fix the problem I ran into) - but this is still weird.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-10 12:10:07 -07:00
Dirk Hohndel
7596db28b5 cmake: allow looking for optional libraries
And use this to look for libusb.
If it's there then libdivecomputer likely was linked against it. If it isn't
then we don't need it, either.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-10 12:08:26 -07:00
Tomaz Canabrava
a8d06b848e Move the translations to it's own subfolder
By adding a new CMakeLists.txt file and configuring
the translations inside of it's folder, the buildsystem
will compile everything on that folder.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 11:57:30 -07:00
Tomaz Canabrava
1a662df648 Use Qt5Translations to deal with translations
And remove the old code that did the same thing in
a very complex way.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 11:16:44 -07:00
Tomaz Canabrava
a56c0f227d We use static library if we find - option was not being used.
Currently we search for a static library and if we don't
find it, we search for a shared library. If one of them
is found, we return success but if none of them is found,
error. So - A static library for libgit and libdivecomputer
is preferred over the shared one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 11:16:30 -07:00
Dirk Hohndel
d6dc1d01df cmake: fix typo
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 20:49:21 -07:00
Tomaz Canabrava
c2bdc58fb8 Make it compilant with the build script
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:27:39 -07:00
Tomaz Canabrava
6f93590705 Add FindLibdivecomputer.cmake
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:27:39 -07:00
Tomaz Canabrava
46990f4ac8 Simplify libgit handling on main CMakeLists.txt
We will use the OPTIONS variable to decide to find the
.a or the .so, so there's no need to do checks here.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:09:35 -07:00
Tomaz Canabrava
5a9931f438 Add build options
- add an option to toogle between libgit2 from package vs built from source
- add two options that will be used in the future: use static/dynamic lib

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:08:55 -07:00
Tomaz Canabrava
2e05dbb791 No need to specify Marble dir anymore
We are already looking for the default directory.
*if* cmake doesn't find Marble automatically, the user needs
to specify -DMARBLE_INCLUDE_DIR and -DMARBLE_LIBRARIES

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:07:33 -07:00
Tomaz Canabrava
057231701e Move the pkg_config_library macro to its own file
The pkg_config_library macro is a helper macro and was generating noise
on the main CMakeLists.txt file, so I moved it to another file.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:07:07 -07:00
Tomaz Canabrava
e56580229b FindMarble moved to cmake/Modules
This is the correct way to deal with CMake Modules (or at least, the
default way). All our custom CMakeFiles will be here.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:06:54 -07:00
Tomaz Canabrava
85fbd1737c Simplify finding Qt
Qt5 Supports Components, which means that we can list the
components we need to find, instead of specifying one for
each line.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-07 16:06:44 -07:00