Commit graph

63 commits

Author SHA1 Message Date
Lubomir I. Ivanov
68da4de643 main.qml: modify showMap() to not accept location
showMap() uses a location to open Google Maps in a browser.
Make showMap() a generic function to push the mapPage on the view
stack.

Update the calls to this function from child widgets and pages.
Also either call mapPage.centerOnLocation()
or mapPage.centerOnDiveSiteUUID() depending if the caller
wants the map to center on a dive site or on map coordinates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Jan Mulder
65d80d3cd0 Mobile QML UI: fix background colors
For some reason, after the update of the main.qml to version 2.2,
all Kirigami Pages and scrollablePages show up plain white.

So now, set a proper background for these pages.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
bd10a8442a Mobile QML: main.qml to Kirigmi 2.2
This is a long standing issue. I wish to keep up with Kirigami developments
including new versions of their controls, but this is not always easy.
While we upgraded to Kirigmi 2.2 for most of our QML earlier, using this
new version of main.qml breaks numerous stuff. In fact, so much that
we just needed to wait.

With the progress in Kirigmi, it is now possible to upgrade, with still
some issues on our side to be fixed, but this is manageble now.

The main show-stopper was a construct to set our theme colors, for example:
Kirigami.Theme.highlightColor = Qt.binding(...)
This is not posssible any more, as the Kirigami.Theme has made these
readonly on their end.

This commit just removes the assignments to the now readonly theme
items. And the setting of a correct theme color for the action button.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
6a53ec69ae mobile cleanup: repair stupid mistake
Commits fed2c5b6a1 and 572fc4707 erroneously deleted two
aliases. That is corrected here. Yes, QML with only runtime
errors can be a pain.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-02 13:13:46 +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
a5b44362c6 mobile: newer Kirigami SHA
This commit consists of the following 3 parts:
1. There are 2 source files added, adapt our build process
accordingly.
2. Due to a change in icon and kirigami QML prefixes, we need to
adapt for this as well. Changed mobile-resources.qrc for that.
When this would not be changed, the icons will not be found.
3. To further prepare for the future, abandon the iconName
property in favour of the new icon grouped property, which
can have more attributes than only the name. But currently
it is only a syntactic change.

Tested on Android device, and no visible changes.

Signedoff-by: Jan Mulder <jlmulder@xs4all.nl
2018-01-03 14:04:08 +01:00
Jan Mulder
825afb4db4 mobile: exit edit mode when navigating away from edit page
Navigating using the breadcrumb in the header did leave the
dive detail edit (and add) mode in such a way that (for example)
navigation in the dive list was suspended. Obviously, it is
debatable what should be done. Saving the edits/add, or
cancelling them. For now, this commit cancels them
silently. This is the exact same thing that is happening when
the user selects the dive list from the drawer menu.

Fixes: #932

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18 15:23:23 +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
Joakim Bygdell
e9bcca9103 Mobile: Enable editing multiple buddies
While the autocomplete function only works for the first entry
adding multiple comma separated buddies can still be done.

Fixes #608

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-12-07 21:43:17 -06: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
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
cf75e6451d QML UI: Scrolling in dive details
While testing the mobile app on Qt 5.9.2, I encounted a show stopping
issue. Select a dive in the dive list, go back to the dive list (as
selecting a dive opens the details), now scroll down to a different
dive, and select one. The app starts enumerating (moved smoothly
according to the specs) all the dives between the old and the new
selected dive. So, depending on the distance, this could take forever.
Explicitly: on 5.9.2. only.

From the Qt docs:

highlightFollowsCurrentItem : bool

If this property is true (the default value), the highlight is moved
smoothly to follow the current item. Otherwise, the highlight is not
moved by the view, and any movement must be implemented by the highlight.

End Qt docs.

Setting this property to false solves the issue. Tested on both Qt 5.9.1
and 5.9.2.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-29 11:08:10 -07:00
Dirk Hohndel
deff17fa36 Whitespace
This commit is empty when shown with '-w' - it just updates the
indentation after commit c00804eff6 ("QML UI: always start edit at top
of page").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 13:40:31 -07:00
Dirk Hohndel
c00804eff6 QML UI: always start edit at top of page
When starting to edit / add a dive, the Flickable needs to be positioned
at the top of the page, not the last position shown.

For clarity I'll do the re-indentation in the next commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 13:38:32 -07: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
Dirk Hohndel
7f0c7eeb24 QML UI: change the dive edit to not be an overlay
This way the accidental closing of the edit (and loss of data)
should no longer happen.

See: #495

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
41f24f2859 QML UI: top padding for dive details
This used to work without manually adding space here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Joakim Bygdell
29e704a1b2 QML UI: loose focus on endEditMode
This handles a cornercase where a user starts editing and then cances the divedit followed by a return to edit mode. The previously acive textfield would then be active again even though all changes are lost.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Joakim Bygdell
9d7eb33a33 QML UI: display rating and visibility stars
Display rating and visibility stars on the dive details page. See #495

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Dirk Hohndel
a7fca80a3e QML UI: don't access dive without modelData
Occasionally I see errors in the log where we would access modelData.dive
with modelData = null. This patch addresses a couple of the spaces where
this happens, but also simplifies the code by using the existing alias.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-21 17:20:07 -07:00
Dirk Hohndel
8525805f04 Add SPDX header to mobile widgets and QML files
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Dirk Hohndel
74a5511b39 QML UI: fix broken delete from dive details page
Trying to close the non-existing context drawer caused the function
to abort (and consequently not to delete the dive).

Fixes #309

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-15 13:50:18 -07:00
Dirk Hohndel
052be692bb QML UI: reset completion fields when adding dive
Otherwise the last value in those fields might still be shown.

Also, set up the cylinder completion.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-14 17:33:11 -07:00
Marco Martin
751626eec5 QML UI: Fully port dive edit to Kirigami2
Completely adapt to the api changes of OverlaySheet in Kirigami2
in order to achieve the same look and behavior for the dive
edits that had with kirigami1

Port most components to QtQuickContrls2, except comboboxes
in the dive edit sheet that will need a new control type

Signed-off-by: Marco Martin <notmart@gmail.com>
2017-04-01 09:35:51 +02:00
Jan Mulder
d6003209d6 Subsurface-mobile: do send decimal GPS to Google
Sending nicely readable formatted coordinates to Google Maps does not
result in a correctly positioned map. Google likes unreadable
decimal format.

Little hacky solution. Added a gps_decimal attribute, populate that
with the standard function for format a coordinate to string, but
reset the preferences value temporarly so that it always converts it
to decimal style.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-24 09:35:00 -07:00
Jan Mulder
59417342c7 mobile: the infamous enumerate problem
This fix seems to fix the enumerate problem: the problem that on a
seemingly non-determinstic way, all the profiles get enumerated
and rendered, causing freeze of the app, or even crash due
to out of memory.

Only 3 lines of code change, but this fix did not come easy. The
enumerate problem seems some kind of race condition between QML,
Kiragami and most definitely, the Subsurface QML code itself.
The breakthrough in my debugging was the setting of
highlightRangeMode: ListView.StrictlyEnforceRange based on
the QML documentation on snapMode: enumeration.

This fix deserves proper testing in multiple environments. As
could be seen on the developpers mailing list, I was (easily)
able to reproduce the enumerate problem, but Rick was not. So
I definitely do not claim to understand why this fix solves
the issue for me.

And as a sidenote: fixes #263 for me as well.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-24 09:27:23 -07:00
Dirk Hohndel
220d25588f QML UI: enable caching of the details view
This way the dive on either side should be cached.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-18 17:05:45 -07:00
Dirk Hohndel
783f9ee565 QML UI: don't explicitly position view
Instead have the view follow the currentItem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-18 17:05:45 -07:00
Dirk Hohndel
dd1d90b529 QML UI: don't clip
At least that's what the QML documentation recommends.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-18 17:05:45 -07:00
Dirk Hohndel
a2bc3e02f8 QML UI: small cleanups
Remove unused signal handler.
Small whitespace cleanup.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-18 17:05:45 -07:00
Dirk Hohndel
9389fd0049 QML UI: don't access members of undefined objects
If we don't have a currentItem, don't try to access its members.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-18 17:05:45 -07:00
Dirk Hohndel
33df10cbaa QML UI: small clarification
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-18 17:05:45 -07:00
Dirk Hohndel
b15b3c195c QML UI: allow magic phrase for multiple buddies to be localized
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-22 18:20:03 -08:00
Dirk Hohndel
0196d9a220 QML UI: correctly test if there are multiple buddies
The JS string function search returns the position of the string you
search for and -1 if that string isn't found. Also, search allows
regular expression, indexOf does just a string match. So let's use
that as it is much faster.

See issue #168

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-22 18:18:57 -08:00
Dirk Hohndel
14b4c94ded Revert "QML UI: build against latest Kirigami"
This reverts commit a842e44b68.
2017-01-21 14:42:10 -08:00
Dirk Hohndel
6459e455bc Revert "QML UI: steps towards working with Kirigami 2"
This reverts commit 53ce3ce3e3.
2017-01-21 14:42:00 -08:00
Dirk Hohndel
53ce3ce3e3 QML UI: steps towards working with Kirigami 2
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-27 09:22:05 -08:00
Dirk Hohndel
a842e44b68 QML UI: build against latest Kirigami
But of course this doesn't work, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-27 01:47:01 -08:00
Joakim Bygdell
1219dc6931 QML UI: deal with multiple buddies correctly
When editing adive in Subsurface-mobile we can only handle one buddy
due to the limitations of the combobox. To prevent loss of data when editing
a dive with more than one buddy we display "Multiple Buddies" in the buddy
field. This creates a special case where no changes are written to the buddy field
unless the user changes buddy for that dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:46:15 -07:00
Joakim Bygdell
4e0200863b Remove hacks regarding multiple gasmixes and cylinders
Enabling cylinder edit in Subsurface-mobile our previous hacks
regarding multiple cylinders and gasmixes must be removed.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-04 07:36:43 -07:00
Joakim Bygdell
674d8331f5 QML UI: Enable cylinder edit
This adds the option to select a cylinder when adding or editing a dive.
Due to limited screen size we restrict the editing to the first cylinder only.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-04 07:36:13 -07:00
Dirk Hohndel
22170d3991 QML UI: add debug output for dive edit save button
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-12 14:49:40 -07:00
Joakim Bygdell
a6c8d0028e Make autocomplete work on add dive
This sets the list models for autocompleting suit, buddy and
divemaster.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-21 07:01:53 -07:00
Joakim Bygdell
0e4e8edf78 QML UI: add comboboxes to DiveDetailsEdit
This adds autocompleting text input fields for suit, buddy and
divemaster.

[Dirk Hohndel: some whitespace cleanup]

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-16 11:05:20 -07:00
Robert C. Helling
502be2a0f1 Mark strings in qml files for translation
I did this semi-automatically: I used the script from
the previous patch and then did some manual corrections.

This marks only title: and text: tags, there might be others

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-03 12:59:16 -07:00