Commit graph

3460 commits

Author SHA1 Message Date
Dirk Hohndel
ccc9d80015 Remove all the no longer necessary code that aborts read of first V2 file
This was a poorly implemented hack when we executed the reverse geo lookup
in the main thread and opening a V2 file could take a very long time. We
need to do the "Welcome" message quite differently.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:41:56 -07:00
Dirk Hohndel
bd11988f74 Cloud storage: warn the user if we are not online
This isn't perfect, but at least tells the user if we weren't able to
connect and are working just off the local cache.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:09:37 -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
Dirk Hohndel
c593dea119 Cloud storage: use preference member instead of hard coded strings
This creates the basis to allow other backends to be used with the cloud
storage infrastructure.

So far this should all just transparently continue to work. A user would
have to manually add the cloud_base_url entry to the CloudStorage section
in their config file in order to use a different backend server.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-15 10:22:00 -07:00
Dirk Hohndel
617b105458 Cloud storage: create preference entry for base URL
This just deals with the mechanics. There is no UI to enter / change this
URL (and that's intentional), neither is it used, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-15 09:56:11 -07:00
Dirk Hohndel
8d05c71ca2 Fix renumbering of dives
The implementation in commit 182fe790c9 ("Add ability to undo
renumbering of dives") looks perfectly reasonable, but it depends on an
implementation detail: it assumes that the keys of the QMap are returned
in the same order in which they were placed there. Which apparently isn't
the case for some version of Qt.

With this commit we simply remember both the old and the new number for
each dive and therefore the order in which they are processed doesn't
matter.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 21:49:34 -07:00
Dirk Hohndel
60f4b37fab Cloud storage: only offer cloud storage related options when verified
If we don't have verified cloud credentials disable the menu options and
disallow the use of cloud storage as default data file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 15:42:28 -07:00
Dirk Hohndel
0c44bc7271 Cloud storage: clear our last error if verification succeeds
This is cosmetic but makes things friendlier, I think.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 14:18:51 -07:00
Dirk Hohndel
4b120d1bf5 Cloud storage: show in preferences if cloud account was verified
This should make it easier to figure out what's happening.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 14:06:44 -07:00
Dirk Hohndel
b5eb66545b Cloud storage: clean up handling of cloud storage account
Correctly tracking the status of our authentication with the cloud service
is non-trivial, especially since the user may quit Subsurface between
registering and verifying an account, they might even register on one
machine and verify on another.

This tries to make sure that when in doubt we check with the cloud service
backend. And we show errors in the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 14:06:28 -07:00
Dirk Hohndel
8f7a4a1a97 Main menu: rephrase the cloud load/save options
This seems to be more logical and more consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 08:40:29 -07:00
Dirk Hohndel
10b9202757 Preferences: hook up default file behavior in the dialog
This now sets the preference variable / config entry and keeps them in
sync. Doesn't actually change the behavior at program start, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 08:32:37 -07:00
Dirk Hohndel
bfd3782b81 Preferences: radio buttons for default data file behavior
These aren't hooked up, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 08:07:15 -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
9a22efb97b Move git related declarations into their own header file
Also change the name of the enum and make sure all the inner functions get
passed the remote transport information.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 09:14:48 -07:00
Dirk Hohndel
492369b312 Cloud storage: Add preference option whether to sync in the background
This defaults to on as that's the most useful setting for the average
user.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 11:48:56 -07:00
Dirk Hohndel
3a0ffb70a0 Cloud storage: don't clear out password by mistake
If the user didn't enable saving the password to the preferences, then the
password was cleared out as the preferences got synced.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 11:28:20 -07:00
Dirk Hohndel
a9c2a3f009 Use friendlier file name when asking about saving changes
It's silly to show our full URL with branch name in that case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 10:42:14 -07:00
Dirk Hohndel
f442358915 Cloud storage: better window title
This makes it clear that we are working with the cloud storage and removes
the (in that case, redundant) branch name from the title.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 10:38:01 -07:00
Dirk Hohndel
ef95bd9a27 Indicate that there are unsaved changes with a '*' in the window title
This seems to be a fairly common way to indicate this property.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 10:21:16 -07:00
Dirk Hohndel
4d06e8f7b5 Cloud storage: check connection before connecting
libgit2 takes forever (a minute or so) to figure out that it can't connect
to a remote server.
So if we are using https as connection protocol, quickly check utilizing
RFCs 2324/7168 to make sure we can reach the cloud server (and not some
captive portal or something).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 09:22:36 -07:00
Dirk Hohndel
82b15b02b3 Dive site management: show pictures instead of profile
This seems to work better than moving the Globe up there.
It's not ideal (I really want to be able to show one big picture for the
site - and on all the sites without pictures we show nothing), but for now
I think this is better than having the profile there.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-11 11:10:14 -07:00
Dirk Hohndel
1dee5e1723 Revert "Dive site management: remove the profile view"
This reverts commit ec8ba5f830.

Turns out that moving the globeGps widget to a different quadrant breaks
the parent relationship and that causes things not to work. I know that I
tested this and didn't notice any issues, but I now can reproduce a broken
default screen. So let's revert.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-11 10:58:01 -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
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
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
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
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
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
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
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
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