Commit graph

8430 commits

Author SHA1 Message Date
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
willem ferguson
b144518a85 Add libcurl to the default library dowloads for debian/ubuntu
Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 21:57:05 -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
Jan Darowski
a524c01c3f Don't compare signed and unsigned values
This fixes a "reproducable hang when using "edit dive in planner" on
non-planned dive".
Comparing unsigned and signed integers isn't a great idea.

Fixes #880

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 21:20:55 -07:00
Gaetan Bisson
77dae89b90 Fix compiling against libgit2-0.22.1
I have no idea whether the semantics is right, this patch was only
written so Subsurface compiles against the current stable release of
libgit2.

[Dirk Hohndel: added an extra conditional so this also compiles with the
	       curl-stream branch needed for https proxy support in
	       libgit2]

Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 20:49:37 -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
60bd4288c7 User manual: first stab at documentation of Subsurface cloud storage
This needs screenshots and better wording, but it's a start.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 15:10:13 -07:00
Dirk Hohndel
9dfe1b77ba Release notes: add a few more details about cloud storage
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 14:52:44 -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
782d5b3689 Make default file behavior work as expected
Subsurface will now start with the no default file, the local default file
or cloud storage as chosen in the preferences.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 08:32:47 -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
Dirk Hohndel
6359a98397 system_default_directory() is broken with Qt 5.4
So for now just keep using the same function as we use with earlier
versions of Qt5 as that seems to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 21:12:54 -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
9ec155fad0 Cloud storage: clean up error propagation
We were falling of the end of a number of functions that were supposed to
return 0 on success or an error.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 20:03:20 -07:00
Dirk Hohndel
0c5ea57f1c Cloud storage: initialize local cache and remote on first use
There's no point in telling the user that the remote is empty. We need to
instead fix that and create the local cache and set things up for the
remote.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 18:36:08 -07:00
Dirk Hohndel
e6dce94088 Cloud storage: if there is no remote tracking branch, create it
When we first store things to the remote there won't be a matching branch
for it. And even if for some silly reason the remote branch got lost -
what's the point of telling the user that there is no remote branch? What
are they supposed to do about it. Let's just fix the problem and move on.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 18:36:08 -07:00
Dirk Hohndel
ef85875cd0 Cloud storage: make do_git_save available to other modules
And add a parameter that tells it whether to try to save any Subsurface
data or whether to just create a branch and push it out.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 18:36:04 -07:00
Dirk Hohndel
f6981f0210 Add helper function to create a directory
Yes, this could easily done from the C code. But this seems just so much
easier and I don't have to worry about the oddities of Windows and all
that.

I'm lazy. So sue me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 18:26:34 -07:00
Dirk Hohndel
b413fabce7 Cloud storage: don't print confusing warning
This is no longer correct and is actively misleading. We now correctly
sync with the remote.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 18:24:27 -07:00
Dirk Hohndel
3d62f89bce Cloud storage: Remove another git related message
Once we failed to load data from cloud storage (for example the first time
we try to use it when the remote repository is empty), don't show git
related errors to the user. It's enough to tell them that the cloud
storage is empty.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 13:16:08 -07:00
Dirk Hohndel
7b7568b1ba Cloud storage: setup proxy before cloning new repository
If we don't have a repository yet, we can't setup the proxy option before
calling into libgit2. Instead we use a callback.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 09:14:48 -07:00
Dirk Hohndel
df255e2573 Don't show an error if you fail to open the cloud storage
The lower level functions will already report that things didn't connect
successfully, no reason to repeat it here (which then exposes the git
URL).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 09:14:48 -07:00
Dirk Hohndel
abde615c1c Cloud storage: give user friendly error messages
Instead of showing the git URL and talking about failures to clone
repositories, simply tell the user what's happening with the cloud
storage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 09:14:48 -07:00
Dirk Hohndel
3ad517d87a Cloud storage: check connectivity before trying to connect
With a new repository we take a different path.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13 09:14:48 -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
e21cae2d46 Cloud storage: sync the remote after save
This change once again tests if the remote can be reached. Even with a
fairly big data file and a medium speed internet connection the remote
sync is fast enough to call it nearly instantaneous. Maybe a couple of
seconds.

We may need more checks / different heuristics / warnings if the sync
didn't happen, etc. But for now this should allow more reasonable testing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 13:56:23 -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
57f2c81125 Add header for Qt helpers used from C functions
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 10:20:57 -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
5e0c546beb Cloud storage: Unset the proxy if none is configured
The settings are stored in the local cache repository - so without
resetting it a proxy would stay configured even if it was disabled in the
Subsurface preferences.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 09:22:35 -07:00
Dirk Hohndel
490d21806e Cloud storage: Setup http proxy for git connection
At the time of this commit support for this feature has not landed in
upstream libgit2, yet (but there is a pull request). Yet supporting this
here doesn't appear to cause any issue with older versions of libgit2,
either, so the http proxy support will simply not work when enabled and a
version of libgit2 that's too old is used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 09:22:27 -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
Miika Turkia
f3b93eb57a Add two new libraries to requirement list (deb)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-11 11:52:15 -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
3e35a0067b Add a more complex sample dive
This includes trips, dives outside trips, deco, gas changes, dives with
multiple dive computers, a really short dive, a rather long dive, a dive
with pictures, dive computers with very coarse sample rate, rather fine
sample rate, with gas integration, without...

Should touch a lot of different scenarios.

The file is in V2 format to also allow testing the importing / conversion
to dive sites.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-11 10:31:11 -07:00
Paul-Erik Törrönen
be6a9ac1ea Minor fixes to the INSTALL-file
* Add needed qt5-qtlocation-devel package for Fedora install
* Correct the call to subsurface binary after compilation]

Signed-off-by: Paul-Erik Törrönen <poltsi@777-team.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-11 07:55:23 -07:00
Dirk Hohndel
8ad000846d Cloud storage: use our credentials when updating the remote
If we are pushing to an ssh or https based remote we need to use our
credentials.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 21:55:19 -07:00
Dirk Hohndel
26cbc32495 Cloud storage
Use the credential helpers earlier in the source. This way we can use them
for the push as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 21:54:42 -07:00
Dirk Hohndel
e81a67f9d3 Cloud storage: track the repository type and pass the information around
This is easier than having various parts of the code to the string
comparison on the URL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 21:54:25 -07:00
Linus Torvalds
39a0ac965b git storage: actually update the remote repository if the local cache is more recent
Again, note that this currently only happens when you initially open the repository.

So if you do

    subsurface https://.../repo[myubranch]

it will start up by fetching the remote information, and updating the
local cache.  If you then download new dives, and do a save-and-exit, it
will save to the local cache, but it doesn't do the fetch at this point,
so the remote is now begind.

The *next* time you start subsurface, and load that git branch again, it
will fetch the remote, and now notice that the local cache is ahead of
it (because you downloaded new dives and saved them locally), and *then*
it will try to update the remote with the new information.

This is obviously bogus, but we will need to decide exactly how we want
to sync with the remote repository.  But now the core functionality is
there, it's just that we need some interface to say "sync now".
Especially in the face of spotty (or non-working) internet, you want a
GUI etc for this whole remote sync, rather than doing it unconditionally
and silently whenever you load the local cache initially.

With that caveat:

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 20:57:57 -07:00