Commit graph

10627 commits

Author SHA1 Message Date
Miika Turkia
454a62c835 Fix initial build of APK
Running subsurface/packaging/android/build.sh after deleting
subsurface-mobile-build-arm directory fails for me due to missing
ssrf-version.h file. Just ignore if it doesn't exist.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 10:59:56 -07:00
Dirk Hohndel
9f9853fc44 Hack to work around issue in current Kirigami master
Commit 339411cca69b in Kirigami master tries to reparent the OverlaySheet
to the page that it is related to. Unfortunately the heuristic used there
to find the right object assumes that every page has a contentItem
property, which our DiveDetails page doesn't have.

As a hack to work around this issue (until this is fixed upstream in
Kirigami) we simply create such a property. This commit should be
reverted once Kirigami upstream has been fixed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 10:53:31 -07:00
Dirk Hohndel
6e6cce770b QML UI: keep QML manager and the UI in sync about selected dive
The manager can now directly update the index of the selected dive, and
the UI tells the manager the timestamp of the currently selected dive.
This allows the manager to pick the best possible dive as selected dive
if things change (for example if the dive list gets reloaded because it
changed in cloud storage).

Fixes #1009

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:43:33 -07:00
Dirk Hohndel
5909e438c9 Make it easy to access the sort model from the QML manager
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:43:33 -07:00
Dirk Hohndel
2878236268 QML UI: clear the flag indicating that we are accessing storage
If the automatic sync is turned off we could be stuck in a state where we
always thought that we were already in the middle of a save.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:43:33 -07:00
Dirk Hohndel
c84f16e7f6 Make the raw timestamp available in QML
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:43:33 -07:00
Dirk Hohndel
590af9ae7d Add helper to find the dive closest to a given time
If we want to keep the selected dive "close" to where it was before an
operation (whether a delete, or a reload, or something like that), then
the most intuitive thing to do appears to be to select either the same
dive again (if it still exists), or one very close to it in time. This
helper allows us to identify the dive in the current dive list that is
closest to the given time.

We do this in the C code to ensure that we look at all dives in the
dive_table - based on the id that is returned the UI can then figure out
where this dive is currently shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:42:10 -07:00
Dirk Hohndel
176b92776b Silence warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:19:01 -07:00
Dirk Hohndel
9a2e3ce7e8 Remove unused function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-13 09:28:55 -07:00
Robert C. Helling
c0a4ffead8 Build instructions to deplay on you own iOS device
... so others might have less trouble.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-11 12:42:59 -07:00
Robert Helling
7bca367c57 Upon undoing a dive deletion select that dive
Before it had the next dive still selected.

Fixes #1053

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-11 12:41:41 -07:00
Dirk Hohndel
e1af20728e Merge branch 'for_dirkhh' of https://github.com/atdotde/subsurface 2016-04-11 12:40:04 -07:00
Rick Walsh
22afd4a1ce VPM-B profile: declare CVA iteration variables within each loop
The variables that control each CVA iteration should be declared at the start
of each loop so that the values are carried over from one iteration to the
next.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-04-11 21:24:00 +02:00
Robert C. Helling
a260dc2f8a Fix time of first ceiling calculation
In our verision of VPM-B for real dives, we take as the deco time the
difference between the time of the deepest ceiling and the time when the
ceiling clears.

When the display of ceilings was set to multiples of 3m this was confused, as
the maximum finder had issues: First of all, it updated the time when the ceiling
was the same (which was almost always the case for stepped ceilings) but changing
>= to > was not enough, since then the first time a deepest stepped ceiling was
reached was used.

This patch uses the actual ceiling (not rounded to the next integer multiple of 3m)
for this calculation to get rid of this problem.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-04-11 21:23:35 +02:00
Linus Torvalds
effad4b2c8 Fix seabear import sample overrun bug
The Seabear import fixed up the NDL and TTS in the samples from minutes
(in the import) to seconds (our internal format for all time).  But it
did it with a loop that overran the end of the samples array by one:

	for(int s_nr = 0 ; s_nr <= dive->dc.samples ; s_nr++) {

Fix it to use the proper "<" instead of "<=".

Reported-by: Stuart Vernon <stuartv@force2.net>
Tested-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-11 12:23:05 -07:00
Dirk Hohndel
ccff227596 Fix wrong function call for desktop build of Subsurface-mobile
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-11 09:56:35 -07:00
Dirk Hohndel
18b7ee3875 QML UI: try to do the right thing for changes on all platforms
On Android we can save locally right away, but we don't want to make the user
wait for a network sync. Sadly, on Android currently the saving in the
background doesn't work and the save will run when the user comes back.
Definitely not ideal.

On iOS the situation is different - a save to the local git cache takes
surprisingly long. Must be the shitty file system they use or something.
Because of that we only mark the dive list changed and instead save the next
time the app is not in the foreground (which works on iOS but not on Android -
go figure).

On all the other OSs (I guess that would be desktop builds of
Subsurface-mobile? But there may be other mobile OSs that people might want to
build it on) we save both locally and to the cloud right away.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-10 19:22:16 -07:00
Dirk Hohndel
4ed369b975 QML UI: only force network access when user asks us to
So when the user taps on the manual cloud sync, we always force access to
the cloud server. Otherwise we only access the cloud server if
git_local_only isn't set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-08 12:37:17 -07:00
Dirk Hohndel
685d31cd4f Simplify code - we now can rely on git_local_only to do the right thing
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-08 12:34:29 -07:00
Dirk Hohndel
eefda2b090 QML UI: reformat the warning message when turning off auto sync
This is silly - it should be set up so it wraps by itself...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-08 12:29:52 -07:00
Dirk Hohndel
a1ec0d6724 git storage: only sync with remote if git_local_only isn't set
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-08 12:29:17 -07:00
Dirk Hohndel
e2e4bb6c2a QML UI: change order of cloud backend accesses
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-08 12:28:05 -07:00
Dirk Hohndel
829369c18a QML UI: make readonly fields more obvious in dive edit
Remove the border and make them look more like labels. This adds a
StyledTextField for that purpose. And while we are at it, we can make that
StyledTextField a little prettier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-08 11:14:10 -07:00
Dirk Hohndel
df2e7c052b QML UI: make gas mix validator case insensitive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-07 22:57:02 -07:00
Dirk Hohndel
069cb8f6c5 remove reference to non-existing object
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-07 22:57:01 -07:00
Dirk Hohndel
1004ced285 avoid dereferencing undefined object
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-07 22:57:01 -07:00
Dirk Hohndel
12f0af19cb QML UI: remove redundant heading
This makes the start page look a bit more natural

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-07 22:57:01 -07:00
Dirk Hohndel
41ab12533b QML UI: more fixes to correctly calculate page widths
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-07 22:57:01 -07:00
Dirk Hohndel
0e49d6965c QML UI: fix page width calculation for dive details
Fixes #1049

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-07 11:22:44 -07:00
Dirk Hohndel
9f7e509f9a QML UI: break the sync into explicit save local and save cloud
This makes the code much cleaner and easier to understand and should allow
us to then switch back to doing at least the local save right after we make
any changes to the data.

This commit also tries to make sure that the accessingCloud status stays
correct and consistent throughout all the various success and error paths.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-06 11:47:12 -07:00
Dirk Hohndel
3bafc2a4e6 QML UI: close the drawer right when the user taps sync manually
Having a short delay before the menu closes looks bad.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-06 11:46:09 -07:00
Dirk Hohndel
961b80ec20 QML UI: after successfully opening storage, store the filename
We rely on the filename being valid elsewhere in the code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-06 11:44:58 -07:00
Dirk Hohndel
6a23e0ef66 QML UI: save with unchanged credentials returns to dive list
If the user is on the credentials page, doesn't change the credentials
but simply taps on save, they now get back to the dive list.

Fixes #1047

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-06 11:42:38 -07:00
Dirk Hohndel
f21b36d9ba QML UI: hide keyboard before saving credentials
This way the user gets to see the git notifications.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-06 11:40:34 -07:00
Dirk Hohndel
6725d54db2 Desktop UI: make sure that git progress is actually shown
This updates the got progress indicator to the changed interface where we don't
pass in an explicit percentage.

It also finally fixes an old problem: If we don't allow the Qt main loop to
process the events, we'll never see a decent progress indicator...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 23:43:17 -07:00
Dirk Hohndel
922c945f5a QML UI: more hacking around with git progress reporting
I gave up on the magic numbers and instead report simply linear progress.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 23:39:54 -07:00
Dirk Hohndel
3555cadb77 QML UI: don't fetch the remote twice when loading
We first check the sha to see if we want to load at all. But at that
point we already have the repository and the branch and we have synced
with the remote. So when we decide that we need to reload from storage,
we don't need to repeat those steps, instead we can go directly to the
git load.

For that to work we need to pass the repository pointer and the branch
name back to the caller so that we can directly call git_load_dives().

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 22:57:16 -07:00
Dirk Hohndel
8b670c3f3f QML UI: restructure (and fix) the saveChanges logic
We first want to save any exiting unsaved changes to the local repository
(and ONLY to the local repository). After that we want to make sure that
we are syncing remotely, fetch the remote and then (possibly after a
merge) push the changes to the remote. In the end we reset the previous
"local git only" preference which we overwrote for this manual forced
sync.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 22:57:16 -07:00
Dirk Hohndel
8af4534286 QML UI: don't try to save again if we are already saving
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 21:36:15 -07:00
Dirk Hohndel
c3ab4dfc3e QML UI: simplify code for loading data from the cloud
We had a redundant check of the server reply hidden in there, and the
logic which values were set where didn't really make much sense. This
seems clearer to me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 21:32:28 -07:00
Dirk Hohndel
a1332ce361 Simplify git tracking of git tree creation
With Linus' changes to the tree creation saving the dives is no longer
the dominant part of that process, so simplify the output (which also
removes the hacky buggy code to show the percentages that is of course
totally bogus).

(apparently a couple of white space cleanups snuck into this patch)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 21:23:48 -07:00
Dirk Hohndel
afb5bb8b06 QML UI: simplify git tracking output
And don't waste quite as much time on updating the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 21:20:33 -07:00
Dirk Hohndel
1634c62b9a DiveListModel: don't add the dives one at a time
Most of the time we are adding all the dives, so do this in a single model
operation. This makes the case when adding a single dive (in the undo delete
function) slightly more complicated, but that seems totally worth it for the
speedup in the common case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 21:17:37 -07:00
Dirk Hohndel
f16a3a1709 Keep the instance in static variable
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 21:16:25 -07:00
Dirk Hohndel
f869ce51b4 git storage: add explanation for fast forward to remote
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 21:13:27 -07:00
Dirk Hohndel
092d0478c3 git storage: compare with correct SHA when checking if cache is current
Otherwise by the time we make the comparison the saved_git_id has already
been updated.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 21:10:41 -07:00
Linus Torvalds
485c5a4ebd Fix per-cylinder SAC rate calculations when cylinder use isn't known
John Van Ostrand reports that when he dives using two cylinders using
sidemounts, the per-cylinder SAC rate display is very misleading.

What happens is that since the two cylinders are used together (but
without a manifold), John is alternating between the two but not
actually adding gas switches in the profile.  As a result, the profile
looks like only one cylinder is used, even though clearly the other
cylinder gets breathed down too.

The per-cylinder SAC rate calculations would entirely ignore the
cylinder that didn't have gas switch events to it, and looking at the
info window it would look like John had a truly exceptional SAC rate.

But then in the general statistics panel that actually takes the whole
gas use into account, the very different real SAC rate would show up.

The basic issue is that if we don't have full use information for the
different cylinders, we would account the whole dive to just a partial
set.  We did have a special case for this, but that special case only
really worked if the first cylinder truly was the only cylinder used.

This patch makes us see the difference between "only one cylinder was
used, and I can use the overall mean depth for it" and "more than one
cylinder was used, but I don't know what the mean depths might be".

Reported-by: John Van Ostrand <john@vanostrand.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 16:53:02 -07:00
Linus Torvalds
ff8392da54 Remove unused and buggy get_cylinder_used_gas_string() function
It's good that this is unused, because it does the calculations wrong.

Due to the gas compressibility the gas use calculations should subtract
the gas_volume() values at the differing pressures, not the pressures
themselves.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 16:52:58 -07:00
Dirk Hohndel
6d1effe886 QML UI: more theme information
The fonts on my Nexus 6p are way too big (especially when compared
to the fonts of the same build on an iPhone 6plus that has very
similar screen size). Simply trying to get more data...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 16:50:43 -07:00
Dirk Hohndel
65696e1eb5 Don't set the window size on iOS, either
Not that it appears to have been an issue, it just seemed wrong for this
to be Android only...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 16:49:29 -07:00