summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
AgeCommit message (Collapse)Author
2018-01-31mobile cleanup: unduplicate code and do not loop over dives (2)Gravatar Jan Mulder
See e6e1473e6. Exact same commit but here for the list of buddies. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31mobile cleanup: unduplicate code and do not loop over dives (1)Gravatar Jan Mulder
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-31Make report_error() reentrantGravatar Berthold Stoeger
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-31Use error callback to log errors in QMLManagerGravatar Berthold Stoeger
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-25Remove function-call indirection in qmlmanager.cppGravatar Berthold Stoeger
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-18Mobile: start message timer on startupGravatar Berthold Stoeger
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-18Mobile: don't show timer twice in log-messageGravatar Berthold Stoeger
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-18Remove redundant local variables cloudPwd and cloudUserGravatar Berthold Stoeger
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-18Remove redundant QML getter functionsGravatar Berthold Stoeger
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-11Introduce helper function empty_string()Gravatar Berthold Stoeger
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-10mobile: fix crash on delete dive from divelistGravatar Jan Mulder
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-08Move resetting of current file out of clear_dive_file_data()Gravatar Berthold Stoeger
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 b3901aa8f90499ee2a34efdddc2463105afc53f1: 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-07Remove redundant call to clear_dive_file_data()Gravatar Berthold Stoeger
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-03mobile: silence warnings in the app logGravatar Jan Mulder
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-03mobile: newer Kirigami SHAGravatar Jan Mulder
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
2017-12-30Get ready for 2018Gravatar Jan Mulder
Copyright strings updated. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-26Cleanup: avoid out of bounds accessGravatar Dirk Hohndel
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-26Cleanup: check we have dive before dereferencingGravatar Dirk Hohndel
Coverity CID: 208341 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26mobile: close GPS menu drawer when selectedGravatar Jan Mulder
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-18CHANGELOG.mdGravatar Jan Mulder
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18mobile: exit edit mode when navigating away from edit pageGravatar Jan Mulder
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-17Cleanup: fix potential uninitialized use of uuidGravatar Dirk Hohndel
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-17mobile: use short date format in edit modeGravatar Jan Mulder
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-16mobile: manual add dive and cancel fails when repeatedGravatar Jan Mulder
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 ef543da5aff296e 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-15mobile: clear internal data when edit/add dive is finishedGravatar Jan Mulder
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-14mobile: show message when going offlineGravatar Jan Mulder
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-14Don't create GeneralSettingsObjectWrapper objectGravatar Berthold Stoeger
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-13mobile: reset download screen in a sane stateGravatar Jan Mulder
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-13mobile: reset Retry button to DownloadGravatar Jan Mulder
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-13mobile: do not just create a new dive siteGravatar Jan Mulder
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-11Remove second parameter (bool force) in set_filename()Gravatar Berthold Stoeger
The last force=false case was removed in commit 96d1cc570e31396039e4970d2bf75d5f00f1e550. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-08Cleanup: mark unused variableGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-07Mobile: Enable editing multiple buddiesGravatar Joakim Bygdell
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-07Show BT device names firstGravatar Robert C. Helling
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-06Don't close menu after clickGravatar Robert C. Helling
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-05Add button to rescan BT devicesGravatar Robert C. Helling
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-05We no longer support Subsurface-mobile without BT supportGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-05iOS: report location services availabilityGravatar Murillo Bernardes
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-05Unify capitalizationGravatar Robert C. Helling
Sorry, this introduces a new string... Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-03Fix argument to set_filename() in QMLManager::finishSetup()Gravatar Berthold Stoeger
The second argument to set_filename() is a boolean, but was given an empty string. Since an empty string evaluates to true, directly pass true for clarity. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-03iOS: Display GPS menuGravatar Murillo Bernardes
Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2017-12-02iOS: check for UUID instead of physical addressGravatar Murillo Bernardes
on iOS the address we display on Connection is an UUID, not a physical address. This change the pattern (on iOS) used to enable bluetooth_mode. Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2017-11-27QML UI: add versions of key libraries to the logGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-25mobile: get GPS data from dive site nameGravatar Jan Mulder
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-25mobile: autocomplete location namesGravatar Jan Mulder
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-19QML UI: QtQuick.Layouts to 1.2Gravatar Jan Mulder
And again, no visual changes. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19QML UI: QtQuick.Controls to version 2.2Gravatar Jan Mulder
Tested fine without visual changes. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19QML UI: QtQuick to 2.6Gravatar Jan Mulder
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-19QML UI: Kirigami to 2.2Gravatar Jan Mulder
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-18Constify strings in pref.hGravatar Berthold Stoeger
Make all char * pointers in pref.h const to make it clear that these strings are not mutable. This meant adding a number of (void *) casts in calls to free(). Apart from being the right thing to do, this commit makes the code more consistent, as many of the strings in pref.h were already const. While touching core/qthelper.cpp turn three instances of (void*) into (void *). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>