Commit graph

10770 commits

Author SHA1 Message Date
Robert C. Helling
c2c0cb48d2 Only attempt to download each picture once
Otherwise we keep downloading the same image multiple times instead
of new images.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 16:18:44 -07:00
Dirk Hohndel
4a9b97e4a9 Remove duplicate resource mention
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 16:16:31 -07:00
Dirk Hohndel
82d4ffbdcd Fix typo
Otherwise this code makes no sense (and has no effect).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 16:15:51 -07:00
Dirk Hohndel
241dd7cb81 Merge branch 'offlineDefault' 2016-04-30 12:40:52 -07:00
Dirk Hohndel
ba9288fab6 QML UI: when first entering cloud credentials, force cloud connection
With offline the default now, we need to force a connection at least once
so that the repos are in sync. And then of course we need to return to the
correct state, regardless on whether this connection succeeded or failed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 11:08:33 -07:00
Dirk Hohndel
7afcadef53 Remove pointless code
This isn't how you remove the default filename

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 11:07:58 -07:00
Dirk Hohndel
d943050a93 QML UI: make offline the default
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 11:07:14 -07:00
Dirk Hohndel
9bec79a71b Don't pretend that opening git repo succeeded
Not sure why we claimed that this was successful when clearly it wasn't.
There's a risk that this could break something on the desktop, but it
makes no sense to me why that would be the right thing to do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 11:06:02 -07:00
Dirk Hohndel
bca2c2a101 Connect to the reply, not the manager
This way if there are other pending connections we don't get triggered by
the wrong completion.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 10:16:00 -07:00
Dirk Hohndel
879482e977 QML UI: forceRemoteSync means connect even without unsaved changes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 10:15:56 -07:00
Dirk Hohndel
711e5e76e8 QML UI: better diagnostics when cloud connection fails
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 10:15:15 -07:00
Dirk Hohndel
05a51f7984 Only create the path to no cloud local storage once
This required a small change to the helper function, but this seemed
totally worth it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 09:46:29 -07:00
Dirk Hohndel
78d420ac32 QML UI: make text match the implementation
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 09:46:19 -07:00
Dirk Hohndel
4a2a0a426e Fix logic for when to mark dive list as changed
Since saving checks if there are changes, we have to always mark the dive
list as changed before asking for the changes to be saved.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 09:46:01 -07:00
Dirk Hohndel
4ad73fb807 QML UI: when switching from no cloud to cloud usage, don't drop local data
This is rather simplistic, it just imports the local data into the remote
repository and therefore loses the git history of the local data - but I
wasn't able to make the git merge without shared base commit work, so I
went this much easier to implement route instead.

One thing we need to be careful about is that contacting the remote server
could fail. If we don't manage to merge the dives from cloud server and
local storage, we need to revery to no cloud status in order not to lose
the local data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 14:36:00 -07:00
Dirk Hohndel
c6205b5819 QML UI: fix order of tests when saving changes
Only check for previous cloud connection when actually trying to save
to cloud

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 14:03:50 -07:00
Dirk Hohndel
247358be37 Clean up comparison syntax in qml
For consistency.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 12:16:55 -07:00
Dirk Hohndel
3f63660267 Allow switching the user from the command line
This is a feature that many people have asked for. This implementation is
somewhat simplistic because we simply use a different name for the
program settings - but interestingly enough this appears to be enough to
capture a lot of the core functionality that people are looking for in
multi-user support.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 12:14:59 -07:00
Dirk Hohndel
f536da0ee3 QML UI: make sure nothing is lost when changing cloud credentials
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 09:48:43 -07:00
Robert C. Helling
2e6588dc0e Protect access to image hash dictionaries with lock
Otherwise we step on our own feet when downloading several images,
like after import from divelogs.de with many linked images.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 09:08:20 -07:00
Lubomir I. Ivanov
cae99471ad CylindersModel: clamp the "cylinderuse" values
If the value for "use" is negative or larger than the number of
elements in "enum cylinderuse", later CylindersModel::data() can
request a string in the lines of cylinderuse_text[cyl->cylinder_use],
which can SIGSEGV.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 09:07:59 -07:00
Linus Torvalds
56ed3f1c61 Fix Qt date interfaces for times before 1970
This seems to work around the crazy QDateTime::fromTime_t() problem in Qt.

It is *very* lightly tested. In fact, the only test is that "test0.xml"
change that is part of this patch.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 09:07:41 -07:00
Linus Torvalds
84166a4ee7 Extend time parsing to before 1970
It turns out that we are starting to have users that have logs that go
back that far. It won't be common, but let's get it right anyway.

NOTE! With us now supporting dates earlier in 1900, this also makes
"utc_mktime()" always add the "1900" to the year field.  That way we
avoid ever using the fairly ambiguous two-digit shorthand.

It didn't use to be all that ambiguous when we knew that any two-digit
number less than 70 had to be 2000+.  Now that we support going back to
earlier in the last centiry, that certainty is eroding.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 09:07:17 -07:00
Dirk Hohndel
9ca0f7334b QML UI: handle failure to read local dive data
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
93d21ceac7 correctly load default filename
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
3946f83ff2 only set index if we have specific target
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
15431f418e QML UI: use anchor to fill parent
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
49e2113ae8 Remove hack that's no longer needed
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
bdf8bc676b QML UI: with a local default file setup, open that at start
And set no cloud mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
ec136defa8 QML UI: set the default local repo to load
This will allow the user to open a repo that was stored in no cloud mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
4b1edceca0 Add helper function for the consumption of loaded dive data
This allows us to call that part of the process from multiple places
in the future.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
7c156f3ba1 QML UI: in no cloud mode, save to a default local repo
And set that up as the default file to load at start.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
9ba090c31f git storage: init local repository
So far we didn't do that at all, we either relied on the user manually
creating a local repo, or we cloned a remote repo.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
1cf71a476b QML UI: start out with save button visible
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-26 10:28:46 -07:00
Marco Martin
7d9c306685 Adapt to Kirigami api changes
* add new file AbstractApplicationHeader.qml to the qrc
* add new file AbstractApplicationWindow.qml to the qrc
* use new api for custom ApplicationHeader

header: Kirigami.ApplicationHeader {
	minimumHeight: 0
	preferredHeight: Kirigami.Units.gridUnit * (Qt.platform.os == "ios" ? 2 : 1)
	maximumHeight: Kirigami.Units.gridUnit * 2
}

Signed-off-by: Marco Martin <notmart@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-26 10:06:44 -07:00
Miika Turkia
bc28944abb Add Ubuntu Xenial to be built (16.04)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-26 09:26:41 -07:00
Miika Turkia
61c9b2891c Fix time parsing for Divesoft Freedom
Divesoft uses 17 bits for time so parse accordingly.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 11:25:34 -07:00
Miika Turkia
90db7d3a50 Abort git authentication attempt
If we have incorrect cloud credentials, we need to return an error on
git authentication call back in order to avoid endless authentication
loop. This might well happen e.g. when changing the password on desktop
and then on laptop Subsurface still thinks the credentials are validated
and ends up in the authentication loop.

The authentication call back on libgit is intended to be used to ask for
user credentials, and as we handle credentials elsewhere, we just need
to fail the authentication attempts. (The threshold for bail out could
have been 1 attempt...)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:58:57 -07:00
Miika Turkia
d3867a09f3 DL7: parse temperature and cylinder pressure
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:17:52 -07:00
Miika Turkia
24edaf4be1 Parse date and time in DL7 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:16:32 -07:00
Miika Turkia
f4ddc07883 Grab the payload of DL7 file
This allows us to parse the DL7 profile data (skipping the header and
footer)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:08:57 -07:00
Miika Turkia
0b8ac416bf CSV import: support min.sec format
Assume a format containing a dot to be min.sec as defined in DL7
specification.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:08:52 -07:00
Miika Turkia
1fec953a13 Special handling for DL7
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:08:45 -07:00
Miika Turkia
e31df43cde Detect DL7 depth units
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:08:34 -07:00
Miika Turkia
74f0192711 Basic GUI part for DL7 import
This sets the basic properties properly but is still missing the parsing
of meta-data, especially used units.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:08:25 -07:00
Miika Turkia
8a4f2f998a Fix file extension regesp
The original negative lookahead failed in case the file name contains
more than 1 dot as it looks for dot that is not followed by the given
extensions. And such a match exists in the file name. The new version
should look properly if the file ends with any of the given extensions.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:08:11 -07:00
Miika Turkia
4955f858bf Add CSV parsing trigger for zxu and zxl files
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:08:01 -07:00
Miika Turkia
46074ebf21 Add DAN DL7 file extensions for import UI
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:07:53 -07:00
Miika Turkia
375f698c78 Detect pipe as field separator in CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:07:34 -07:00
Miika Turkia
7a4fa510e9 Add pipe as supported field separator on CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:07:27 -07:00