Commit graph

1362 commits

Author SHA1 Message Date
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
Dirk Hohndel
8e7711c054 mobile/cleanup: remove the second access to cloud data
While I remember some of the thinking that went into doing things this way,
the more I read the code, the less it makes sense to me.

This is a rather drastic step, but in reasonably extensive testing it seems
to work in every case that I tried.

That's rather embarrassing, actually.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-17 16:49:53 -07:00
Berthold Stoeger
4bd217299a mobile/edit: don't add dive site twice to table
When editing a dive on mobile we might have to create a new
dive site. That site is added to the global dive site table
in the undo command. However, the code in QMLManager created
the dive site with create_dive_site*() functions, which already
adds it to the table. The undo command then added the dive
site again leading to a hang of the application.

To solve this problem, create new alloc_dive_site*()
functions that do the same as create_dive_site*()
but do not add it to the table.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-17 14:05:24 -07:00
Dirk Hohndel
ccd024f0ee mobile/DC-download: select reasonable connection after rescanning
This seems to make more sense than to not select anything (which was the
previous behavior).
If the same connection is still available, select it again. Otherwise
pick the top connection (which is the right thing to do if the user has
just plugged in a USB device and refreshes the list -- that device will
show up as top entry).

Based on a suggestion by Christof Arnosti <charno@charno.ch>

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 13:59:18 -07:00
Dirk Hohndel
2abfd16a10 mobile/DC-download: show USB devices before BT/BLE
This makes sense because USB devices will only show up when connected,
while BT/BLE will get listed once they are paired, even if not currently
connected. So the higher likelihood of being the device a user is looking
for is for any USB devices that show up, so those should go first.

Suggested-by: Christof Arnosti <charno@charno.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 13:59:18 -07:00
Dirk Hohndel
2265a27912 android/usb: better memory management
Instead of relying on the std::vector staying unchanged and not freeing
its members, instead keep a copy of the object in our DCDeviceData class.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 07:58:20 -07:00
Dirk Hohndel
0b72495413 android/usb: simply restart the download after receiving permission
If the user tries to download from a device that he hasn't given the app
permission to read from, Android will pop up a dialogue asking for that
permission. With this after giving the permission we continue (well,
technically, restart) the download which is likely the expected behavior.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 07:58:20 -07:00
Dirk Hohndel
4619b4932e android/usb: refresh USB device list on entering download from DC
The usbRescan() code is smart enough not to duplicate entries that might
already be there. And with this the user doesn't have to manually tap
rescan if they didn't open Subsurface-mobile via the intent after a
device was plugged in.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 07:58:20 -07:00
Dirk Hohndel
ff2f199eed mobile UI: rescan button on DC Download page rescans BT/BLE/USB
This way even if a USB device wasn't added through an Android intent, we
still have a way to scan for it and select it. This is especially
important in case a user has a cable that we haven't seen yet (i.e. with
a VID/PID that we haven't added to Subsurface-mobile), but that
nevertheless works with the android usb serial drivers.

This also makes the flow a little more logical / consistent when
deciding which connections to show.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 07:58:20 -07:00
Dirk Hohndel
274dbc2ebf mobile UI: remove special case for Atomic Aquatics
This dive computer hasn't been supported on Android in quite a while.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 07:58:20 -07:00
Dirk Hohndel
ec3a968df9 android/usb: pass in the UsbDevice when downloading
This finally allows us to download from not just the first device, but specifically
the device that the user picks.

Passing the object through a void pointer is not nice - but since this traverses
C code other solutions (like passing an index into the list) seemed even worse.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 07:58:20 -07:00
Dirk Hohndel
4cd453dc92 android/usb: parse the usbDevice when responding to intent
This vastly simplifies our handling of devive information as we simply use
what is already in the descriptor. This way we do not duplicate information
about USB devices in the QMLManager.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 07:58:20 -07:00
Dirk Hohndel
822b05bec4 mobile/download: only use device guess if no USB device plugged in
If we explicitly open the download page after the use plugged in a USB
device, don't try to use guesses from the BT/BLE pairings to populate
the device/connection dropdowns.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 07:58:20 -07:00
Dirk Hohndel
ff68fd7c0c mobile/export: fix invalid reference
This just removes broken code. That file select dialog is still just a very
strange idea and should be revisited at some point.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-12 07:07:48 -07:00
Dirk Hohndel
f2a8562b5d mobile UI: stop trying to play with opacity
Since we are switching between pages, the whole opacity mechanics make no
sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-12 07:07:48 -07:00
Dirk Hohndel
84d45485fd mobile UI: remove duplicate StartPage
This was a merge error in the dive list rewrite and brought in a code block that
had moved, which caused issues with correctly switching to the dive list.

Calling setupActions() moves to the diveListView (where it really belongs).

Instead of messing with the visibility of components of the same page, we now
simply switch out the shown page.

Fixes #2667

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-12 07:07:48 -07:00
Dirk Hohndel
0d1510929f mobile UI: make user and log messages consistent for no cloud
A number of our messages were misleading in the no cloud case. This should help
to reduce confusion.

Adding the save_dives() call after creation of the repo appears to help us have
a valid repo in place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-12 07:07:48 -07:00
Robert C. Helling
285fa8acbc Grammar: replaces 'indexes' by 'indices'
Grammar-nazi ran

git grep -l 'indexes' | xargs sed -i '' -e 's/indexes/indices/g'

to prevent future wincing when reading the source code.

Unfortunatly, Qt itself is infected as in
QModelIndexList QItemSelection::indexes() const

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-03-11 08:26:30 -07:00
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
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
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
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
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
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
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