Commit graph

17314 commits

Author SHA1 Message Date
Dirk Hohndel
f4589583ef Android: remove USB devices we don't support
The HID devices and the Atomics Aquatics Cobalt cannot work on Android
right now. We should claim to support them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 13:27:43 -07:00
Dirk Hohndel
0212b1b9f7 undo infrastructure: improve undo command texts
For many of the commands it is fairly easy to add information that makes
it easier to figure out what actually happened. That's especially true
for commands operating on dives. Trip and dive site edits haven't been
given these more elaborate undo texts (yet).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
8ce4e10ccb cloud storage: add list of changes made to commit messages
This should make it easier to figure out what operations lead to the commit
that is written to git.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
160d2ab071 core: make command texts available for C code
Create a C string (which the caller needs to free) with the executed commands
in this session.

The detour via the callback allows us to not make the corelib depend on the
commands, which is nice for tests, export-html, and smtk2ssrf.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
626a149b7c undo infrastructure: collect the texts for the executed commands
This creates a single string with all the undo texts that are on the stack.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
053356c49b build-system: remove pointless distinction between desktop and mobile
It's the same sources, the same library.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
0720e74c1a mobile UI: six new icons
I will (mis)use these for moving dives out of trips and to the trip above or
below and of course for undo/redo. And the weirdest one is the 'local offer'
icon that seemed a reasonably good fit to edit trip details.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
0683d97636 mobile UI: save changes to trip details
The logic when we show the save button is a little fragile (and visually I'm not
sure I love the disabled button), but hey, this works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
eaa1a5126b mobile: add ability to update trip details
This creates up to two undo events. This seems like such a small issue that
it's not worth creating yet another undo command for this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
4b4df28ecd mobile UI: add divelist context drawer action to edit trip details
For now this only shows the trip details. They can be edited on the page, but
there is no way to save those edits, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
028807ebc5 mobile models: add trip location and notes
First step towards making those accessible and then editable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
9e13777cc1 mobile/dive-list: add context menu when long-pressing on trip
This doesn't show the dive specific actions and sets the stage for trip edit
actions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
3bcc562150 mobile UI: don't call into the event loop
While this has worked fine for a long time, it now suddenly seems to trigger
crashes. So let's not do that (there are a number of discussions online that
talk about how this could indeed lead to BadThings(tm) happening.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
c8b55ddb76 mobile/dive-list: allow moving dives between trips
A dive that is already in a trip can directly be moved into the trip above or
below.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
476ecb8d72 mobile UI: more context actions in dive list
This adds the ability to delete a dive and to show its location on the map
directly from the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
7fc43c58be mobile/dive-list: long press on dive selects and opens context drawer
This way one can execute dive list manipulations without the detour
to the dive details screen. For example you can long-press on a dive and then
add it to a trip or remove it from a trip.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
289d451294 mobile UI: fix autoclose of context drawer
The default policy closes the context drawer if there is a button release
outside the context drawer area. That messes with the intended UI. For us a
much more useful behavior is to have the next click outside of the drawer close
the drawer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
ffdcc8bf30 mobile UI: add context menu to dive list
This one exposes undo/redo as well as some basic trip manipulations, very similar
to what's already available on the dive details page. Except that here it also
makes sense to add a selected dive to a trip above or below (if those exist and
the dive isn't already in a trip).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
2c8f962ecc mobile UI: allow adding a dive to a trip from context menu
Right now this is only available on the DiveDetails screen. The menu entries
are only enabled if there is such a trip to add the dive to (and if the dive
isn't already part of a trip).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
a4043401c9 mobile/trip-handling: add helper to add dive to a trip
This again uses an undo command and should be completely symmetrical to removing
a dive from a trip.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
ccf5bf6445 dive models: add helper role to find trip above or below dive
This is only used in the mobile UI where the sort direction is fixed and we
refer to dives based on the tree model. So the terms used and the concepts
that these rely on should be guaranteed to be valid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
0cd275af67 core/trip handling: add helper function to get trip from id
In the QML code we pass ids around. I had assumed that there already was a reverse
lookup function, but I wasn't able to find it. So I added it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
3464e776e2 mobile UI: add ability to remove dive from its trip
If we remove the newest dive from its trip, it becomes inaccessible in the app,
but the dive data saved to disk appears to be correct.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
968278fe91 core: add 'diveInTrip' role to underlying data model
This will allow us to offer differentiated options in the context menu.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
56db02a685 mobile UI: only show context menu when viewing a dive
In add and edit mode this is confusing and wrong.

There is a bug in Kirigami that creates lots of bogus error message about
missing mainFlickable. That needs to be patched out.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
ef2f65fd27 mobile/filter: use signal to reload filter
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
857e591a59 mobile: remove dive::collapsed
This was used by the old dive-list to mark collapsed entries.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
65fe892cba mobile UI: set the correct location string when editing dives
In some situations we ended up with the wrong location name. One way to
reproduce the problem was to edit an existing dive location to be a substring
of an existing location name. Save the dive, then immediately edit it again.
The wrong location would be filled in.

The code here looks strange and unnecessary, but it seems to fix the issue.

The aliases don't seem to make the code any easier to understand. This replaces
them in the case of the location combo box with direct accesses to the data on
the DiveDetailsEdit page. It may be worth removing all of them. The
locationModel alias was unused.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
28bf078ff7 mobile UI: add context menu to DiveDetails
The undo and redo action actually work already.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
af4bd16f88 mobile: replace undoDelete() with generic undo()
Since we are using the existing command infrastructure, this isn't specific to
undoing a delete.

This commit renames the function and removes its use in the UI, the next commit
will then add the generic undo to the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
8e6cc9b8d0 mobile UI: make the text of the undo/redo action available to QML
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
41072cf48f core/undo: provide access to the QUndoStack
This is used by the mobile UI to get notifications when the undo
text changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
2936d203e2 mobile/divelist: add context drawer
This is just pulling in the object so it can later be used on other pages.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
3c2a192864 mobile: remove no longer used DiveListModel
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
6400867910 mobile/filter: connect directly to filter
Since the divelist model is now placed on top of the common
models, we can directly reset the filter.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
79b04a2f01 mobile: remove selectedDiveTimeStamp logic
Since the selection is now handled in the core this is not needed anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
e700920e8e mobile: remove updateSelectedDive logic
Selection is now be handled by the core.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
57b96490b2 mobile/undo: create EditDive command
Command that just swaps two dives. This is rather complex,
as for example a dive site might be created.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
2009321894 mobile/divelist: better handling of selection change
This still has an odd bug. When we swipe the dive details to change the
selected dive and that action causes a trip to expand or collapse, then
the color change / highlight in the dive list isn't updated correctly,
even though the log file indicates that we made the necessary changes.

This also changes the coloring of the selected dive; having the same coloring
as a trip was very confusing. This is a bit stark, but it clearly communicates
the distinction.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
58dcbfff13 mobile: use undo-command to paste dives
The UI for this is currently disabled (this was lost in the dive list rewrite).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
6e9597027d mobile: random white space cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
c0f2563495 mobile: don't disconnect model on download
That makes no sense anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
2a88ff0ffb mobile: reduce the number of model reloads when opening cloud data
The whole load from cloud thing will have to be audited. It appears
to me that there are way too many model resets...?

The only thing that is left is dive editing. Let's do that next.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
5493e7cbf6 mobile UI: use undo-command for adding dive.
Instead of using the model, copy the code we have in the desktop version
which manually creates a 15m/40min dive and passes that to the addDive
undo command.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
2ad7b26f4b mobile UI: don't hide dive view when deleting dive
The next dive is automatically shown anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
69516c37ec mobile/divelist: select dive after swipe
After swiping through the dive list, select the currently visible dive.
Thus, the dive is highlighted in the overview pane.

The connection with the QMLManager feels atrocious, but I would prefer to have
as little logic in QML as possible.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
dd8d8edc45 mobile/divelist: don't set currentIndex on undo of dive deletion
The core sets the current dive when undoing something.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
d55ea8f875 mobile/divelist: remove showDiveIndex QML-function
The currently shown dive is now controlled by the core.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
c34b7857fc mobile/divelist: implement model that shows all dives in trip-order
MobileSwipeModel is probably not an ideal name, but all I could come up with.

One of the main complications here is that our list is reversed with respect to
the source model. We should change that one day.  Probably by moving the
sorting down to the core-model.

Since looking up the source row is somewhat expensive, the lookup is cached for
a single entry because accesses come in bursts for a single dive. This should
be a good compromise and avoids keeping track of a full row-to-dive array.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
71b378aa82 mobile/divelist: derive MobileListModel from a base model
In analogy to the DiveTripModel split, derive MobileListModel from a base
model that exports the roles, etc. This will allow us to create a second model,
which nevertheless possesses the same roles and all that without too much code
duplication.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00