Commit graph

671 commits

Author SHA1 Message Date
Dirk Hohndel
00e673230a Mobile: reserve space for the hamburger menu on Download page
Having a label with no width that can expand wasn't really a great way
to do so.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-11 21:50:41 +01:00
Berthold Stoeger
f3acb0ca02 Mobile: catch null references in DownloadDCThread
There are reported crashes on Android that suggest a null
"tables" attribute in DownloadDCThread. This should never
happen, as the table() function connected to this attribute
returns the address of a subobject. Thus, even if the original
DownloadThread is null, this would not return a null pointer
(the subobject is not at address 0).

Catch these null-object accesses and write a warning message
to the console. Hopefully, this will help is localizing the
problem.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-10 09:58:19 -07:00
Dirk Hohndel
144de49ad4 Mobile: add checkbox to force downloading all dives
This has been a feature people have asked for quite frequently. It is
taking up some valuable screen real estate - so the question could
become if there should be a switch to enable / disable it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-11 11:40:07 -07:00
Berthold Stoeger
82af1b2377 Undo: make undo-system dive site-aware
As opposed to dive trips, dive sites were always directly added
to the global table, even on import. Instead, parse the divesites
into a distinct table and merge them on import.

Currently, this does not do any merging of dive sites, i.e. dive
sites are considered as either equal or different. Nevertheless,
merging of data should be rather easy to implement and simply
follow the code of the dive merging.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12 18:19:07 +03:00
Dirk Hohndel
9d582c5512 Mobile: only show dive computers in the Bluetooth connection list
And offer an option to show all devices in the settings. This is intentionally
not stored in the preferences as this should never be needed. We don't support
BT or BLE dive computers that we don't recognize. This is a last resort in case
a new firmware were to change the name or some other weird issue causes us not
to recognize a dive computer - and that should be fixed instead of worked
around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-02-14 09:05:58 -08:00
Berthold Stoeger
ff9506b21b Import: don't add to new trip while downloading
Since process_imported_dives() can add dives to a newly generated
trip, this need not be done in the downloading code. This makes
data flow distinctly simpler, as no trip table and no add-new-trip
flag has to be passed down to the libdivecomputer glue code.

Moreover, since now the trip creation is done at the import step
rather than the download step, the latest status of the "add to
new trip" checkbox will be considered.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19 13:48:17 -08:00
Berthold Stoeger
f542dc4030 Import: add trip_table argument to DiveImportedModel::repopulate()
In the future we want to download trips into a distinct trip-table
instead of the global trip-table to allow for undo of import.

Therefore add a trip_table argument to DiveImportedModel::repopulate()
and a trip_table member to DiveImportedModel. To correctly set these,
add a DownloadThread::trips() function, which currently simply returns
the global trip table.

Finally, make "struct trip_table *" a Q_METATYPE, so that the corresponding
arguments can be passed from QML.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09 20:58:04 -08:00
Lubomir I. Ivanov
0903bef9db update year to 2019 in about screens
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2019-01-02 09:45:01 -08:00
Dirk Hohndel
c38215dfa7 Mobile: deal with BT name and address when tapping Download
Instead of trying to update this whenever the connection text changes,
instead deal with it right before it actually gets used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-12-21 14:53:45 -08:00
Miika Turkia
53ba950c8f Mobile: copy the dive data when configuring settings
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-12-21 09:13:37 +02:00
Miika Turkia
8e7a9a4f4c Mobile: UI for selecting what to copy-paste
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-12-21 09:13:37 +02:00
Berthold Stoeger
bfe69239df Import: unglobalize downloadTable
To make data flow more clear, unglobalize the downloadTable object.
Make it a subobject of DownloadThread. The difficult part was making
this compatible with QML, because somehow the pointer to the
download-table has to be passed to the DiveImportedModel. Desktop would
simply pass it to the constructor. But with objects generated in QML
this is not possible. Instead, pass the table in the repopulate()
function. This seems to make sense, but for this to work, we have to
declare pointer-to-dive-table as a Q_METATYPE. And this only works
if we use a typedef, because MOC removes the "struct" from "struct
dive_table". This leads to compilation errors, because dive_table is
the symbol-name of the global dive table! Sigh.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-12-17 07:37:32 -08:00
Berthold Stoeger
68414531ad Mobile: don't format trip heading for all dives
QML's ListView uses the "section" property to test if items belong to the
same section. Apparently, this must be a string and therefore we can't
pass e.g. a dive-trip object. Therefore a specially formatted string
was passed in, which was guaranteed to be unique (contained the dive-trip
pointer value) and the fully formatted trip-title and short-date.

The disadvantage of that approach is that the formatting is performed for
every dive and not every trip. Perhaps not a problem now, but it makes
it for example necessary to cache the number of filtered dives.

To be more flexible, pass in only the pointer value formatted as
hexadecimal string and provide a function to convert that string
back to a trip-pointer (in the form of a QVariant, so that it can
be passed to QML). Moreover provide two functions for formatting the
title and the short-date.

The three new functions are members of DiveListSortModel. This might not
be the perfect place, but it is easy to reach from the DiveListView.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-23 13:22:24 -08:00
Miika Turkia
88d5eccb17 delete-copy-paste buttons layed out properly
Now these buttons are finally shown with long press and seem to be
working more-or-less as intended.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:31:44 +08:00
Miika Turkia
76a68f71a4 Support for copy-pasting specific fields on mobile
Initial implementation/prototype of copy-paste support for
Subsurface-mobile. The UI part is really lacking; right now the copy
button is initially visible and paste is achieved by long press on a
dive and clicking the paste button when it appears. Delete is currently
not possible at all, as I just failed to layout the buttons properly
using QML. It just sounds so simple, to put all the copy-paste-delete
buttons next to each other...

The data to be copied is currently hard-coded. A dialog to choose
inteded fields would be nice, but it'll take quite a bit effort to get
used to QML enough to be able to hack something together.

Anyway, this seems to work, even though the UI is not always reflecting
the paste without switching dives (when testing on laptop).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:31:44 +08:00
Jocke
03143f1ef1 Mobile: Allow multiple divemasters
While not something that many will use, editing a dive on
Subsurface-mobile should not result in data loss.
This makes the divemaster field behave in the same way as the buddy
field with regards to multiple entries.

Fixes #1853

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15 18:10:13 +08:00
Dirk Hohndel
4636fcc834 Mobile/filtering: don't show the filter line when pulling divelist down
Even though the height was zero, when pulling down the dive list for refresh,
the filter input line would still be visible. With this fix it no longer is.

Also remove unused property.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-31 14:34:43 -07:00
Berthold Stoeger
75b5d61522 Dive site: replace UUID by pointer in mobile code
Replace UUIDs by pointers to dive-site in mobile code. In both
cases, the value is transported via a QVariant. The function
getCoordinatesForUUID(), which was only used from mobile, can
be replaced by a getCoordinatesFor() function taking a variant
supposed to contain a dive-site pointer. Likewise, the variant
of the centerOnDiveSite function is now supposed to wrap a
pointer-to-divesite.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29 00:09:31 +00:00
Dirk Hohndel
01cd2e224f QML UI: we don't need Controls 2.4
In commit 99c06dec3d ("Mobile/filtering: simple busy indicator") we switched to
Controls 2.4 which requires Qt 5.11. Revert that one line of the commit as it
isn't necessary.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-27 07:17:51 -07:00
Dirk Hohndel
e0e3b63601 Mobile/filtering: make busy indicator smaller
Suggested-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
3eabb80398 Mobile/filtering: update number of dives shown when resetting filter
Otherwise we start showing an illogical '0' there when first opening the filter
dialog, and the equally wrong previous count when closing and then re-opening
the filter dialog.

Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
51e7603d7e QML UI: remove some of the log file noise
A couple came from this series, others are much older.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
1e6c5d002b Mobile/filtering: show a better message while waiting for the filter
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
cf3fcc53b6 Mobile/filtering: implement the filter update through a thread
It's important to disconnect the model from the ListView, otherwise the update in a
different thread will fail.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
84822ebd2f Mobile/filtering: remove redundant busy indicator on dive list
We should use the global one instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
b0a0e1e374 Mobile/filtering: simplify the filter toggle
Simply make it always reset the filter. There's no point remembering the last
filter pattern and explicitly setting it, if the last thing we do is to reset
this pattern.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
2183e41bb0 Mobile/filtering: add properties for dive list model and filter text
This allows us to modify those from different parts of the code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
09507416c8 QML UI: add busy indicator to the main window
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
6d77e66b69 Mobile/filtering: clean up whitespace from last commit
This one does nothing but whitespace - separating it into two commits makes the
previous one a lot easier to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
00a80c0e08 Mobile/filtering: add background rectangle for filter row
We are still trying to ensure that the filter is indeed shown in front of the
dive list. This is working when running on the desktop without the rectangle,
but on Android this appears to be needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
76e4826fbc Mobile/filtering: simplify transitions
We don't need to toggle visibility, toggling height is sufficient. This
dramatically simplifies the transitions.  But as a result we need to use the
'enabled' property to reset the filter.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
e4e0c608e1 Mobile/filtering: simple busy indicator
Filtering takes a noticeable time on mobile, so lets show the user we are doing
something.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
c0540d7682 Mobile/filtering: add Settings options for filtering
Toggle case sensitive and whether or not to include the notes in full text search.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
2caaf8889b Mobile/filtering: make sure the header is top-most element
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
97e6494eee Mobile/filtering: ensure filter input field has focus when shown
QML's logic for who gets focus is a bit complicated. But forceActiveFocus()
cuts through the confusion and makes sure that your field does indeed get
focus.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
fd31dfe40d Mobile/filtering: use margins instead of rectangles to create space
I'm not sure why this had initially failed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
c797038bd8 Mobile/filtering: only filter when editing is finished
This is a usability / performance tradeoff. I like it better when it filters as
I type, but on mobile this may make things feel sluggish.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
f965492241 Mobile/filtering: reset the filter text when toggled
This seemed less UI clutter than adding a clear button.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
cadb072a0c Mobile/filtering: improve code readability
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Dirk Hohndel
e5ee895793 Mobile/filtering: animate the filter header
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Dirk Hohndel
90d321f0ff Mobile/filtering: add count of filtered dives to search bar
The count in the trip headers is still that for the complete trip and therefore
misleading.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Dirk Hohndel
65aa6bc43b Mobile/filtering: make the search box an overlay
This way it stays at the top of the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Jan Mulder
0bc0b6bfe8 Mobile/filtering: first attempt to filter on dive site
[Dirk Hohndel: this is the starting point of my following commits, I decided to
	       leave it in place to give Jan credit for the work he did on
               figuring out some of the plumbing needed to get things to work]

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Jan Mulder
f1bb2c8478 Mobile/filtering: add icons for filter and sort
Add 2 icons for filter and sort capabilities. And as before, these
icons are coming from the Google Material design set.

[Dirk Hohndel: Jan's commit forgot to add the actual icons, I added
               those so the commit matched its message]

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Jocke
9c6d24e50e Mobile UI: make SsrfSwitch resizable
Back in 8ab8a67f the checkbox where made resizable.
This applies the same functionality to the selector switch and makes the
two objects match in vertical size.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-21 14:43:41 -04:00
Jan Mulder
4263d1c3f5 QML, cleanup: remove stackView
There is no reason (any more?) to have a property defined
that basically renames the global pageStack into a local
pageView. Just cleanup.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-12 08:22:26 -07:00
Jan Mulder
8074f12b91 QML UI: disable rescan when no bluetooth
This is cosmetic only. It make no sense to selected rescan when
Bluetooth is off.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-10 06:27:21 -07:00
Jan Mulder
8034af5ad5 QML UI: do not try to download from DC with empty vendor/product
Disable the Download button when one of the fields vendor, product,
connection is not filled in. The app will crash when trying.
In addition, make the underlying core code to actual download
more safe by checking this, and silently fail instead of crash.
And, yes, this is a double fix in this scenario, but the core code
is used in more places, so better safe than sorry.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-10 06:27:21 -07:00
Jocke
8686b53c37 Mobile/DC download: reset the "Download" button
When changing to another DC, reset the "Download" button text.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-09 21:04:23 -07:00
Jocke
3ce019cf1a Mobile/rememberDCs: remove duplicated code
The code to disable a quick button has moved to the DC matching logic,
in order to inactivate the correct button also for USB DCs.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-09 21:04:23 -07:00