Commit graph

7839 commits

Author SHA1 Message Date
Tomaz Canabrava
b8092c07a4 Create a new DiveSite when user clicks on add
Also reorganized a bit of the code, and renamed a few misleading methods.

[Dirk Hohndel: remove some C++11 code]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 13:24:37 -07:00
Tomaz Canabrava
82d3f088a4 Manage Dive Site from the MainMenu
Trigger the ManageDiveSite from the MainMenu.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 13:14:24 -07:00
Tomaz Canabrava
b9a3234371 Add a timeout (500ms) to GeoLoccation discovery
GeoLocation discovery would hang if on an incorrectly configured proxy -
this way we will finish as soon as it tries to get everything.

I also need to see what to do with the dive sites if it fails to find any.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 13:13:45 -07:00
Dirk Hohndel
d0b5f355ab Move helper function to the appropriate file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 13:09:45 -07:00
Dirk Hohndel
a0b455582d Build script: use sufficiently new libgit2 and enable cloud storage
Turns out that as of a day ago or so tip of libgit2 master appears broken
(the in memory ssh key test in the cmake file fails). But the specific
commit that I'm picking here appears to work and is also new enough that
https and ssh based cloud storage works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 12:54:28 -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
Dirk Hohndel
e84d8624bb Add strndup.h header so we can use this useful function
It's missing on Windows... we had this helper in liquivision.c but since I
used the function in git-access.c I figured I should just turn it into a
little helper.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 23:14:56 -07:00
Dirk Hohndel
5bbcc7f16d Cloud storage: first stab at implementing cloud storage
So far there is no mechanism to actually create a repository on the
server, so this only works with the two test repositories.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 22:35:50 -07:00
Dirk Hohndel
a6b6674780 Cloud storage: rethink the terminology used
Cloud storage makes more sense that remote storage - at least I assume
that more people are used to thinking about "storing things in the cloud".

Don't use PIN or passphrase, call it a password everywhere.

Don't use copy_string() to copy the password - the git credentials routine
asserts that password is not NULL, so make sure we at least have a pointer
to an empty string here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 19:45:05 -07:00
Dirk Hohndel
97ef9d0ee8 Cloud storage: add support for https based remote
This will make it easier to access the remote storage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 17:15:58 -07:00
Dirk Hohndel
96cffe88e7 Fix crash
With no dive sites we dereference a NULL pointer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:12:56 -07:00
Tomaz Canabrava
f28cec7b9e Don't ask for globe-coordinates for a dive
Only ask that for dive_site_management.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:03:37 -07:00
Tomaz Canabrava
ad9d1a81a2 Don't ask for a GeoCoordinate when editing a dive
This should be asked when we are in dive_site_edit mode.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:03:07 -07:00
Tomaz Canabrava
6d9206150a Organize the dive_sites alphabetically
run std::sort on the dive_site list inside of the model.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:02:35 -07:00
Tomaz Canabrava
7129cef66f Don't calculate what we already have
We already have the correct number of dive_sites, why use a loop to
calculate it?

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:01:46 -07:00
Tomaz Canabrava
b35e48c68e Fix off-by-one error
i is one greater than the number of dive_sites, use the correct nr.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:01:16 -07:00
Tomaz Canabrava
8b96179d59 Fix crash when cancelling divesite edit with empty divesite
Only happens if you dont't have any divesites in your list, but either
way, it could happen.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:00:51 -07:00
Tomaz Canabrava
636aac83f8 We are not using a completer for location anymore
So, remove it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:00:16 -07:00
Tomaz Canabrava
80fe3f88f9 Correctly set the dive site id on the dive
When changing the index of the combobox we were discarting the
dive_site_id. This fixes it.

Now I need to understand what's happening to the globe.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:59:47 -07:00
Tomaz Canabrava
b0d7d0f3b9 Fix the connections for the Location Edit
The LocationEdit now correctly connects to the QComboBox signals, not the
QLineEdit signals.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:59:30 -07:00
Tomaz Canabrava
ac6a7ab24e Update DiveLocationModel when thread finishes
This patch updates the DiveLocationModel when the
GeoLoockupInformationThread finishes, and also selects
the correct index for the displayed dive.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:59:11 -07:00
Tomaz Canabrava
d6e61b74fc Typo on the header guard. oops.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:58:58 -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
88549d1874 Change the Location from a LineEdit to a ComboBox
And hook up every method that was changed.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:58:38 -07:00
Tomaz Canabrava
abb6773490 Fix border glow on OSX
The border was just too small for the glow.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:58:26 -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
37bd82f623 Fewer rebuilds triggered by changes in models.h
Models.h now is quite minimal, I'll keep it like that for now, until it
grows huge again. I've also cleaned a bit the headers that are using it so
only the ones that actually need the stuff that I've left behind will
actually include this file.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:13:44 -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
29e7459d6b Remote storage: second attempt to fix build with older libgit2
That was embarrassing...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 21:43:32 -07:00
Salvador Cuñat
64ba7f8683 Correctly save dive rating after changing it
Corrects typo in ebaa7d1fd which impeded that changes in dive rating
were saved after editing.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 16:12:37 -07:00
Dirk Hohndel
c6e0b74452 Remote storage: turns out you need a newer libgit2
I was afraid that this would only work with a farily current git master of
libgit2 and it turns out I was right. The API was available, but the
correct type wasn't.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 16:09:29 -07:00
Dirk Hohndel
61c0d0c73d Remote storage: collect email and PIN in preferences
This allows entering / storing the PIN (aka passphrase) for the ssh key.
The email isn't used, yet - this will be used by the automated backend to
create a unique git repository that will turn into the remote storage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 14:40:06 -07:00
Dirk Hohndel
c90635cef2 Remote storage: add preferences UI
This isn't hooked up at all right now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 14:39:53 -07:00
Dirk Hohndel
43254a70ca Remote storage: provide credentials for ssh based remotes
The key location is hard coded as this is only intended for our own
infrastructure, so we don't need multiple keys.

If the private key is protected by a passphrase, this needs to be manually
added to the preferences. As RemoteStorage->passphrase.

This has only be tested with a current version of libgit2 master, but
should compile with any previous version (the API doesn't exist in v0.19
and earlier - that's handled with appropriate #if clauses).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 14:39:35 -07:00
Dirk Hohndel
20d1d2c385 Remote storage: add preference for the passphrase
While we don't expose it as this to the user, we'll need an ssh key and
potentially a passphrase in order to communicate with the git server in
our infrastructure. This simply sets up a way to store the passphrase.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 14:38:59 -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
Guillaume GARDET
8af85fbc04 Documentation: Merge/update french user-manual translation
Merge/update french user-manual translation.

Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28 08:18:01 -07:00