Commit graph

456 commits

Author SHA1 Message Date
Dirk Hohndel
80f29bd3f6 QML UI: brute force around Qt 5.6.0 bug
With the current release candidate of Qt 5.6.0 we get into an infinite
recursion of the grid layout engine. This had happened before (prior to the 5.6
beta) and it appeared that setting the maximum width of the columns was
sufficient to fix this. But with the RC even that isn't sufficient, so now we
give up on having QML figure out the best possible column width and hard code
both preferred and maximum width to the same, predefined values. That's a total
shame, but at least now we can build against Qt 5.6 without infinite recursions
and crashes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:36:57 -08:00
Dirk Hohndel
0cad6d206c QML UI: remove commented out / unused code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:35:54 -08:00
Dirk Hohndel
12f36c92e1 QML UI: try to avoid binding loop
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 10:51:52 -08:00
Marco Martin
d24e5b455f use the global showPassiveNotification function
don't create a local PassiveNotification copy,
use the global show/hidePassiveNotification from
ApplicationWindow, now that it works

Signed-off-by: Marco Martin <notmart@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 10:44:41 -08:00
Dirk Hohndel
93f9bcd041 QML UI: remove incorrect statement
Not sure what this was even supposed to do...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 06:35:25 -08:00
Dirk Hohndel
6ac4fe7b18 QML UI: show notification for saving dives to cloud as well
Fixes #1014

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 06:33:00 -08:00
Dirk Hohndel
c5153fbc10 QML UI: ensure that cloud notification is always cleared
All error cases need to reset it as well.
And it's easier to reset it right after we come back from parse_file()
instead of trying to track all the exit cases after that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 06:32:12 -08:00
Dirk Hohndel
7133216653 QML UI: show notification when cloud is accessed
And hide the notification either after 5 seconds or once we are done.

This requires an extension to the Kirigami components that isn't upstream,
yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 17:14:47 -08:00
Dirk Hohndel
1f0b716021 QML UI: new property to tell the UI that we are accessing cloud storage
This can then be used to give the user visual feedback (instead of them
just thinking the app is hung).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 17:13:42 -08:00
Dirk Hohndel
605d085573 QML UI: resolve confusion about dive list model ordering
Oops, I forgot to take the sort model on top of the model into account.
Now everything should stay consistent - ListView order when accessed from
QML, but internal order when accessing the underlying array.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 09:02:00 -08:00
Dirk Hohndel
cd713d421b QML UI: update profile when editing duration of manually added dive
We need to make sure that a new fake DC is created after the duration was
changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 06:28:00 -08:00
Dirk Hohndel
880f1c5644 QML UI: update the correct dive in the model when committing a change
When manually adding a dive and moving it in the dive list (by editing
it's start time) we could create a situation where the dive list
internally was correct, but the dive list model on screen showed an
incorrect dive list with the new dive in two different spots.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 04:52:44 -08:00
Dirk Hohndel
ce83357889 QML UI: after adding a dive, jump to it in the list
Don't do the slow motion scrolling through the list if we previously
showed a different dive in the list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 04:47:51 -08:00
Dirk Hohndel
3b37844708 Add helper functions to identify the position of a dive in the dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 04:46:26 -08:00
Dirk Hohndel
abab031ed2 QML UI: implement undelete
This code is very similar to the undo code in the desktop UI, but
untangling that from the desktop seemed massive overkill; we don't have
lists of dives to delete and undelete here - so this is actually much
simpler and easier to maintain (I hope).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29 15:42:33 -08:00
Dirk Hohndel
e39e9eee3b QML UI: present an undo dialog after delete
The dialog gives the user 3 seconds to undo the delete and then disappears
without any user interaction.

This isn't hooked up, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29 15:41:58 -08:00
Dirk Hohndel
0b7be8ec5e QML UI: small adjustment to DiveDetailsView
This reduces the margin to use more of the available space and also makes
the first column slightly wider so the word "Cylinder" isn't broken on a
Nexus 6p.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-28 17:18:56 +01:00
Dirk Hohndel
2bf6f4e45d QML UI: ensure that after a dive edit the profile is redrawn
Normally this is triggered when the DiveDetailsView component is
completed, but since QML isn't recreating this component unless we switch
to a dive a couple of spots in the dive list away from this one, we
wouldn't get any changes in the data reflected in the profile.

But since this now redraws the same dive that potentially was drawn last,
we need to make sure we call plotDive() with force=true.

I also suspect that this could help with the strange bug that sometimes we
show a blank profile after certain edits.

See #1013

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-28 16:46:50 +01:00
Dirk Hohndel
10af45d6dc QML UI: we no longer use the return value of commitChanges()
So make it a void function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-28 15:45:26 +01:00
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
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
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
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
58f014728c Remove debug output
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 16:08:50 -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
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
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