Commit graph

10399 commits

Author SHA1 Message Date
Dirk Hohndel
6d52d0f761 QML UI: add context menu to delete dive
This allows the user to delete the currently shown dive. This action takes
effect right away, no confirmation, it gets right away written to the
local git cache.

One idea for an undo operation here could be to simply reset the git tree
to HEAD^ and reload. Not elegant, but would work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-23 14:07:49 +01:00
Dirk Hohndel
2772ab8764 Add helper to delete dive from QML
Once again we make this save the changes to the local cache without being
prompted.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-23 14:07:49 +01:00
Miika Turkia
ae22b7cae0 Divelogs.de import: encode + character on password
Upload seems to work as is...

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-23 14:07:49 +01:00
Linus Torvalds
10ae00db3c pressure interpolation: incrementally update interpolation data
Instead of re-calculating all the interpolation data for each plot entry
(which means that we have a quadratic algorithm that walks over all the
plot-info points for each plot-info point), we can just update it
incrementally within any particular interpolation segment.

The previous cleanups made the code sane enough to understand, and makes
it trivial to see how you don't have to recalculate the full thing.

This gets rid of the O(n**2) algorithm, and it instead becomes O(n*m)
where 'n' is the number of plot entries, and 'm' is the number of gas
segments (which is usually a much smaller numer, typically "1").

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21 16:36:10 -08:00
Linus Torvalds
b71fc7ffb2 pressure interpolation: further code simplification
With the two bigger simplications, this just re-organizes the code to do
the "interpolate.pressure_time" update that is shared among all the
"after segment start" cases in just one place.

That leaves the get_pr_interpolate_data() much simpler, and makes it
much clearer what it actually does.

In particular, it becomes very obvious that "interpolate.pressure_time"
is constant for one particular segment (it's the total pressure time),
and that "interpolate.acc_pressure_time" is the one that gets updated
for every entry.

The next step is to only call this for the first entry, and then update
just the "acc_pressure_time" in the caller.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21 16:34:46 -08:00
Linus Torvalds
398cd5d9cc pressure interpolation: simplify code
Getting rid of the pointless always-zero pressure now makes it obvious
how some of the remaining code can just be removed too: there is no
point in re-initializing the pressure_time entries to zero at the
segment start, because they started out zero and we just checked that we
don't do anything to them before we hit the segment start.

Similarly, now that the silly pressure testing is gone, it is obvious
that the code for "i < cur" and "i == curr" cases is identical, and the
two cases can just be collapsed.

Signed-off-by: Linus Torvalds <torvalds@ linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21 16:33:39 -08:00
Linus Torvalds
1f7f3c4af5 pressure interpolation: get rid of pointless and confusing code
In the function fill_missing_tank_pressures(), we only ever call
get_pr_interpolate_data() if "pressure" is zero.  So passing it in as an
argument, and then testing whether it is zero or not, is just totally
pointless, and only obfuscates things.

This whole thing seems to be due to people editing the code over time,
with the tests becoming superfluous as the code around it changed, and
nobody looking at whether it actually made sense any more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21 16:32:45 -08:00
Dirk Hohndel
5da9486533 QML UI: further validation in the C++ code
Don't allow negative depth or depth beyond 500m.

Additional checks that the gas mix is possible (even thought QML code
SHOULD only allow valid combinations).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20 22:11:03 -08:00
Dirk Hohndel
a550467e8b QML UI: make unit matching case insensitive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20 22:00:07 -08:00
Dirk Hohndel
8b39352d4e QML UI: only allow valid gas mixes
The input is restricted to

EAN100
EANxx  (with 'x' one of 0..9)
AIR
xx/xx  (with 'x' one of 0..9)
xxx    (with 'x' one of 0..9 and the number <= 100)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20 21:57:53 -08:00
Dirk Hohndel
e22a452cf5 QML UI: don't allow negative duration or depth
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20 21:50:11 -08:00
Dirk Hohndel
38ab11a6c0 Add option to allocate the samples in fake_dc()
We (ab)use fake_dc() to create a pleasing profile for a manually added
dive. Based on it's intended use, fake_dc() simply handed back a dc
structure that pointed at staticly allocated samples - that's obviously
(now that I think about it) going to blow up in my face if I edit a
manually added dive more than once.

So now we have an option for fake_dc() to actually allocate the samples -
this way the rest of the code can treat these samples as we would treat
samples created any other way. We can free them and replace them with a
new set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20 09:36:14 -08:00
Dirk Hohndel
0b0e56edeb After freeing the samples, clear the pointer
Otherwise we might end up trying to free them a second time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20 07:39:25 -08:00
Dirk Hohndel
5fc16910c2 QML UI: fix recreation of profile after dive edit
We only need to deal with this if the dive changed. And in that case, if
we calculate a new fake DC, we need to clear out the meandepth as
otherwise the algorithm will try to match both max and mean depth. Since
the user potentially changed the max depth that could have very odd
consequences.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20 07:33:05 -08:00
Dirk Hohndel
97d6a1e779 QML UI: no longer change unit preferences when parsing edits
When the user explicitly sets the units when editing or adding dives, we
used to change the display preferences. This was changed for some but not
all fields in commit 6252d0cd3b ("While parsing weight and pressure we
should not change the users settings")

Now we do this consistently for all inputs.

Also, when editing the depth of a manually added dive, we now throw away
the samples (as those are certain to be inconsistent).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-15 07:54:35 -08:00
Dirk Hohndel
75bd37e3e5 Clean up conversion helpers
- coding style (ugh - I should have fixed that when I first committed them)
- remove redundant variables
- add similar code to the length and temperature helpers

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-15 07:50:30 -08:00
Dirk Hohndel
bbbd479914 QML UI: better text when no profile is shown for a dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-15 07:27:00 -08:00
Dirk Hohndel
a3189a9b3e QML UI: don't show an odd profile for zero duration dive
A dive with zero duration creates an odd profile that is 2min 30seconds
long and looks just weird. Instead, simply show a text that there is on
profile shown for such a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 16:27:41 -08:00
Dirk Hohndel
06ad45c48f Add dive property to easily test if there isn't an actual dive
Right now this just tests for zero duration, but maybe this should also
return true for positive duration and max depth of 0.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 16:26:37 -08:00
Dirk Hohndel
58f014728c Remove debug output
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 16:08:50 -08:00
Miika Turkia
8e4b4c788a Grab pressures from samples if required
If cylinder does not have start and end pressures assigned, attempt to
grab them from the samples instead.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 12:37:37 -08:00
Miika Turkia
8c38dbf3b7 Test cylinder usage properly
It is better to use the proper function to test if cylinder is in use
than just checking the description.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 12:37:30 -08:00
Dirk Hohndel
c97ed010c7 QML UI: back key on dive list exits the app
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 12:17:24 -08:00
Dirk Hohndel
f2c8aed07b QML UI: when canceling a dive add, go back to dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 23:54:40 -08:00
Dirk Hohndel
3413dfc3aa QML UI: simplify and correct top bar layout
Now things are centered and reasonably well spaced

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 23:44:59 -08:00
Dirk Hohndel
e4d27f27f0 QML UI: remove disabled parts of the top bar
I guess we are going with the Plasma Mobile influenced design after all

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 23:29:42 -08:00
Dirk Hohndel
464d468b75 QML UI: better margins for start page
This way it doesn't look like it's stuck in the corner.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 23:28:06 -08:00
Dirk Hohndel
55eb4160da Fix incorrect reference to endEditMode()
Not sure how that slipped through the cracks.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 21:53:01 -08:00
Dirk Hohndel
da5be2249d QML UI: use action button for save in GPS preferences
For consistency

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 21:50:31 -08:00
Dirk Hohndel
23b877a869 QML UI: don't change dive while editing
If the user taps on a dive in the dive list while a dive is being edited
or added, ignore that tap.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 21:28:32 -08:00
Dirk Hohndel
0ce1dd80cc QML UI: change the dive add/edit action button to be save
Remove the button on the page and instead use the action button to save
and the back key to cancel.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 21:25:10 -08:00
Dirk Hohndel
5952b09b51 QML UI: use action button and Android back button to save / go back
This is more consistent with the rest of our UI

To make this work you once again need changes to the mobile components
that aren't upstream, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 21:10:51 -08:00
Joakim Bygdell
ae116c5bc8 QML UI: enable edit of gasmix
First cylinder only, show warning if there are more than one cylinder defined.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 10:04:05 -08:00
Joakim Bygdell
8cc4463a1a Add helper function to parse gasmix strings
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 10:04:00 -08:00
Joakim Bygdell
a01bcd82aa Add helper function to retrieve first gas
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 10:03:56 -08:00
Joakim Bygdell
6252d0cd3b While parsing weight and pressure we should not change the users settings.
Now it is possible to enter a specific unit that is different from the
unit stored in the preferences. If only numbers are inputed the unit will
be the same as specified by the users preferences.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 10:03:50 -08:00
Dirk Hohndel
a91d4164b4 QML UI: remove the redundant context menus that just close the page
Android users are well used to using the back key for this. I kept the
code in place as things may end up completely different on IOS or other
mobile platforms.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 22:26:47 -08:00
Dirk Hohndel
692719f230 QML UI: when saving edits, really only save them locally
This should have been obvious. Without explicitly asking for only local
git activity, it will connect to the remote.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 22:14:17 -08:00
Dirk Hohndel
e5e5ab7480 QML UI: don't even try to connect if email or password are empty
This way the user gets better messages on the screen.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 22:06:38 -08:00
Dirk Hohndel
9367613a77 Don't connect to remote if git_local_only is set
If there was no local cache we still tried to connect to the remote, even
with git_local_only set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 22:01:20 -08:00
Dirk Hohndel
afb57bf741 Add missing import
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 17:26:26 -08:00
Dirk Hohndel
1f5cf4b42d QML UI: more progress update on start page
Again, to help track down where things hang.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 12:17:47 -08:00
Dirk Hohndel
45b0554a67 QML UI: add context menu to Theme Test
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 12:17:43 -08:00
Dirk Hohndel
d9d1b58e6a QML UI: experimentally enable context menu on each page
This is necessary to allow all user interaction when removing action
buttons from the top bar.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 09:56:27 -08:00
Dirk Hohndel
a738174a45 QML UI: experimentally turn off all the top bar buttons
This allows us to shrink the top bar quite a bit and have a little more
screen real estate. In order to maintain functionality we need to reenable
the context menu on some screens.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 09:56:20 -08:00
Dirk Hohndel
093c5fa5ff QML UI: more progress information on the start page
Since some users report hangs when changing credentials it would be useful
to see how far the application got.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 06:54:52 -08:00
Dirk Hohndel
f925711185 QML UI: clear up more data when changing credentials
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-11 22:46:35 -08:00
Dirk Hohndel
d877e13e0a QML UI: even with valid credentials, don't show empty dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-11 22:46:00 -08:00
Dirk Hohndel
dbc96b1db3 QML-UI: allow dive list to be pulled up above Action Button
This way you can fully interact with it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-11 12:43:32 -08:00
Dirk Hohndel
e189433a5d QML UI: calculate correct height for the cloud credentials
It still complains about a binding loop but I don't quite understand why
and how...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-11 10:04:44 -08:00