Commit graph

1701 commits

Author SHA1 Message Date
Dirk Hohndel
4843ae4ede mobile/UI: add visualization of font size vs gridUnit
This seems harmless and obvious, but it shows that for the last however
many years our smaller/regular/larger font change was bogus and broken.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-19 12:35:29 -08:00
Doug Junkins
31e26fd144 mobile: add GF fields for ceiling calculation
Adds fields to the advanced preferences page to modify GFLow and GFHigh for
the Buhlmann decompression model for calculating ceilings. Updated preferences
code to set the Buhlmann parameters in core/deco.c when the GF prefs are
updated.

Signed-off-by: Doug Junkins <douglas.junkins@gmail.com>
2021-01-19 12:34:46 -08:00
Dirk Hohndel
622e5aab69 mobile/cleanup: remove more noisy debug output
The repositioning message when a virtual keyboard opens is useful enough
to keep it and just hide it unless in verbose mode. The others have all
outlived their usefulness.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-13 16:16:31 -08:00
Dirk Hohndel
702d09df9f mobile/GPS: fix two errors in the GPS handling
First, the time zone adjustment was wrong - this as written could only
ever have worked in UTC or by pure chance.

Second, the order of alerting the UI of the availability of a GPS fix
was also incorrect creating a race between the UI and our data
structures.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-13 13:52:00 -08:00
Dirk Hohndel
4454cf0381 mobile/statistics: allow chart selection for statistics
Based on a dummy commit from Berthold, this provides a styled popup of
the available chart types for the current variables.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-13 11:39:36 -08:00
Berthold Stoeger
12842f4a86 mobile/statistics: make charts model available to UI
Create a QML ChartListModel in the StatisticsPage and pass that to the
StatsManager on initialization.

[extracted from a slightly larger commit]

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-13 11:39:36 -08:00
Dirk Hohndel
e5c30e042b mobile/statistics: start with dives per year bar chart
That seems to be the most commonly usefule chart.

This also removes some noisy log messages; these were super useful
during development, but should have been merged.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-13 11:39:36 -08:00
Dirk Hohndel
22ffe59a60 mobile/statistics: fix layout issue in wide mode
After spending so much time trying to make things work well on smaller
screens I completely missed that there was an off by one error making
the statistics display way too small on larger tablets in landscape mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-13 11:39:36 -08:00
Dirk Hohndel
ee3482c109 mobile/UI: small adjustments, using the slim combo box
This changes most readonly combo boxes to use the smaller, more modern
looking TemplateSlimComboBox and makes some layout adjustments on a few
pages to overall create a better UI.

A lot of this is just cleaning up things that were rather rough in the
first place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-12 08:31:35 -08:00
Dirk Hohndel
2784f390a1 mobile/UI: better sizing for Global Drawer header image
Especially on smaller screens in landscape mode (which is nice for
statistics) the image took up way too much space. Now it gets cropped in
a way that makes sure all the information text is visible, but not too
much space is stolen from the rest of the menu.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-12 08:31:35 -08:00
Dirk Hohndel
0cb533abcb mobile/UI: make the comboboxes slightly more modern looking
The smaller indicator and more rounded corners seem more pleasant.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-12 08:31:35 -08:00
Dirk Hohndel
871e29d031 mobile/UI: add another variation of the combo box
This one is designed to be fixed size and space efficient, non editable.
It's used in the statistics page for now and looks much better than what
we have elsewhere, so the style should propagate to the rest of them as
well, but this is trickier for the once that are editable - and of
course the fixed width might also not be appropriate in other places.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-12 08:31:35 -08:00
Berthold Stoeger
6c315eaf21 mobile/statistics: fix crash in dropdowns
The code was protecting against the wrong member being NULL.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-12 08:31:35 -08:00
Dirk Hohndel
5fe3b7c8c6 mobile/UI: add settings to display profile ceiling
So far only DC provided ceiling information was available and visibility
of that was simply inherited via cloud storage from the desktop.
With this the user can set both DC reported and calculated ceilings in
the advanced settings in the mobile app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10 15:57:39 -08:00
Dirk Hohndel
669cbdaac5 mobile/UI: add signal to redraw profile
This allows us to force a redraw of the dive profile when settings change
that require a refresh of the profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10 15:57:39 -08:00
Dirk Hohndel
3cd795c71e mobile/statistics: small UI improvements
This gets us better log messages and better spacing - but it's far from
good and all of this should be squashed into one working version in the
end.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10 15:16:52 -08:00
Berthold Stoeger
5cfa13694c statistics/mobile: add variable2 operations combo-box
Copy paste of the other combo boxes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:16:52 -08:00
Berthold Stoeger
9a0c5df744 statistics/mobile: set currentIndex of QML combo boxes
Use Q_PROPERTYs of the StatsManager to correctly set
the current index of comboboxes after a state changed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:16:52 -08:00
Dirk Hohndel
8f8ee5c589 mobile/statistics: add simple icon
This doesn't look great, but it's already part of the breeze-icons,
so it's very easy to add - and it's better than no icon.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10 15:16:52 -08:00
Dirk Hohndel
0de26e44a5 mobile/UI: rewrite screen size logic
This has been a thorn in my side for a long time. The old code was
terrible and insanely fragile. The new code is really dumb and quite
fragile. So definitely an improvement?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10 15:16:52 -08:00
Dirk Hohndel
eb2b0f0a3e mobile/statistics: add a statistics page on mobile
This adds a reasonably flexibile mobile page that tries to do the right
thing for both portrait and landscape mode. In order to get the most out
of a mobile screen, it's implemented in a way that always gives it the
full screen (it does so by emptying out the page stack and being the
only page shown - brutal, but effective).

This commit also contains a bunch of other random cleanups that didn't
really justify being in separate commits.

Parts of this was written by Berthold, hence the double SOB.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:16:52 -08:00
Berthold Stoeger
d77f254328 statistics: add a skeleton StatsManager class
In analogy to "QMLManager", add a "StatsManager" class,
which manages the statistics module on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:16:52 -08:00
Dirk Hohndel
c6f134a9b1 mobile: replace locationProvider with calls to GpsLocation::instance()
This makes it more obvious what we are doing. And won't make any difference
from a performance perspective.

Also converted the last call to connect using the old syntax to the new syntax.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-02 12:47:15 -08:00
Dirk Hohndel
5048a695aa mobile: turn GpsLocation into a regular singleton construct
Simply move the initialization of the logging function into its own method and
call that in the QMLManager constructor.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-02 12:47:15 -08:00
Dirk Hohndel
53b572f987 mobile: don't connect to applicationStateChanged signal early
We don't want to connect to this until all parts of the QMLManager object are set up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-02 12:47:15 -08:00
Dirk Hohndel
4ca40bc152 mobile/UI: consolidate to a single check box
It was very odd that we had two slightly different styled check boxes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
765c4f9704 mobile/UI: fix the logic to keep input visible
Using the y coordinate of the component directly doesn't work if we use
the component inside other components. Instead we need to grab the
position relative to the flickable.

The comment about needing the function for this to work seemed dubious.
So for now I've removed that function and am setting the position
directly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
d5a7ceb433 mobile/UI: trigger position check on focus
Doing this check every time we get a 'pressed' signal for the input
field seems excessive. We really only need to check when the input field
gets focus - that's when the OS virtual keyboard might open and hide the
field the user wants to edit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
bb1fb86f20 mobile/UI: don't show warning if text field is not in flickable
It's entirely reasonable to use the component in a context where we
don't have a flickable. Simply don't try to reposition things in that
case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
7ed32e3a49 mobile/UI: ensure active input field stays visible
This reuses the logic we implemented in the SsrfTextField.

Eventually we will need to clean up the inconsistent names for these
elements.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
f503e5a9c2 mobile/UI: avoid pointless warnings
These can create quite a bit of noise in the log.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
685403ff47 mobile/UI: ensure that edited text is current
By removing focus from all input fields we can ensure that we have the
correct data reflected when saving an edited dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
0a88d9839c mobile UI: avoid circular dependency
The relevant text field names are different depending on whether our
combo box is editable or not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
2d6710bdef mobile/UI: use our small label template
This saves 66 lines of code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
2e26051bd6 mobile/UI: provide more structured debug output for dive edit
Instead of always showing info about the location, allow all data to be
captured in a more structured format - but only when the app is in
verbose mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
9d12ad2308 mobile/UI: don't try to set the combobox index
There's no point in doing that - we set the correct text and leave that
in the editText and displayText for the combo box. If the user uses the
drop down they can replace that. This works correctly for single people,
and for multiple people the drop down doesn't work at all, anyway.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
1771c39dd8 mobile/UI: don't show virtual keyboard when starting dive edit
When we start editing a dive the OS will open the virtual keyboard if
any of the input fields have focus (which they might get when we set
their content).
The explicit closing of the keyboard might be overkill, but also doesn't
appear to hurt.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
d6456d490f mobile/UI: add template for editable combo box
This makes the code easier to read and manage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01 11:35:39 -08:00
Dirk Hohndel
c62b8f3a75 mobile/UI: fix theming of About page
Can't believe I missed that one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-23 09:44:39 -08:00
Dirk Hohndel
9621b88496 mobile/UI: improve theming of spin box
Those are used for the rating / visibility when editing dives.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-23 09:44:39 -08:00
Dirk Hohndel
336decd30c mobile/UI: open dropdown on any tap for readonly combo box
This seems more intuitive. For editable combo boxes you need to tap on
the indicator, but for non-editable (readonly) ones, you can tap
anywhere and the dropdown is shown.
The code feels a bit clumsy, but seems to work in all cases.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-23 09:44:39 -08:00
Dirk Hohndel
bda1f0b6e1 mobile/UI: slight visual change to combo boxes
They always have a 10% darker background, and show a border if the combo
box has focus. This seems to look reasonably well in all situation we
use them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-23 09:44:39 -08:00
Dirk Hohndel
bae1529fb7 mobile/UI: repaint the combobox indicator on color change
It seems that now all elements are correctly re-colored if the user changes
theme.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-23 09:44:39 -08:00
Dirk Hohndel
d9661a7be8 mobile/UI: initialize Kirigami theme to use our colors
With this we should finally get the correct button colors even when
switching color theme.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-23 09:44:39 -08:00
Dirk Hohndel
4dc1b4ef4a mobile/UI: update location combobox for dive edit
This one was missed in commit

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-23 09:44:39 -08:00
Dirk Hohndel
83acb98886 mobile UI: make TemplateComboBox selectively editable
Getting the visual right is really hard. The anchors seem to mostly work,
but it still doesn't look exactly right, IMHO.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-23 09:44:39 -08:00
Dirk Hohndel
ee0ca3995e mobile/UI: fix trip details padding
Incorrect reference to the Kirigami Units.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-23 09:44:39 -08:00
Dirk Hohndel
a2b1266c15 mobile/UI: hardcore passiveNotification colors
I was convinced that I had fixed this while working on this set of patches,
but apparently I didn't. This simply hardcodes good colors.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-21 14:10:48 -08:00
Dirk Hohndel
dbb6256b67 mobile/UI: make trip details edit theme aware
This got forgotten earlier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-21 14:01:08 -08:00
Dirk Hohndel
052a46b562 mobile/UI: again, correct side button colors
I am confused how this worked and then got broken, but this appears to
once again fix the colors.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-21 13:57:13 -08:00
Dirk Hohndel
40a0916de8 mobile/UI: stop using removed Kirigami interface
hidePassiveNotification() is no longer supported.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-21 13:44:53 -08:00
Dirk Hohndel
bed11f79a1 mobile: remove non-functional code
This never ever worked to trigger a profile update. The code is
nonsensical as we cannot access the QMLProfile in a model delegate this
way from outside the delegate.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-21 13:12:37 -08:00
Dirk Hohndel
1228dec19f mobile/profile: directly set up the diveId
The weird 'Component.onCompleted' always felt like the wrong way to do
this. Setting this directly from the model seems like the much cleaner
solution.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-21 13:12:37 -08:00
Dirk Hohndel
f8b354d64d mobile/UI: remove incorrect code in ComboBox
This actually created a recursive dependency - I didn't see any negative
visual effect, but lots of annoying warnings.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 19:54:51 -08:00
Dirk Hohndel
7fc4ec1163 mobile/UI: fix theming of combo boxes in dive edit
Again, not using our template combo box.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 18:04:57 -08:00
Dirk Hohndel
4995c141c6 mobile/UI: make dive download combo boxes theme aware
In reality I should make our TemplateComboBox capable of handling the
modifications needed here without yet another reimplementation. Maybe
I'll do that next. This at least makes things look right.

A couple of odd whitespace changes snuck in at the end.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 17:20:02 -08:00
Dirk Hohndel
535a15e5fd mobile/UI: make filter entry / dives shown theme aware
Again, not using our text field / label (plus adding a subdued color for
the placeholder text).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 17:14:07 -08:00
Dirk Hohndel
68a15b8cdf mobile/UI: cloud credentials follow our theming
This was simply not using our labels / text fields, so it didn't pick up
our colors automatically.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 17:08:21 -08:00
Dirk Hohndel
494e5c5a34 mobile/UI: make passive notification easier to read
Once again I couldn't fix this without making changes to Kirigami.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 17:06:56 -08:00
Dirk Hohndel
43b5ac378a mobile/UI: fix context drawer header
Once again I couldn't fix this without making changes to Kirigami.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 17:06:34 -08:00
Dirk Hohndel
5979292469 mobile/UI: correctly theme combo boxes
Again, the fact that you basically need to completely reimplement the
ComboBox in order to change some colors is frustrating.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
fe283857e1 mobile UI: style check boxes and radio boxes
This is needed for the Export page.
And may I say for the record that it's rather surprising that in order
to change the color of one of those elements one ends up having to
completely re-implement them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
b0193f79d0 mobile/UI: fix dive summary for dark theme
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
b3c80c5ae0 mobile/UI: use theme colors for startup text and location warning
This now looks right for the dark theme.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
3429552433 mobile/UI: correctly color the action button icons for dive list
This uses one of our fixes to Kirigami to allows us to set the correct
overlay color for our icons.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
0b52d7a398 mobile/UI: correctly color the action button icons for dive view
This uses one of our changes to Kirigami that allows us to set the
correct overlay color for our icons.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
86a4c5a0e5 mobile/UI: fix ActionButton icon coloring
This seems like a reasonably serious bug in Kirigami.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
7ed861fb9f mobile/UI: better dive list color for dark theme
While the text name is 'light primary color' it really has to be a dark
blueish color to fit with the theme.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
d0d867d80a mobile/UI: correctly theme the global and context drawers
This requires more changes to Kirigami, but with this we get dark
drawers (the menus that slide in from the side) in the dark theme.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
6a5f83d7da mobile/UI: improve theming of title bar
We do theming very differently from what Kirigami intended. Mostly
that's because our code predates theirs. But also because Kirigami wants
and app to simply use an OS theme - whereas we want to be able to
provide different looks, independent from the OS theme.
Ideally we'd still use the existing methods to change the colors and
sizes of Kirigami UI elements, but for now this hack helps improve
readability of the title bar.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
00cb5dd834 mobile/UI: ensure we show a line between dives
In the dive list the rendering of the line ended up being subject to
rounding errors. With this change we ensure that the thin line is always
shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
31b28a31a9 mobile/UI: shrink dive log date button
This was too big relative to the page layout.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
791daa67b1 mobile/UI: remove the thick line between trips
This took up a lot of space and made the UI look stodgy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Dirk Hohndel
3ecedbf018 mobile/UI: fine tune the action button rendering
On some platforms the side buttons looked disjoint from the center
button. This fixes that problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-20 10:51:18 -08:00
Berthold Stoeger
79f95b7f7d core: remove DiveObjectHelper
Since switching to the mobile-models and removing grantlee,
DiveObjectHelper was demoted to a thin wrapper around string
formatting functions. The last user was removed in a previous
commit.

It was never a good idea, given QML's strange memory-management.
Let's remove it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17 13:03:56 -08:00
Berthold Stoeger
1037c15b98 mobile: remove DiveObjectHelper code
When editing a dive, a DiveObjectHelper of the unmodified dive
was created to compare the edited with the old values. Since
the DiveObjectHelper is used here only as a pointless wrapper
around the formatting functions, call these functions directly.

However, note that the code is in principle wrong since the
change to the mobile-models, which do not use the DiveObjectHelper.
The real fix would be to reload the data from the model to prevent
going out-of-sync with respect to the formatting routines!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17 13:03:56 -08:00
Dirk Hohndel
6043b223cb mobile: adapt resource names
With the new Kirigami the URI for the backwards and forwards arrows apparently
changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
1720791786 kirigami: maintain our patches relative to upstream
Having them as commits like this should make it easier to migrate them
as we update the underlying Kirigami version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
241d6105c0 mobile: fix implementation of menu back feature
With the updates to Kirigami I slightly modified the hack that we use to
implement that, as a result we call pop() directly on the globalDrawer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
a883fce612 mobile: re-add breeze icons
This time from the cloned repo.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
1f9fa8b462 mobile: avoid warning in QML code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
35ca8e4c66 mobile: don't use reserved word
This used to work, but with current QML/Kirigami it throws an error.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
0e7fd632c1 mobile: silly whitespace cleanup
Simply because it bugged me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
0851224b6c mobile/kirigami: first steps to switching to Kirigami 5.76
Our half-assed manual build of Kirigami was becoming completely unmaintainable.
So let's try to use the build method that the Kirigami team recommends. Which
unfortunately requires us to have access to the KDE extra cmake modules (ECM).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Berthold Stoeger
50b11024d6 core: keep tank infos in a dynamic table
The list of known tank types were kept in a fixed size table.
Instead, use a dynamic table with our horrendous table macros.
This is more flexible and sensible.

While doing this, clean up the TankInfoModel, which was leaking
memory.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:49:59 -08:00
Berthold Stoeger
38a784f5af desktop: automatically reload completion-models
Instead of programatically reload the completion models, listen
to the relevant signals in the models. To that goal, derive all
the models from a base class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-14 10:01:50 -08:00
Dirk Hohndel
360123d432 mobile: add missing word to location warning
Thanks to Johan, one of our Swedish translators for noticing this
oversight.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-05 14:22:15 -08:00
Dirk Hohndel
1a0cf0bb44 cleanup: remove struct/class confusion
DiveSiteChange is defined as a struct, not as a class.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Berthold Stoeger
2b86fe84f9 cleanup: move application flags to core/subsurfacehelper.h
These flags are not dive-related, therefore move their declaration
to the appropriate header file. Likewise, move their definition
from parse-xml.c to subsurfacehelper.c

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
3358bff432 cleanup: move mark_divelist_changed() to qmlmanager.cpp
Desktop does not use mark_divelist_changed() anymore - all is done
via the undo machinery. Therefore move this function (and its
counterpart unsaved_changes()) to qmlmanager.cpp.

Ultimately, it probably should be removed from there as well, but
currently I don't dare to touch all the cloud-logic!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:04 -07:00
Berthold Stoeger
255f561aff git: add device-table to git-parser-state
In analogy to the xml-parser add a device-table to git's parser-state.
Currently this is unused. In upcoming commits the git parser will
then be changed to add device nodes in this table instead of the
global device table. The long-term goal being to detach the
parsers from global state and to make dive-import fully undoable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24 09:51:37 -07:00
Berthold Stoeger
39a4090c0a devices: add devices in Command::importTable()
Add a device_table parameters to Command::importTable() and
add_imported_dives(). The content of this table will be added
to the global device list (respectively removed on undo).

This is currently a no-op, as the parser doesn't yet fill
out the device table, but adds devices directly to the global
device table.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24 09:51:37 -07:00
Berthold Stoeger
53118be1f9 devices: add functions to add / remove / check for devices
To include the device code in the undo system, we need functions
to check for the existence of devices and to add or remove them.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24 09:51:37 -07:00
Berthold Stoeger
a261466594 parser: add device_table to parser state
If we want to avoid the parsers to directly modify global data,
we have to provide a device_table to parse into. This adds such
a state and the corresponding function parameters. However,
for now this is unused.

Adding new parameters is very painful and this commit shows that
we urgently need a "struct divelog" collecting all those tables!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24 09:51:37 -07:00
Dirk Hohndel
28107efd30 mobile: show location service warning
Google play now requires that we show an explicit notification when turning
on background location. This is an attempt to fulfill that requirement - we
won't know if this is 'good enough' until we submit the app, though.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-24 09:47:37 -07:00
Dirk Hohndel
4638936a22 mobile: show text with location service icon
I don't recall why we removed that text, but this makes it much clearer
that the service is active.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-24 09:47:37 -07:00
Berthold Stoeger
a7bbb6c1cc filter: remove filter_preset_table_t
We used a typedef "filter_preset_table_t" for the filter preset table,
because it is a "std::vector<filter_preset>". However, that is in
contrast to all the other global tables (dives, trips, sites) that we
have.

Therefore, turn this into a standard struct, which simply inherits
from "std::vector<filter_preset>". Note that while inheriting from
std::vector<> is generally not recommended, it is not a problem
here, because we don't modify it in any shape or form.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-17 09:04:20 -07:00
Dirk Hohndel
b3e28eed5d Update translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-06 14:58:21 -07:00
Berthold Stoeger
1fcf4f891d filter: implement loading of filter presets from git repositories
This is mostly copy and paste of other git loading code. Sadly,
it adds a lot of state to the parser-state. I wish we could pass
different parser states to the parser_* functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29 16:13:03 -07:00
Berthold Stoeger
41cf83583d filter: load filter presets from XML files
This is a bit painful: since we don't want to modify the filter
presets when the user imports (as opposed to opens) a log,
we have to provide a table where the parser stores the presets.
Calling the parser is getting quite unwieldy, since many tables
are passed. We probably should introduce a structure representing
a full log-book at one point, which collects all the things that
are saved to the log.

Apart from that, this is simply the counterpart to saving to XML.
The interpretation of the string data is performed by core
functions, not the parser itself to avoid code duplication with
the git parser.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29 16:13:03 -07:00
Berthold Stoeger
634e26cbce filter: unify desktop and mobile filters
Switch the mobile code to use the constraint-based filter. The one
thing that is still commented out is dive-site mode, since mobile
doesn't (yet) have a dive-site edit feature. And even if it had,
the dive list probably wouldn't be shown at the same time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29 16:13:03 -07:00
Dirk Hohndel
a469dfa348 mobile/dive-list: correctly update view when changing dive date
If the dive timestamp changes, the dive could move in the dive list. But the
current dive actually doesn't change (it's still the same dive, right?). Yet
we need to update the dive list as well as the shown dive (especially if this
is after adding a dive, which is first inserted with the current time and then
updated with whatever the user enters).

Fixes: #2971

Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-27 14:16:18 -07:00
Dirk Hohndel
21d70cbeb1 mobile/cleanup: use local variable to simplify code
The old code wasn't wrong, and likely the compiler turned this into something
that wasn't really terrible... but yeah, 5 unnecessary calls to a helper
function just bugged me. And I think the new code is much easier to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-08-16 16:23:19 -07:00
Dirk Hohndel
ebcfb46d8c mobile/dive-edit: fix incorrect handling of multi tank gas mixes
A silly copy and paste error caused us to overwrite the gas mixes for
all the tanks with the gas mix in the first tank.

Fixes #2913

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-08-16 16:23:19 -07:00
Dirk Hohndel
4ec62441c1 mobile/download: don't allow download without connection set
It appears that multi line attributes silently fail. Without this change, the Download
button is enabled if vendor and product are chosen, even if there isn't a connection
selected. With this change (having all three conditions on the same line) the code
works as expected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-07-14 10:57:10 -07:00
Dirk Hohndel
5ff08598ca mobile: show sync state in menu plate
This seems like the easiest way to show the state without disrupting the UI
elsewhere. Directly below the email address used for cloud storage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Dirk Hohndel
3a409c51ea mobile: add status text for cloud sync state
This allows the mobile UI to reflect the three states that the dive list can be
in:
- changes that haven't been written to local storage
- there potentially are changes in local storage that were not synced with the cloud
- dive list is in sync with cloud storage

The last state could be misleading if the user access the cloud from a
different device and makes changes to the cloud storage from there, but from
the point of view of this device, the states are consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Dirk Hohndel
01de67a5a6 mobile: track if we have changes that aren't synced to cloud
If we haven't connected at all to the cloud server we assume that there are
local changes. And whenever we save changes only locally, we also set that
flag.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Dirk Hohndel
8a4a9382d3 mobile/dive-details: restrict width of tags field
Having a lot of tags (or more precisely, a tags string that is very long) could
cause the width of the dive details view to extend past the width of the the
page. The txtTags label was missing a maximum width, and to make the result
more useful, I also added correct wrapping and elide to the mix (stupidly, we
had the wrap and width for the fixed name of the field ('Tags'), but not for
the user determined content of that field).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-08 12:27:50 -07:00
Dirk Hohndel
e00e72d430 mobile: add option to merge local cloud cache data
The UI is ugly, and of course this is hidden in the developer options that have
to first be enabled in the advanced settings. As I mentioned in the previous
commit, I believe the actual risk that something gets damaged here is very low,
but still, explaining this so it makes sense to the casual user may be a bit...
difficult.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07 19:47:52 -07:00
Dirk Hohndel
208d46d58e mobile: add helper to import data from local cloud cache
If you pass in the repo name, it isn't treated as cloud storage, but simply as
local git storage and imported (i.e., added) to the current dive list.

This allows the user to work around failed no-cloud->cloud transitions, merge
different accounts, and most importantly deal with situations were conflicts on
the server caused us to move a cache out of the way and potentially make dives
that were on the mobile device inaccessible to the user.

Once a UI is added, this allows the user to recover those dives (realistically
this is not really all that potentially 'dangerous' to do, but it's definitely
something that would best be done after talking to someone who understands the
cloud storage and can guide the user...).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07 19:47:52 -07:00
Dirk Hohndel
dd82149726 mobile: make list of local cloud cache directories available
This way QML can show those to the user.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07 19:47:52 -07:00
Dirk Hohndel
8b167c14ad mobile: tiny whitespace update
Every time I edit main.qml, QtCreator fixes this for me. And then I filter it
from the commit to not mix white space and actual changes. So let's just get
this fixed and move on.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07 19:47:52 -07:00
Dirk Hohndel
afdcccc9fe mobile/dive-edit: fix broken editable combo boxes
This is a partial revert of commit 99438121c4 ("mobile/dive-edit: use template
components and theme colors")

Clearly the information given in the Qt documentation on how to theme ComboBox
is flat out broken. The trade-off between 'better dark theme' and 'broken user
experience' is fairly easy to make.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-30 11:19:54 -07:00
Dirk Hohndel
9deb4f4a22 mobile/credentials: email address must be lower case
I could have sworn that I have fixed this several times in various places,
but apparently (as shown by todays support emails) it's still possible to
setup a mixed case email address. So let's try to solve this problem at
the very top.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-25 08:36:01 -07:00
Berthold Stoeger
8f80129bac cleanup: create common QDateTime -> timestamp conversion function
In analogy to the timestamp -> QDateTime conversion, create a
common function.
1) For symmetry with the opposite conversion.
2) To remove numerous inconsistencies.
3) To remove use of the deprecated QDateTime::toTime_t() function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22 12:31:06 -07:00
Dirk Hohndel
99438121c4 mobile/dive-edit: use template components and theme colors
Another small step to make the dark theme at least marginally useful.
We now use our template components and add the necessary elements to have
consistent text color.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-18 13:00:03 -07:00
Dirk Hohndel
58d97c571d mobile/UI: correctly theme template spin box
This was all hard coded and wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-18 13:00:03 -07:00
Dirk Hohndel
4798382e70 mobile/dc-download: fix dark theme appearance
I noticed that the download from dive computer page looked especially bad
in the dark theme (a user sent us some screenshots for a different reason)
and a quick look at the sources showed that we weren't using our template
label. Switching to that gives us the correct size by default so we can
drop all those explicit font size parameters. And we get the correct color
as used in the theme.

One random whitespace cleanup snuck into this commit. Oh well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-18 13:00:03 -07:00
Dirk Hohndel
f6b09dd8c3 mobile/dive-details: show tags
So far the user can't edit them, but at least they are now shown as
part of the dive details. Usage of tags varries widely, I've seen
people who use a LOT of tags to classify their dives, so I'm giving
this a complete row by itself.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14 12:57:08 -07:00
Dirk Hohndel
6f96edd766 mobile/dive-details: less whitespace at the top
This always seemed odd - the location looked like it sat 'low' on the
screen.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14 12:57:08 -07:00
Dirk Hohndel
6e47bb11d5 mobile/dive-details: use our labels to create denser display
This makes better use of the screen real estate, without (IMHO) seeming
too crowded. This is a tough balance to strike.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14 12:57:08 -07:00
Dirk Hohndel
7720e97db5 mobile: reduce vertical white space around labels
Our labels all seem to have a lot of empty vertical space around them.
Try to be a bit more conservative with space.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14 12:57:08 -07:00
Dirk Hohndel
46d582ef0a mobile: add smaller, vertically dense template label
By default single line text has too much white space around it. This
smaller, denser label works well to more efficiently use screen real
estate, I think.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14 12:57:08 -07:00
Berthold Stoeger
fb6210a99a cleanup: invert control-flow when resetting the core structures
To reset the core data structures, the mobile and desktop UIs
were calling into the dive-list models, which then reset the
core data structures, themselves and the unrelated
locationinformation model. The UI code then reset various other
things, such as the TankInformation model or the map. . This was
unsatisfying from a control-flow perspective, as the models should
display the core data, not act on it. Moreover, this meant lots
of intricate intermodule-dependencies.

Thus, straighten up the control flow: give the C core the
possibility to send a "all data reset" event. And do that
in those functions that reset the core data structures.
Let each module react to this event by itself. This removes
inter-module dependencies. For example, the MainWindow now
doesn't have to reset the TankInfoModel or the MapWidget.

Then, to reset the core data structures, let the UI code
simply directly call the respective core functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-07 08:43:27 -07:00
Berthold Stoeger
9b8eed7821 cleanup: replace constructs of the type &vector[0] by vector.data()
It appears that some misguided compiler / library combinations crash
on &vector[0] for empty vectors. Even though very unfriendly, they are
technically correct, so let's remove these constructs.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-21 07:50:38 -07:00
Dirk Hohndel
47506028ca mobile UI: indicate status of verbose flag
This way the user can verify that they have set the log to verbose
mode in the developer menu.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-18 09:00:21 -07:00
Berthold Stoeger
3d4412ad1a mobile: don't call main loop for notifications once initialized
Calling qApp->processEvents() in QMLManager::setNotificationText()
caused crashes, because it could lead to the context-menu that
initialized the call being deleted. Something that QML apparently
doesn't like.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-13 08:33:47 -07:00
Berthold Stoeger
24eac8df87 mobile: remove overwriting of line special case in ui-notification
On startup, we showed progress of the population of the fulltext
and listmodels for every 100th dive. This worked by overwriting
the last line if the new line started with '\r'. Since we don't
do that anymore, we can remove this special case.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-13 08:30:51 -07:00
Dirk Hohndel
c7c5dac621 mobile/startup: fix potential crash when switching back and forth
If the user switches away from Subsurface-mobile and back while we are
in our initialization phase, that code might run more than once leading
to undesirable results.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 16:12:52 -07:00
Dirk Hohndel
8414f83926 mobile/cleanup: create helper function to hide verbose casts
The strange enum casts (that apparently we needed in order to have strongly typed
enums in QML) are really ugly and confusing in the code. Since we had this three
times it seemed worth to create a little helper that hides this nonsense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 16:10:50 -07:00
Dirk Hohndel
6aaa9a40b6 mobile/cloud-storage: correctly transition from no-cloud to cloud
We know that we have valid credentials, so calling openLocalThenRemote()
makes no sense, worse, it doesn't respect the special case of
transitioning between accounts. That's the whole point of having a
separate loadDivesWithValidCredentials() call.

Once we have transitioned state, we need to record the now current state
as the old state so that future transitions will work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 16:10:50 -07:00
Dirk Hohndel
7757ce878b mobile/cloud-storage: fix test for no cloud to cloud transition
The noCloud variable contains our desired state, we need to test for the
previous state for this to make sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 16:10:50 -07:00
Dirk Hohndel
46032af320 mobile/cleanup: remove outdated comment and fix whitespace
We haven't supported the GPS web service for a long time.

Also, add another message for the log to be able to more easily trace
one error case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 16:10:50 -07:00
Berthold Stoeger
1de56d468f mobile/undo: set undo stack as clean after save
If we're using the undo stack for determining the whether there are
unsaved changes, we have to mark the undo stack as clean after save.

This duplicates code from desktop. It is planned to unify this in
the near future.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04 16:09:57 -07:00
Berthold Stoeger
a6567a0070 mobile/undo: consider undo-stack when checking for unsaved changes
In analogy to desktop, also consider the state of the undo-stack when
testing for unsaved changes. This prevents us from missing changes.

This adds duplicate code, which will be unified in the near future.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04 16:09:57 -07:00
Dirk Hohndel
1f180552c9 mobile/edits: ensure changesNeedSaving is called
These appear to be the only cases where we forgot to ensure data is
saved.  And pastDiveData is currently not called as the UI to use it has
been removed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 16:09:09 -07:00
Berthold Stoeger
96d12f5a39 mobile: when creating gps dive site use the new dive site name
The code was using the pre-editing dive site name, which appears
weird. Not sure if that was on purpose.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04 14:30:06 -07:00
Berthold Stoeger
4cdea48926 mobile: properly recognize changed dive site
QMLManager::checkLocation() would only return true if the
dive-site itself was changed, not if the dive-site was set
to a different site.

Thus, in some cases edit events could be lost.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04 14:30:06 -07:00
Dirk Hohndel
e43362fdcf mobile/download-from-DC: ensure that changes get actually saved
Calling saveChangesLocal() seems like the right thing to do, but it
doesn't do anything useful if the dive list hasn't been marked as
changed. The correct helper function to call is changesNeedSaving()
which makes sure we save the changes and update all UI information.

[Berthold: since this removes the last QML caller of saveChangesLocal()
we can make that function private.]

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04 12:00:25 -07:00
Dirk Hohndel
35080aad98 mobile/cleanup: fix whitespace and remove verbose messages
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:25 -07:00
Dirk Hohndel
001fb7f4fa mobile UI: delay reading the dive list until app is active
This way the launch screen is shown significantly shorter on a device,
and instead the user sees our progress notifications.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:25 -07:00
Dirk Hohndel
0673e53a68 mobile UI: only test for plugged in USB serial device on Android
This test makes no sense on other platforms (and the log file text is
frankly confusing when not running on Android).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:25 -07:00
Dirk Hohndel
0e1b784afe mobile/core: remove locking for git access
We have convinced ourselves that only the main thread will ever trigger
a save operation, therefore the locking is not needed (and it has
recently started to cause user problems where local changes aren't saved
to storage and get lost).

Fixes #2718

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:25 -07:00
Dirk Hohndel
37b1a97f89 mobile/dive-list: don't use cacheBuffer
QML documentation recommends against using the cacheBuffer for longer
lists and doing more testing shows that this really doesn't help at all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:25 -07:00
Dirk Hohndel
66d3eaa943 mobile/dive-list: performance improvement for invalid dives
Small optimization that reduces the number of accesses to the underlying
model.  Instead of evaluating the isInvalid member eight times per
delegate, we only check it once.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:25 -07:00
Dirk Hohndel
cf9303c862 mobile/dive-list: only show dive list notifications when it is visible
Without this check we'll show the 'Please tap the plus botton...'
notification during app initialization as we are showing the initial set
of messages - which makes no sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:25 -07:00
Dirk Hohndel
85dfbfe67d mobile/startup: show progress update earlier
Instead of not showing a notification until after we are done loading
the data into our models, tell the user that we are about to do that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:24 -07:00
Dirk Hohndel
8801ae857e mobile/startup: show notification directly in the UI window
Until the app is initialized, we have problems getting the 'floating'
passive notifications to show up and be useful. Instead update the user
by filling a text block on the otherwise empty initial page of the app.

Delay the switch to the dive list until the app is initialized and then
use the passive notifications again. While we are initializing also show
a busy spinner so the user doesn't think the app is hung.

As a side effect of this change, the dive list isn't shown until our
models are initialized. And strangely this causes every single possible
delegate to be instantiated. We can prevent that by not setting the dive
list model until after we are done setting up the model.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:24 -07:00
Dirk Hohndel
d317eefb67 mobile UI: setup callback for the new notification mechanism
This simply passes the text to the existing notification text mechanism.

The call to processEvents() ensures that Qt processes the UI events
after we updated the notification and that the user gets timely updates;
otherwise the UI might look like the app is hanging.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:24 -07:00
Dirk Hohndel
a37499bccd mobile: add indication if the app has finished initializing
This will help us to ensure that notifications are actually shown on the
UI during the startup phase.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:24 -07:00
Dirk Hohndel
f9ccbabb3d cleanup: update all copyright dates to 2020
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:24 -07:00
Berthold Stoeger
69d437bc86 undo/mobile: keep track of dive sites
When editing the dive site of a dive, the dive-table of the
corresponding dive site was not properly updated by the undo
commands. Try to get this right.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04 11:49:23 -07:00
Dirk Hohndel
7bddef02cd mobile/dive-list: try to force focus on filter text field
This was triggered by a change in enabled, but what is really changing is
the visible property. This should work better.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 20:33:11 -07:00
Dirk Hohndel
1549d6f528 mobile/dive-summary: make the drop downs smaller
Especially on smaller screens we had issues fitting this on the screen.
And it looks fine on larger screens as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 20:33:11 -07:00
Dirk Hohndel
4982751bbe mobile/dive-details: add option to toggle the invalid flag
Simply for consistency with the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 20:33:11 -07:00
Dirk Hohndel
9dd01da9c1 mobile/dive-details: fix incorrect call to create trip
This was using the myData alias that exists in the dive list but not on
the dive details. This might work (because the models both use the same
underlying base model), but given that we are using the currentItem of
this ListView, I'm guessing that this would just silently fail (maybe
with a warning in the log).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 20:33:11 -07:00
Dirk Hohndel
2bf394581f mobile/dive-details: if menu is open, close that with back button
A second tap on the back button will then end add/edit or close the dive
details and get us back to the dive list.

This fixes an issue where tapping on back with the context menu open
would bring you back to the dive list with the context menu still open,
and because then change the text in the context menu as those are
designed differently.

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 20:33:11 -07:00
Berthold Stoeger
d13f73001b cleanup: make QMLManager member functions private
The
	- mergeLocalRepo()
	- openLocalThenRemote()
functions were not invoked from outside QMLManager.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31 08:56:45 -07:00
Berthold Stoeger
82f6c60856 mobile: don't call saveChangesLocal() twice on non-iOS
QMLManager::changesNeedSaving() behaves differently on iOS:
it only saves locally with saveChangesLocal(), whereas all
other OS save to cloud with saveChangesCloud(). Nevertheless,
even for other OS saveChangesLocal() is called even though
that will be called in saveChancesCloud anyway. Therefore,
compile the saveChangesLocal() call in changesNeedSaving
conditionally.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31 08:51:20 -07:00
Dirk Hohndel
49dc8b9065 mobile/dive-details: don't show virtual keyboard in dive view mode
At least in 4.9.3.1258/3.0.1 I was able to reproduce a situation where I
edit one dive, go back to the dive list, then tap on a different dive
and then the keyboard pops up, obscuring a big chunk of the screen.

This tries to make sure the keyboard isn't shown in dive view mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 08:42:20 -07:00
Dirk Hohndel
085b5ff0db mobile: improve Android back key behavior
There are two places where we try to prevemt unintended app exits.
Once, in the onBackRequested signal handler on the dive list. This was
missing special handling for the situation where one of the drawers was
open.
The second place is the onClosing signal handler in main.qml. Naively I
thought that this was enough to catch all cases where we were about to
exit the app, but apparently an explicit manager.quit() is a bit too
forceful and doesn't get to that signal handler.

With this commit we check for open drawers in both places. Belts and
suspenders, I guess.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 08:42:20 -07:00
Dirk Hohndel
aeb1794616 mobile/dive-details: remove the redundant 'map it' button
You can already get to the map by either clicking on the location text
or on the left action button. This third way to get there reduces the
available space for the location text, and can cause positioning issues
with very long location texts creating three or more lines of text,
which then overwrites the dateRow below.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 08:42:20 -07:00
Dirk Hohndel
c406ad83ea mobile/dive-list: avoid using undefined value as boolean
This gets rid of an annoying and noisy warning.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 08:42:20 -07:00
Berthold Stoeger
eef41a3403 cleanup: remove loadFromCloud() declaration from QMLManager.h
This getter functions was not defined anywhere.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31 04:18:34 -07:00
Berthold Stoeger
da740dfc19 cleanup: use setPointSizeF() in themeInterface::set_currentScale()
The compiler complained that we were passing a float to the
QFont::setPointSize() function, which expects an integer.
Solve this by using the QFont::setPointSizeF() function.

This might introduce a user-visible change, albeit very unlikely:
We now may set the point-size to a non-integer number.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:58:10 -07:00
Berthold Stoeger
45a3fff62c cleanup: fix initialization order in QMLProfile constructor
The compiler complains that members were initialized out-of-order.
Even though this is not an issue here it is correct to emit a
warning, since only then it is guaranteed that the objects are
destructed in reverse-order with respect to construction.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:58:10 -07:00
Berthold Stoeger
38d70ba854 cleanup: un-slotify QMLManager functions
Some slots in QMLManager were not called from the outside, some
only directly from C++-code. Make the former private and the latter
public member functions.

The idea here is to document which functions are actually called
from the outside and which are called from QML or connected to
signals.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:58:10 -07:00
Berthold Stoeger
9d485f9626 cleanup: fold ThemeInterface::setup() into constructor
There appears to be no reason for two-phase initialization.
Let's keep things simple: let the constructor produce a
functioning object.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
0e9bd27bae cleanup: don't send values in changed-signals of ThemeInterface
According to the Qt-docs you *may* send the new values in the
NOTIFY signal of Q_PROPERTYs. However, since changes will lead
to a reevaluation of a whole expression, this argument will be
unused. All it does is make the code more verbose and brittle:
What happens if you send the wrong value?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
ce1629ccce coding style: rename themeInterface to ThemeInterface
As per coding style, class names are PascalCase.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
1702747459 cleanup: make color-constants in themeinterface.cpp static
There were no outside users - no point in exporting them.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
79bf243ec0 cleanup: make members of ThemeInterface non-static
We have a singleton class ThemeInterface, which means that it
is global and exists only once. It's members are static, i.e.
also global. A message from the department of redundancy department?
In any case, that makes no sense. Let's just make these members
local to the class.

I would even rip out the whole singleton thing, since the object
is not accessed anywhere outside from QML. Let's keep it for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Dirk Hohndel
fbe68a6e07 mobile UI: don't exit when using back button to close drawers
An Android user might reasonably assume that they can use the back button to
close the global or context drawers. So act accordingly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-30 09:16:55 -07:00
Dirk Hohndel
2e07e9345f mobile/dive-list: add indicator that dive list is being processed
This should deal with the rather confusing 'No dive in dive list' shown
while loading and processing the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-30 09:16:55 -07:00
Dirk Hohndel
cbf1f35d63 mobile/dive-list: show/hide virtual keyboard as needed for filter
This should happen automatically, but for some reason it doesn't. So
let's try to force it manually.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-30 09:16:55 -07:00
Dirk Hohndel
ccb671685d mobile/dive-list: make sure filter input area is visible
Since apparently the header property of the ListView isn't reliably
making sure that our filter input line is visible, let's move the filter
header to be it's own visual element and manually manage the
relationship between that and the ListView.

The obvious idea was to anchor the ListView to the bottom of the
filterHeader, but that didn't work in my tests. So instead we are using
the topMargin to make sure that there is space to show the header.

Because this re-indents the whole filterHeader, 'git show -w' gives a
much better idea what this commit actually changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-30 09:16:55 -07:00
Dirk Hohndel
d12e86cb2b mobile/cleanup: use a mutex to protect storage access
Instead of the crude and error prone bool, let's just use the right tool
for this job.

In order to avoid issues with a goto across a mutex boundary, this
slightly restructures the code in one place - 'git show -w' makes it
clear that this is really rather simple in its changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-29 12:36:57 -07:00
Dirk Hohndel
98966fdd8a mobile/save-changes: untangle the handling of alreadySaving
I'm suspicious that an issue that some people have seen around changes
not being saved is caused by our handling of alreadySaving.
When starting with Subsurface-mobile in no-autosync mode, we were able
to end in a scenario where alreadySaving was true, even though there
were no unsaved changes. And in that case no changes made during such a
session were saved unless the user forced a manual sync with the server.

This commit radically changes our approach to handling the flag. It
moves it right next to the actual calls into code that could modify git
storage, and ensures that the flag can never stay set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-28 11:00:09 -07:00
Dirk Hohndel
73bbe1f02b mobile/cleanup: tiny coding style issue that bugged me
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-28 11:00:09 -07:00
Dirk Hohndel
60d2d051bb mobile UI: add create trip to DiveDetails context menu
Should have done that in the first place. That's what happens when you
are rushing it...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-26 16:48:48 -07:00
Dirk Hohndel
302404dac0 iOS: ensure changes are saved locally
This was disabled in the past because it was deemed to slow. A lot
of time has passed, since. Maybe on current phones / iPads this is
acceptable again?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-26 14:27:14 -07:00
Dirk Hohndel
8177dd4dc3 cleanup: remove dead code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-26 12:59:00 -07:00
Dirk Hohndel
66fd93c9cc mobile/dive-list: add ability to create trip
This adds a context menu entry for top level dives that allows the user
to create a trip for that dive.

Unfortunately this creates a new string to translate right before a
release...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-26 12:59:00 -07:00
Dirk Hohndel
241d378f14 mobile/cleanup: pageStack.pop() doesn't take a string argument
This happens to do the expected thing, anyway, but let's not keep this
broken code around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-26 11:49:46 -07:00
Dirk Hohndel
0301fc6905 mobile UI: undo partial dive add when canceling
When we start adding a dive, we actually create a diveAdd undo command
so we have a dive that the user can edit. Which means we need to undo
this action if we cancel.

Also, for a more consistent UI, we should pop the dive details page that
we used to edit this dive and bring the user back to the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-26 11:49:12 -07:00
Dirk Hohndel
f2a48e813f mobile/page-selection: consistently use showPage to select a page
We still used pageStack.push() all over the place.

Also, in showPage, disable the map hack if the user actively picks a
different page.

This should fix an issue where the user picked the map and then tried to
add a dive to the dive list - and instead of the dive edit was shown the
map again.

Reported-by: Hartley Horwitz <hhrwtz@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-26 11:49:05 -07:00
Dirk Hohndel
69272eefa8 mobile/profile: ensure profile opacity resets when zooming
It's possible for our code to think that the user wants to pan the
profile before realizing that the user actually is making a pinch
gesture. In that case the profile could get stuck in semi-transparent
mode. This prevents that from happening by explicitly resetting the
opacity to 1.0 when we start a pinch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-25 09:28:05 -07:00
Dirk Hohndel
f084852f5c mobile/debug: simulate zooming through mouse wheel on desktop
And allow touchpad gestures to be recognized as well. This has no
negative impact on the mobile platforms, but makes it much easier to
test profile scaling / panning on the desktop.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-25 09:28:05 -07:00
Dirk Hohndel
c7dd1e1bab mobile/profile: don't pan unless we are zoomed in
This way someone trying to swipe from dive to dive won't inadvertantly
pan the profile instead. And panning it really only makes sense when
zoomed in in the first place.

This could leave us in a situation where we zoom in, pan, zoom out and
now the profile is out of whack and we cannot correct it. A simple click
on the profile fixes that.

The real solution would be some constraining / adjusting as we zoom and
pan to ensure we keep things correctly positioned. Maybe I'll figure out
the correct way to do this later...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-23 20:49:05 -07:00
Dirk Hohndel
bba73fdc87 mobile: show the new v3 user manual
I would love to figure out a way how to bundle the user manual and load
it from the device file system, but in the meantime this should continue
to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-23 20:48:03 -07:00
Dirk Hohndel
30e6102886 mobile/divelist: add UI to toggle dive invalid flag
This reuses the corresponding undo command.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-21 14:31:37 -07:00
Dirk Hohndel
c77cc93eec mobile UI: show dives marked as invalid with strike through
This matches the visual language of the desktop UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-21 14:31:37 -07:00
Dirk Hohndel
1453888e02 mobile/tripedit: close page after saving
That's consistent with how we do things on other pages.
Also hide the on-screen keyboard.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-21 13:27:00 -07:00
Dirk Hohndel
fbea54f8dd mobile/settings: attempt to fix the layout
The hardcoded widths with fixed values was just flat our broken and
created all kinds of strange artifacts.

But even with this somewhat more idiomatic approach this still isn't
perfect - on wider screens it doesn't shrink back to the minimum column
width. But that seems like a bit of a corner case. Overall this feels
like a huge improvement.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-21 13:27:00 -07:00
Dirk Hohndel
559547b7e6 mobile/DCdownload: try harder to get the right elements selected
The number of possible sequences of events when the user is connecting a
USB device is rather surprising. These changes try to ensure that in
every case we get USB connection information we do in fact show the
correct (or best guess) connection.

See #2686

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-21 13:27:00 -07:00
Dirk Hohndel
98ef01b2e4 mobile UI: stop the use of dark icon theme
This was used very inconsistently and had more bugs than positive
impact.

See #2686

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-21 13:27:00 -07:00
Berthold Stoeger
568a8d6254 mobile: remove QMLManager::updateSiteList()
The location information model is updated automatically by the
divelist-model and the undo commands. Therefore remove the
QMLManager::updateSiteList() function. We do have to keep
the locationListChanged() signal though, because the list
of dive sites is not exported via model/view but rather via
a Q_PROPERTY. We really should change that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-18 13:27:16 -07:00
Berthold Stoeger
ed3e68c36a git: load into arbitrary dive tables
The git parser loads into the global dive table, even if it
is called indirectly via parse_file(). However, parse_file()
may be given a different table. Fix this by extending the
git parser state.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-17 16:50:20 -07:00
Dirk Hohndel
2042a47230 mobile/cleanup: add some more log messages
This will help understand the control flow in the log.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-17 16:49:53 -07:00