Commit graph

84 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
Dirk Hohndel
102f3bf295 mobile/notes-edit: ensure cursor stays visible editing dive notes
This seems to work much more reliably as it specifically compares the cursor
position to the visible bottom and top of the screen.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-07 14:01:23 -08:00
Dirk Hohndel
e6298f9352 Mobile: allow editing dive number
No checks regarding duplicate numbers - we trust the user knows what
they are doing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-21 15:50:41 -04:00
Dirk Hohndel
158a2ec159 Mobile: remove remaining accesses to DiveObjectHelper from QML
Add a couple more roles and remove the dive role that allows accesss to
the DiveObjectHelper in the first place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-20 16:08:55 -04:00
Dirk Hohndel
01f1bea995 Mobile: ensure input fields stay visible after keyboard opens
When the user taps on a TextField to enter text, usually the virtual
keyboard will pop up. This code tries to ensure that the keyboard
doesn't cover the entry field that the user was trying to work on.

In order to centralize these changes, this introduces a new
SsrfTextField type which we use to also remove a few redundant default
settings that we previously had for every field. The one TextArea for
the Notes field didn't seem worth creating yet another type for, so
there the changes are done directly in DiveDetailsEdit.

The awkward timer mechanism is necessary as the keyboard pops up
asynchronously and then triggers a change of height for the app, so we
need to wait a little bit before doing the adjustment.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-14 13:39:45 -07:00
Paul Buxton
65ec16e59d Fix text in darkmode on mobile app.
Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
2019-10-06 11:39:46 -07:00
Jan Mulder
9b199602c6 Mobile QML UI: bump Kirigami imports to 2.4
Primarily for reasens of keeping up with upstream. And hopefully
bugfixes and added functionality.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:29:46 -07:00
Berthold Stoeger
0aab39b35d Mobile: use editText instead of currentText in Suit and DiveMaster boxes
A user reported problems with editing the Suit and DiveMaster fields.
Apparently, editing does not change the currentText. Without doing
a deeper analysis, simply use editText (a more proper fix might be
changing the currentIndex on editing).

(Parially?) fixes #1694

Reported-by: Mark Powell <mcpowell123@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-25 09:27:16 -07:00
Jocke
0fb086a4a5 Mobile: fix saving new dive
With the new setup we need to know which state we are coming from
when we are saving cylinder related info. When we are adding
a new dive we explicitly should save cylinder data to the first cylinder.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
bd8eec5c8e Mobile: fix adding new dive
All the changes to multi cylinder editing broke the option to add a new dive.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
ae70a751c7 Mobile: save pressures
Save start and end pressures for used cylinders.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
891e8acaa8 Mobile: save gasmixes
Same as for cylinder info, we need to make sure that the gasmixes gets saved to the correct cylinder.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
9c9450748b Mobile: display all used gases on the edit page
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
94428b9a18 Mobile: save edited cylinders
Save the edited cylinder in the correct slot.
Since the cylinder number and the used cylinder number need not be
the same we first need to test if the cylinder are used.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
6b93e5fe27 Mobile: Display used cylinders on edit page
This displays the used cylinders in a dive so that they can be edited.
Currently limited to 5 as a POC.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Dirk Hohndel
1d95cc4cbf QML UI: if we don't have a current position, update it later
Once we get a new fix we asynchronously update the text.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-14 13:37:44 -07:00
Joakim Bygdell
ab99703b02 QML UI: drop focus when selecting a location
Make sure to drop focus both for typing and when selecting
an entry from the list.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
94e0ec8dc9 Mobile: change location combobox id
Change the id of the location combobox to math the naming scheme
of the other comboboxes.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
07fb1db3ad Mobile: Fix location combobox
In the initial move to comboboxes the correct location model
was not used. This uses the correct model and makes it behave
like the other comboboxes.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
6badba2bae QML UI: drop focus on edit
Drop focus on editable comboboxes when pressing enter.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
477d1a3533 Moblie: remove comparison when saving
Removing the comparison of currentText vs editText when saving buddies
fixes the issue of data loss when dive has more than one buddy.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Dirk Hohndel
7feb9a3b6e QML UI: drop focus when ComboBox element is picked
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-19 12:01:14 -07:00
Dirk Hohndel
9145ea209f QML UI: cylinders aren't editable
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
9755650b3c QML UI: switch editing back to comboBox
The HintsTextEdit just doesn't feel natural and intuitive.

Edit, fixed rebase issues.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Jan Mulder
494ad26540 mobile cleanup: restyle construction of locationlist
See also e6e1473e6. The construction of the locationlist
was not the same as the 3 previous lists, and it needs
the inclusion of a new model file (divelocationmodel.cpp)
in the mobile app. In addition, as the mobile app is mainly
interested in a simple stringList (model) to populate a HintsText
field (or maybe later a combobox), this stringlist is added
to the model, to easy interfacing with QML.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
83259008e7 mobile cleanup: unduplicate code and do not loop over dives (3)
See e6e1473e6. Exact same commit but here for the
list of divemaster. The careful reader will spot a
small addition to the clearDetailsEdit() QML function.
Two more field are cleared.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
572fc47071 mobile cleanup: unduplicate code and do not loop over dives (2)
See e6e1473e6. Exact same commit but here for the
list of buddies.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
fed2c5b6a1 mobile cleanup: unduplicate code and do not loop over dives (1)
This is the first of a set of commits that are (very) similar.
It appeared that a number of more or less static lists, which are
constructed by a loop over all dives in the logbook, were executed
when changing focus to a next dive. For example, the in this
commit addressed list of used dive suits.

What was wrong was that the suitList was linked to a dive. There
is only a need to construct the list of used suits when data is
changed (and obviously, once on startup of the app). Further, it
appeared that a lot of code was duplicated and that we can use
(in this case) the same code from the desktop completionmodels.cpp.

Basically, this commit involves the following changes:
- include completionmodels.cpp in mobile and desktop (so move
it from the desktop only category to the generic category).
- remove double code from DiveObjectHelper.cpp
- Do not differentiate in the init phase and the normal refresh
of the list
- the per dive logic is now only the getting of a previously
constructed list (in init or update of the divelist).

There are no visible changes in the UI, other than a better
performance when scrolling over dive details.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
ef543da5af mobile: clear internal data when edit/add dive is finished
When editing (or adding) a dive, the internal data containing the
attributes on the edit page was not cleared when editing was
finished (in any way, by saving the edit or by cancelling it).
As long as the user only edits existing dives, all this poses
no problem, as at the start of a dive edit, the data is filled
from the dive to be edited. However, when adding a dive, data
coming from previous edits shows up. This not clearing data
also causes the strange effect as written in issue #950: adding
a dive, deleting it, and adding a dive again, added the first
added dive data, without the edit screen being shown.

All this can be solved by clearing the data from the edit when
editing is done.

Fixes: #950

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-15 09:03:24 -08:00
Jan Mulder
806c7077f2 mobile: get GPS data from dive site name
When the user entered a dive site using autocompletion, it
is a known site, of which we might have a GPS location already.
Just fill the known site coordinates.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-25 08:13:42 -08:00
Jan Mulder
64704d6e5a mobile: autocomplete location names
Add the capability to select the location name from a list, constructed
from the known dive sites in the logbook.

Fixes: #546

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-25 08:13:42 -08:00
Jan Mulder
fea111cb3a QML UI: QtQuick.Layouts to 1.2
And again, no visual changes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
e9903d1835 QML UI: QtQuick.Controls to version 2.2
Tested fine without visual changes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
f3d978b8a5 QML UI: QtQuick to 2.6
Upgrade QtQuick to 2.6. Seeing a small artifact in the application
header, lets see what happens when upgrading more includes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
3b5375d553 QML UI: Kirigami to 2.2
When first tested this commit, especially the dive list was looking
terrible. However, after including newer SHA's from libkirigami, and
correcting lots of spacing/margin issue, a retest of this commit shows
no strange artifact any more, and the amount of warnings in the log
output is reduced significantly. So now, it appears save to
upgrade.

Notice that main.qml still uses Kirigami 2.0. and is not updated in
this commit. With version 2.2, there is a new way of theming, that
is not (yet) compatible with our current code. Blindly upgrading to
2.2 leads to a almost black dive list, wrong button colors, and
runtime errors in the log, due to the fact the direct setting from
QML Kirigami's Theme colors is not allowed any more.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
d623eccdef mobile: silence deprecated messages in logging about Kirigami.Label
Commit 8f6827ab12 brought a new SHA for Kirigami, but that introduces
a very noisy logging of "Kirigami.Label is deprecated. Use
QtQuickControls2.Label instead".

So, thats what done here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-17 15:32:27 +02:00
Dirk Hohndel
3487612337 QML UI: add transition when switching to edit mode
The hard switch was not ideal. This isn't perfect, yet, but a step in
the right direction. The 'transitions' to change the visibility
properties are a bit odd, but that's how it's done in the examples as
well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 08:21:55 -07:00
Dirk Hohndel
636904e078 QML UI: make edit page scrollable
And have a tiny bit of space around it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00