Commit graph

8130 commits

Author SHA1 Message Date
Linus Torvalds
971f1c6674 git storage: re-organize code to make 'origin' remote more widely available
I'm going to try to update the remote if the local cache is more recent
when we fetch the data, which requires access to the remote over a wider
range of code.  This re-organizes the code so that we can free the
remote later without having to have nasty error handling.

We avoid the whole "if an error happened, free the remote and return" by
creating helper functions and freeing the remote in the caller, so that
all paths end up freeing it naturally.

NOTE! We want to try to update the remote when we save the local cache
too, so this whole "update remote when opening it" is incomplete. But
 (a) we do want to do it here as well
and
 (b) this is the easiest place to create the initial "push to remote"
     code without any new "sync with cloud" interfaces.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 20:57:13 -07:00
Linus Torvalds
1379f34792 git storage: actually update cached copy from remote
We used to fetch the remote information but not actually do anything
about it, except report when it wasn't up-to-date.

Now we actually update the local cached copy if the remote has changed.

The code does not try to actually merge things, so only fast-forward
updates are done, but that should be the normal case.  We might
eventually do some simple merging on our own, but I suspect manual
merging may be the safer option.

We don't currently ever update the remote repository, and only inform
users that our local repository is ahead of the remote.  Fixing that is
the next step.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 18:13:25 -07:00
Dirk Hohndel
ec8ba5f830 Dive site management: remove the profile view
While this isn't what I really want (I wanted pictures of the dive site
instead of the profile), at least this makes it clear that we aren't
editing a dive but instead are looking at a site.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 15:03:12 -07:00
Dirk Hohndel
b0fc00694d Add "additional name" to the correct dive site
Adding the name to its own dive site was kind of silly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 13:03:37 -07:00
Dirk Hohndel
3b018204f2 When done reverse geocoding, hide the notification
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 12:30:02 -07:00
Dirk Hohndel
0da0a40bb8 Don't show the V2 warning anymore
This now happens in its own thread...

But leave the infrastructure so we can ask questions about the geo
encoding

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 11:57:31 -07:00
Dirk Hohndel
2c22b24ef6 When parsing V2 XML files try to be smarter when creating dive sites
Two "locations" from a V2 file are the same site if they have the same
name AND if their GPS coordinates are within 20 meters of each other.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 11:52:18 -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
1ee447b5a9 When saving only selected dives, only include referenced dive computers
Since we should have far fewer dive computers than dives this straight
forward algorithm shouldn't cause any performance issues.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 09:29:04 -07:00
Dirk Hohndel
2365531c68 When saving only selected dives, only include referenced dive sites
The algorithm seems rather brute force; basically quadratic in the number
of dives, assuming we have about the same number of dive sites as dives
which seems a reasonable assumotion.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 09:28:40 -07:00
Dirk Hohndel
d24de5b72b Don't show all the auto generated dive sites on the globe
When downloading GPS data from the Subsurface webservice we repopulated
the globe before purging all the unused GPS fixes from the list of dive
sites which caused massive clutter (until the next time the user changed
the displayed dive or did anything else that caused the globe to redraw
itself).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 07:09:23 -07:00
Dirk Hohndel
2a110811cf Cloud storage: be more careful when trying to determine a user name
Since we use the email address (including the '@' sign) as the repository
name we have to be more careful when trying to pick an account name from a
git URL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 20:54:01 -07:00
Dirk Hohndel
0eb6dc4332 README should mention that this is not a release
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 17:42:30 -07:00
Dirk Hohndel
7ec406da82 ReleaseNotes: mention cloud storage
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 17:41:44 -07:00
Dirk Hohndel
8282ed2348 Merge branch 'cloudstorage' 2015-06-09 17:16:31 -07:00
Dirk Hohndel
57507cfb93 Cloud storage: implement confirmation of email address via PIN
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 17:04:30 -07:00
Dirk Hohndel
a04f1fd133 Cloud storage: deal with visibility of PIN entry
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 17:03:53 -07:00
Dirk Hohndel
a07376b534 Cloud storage: initial support for confirming the email PIN
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 17:03:36 -07:00
Dirk Hohndel
9d0f2a6571 Fix Ubuntu build
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 16:55:27 -07:00
Dirk Hohndel
e60e133e76 Build script: switch to working URL for grantlee
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 16:09:30 -07:00
Dirk Hohndel
74f3961b05 Discard all temporary sites after merging with dive list
After we import all the GPS fixes from the Subsurfae webservice we delete
the ones that didn't match any dives. The algorithm skipped every other
one by mistake.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 14:35:27 -07:00
Dirk Hohndel
e19fa0a9f3 Subsurface GPS webservice: make sure dive log is marked as modified
One of the cases was missing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 14:34:37 -07:00
Dirk Hohndel
53806c265c Create unique dive sites when downloading from webservice
The Subsurface Webservice (as backend for the companion app) will usually
send a lot of gps fixes encoded as dives, all with the same dive site
name. When parsing the XML file it sends we need to make the dive site
names unique so that we can then match them to the existing dives.

The fake dives with all the dives sites will all be discarded, but without
creating the unique dive sites we can't successfully add the GPS
coordinates to the existing dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 12:50:17 -07:00
Gehad elrobey
d88da53586 Fix building with NO_MARBLE issue
We can't build with -DNO_MARBLE after some previous commit broke
globe.cpp

- centerOnCurrentDive() is still existing in the code while removed from
header in 6b81fb49d0.

- Some referenced to MainWindow::instance()->globe() even if we are
building with no marble.

- include stdint.h

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 11:22:41 -07:00
Dirk Hohndel
318bf5cccc Cloud storage: first stab at creating an account on the backend
This triggers when the email address / password is changed in the
preferences. It opens an https connection with the backend server (the URL
is hardcoded) which should create an account with these credentials.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 09:54:35 -07:00
Tomaz Canabrava
d9801b67b4 Select the correct dive in EditAddedDive mode
If we added two dives, and then tried to edit
the first added one, the current 'added dive'
set on main_tab would be the second one, so when
we got to the accept() part of the call, it would
reselect the last added_dive that we had.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:37 -07:00
Tomaz Canabrava
09172ddfa4 Change the name of the dive site on the globe
The name of the dive site on the globe wasn't being
updated when we changed the name of it in the dive
management dialog.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:37 -07:00
Tomaz Canabrava
111968776f Reset the current dive site when we reject it
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:37 -07:00
Tomaz Canabrava
03147d69ba Plot the current dive site in edit mode
We were ignoring the displayed_dive_site
as we were adding it and the changes weren't
accepted yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:37 -07:00
Tomaz Canabrava
48d2d4a942 Do not connect to same signal/slot twice
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:37 -07:00
Tomaz Canabrava
dd5e221388 Temporary dive + temporary site = crash
We always thought that a dive had a dive site
and that a dive really exists. but if we go
to add dive and then go to add dive site,
none of those exist yet and then we got a crash.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:37 -07:00
Tomaz Canabrava
ed20b004a8 Always fill the fields in LocationInformation edit widget.
If the current_dive was the same as the dive send to
the LocationInformation widget, we would do nothing,
wich is wrong because we could have filled the information
on an add_dive_site action and then cancelled it, so the
info will stay there until we change it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:37 -07:00
Tomaz Canabrava
6b81fb49d0 Always send the UUID of the coordinates to the globe
We were relying in the current_dive to display the
globe coordinates correctly - but this is not always
the case: you can be inserting a new dive site and it
isn't yet inside of the dive until the user presses
accept. So always pass the uuid of the dive site that
we want to display.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:32 -07:00
Dirk Hohndel
218ad95d7d Build script: fix several bugs
With this I can now successfully run this on Mac and Arch Linux, both running
"fresh" and running in an existing build directory (i.e., getting the updates
right).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 13:52:13 -07:00
Dirk Hohndel
d9606022b4 Build script: Integrate Grantlee & build Subsurface with printing
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 11:53:31 -07:00
Dirk Hohndel
a798bb010c Build script: make sure the versions we want to build exist
The script didn't do the right thing if it had been run before and was
re-run to create the latest build. We need to actually pull the latest
versions of the different git repositories and make sure that the branches
and commits that we want exist.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:49:20 -07:00
Dirk Hohndel
1cf31eeaf9 Make Subsurface compile with NO_PRINTING set
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:18:37 -07:00
Lubomir I. Ivanov
9bda2e2d82 GlobeGPS: add empty function for NO_MARBLE
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:08:14 -07:00
Gehad elrobey
a820688aeb Printing: Add progress updating ability to print dialog
The progress bar shows the progress of both the rendering part and the
templating part, unfortunately we can't check the progress of Grantlee
templating engine so the progess bar doesn't have a constant pace it
stops a little around 20%.

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:08:09 -07:00
Gehad elrobey
231f90bd26 Printing: call print from printer class
This is the main function that prints dive lists.

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:08:04 -07:00
Gehad elrobey
b4e1563d10 Printing: remove the print_options struct from display.h
Move print_options struct to printoptions.h, its more relevant to be
placed here.

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:59 -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
a0b8eed612 Printing: Edit the print options widget
Remove obsolete code and add new customizable print code to the options
dialog.

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:50 -07:00
Gehad elrobey
912606e1c7 Printing: Remove the obsolete code from PrintDialog
We don't need any further calls to printLayout as it will be replaced by
Printer class that handles the new custom printing capability.
Also fix one coding style issue.

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:46 -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
Gehad elrobey
672039c44f Printing: Create two dives per page grantlee template
This is just a HTML/CSS template file which will be used
as the basis for initial Grantlee development.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-04 10:05:11 -07:00