aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
AgeCommit message (Collapse)Author
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>
2017-06-23QML UI: color the status bar on AndroidGravatar Dirk Hohndel
This code is based on code from Marco Martin from the Kirigami Android sample app. In order to simplify the QML code the QMLManager function is there for all OSs, but it's a no-op on anything but Android. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-18Clean up git storage update messagesGravatar Dirk Hohndel
Translate all of them, but also remove some redundant or possibly misleading messages. These are now seen by users, not just developers trying to debug the code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-17QML UI: show debug output in the App LogGravatar Dirk Hohndel
We have unified the debug output to the console and to the App Log, let's use it consistently everywhere. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-17QML UI: redesign the user notificationGravatar Dirk Hohndel
The old system of cloud access updates with fake percentages just wasn't helpful. Even worse, it hid a lot important information from the user. This should be more useful (but it will require that we localize the messages sent from the git progress notifications and make them more 'user ready'). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12Android BT: fix compile bugGravatar Jan Mulder
One Andorid JNI include was missing. And removed the unused ones from QMLManager. [Dirk Hohndel: I had added the missing include elsewhere, so this commit now only has the removal of the unused includes] Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12QML UI: do not crash on selecting dive computersGravatar Jan Mulder
For reasons unknown to me, the DCDeviceData instance was freed way too early, and used afterwards, obviously resulting in a SIGSEGV. This commit creates the DCDeviceData as a direct child of the QMLManager instance, ensuring it does not get freed prematurely. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11QML UI: move BT handling into core codeGravatar Dirk Hohndel
This shouldn't be part of the UI (qmlmanager), but part of our overall handling of dive computers and BT devices. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11QML UI: adjust to modified logging APIGravatar Dirk Hohndel
appendTextToLog prepends the elapsed time which can be useful, so let's not remove that but instead have it log to qDebug() instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-02Silence compiler warningsGravatar Jan Mulder
Silence some compiler warnings about implicit double to int conversions. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-02Android BT: generalize pairing dataGravatar Jan Mulder
This adds a list of paired BT devices to the QMLManager class. In addition, a very simple implementation is made of getting the paired BT devices on Linux, so that we can test further processing of selecting the proper devices, in a mobile-on-desktop situation. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-01Android BT: do not force BT onGravatar Jan Mulder
It is very impolite to force BT on at start of the mobile app. We cannot know if the user is going to import dives over BT. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-01Android BT: pull the pairing data from a deviceGravatar Jan Mulder
As Qt is not able to pull the pairing data from a device, a lengthy discovery process is needed to see what devices are paired. On https://forum.qt.io/topic/46075/solved-bluetooth-list-paired-devices user s.frings74 does, however, present a solution to this using JNI. Currently, this code is taken "as is". Currently, only for Android (so not mobile-on-desktop, or even desktop). And only generating logging data in the logcat. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-01Use #if defined() instead of #ifGravatar Jan Mulder
qtcreator (4.3.0) got confused whether BT_SUPPORT was defined. Using work as expected. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-05-31QML UI: try to also detect OSTC BT dive computersGravatar Dirk Hohndel
The naming scheme of OSTC dive computers doesn't match their product names, but they all behave the same from a download perspective, so we assume that any BT device that has a name starting with OSTC is an OSTC 3. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-31Android: connect to BT via uuid instead of portGravatar Dirk Hohndel
We remember the offered service uuids as we detect the device and then try the first one - likely this needs to be fixed / tuned to pick the right one if multiple uuids are offered. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-31QML UI: add getBtAddress functionGravatar Dirk Hohndel
This allows us to get the BT address of the first dive computer that we found. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-29QML UI: detect BT dive computersGravatar Dirk Hohndel
If we find something that looks like a known BT dive computer, set things up so that we can use it later. If multiple dive computers are found, simply use the first. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-29QML UI: try to match BT names to known dive computersGravatar Dirk Hohndel
So far this just adds data to the log. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>