aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.h
AgeCommit message (Collapse)Author
2018-09-11cleanup[4/6], mobile: remove superfluous code from gpslocationGravatar Jan Mulder
Despite the fast that this code is sitting in core, its used mainly from mobile. In 987e221f8e6b7b, the buttons to interact with the GPS webservice were deleted from the UI. Now, delete all the code that was used under these buttons. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-08-11Mobile: fix saving new diveGravatar Jocke
With the new setup we need to know which state we are coming from when we are saving cylinder related info. When we are adding a new dive we explicitly should save cylinder data to the first cylinder. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11Mobile: save pressuresGravatar Jocke
Save start and end pressures for used cylinders. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11Mobile: save gasmixesGravatar Jocke
Same as for cylinder info, we need to make sure that the gasmixes gets saved to the correct cylinder. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11Mobile: save edited cylindersGravatar Jocke
Save the edited cylinder in the correct slot. Since the cylinder number and the used cylinder number need not be the same we first need to test if the cylinder are used. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11QML UI: add callback to run after app is fully initializedGravatar Dirk Hohndel
And then use that to check for pending Intents on Android. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11Android: notify the UI a dive computer was plugged inGravatar Dirk Hohndel
And try to guess which one from the device string we get from the Intent. The function is named to indicate its future use (because once the user plugs in such a device, we should show the download page). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11QML UI: add property to pass detected device name to UIGravatar Dirk Hohndel
If the user plugs in a device on Android we get a device string that should allow us to figure out which dive computer was plugged in. Make that string available to the QML UI. Right now all we do is log it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-27QML UI: remove unused propertyGravatar Dirk Hohndel
We always save the libdivecomputer log. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20QML UI: remove unused propertyGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-15mobile: move settings from qmlmanager to qmlprefsGravatar jan Iversen
add settings variables/functions to qmlprefs remove settings variables/functions from qmlmanager change manager. to prefs. in qml files for setting variables/functions Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-15mobile: move NOCLOUD_LOCALSTORAGE from qmlmanager.cpp to .hGravatar jan Iversen
Make NOCLOUD_LOCALSTORAGE public for other qml functions Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09mobile: add DCDeviceData properties to qmlmanagerGravatar jan Iversen
add DCDeviceData qml properties etc. to qmlmanager Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-04Cleanup: fold core/helpers.h into core/qthelper.hGravatar Berthold Stoeger
helpers.h included qthelper.h and all functions declared in helpers.h were defined in qthelper.h. Therefore fold the former into the latter, since the split seems completely arbitrary. While doing so, change the return-type of get_dc_nichname from "const QString" to "QString". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-26Cleanup: remove reply and request member variables in QMLManagerGravatar Berthold Stoeger
The reply member variable was used to access the reply in the handleSslErrors, handleError and retrieveUserid slots. This is a very scary proposition in the light of multi-threading. Instead, the reply can be accessed by using the QObject::sender() function. Thus, we can remove the member variable. The request member was just downright weird. This was only used locally to describe a network request. Since QNetworkAccessManager::get() copies the request, it can be destructed right away. Nevertheless, the data was kept as a subobject. Remove member and make it function-local. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-21mobile: removed setting for libdivecomputer.logGravatar jan Iversen
Users need a simple way to report download problems. Asking them to go into settings, activate logging, and repeat the download is too much. libdivecomputer.log will always be generated, but overwritten, with every download, so the latest log is ready. The download is very slow due to BT, so there are no impact of having the log active, neither in terms of size (a concern on small mobiles) or write time. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-18mobile: add "Copy log to clipboard" buttonGravatar jan Iversen
on iOS it is practically impossible to copy the App log to e.g. a mail! in iOS 11 the log file is stored within the subsurface container and you first need to copy (actually using the clipboard) out from there to the "normal" document shared space, before it can be used. At least iOS users (and I believe Android users) are not really used to work with files, so the process is not easy to document in an understandable way. The alternative is to provide a button, which simply puts the log on the general clipboard, allowing it to be pasted in a multitud of applications. Signed-off-by: Jan Iversen <jani@apache.org>
2018-04-14QML UI: if we don't have a current position, update it laterGravatar Dirk Hohndel
Once we get a new fix we asynchronously update the text. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-13iOS: log messagesGravatar Dirk Hohndel
So far we only wrote messages to subsurface.log on Android (since we couldn't figure out how to make that file user accessible on iOS). Now that that's fixed, we also need to actually write to the file in the first place. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-13iOS: always create subsurface.log fileGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-12Mobile: pass QString as value to registerError()Gravatar Berthold Stoeger
registerError() may be called from a different thread context. Passing the message as a const-reference may lead to a dangling reference. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31mobile: introduce simple private helper updateAllGlobalLists()Gravatar Jan Mulder
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-31mobile cleanup: restyle construction of locationlistGravatar Jan Mulder
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-31mobile cleanup: unduplicate code and do not loop over dives (3)Gravatar Jan Mulder
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-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-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-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>
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-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-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-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-07Make compile succeed without BT_SUPPORTGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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-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-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-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-12QML UI: make BT state available to QMLGravatar 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: 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-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-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>