Commit graph

145 commits

Author SHA1 Message Date
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