aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
AgeCommit message (Collapse)Author
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-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-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-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-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>
2017-10-17mobile: fix initial setup with no repo or meta infoGravatar Jan Mulder
First, obviously, I could have squashed this small commit into the previous one, but I explicly decided not to. It shows the fragility of all this credential processing code, and the complex flow control troughout the code. Testing on a brand new install, and immediately going for a no cloud setup, the PIN screen was shown, instead of an empty divelist. Looking at this small code change shows why. In case of a no cloud situation, there is no PIN to verify (or email and passwd rules checked). So just do not force us there. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-17mobile: No cloud repo creation more explicitGravatar Jan Mulder
Before this change, there was only one way to create the local no cloud repo on the device. The user needed to add at least one dive to the no cloud account (so that there is something to save). While this worked in some scenarios, it could also get things in an inconsistent state: credential status = CS_NOCLOUD but no local repo. This was a dead end. In this commit, the creation of the no cloud repo is made more explicit. When asking for no cloud mode, just create an (empty) repo for it when it does not yet exist, and otherwise, just open the existing (possibly empty) repo. Now, a user can have no cloud repo, next to (any number of) cloud accounts. This leaves one functional aspect left: how does a user abandon the no cloud repo, by merging his data into a true cloud account. This is code for this, that tries to do this merge in a smart way. This seems to be broken (too). To be clear: this is no part of this commit. Fixes: #667 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-16Fix stupid syntax errorsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-15Make sure we can still build without BT_SUPPORTGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-12mobile: enable switching BT on/off during session.Gravatar Jan Mulder
This commit implements possible switching BT on and off during a session, so not needing a restart of the app when the user forgot to switch it on when starting the app. For this, the following needed to be done: 1) create a handler that reacts on local BT device status changes. 2) repopulate the connection list in the download screen when a BT status change is detected. Notice the subtile change of the Q_INVOKABLE btEnabled() function to a Q_PROPERTY. This gives a nice dynamic behaviour when switching BT on/off with the app open. Fixes: #556 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-09Use lrint() for all degrees_t related roundingGravatar Lubomir I. Ivanov
In certain places the '(int)' cast is used, while in other the llrint() or lrint() functions. Make the conversation from degrees in the 'double' form to the 'int' degrees_t consistent using lrint(). lrint() is the function which should give the best results, because it accepts a 'double' and results in a 'long' even if degrees_t is 'int'. If the truncation from 'long' to 'int' is discarding some of the precision then the next step would be to turn degrees_t into a 64bit signed integer type. Possible fix for #625. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-08mobile: do not clear email and passwd when cancellingGravatar Jan Mulder
Commit cf8e87545f1e2bf implemented a way to cancel pin setup, and this also has effects on an exit from the app after pressing the android exit. The change button started with clearing the email and passwd in order to get the credentail page(s) active again. While this worked ok, it confuses users that exit the app from the credential pages, resulting in the need to enter the credentials again after a restart. It appears that clearing the credential state is sufficient to get the pages active. Notice that the android exit is still not working (it seems a no-op), but the interaction with the buttons in the app preserves the email/passwd. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-08mobile: only set old credential status in one placeGravatar Jan Mulder
The old credential status should only be set when changing the actual credential status using the setCredentialStatus function. Setting it here is just wrong. It sets the old status to the current, and than adds the current to the prefences, obviously, resulting in old = current, which can not be right and results in a wrong flow of control in the credential state processing. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29QML UI: rework single credential page to two pagesGravatar Jan Mulder
This commit tries to implement most of issue #515. It reworks the one credential page, which its dynamic PIN part, into two pages. Main driver of selecting one of the two pages is the showPin boolean. Page 1 contains the email/passwd field (and the option to use a no cloud setup). Page 2 only contains the PIN part (and the option to cancel the process). The Kirigami central button does not seem very handy here. We need, for example, a cancel, sign-in and register, only register, etc. buttons, which are not easy to handle in specific icons. Therefore, normal pushbuttons are chosen to deal with user interaction, and the Kirigami button is removed from these pages. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29mobile: make sure that the old credential status is correctGravatar Jan Mulder
This commit is just a precaution. It makes sure that the old (aka previous) credential status is correctly set on all changes of this status. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29mobile: only deal with localrepo in NOCLOUD modeGravatar Jan Mulder
This is a very subtile bug. Testing/developing on the desktop for mobile, with a normal logbook in a git repo, resulted in a surprising effect. When swichting from a cloud account to a NOCLOUD situation, the no cloud repo was (not always) reset to the NOCLOUD_LOCALSTORAGE, but to the normal logbook. Resuling in commits in the wrong repo. This can easily be solved by setting the filename to NOCLOUD_LOCALSTORAGE, when switching to NOCLOUD mode. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29mobile: do not care about email/passwd when NOCLOUDGravatar Jan Mulder
In case the credential state is NOCLOUD, the saving of credentials in the preferences was suppressed in case of invalid data in the email/passwd fields. There is no reason to check these fields for correct input, as they are not used in case of NOCLOUD mode. A simple if statement is added. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29mobile: add helper function cancelCredentialsPinSetup()Gravatar Jan Mulder
As written in 8d9ad3cfea7e4c0875, the user needs to be able to exit the PIN entry UI, in case no PIN can be received due to a wrong email address. The simplest way seems to just clear the cloud credential data, and let the user try again. Obviously, we could argue if the exact previous state of the 1st credentials screen could be restored, but as it is only 2 simple fields, of which it is higly likely that the email adress is misspelled (and the password hidden), it seems overly complex to implement. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29mobile: propagate "still PIN required status"Gravatar Jan Mulder
Makes sure that the CS_NEED_TO_VERIFY status is carried forward and sets the showPin flag that triggers the 2 different states in de QML UI. The new credential UI will have one page for username/passwd, used for setting up an account or switchting to a different account, and a second page to enter a PIN only. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29mobile: do not go to NO_CLOUD status from UNKNOWNGravatar Jan Mulder
In case the credential status is UNKNOWN, and the cloud username and password are empty, do not go automatically to NO_CLOUD status. This is (again) preparation for future work on credential management. For example, the user entered an email address with a spelling error, so does not receive a PIN code email. This user needs a way out, so there needs to be a <cancel> button on the PIN code screen. And the most logic was of cancelling is emptying the entered username/passwd and let the user try again. Without this change, the user immediately gets into the (somewhat) final NO_CLOUD state, which will result in (very) confused users. With this change, there is exacly one way (left) to get into a NO_CLOUD setup: hitting the proper button, so a deliberate user action. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29mobile: initialize credential data in one placeGravatar Jan Mulder
It appears that the onCompleted of the StartPage item is triggered before the onCompleted of the rootItem. This is logical as the Startpage is a child of the rootItem. And, yes, this does matter. As the divelist also contains the logic for initial cloud registration (and is the default page shown in a state where the cloud credentials are valid (CS_VERIFIED state)), we need to know the correct credential state at start of the app. The move of this one line of code makes sure of that, in addition to setting the credential state from the preferences. Now, the setupActions function can reference correct credential data. This is further preparation for a better cloud creation process from mobile. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04Unify credential statesGravatar Jan Mulder
Having two different enums around with more or less the same definition has lead to unclear code. After removing two not needed states on the mobile end, the remaining step to one enum for the credential state becomes almost is simple rename operation. Unfortunately, I do not know a way to embed a plain C enum from pref.h into the QMLManager object. So after this, there are still 2 enums around, but now identical. This commit is not changing any functionality. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04mobile: remove superfluous state INCOMPLETEGravatar Jan Mulder
And here, the removal of a second superfluous state from QMLManager. This is true no-brainer. While this state was set once troughout the entire mobile code, it was never tested for this state. Testing shows that it is safe to change to the UNKNOWN state. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04mobile: remove superfluous state VALID_EMAILGravatar Jan Mulder
This is a no-brainer removal of the VALID_EMAIL state used in QMLManager. All current usage of this state is "if state is VALID or VALID_EMAIL", so there is no distinction between the two states. It is even a little different. The comment suggests "when we can open a local cloud storage, tied to a cloud account (so explicitly not the no-cloud status), we have at least a valid email". While this is formally true, this implies that there is also a cloud account on the cloud server (ie. the cloud account is in a VERIFIED state). In other words: currently, there can't exist a valid local storage that is tied to a valid email adress, without valid cloud account on the server. Notice that this touches the discussion on GitHub for commit e76f527fe530636 (pull request #520). Can we implement the creation of a valid cloud account without data link to the cloud server? Currently, we need the server to confirm the email address (for example for uniqueness reasons on server side). Obviously, we could hack our way out of this, but we have a perfect solution already in place. Create a no-cloud account, and transfer that later to a true and valid cloud account. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04mobile: go to the correct credential stateGravatar Jan Mulder
When we want to go the NOCLOUD credential state, do not go the incorrect INCOMPLETE state. This is the first in a series of unraveling the preference parameter prefs.cloud_verification_status and the data that is carried around in the QMLManager::credentialStatus_t. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-08-02QML UI: enable modification of ratingsGravatar Joakim Bygdell
This enables editing of visibility and ratings for a dive. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-31mobile: make sure old credentialStatus is definedGravatar Jan Mulder
In commit e76f527fe53063, the scenario of switching between 2 already VERIFIED cloud accounts was identified, which was working poorly. It needed a restart of the app to get the new account visible. Reason for this, was the setting of the credentialStatus to the value of an undefined (never set) old credentialStatus. This commit makes sure we have a defined credentialStatus, just before changing it to the new one. A really mini step forward, as the behavior is still not perfect. Now, the user has to select the dive list manually, after entering credentials of the new clould account. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-29Trivial log string correctionGravatar Jan Mulder
The PIN (and cloud account creation) is not limited to the desktop (any more). Correct the string accordingly. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-25Mobile: honour location service time thresholdGravatar Jan Mulder
Independ of the settings, the threshold to reset the GPS data was hard coded to 5 minutes. Now, honour the entered (and updated during a session) time to refresh the GPS data in the location service. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-25Error message on mobile cloud credentialsGravatar Miika Turkia
Display proper error message when cloud credentials are incorrect. See #481 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-23QML UI: move location services to GPS menuGravatar Joakim Bygdell
Move the location services switch to the GPS menu, indicate both with icon and text if the service is active or not. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23QML UI: add checkbox to show/hide developer menuGravatar Joakim Bygdell
Add a checkbox to the preferences page to facilitate selective visibility of the developer menu. With the coresponding function in qmlmanager. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-19QML UI: Allow cancel of ongoing downloadGravatar Jan Mulder
This commit adds the capability to cancel a running download from DC. The actual cancel is fully handled in the underlying libdivecomputer code. As the user may be interested in the dives downloaded up to the moment of cancel, do not just close the download screen (as it was before this commit). Now, the <quit> button changes to <cancel> when the download is started, and pressing cancel, only cancels the download and does not close the download screen, but presents the so far downloaded data. When no download is running, the <quit> button just quits the screen as before. Fixes: #485 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-19Android: truncate logfile and add dateGravatar Jan Mulder
Trucate the logfile on open to remove any data from previous sessions. This confused me very much, as the new logfile started from the top, leaving old data on the bottom. Also added system date for easy reference. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-15Fix compile errorsGravatar Dirk Hohndel
This was fixed in my local tree but I forgot to amend the commit before pushing it out. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-14QML UI: enforce rules for cloud credentialsGravatar Dirk Hohndel
Email addresses are checked for a someone useful pattern, passwords are letters, numbers, and +-_. only. Reject anything else. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-12QML UI: make BT state available to QMLGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-09QML UI: actually write libdc logfileGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-09QML UI: add variable for libdc logfileGravatar Dirk Hohndel
It seemed cleanest and easiest to have this in the QMLManager and not in the DCDownload object. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-09Android: write appLog to fileGravatar Dirk Hohndel
The trick is to pick a path that is accessible from other applications. In theory QStandardPaths::GenericDataLocation should provide that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-09QML UI: show progress messages on the download pageGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-09QML UI: add progress message variableGravatar Dirk Hohndel
To be shared between C/C++ and QML code in order to show the updates and potential error messages from libdivecomputer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-09QML UI: add dev_info data to AppLogGravatar Dirk Hohndel
This should make it easier to tell how far we get downloading data from dive computers. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-06QML UI: start BT discovery a tiny bit laterGravatar Dirk Hohndel
This way the AppLog starts with the name and version of Subsurface-mobile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23QML UI: remember the themeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>