Commit graph

623 commits

Author SHA1 Message Date
Jan Mulder
6700715b5d Mobile QML UI: fix more background colors (gpslist)
And another one. The SwipeListItem also needs to have a set
background color. Unfortunately, the lines between the
individual SwipeListItem disappeared, so, set the
smallest possible border on these items.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
e7ccb7d4d9 Mobile QML UI: color the application header correctly
Also, this got broken after the Kirigami to verion 2.2 in main.qml.
So, set the header background color according to our theme setting.

Notice, that there is a remaining issue here. We could color the
text color in the header, but now, this seems impossible (or I
do not understand how and where to set this).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01: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
01188905ae Mobile QML UI: Divelist hover/selected colors
This is subtle one. With the changing of the theme color, it
appeared that the hover and selected colors in the divelist
where wrong (as in, always blue-ish). This is easily solved
by setting the activeBackgroundColor to our theme color, and
Kirigami does the rest (tint and opaque settings for the
different states a selected dive can be in).

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
7b320fc859 Mobile QML: set fontsize for developer log
Just set the fontsize to something sane.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-11 21:17:57 +01:00
Jan Mulder
72f59d54cb Mobile cleanup: remove unused actions
Trivial removal of 2 unused Kirigami actions. These were leftovers
from the time we had a very different style of cloud account
management.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-08 21:29:47 +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
e4c8d6968f mobile: introduce simple private helper updateAllGlobalLists()
As we need to update our new stringlist models on multiple
locations, just refactor them into a new function.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01: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
Berthold Stoeger
8f81a22e7f Make report_error() reentrant
Remove the global error buffer and pass the error string directly
to the frontend. The frontend is then responsible for accumulating
errors.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31 14:47:26 +01:00
Berthold Stoeger
f8f14c5edb Use error callback to log errors in QMLManager
Instead of manually logging errors after each potentially
error-producing function, use the error-callback. The error texts
are accumulated in the QMLManager object for further use.

The text is transported to the QMLManager object via a queued
connection. Thus, errors can be reported from other threads
without having to deal with manual locking.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31 14:47:26 +01:00
Berthold Stoeger
a07b6b4d97 Remove function-call indirection in qmlmanager.cpp
QMLManager::tryRetrieveDataFromBackend() was a one-liner calling
void QMLManager::checkCredentialsAndExecute() with a pointer-to-member.
The latter was never called with a different pointer, therefore
fold the latter into the former and remove the indirection.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-25 08:39:20 +01:00
Berthold Stoeger
3d02edf61e Mobile: start message timer on startup
Since the timer will be started on first message anyway, we might
just start it at application startup.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 17:35:35 +02:00
Berthold Stoeger
84b96ac2ae Mobile: don't show timer twice in log-message
This was probably an oversight - the timer was only shown for very
specific messages. This was change to show the timer for all messages.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 17:35:35 +02:00
Berthold Stoeger
a116ff85f8 Remove redundant local variables cloudPwd and cloudUser
These were assigned the member variables QMLManager::m_cloudPassword
and QMLManager::m_cloudPassword. Use the member variables directly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 08:56:00 +01:00
Berthold Stoeger
ee17024ac5 Remove redundant QML getter functions
QMLManager was full of redundant getter functions of the type
bool QMLManager::locationServiceAvailable() const
{
       return m_locationServiceAvailable;
}
These can be removed changing READ keywords to MEMBER keywords
in the QPROPERTY declarations.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 08:56:00 +01:00
Berthold Stoeger
e85ecdd925 Introduce helper function empty_string()
There are ca. 50 constructs of the kind
  same_string(s, "")
to test for empty or null strings. Replace them by the new helper
function empty_string().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11 06:07:13 +01:00
Jan Mulder
6193aef9ac mobile: fix crash on delete dive from divelist
This is a somewhat hacky commit. For a very long time, the delete
from the divelist on mobile crashed. That is, not always for anyone,
but for me almost consistently. This commit tries to solve it.

I found that trying to save the delete immediately after removing
data from the underlying model seemed to cause the crash. Hacking
around, I found that a simple beginResetModel/endResetModel between
the delete of the underlying model data and actual save is
sufficient to solve the crash.

The big question is, why does this all work? I suspect some of race
condition between deleting model data, and giving the QML engine
the opportunity to do its thing.

This is also related to issue #311, but that is not implemented
here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 20:34:16 +01:00
Berthold Stoeger
099662023c Move resetting of current file out of clear_dive_file_data()
This is the only case where C-code sets the current file.
Remove this call for a better separation of C-backend and
C++-frontend parts.

There were four callers of clear_dive_file_data(). Two of them
would call set_filename() anyway. For the remaining two add an
explicit call to set_filename().

This commit fixes a bug introduced in commit b3901aa8f9:
The cloud-online menu entry was still enabled after "closing" the
cloud storage.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-08 12:01:04 +01:00
Berthold Stoeger
e5980942aa Remove redundant call to clear_dive_file_data()
In QMLManager::saveCloudCredentials(), clear_dive_file_data() was
called just before calling openLocalThenRemote(). The latter calls
the former anyway, so remove the former.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-07 13:02:12 +01:00
Jan Mulder
47bf5cf5e0 mobile: silence warnings in the app log
The new SHA mysteriously caused more than 300 extra warnings in the
app log. It was caused by a code change in Kirigami. The way to
suppress it is, in hindsight, after some hours of searching, trivial.
A Kirigami.BasicListItem shall have an icon defined. And as we do
not care about any icon here, just define it empty.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-03 14:04:08 +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
86860b941e Get ready for 2018
Copyright strings updated.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-30 08:23:22 -08:00
Dirk Hohndel
b4b8a9db4e Cleanup: avoid out of bounds access
sizeof() is clearly the wrong way to get to the size of that array...

Coverity CID 208297

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 15:57:45 -08:00
Dirk Hohndel
2c8614e43e Cleanup: check we have dive before dereferencing
Coverity CID: 208341

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 13:41:58 -08:00
Jan Mulder
ff3b107a9d mobile: close GPS menu drawer when selected
This is mainly a cosmetic improvement. The GPS menu stayed
visible, when selecting most of the options. This looks weird,
as the close of the menu is also an indication of the selected
action carried out. So, just close it

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-26 13:08:37 -08:00
Jan Mulder
5e116db1a1 CHANGELOG.md
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18 15:23:23 +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
Dirk Hohndel
648fec7a3d Cleanup: fix potential uninitialized use of uuid
And make sure we don't create a dive site for an empty location string.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17 09:12:44 -08:00
Jan Mulder
b59778abd8 mobile: use short date format in edit mode
See issue #949. In the dive list, dates are shown in short format, and
when we start to edit an existing dive, the date field on the edit
page is shown in sort format. However, when adding a new dive, the
initial date shows up in long (normal) format. This in not only
inconsistent, but also introduces the parsing problem, as described
in the mentioned issue.

This can be fixed by using short formatted dates in all cases in
the mobile app. As the screen real estate is precious on mobile,
this seems the most logical choice.

Fixed: #949

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-17 09:04:16 -08:00
Jan Mulder
b1d94b2470 mobile: manual add dive and cancel fails when repeated
This commit fixes a very subtle bug. Probably there for ages,
but never noticed. When manually adding a dive, and canceling
the add right away, the divetable was extended by 1 dive (using
the core function add_single_dive), but canceling never removed
that dive (using delete_single_dive). This is corrected here.

Notice that commit ef543da5af claims to fix issue #950.
With this commit, however, that issue can be seen sometimes
again.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-16 19:04:57 -08: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
62ef78b5e8 mobile: show message when going offline
Trivial fix. Show the message "Turning off automatic
sync to cloud ..." when turning automatic sync to offline. Just
a more logical moment to show this message. Also rephrase the
message "Enable auto sync" to "Auto sync enabled". It shows
a status, and not an action.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-14 17:01:51 +01:00
Berthold Stoeger
c21e998277 Don't create GeneralSettingsObjectWrapper object
Instead use the application-wide instance. Creating a local
object defeats the whole purpose of these objects - nobody
can receive signals in case the settings changed.

No other cases of locally created SettingsObjectWrapper
objects were found.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-14 17:01:34 +01:00
Jan Mulder
239974d600 mobile: reset download screen in a sane state
Set download srceen in a sane state after a previous download
session using this screen. The erroneous behavior was very
similar to the one fixed in commit 7fe9bbe295dcf92. For example,
download some dives, quit the screen, go back, and the bottom
buttons are still selectable.

This commit resets some values when leaving the download screen
(ie. not only swiping it away), so that it looks sane at a next
visit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 08:23:27 -08:00
Jan Mulder
59f86a06ad mobile: reset Retry button to Download
Reset the Retry button on exit of the Download from divecomputer
page. So, it it not reset wehen swiping this page away, or
cancelling a running download, but resetting it on accepting
downloaded dives.

As we do not have real error reporting (from download failures),
this all is a little arbitrary. Another "fix" could be, not
changing the button text at all.

Further notice, this is not specific iOS, but also Android.

Fixes: #895

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 08:23:27 -08:00
Jan Mulder
5707554e98 mobile: do not just create a new dive site
This fixes an annoying bug. When entering an existing divesite
in the mobile app, always a new divesite (with same name) was
created, resulting in multiple sites on the same gps location.

So, be more carefull in checking and creating a new site.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 05:05:49 -08:00
Berthold Stoeger
ea0cbba804 Remove second parameter (bool force) in set_filename()
The last force=false case was removed in commit 96d1cc570e.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-11 00:17:39 +01:00
Dirk Hohndel
4ccb70011c Cleanup: mark unused variable
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-08 16:29:49 +01: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
Robert C. Helling
1c223b09c3 Show BT device names first
Show them left of address (so they are in the user's view) rather
than on the right.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-07 18:15:40 +01:00
Robert C. Helling
4a9add167f Don't close menu after click
I consider it more natural for example for the GPS menu
to stay open when an action is clicked. So this turns off
the general close but has to trigger it on individual items.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-06 06:00:22 -08:00
Robert C. Helling
afd46a60f7 Add button to rescan BT devices
Otherwise the divecomputer has to be in pairing mode
at app start time.

Unfortunately, this leaves less space for the progress message.
My time/qml knowledge does not suffice to move that to the next line
(when moving that out of the RowLayout it overlaps with
the buttons).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-05 20:05:16 -08:00
Dirk Hohndel
0e789c6016 We no longer support Subsurface-mobile without BT support
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-05 19:29:59 -08:00
Murillo Bernardes
4dbbf1ff27 iOS: report location services availability
This enable use of current location on Add/Edit

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-05 08:57:18 -08:00
Robert C. Helling
89bd0cfdbd Unify capitalization
Sorry, this introduces a new string...

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-05 10:11:57 +01:00