aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.cpp
AgeCommit message (Collapse)Author
2016-01-20If set imperial units explicitly on mobile appGravatar Miika Turkia
If unit_system is set to imperial, we need to set the units explicitly on mobile application. Fixes #993 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11Random whitespace cleanupGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10QML UI: Store the dive duration in dive and (fake) divecomputerGravatar Dirk Hohndel
This is needed so that our heuristics for fixing up dives don't mess up the data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10QML UI: only store the new date/time if they are validGravatar Dirk Hohndel
Otherwise we are overwriting valid data with midnight, Jan 1, 1970. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10Save a dive has to mean "save to local storage" on mobileGravatar Dirk Hohndel
While it makes sense to have the concept of "what's in memory" and "what's on disk" in a desktop application, on a mobile device that seems like the wrong approach. If the user edits a dive and taps on "save", they reasonably expect this to be saved to storage (so our local cache of the remote git repository). And "Upload to cloud" then pushes the data to the cloud server. It may even be reasonable to do that automagically, but that I'm not so sure about. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10Remember in settings if we ever synced with the cloudGravatar Dirk Hohndel
Otherwise, if the device is offline we would not be able to store changes in the local cache, completely defeating the purpose. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10QML UI: refresh divelist after GPS data was successfully appliedGravatar Dirk Hohndel
And create a helper to do so to make the code simpler. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08QML UI: partial, slow and incomplete implementation of delete GPS fixGravatar Dirk Hohndel
This only deletes the fix on the mobile device, not on the server. And it is really really slow. Re-reading the data from the settings just isn't a smart way to do this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08Untangle Library LinkageGravatar Tomaz Canabrava
with the adittion of gpslistmodel/location, the libraries qt-models had a direct dependency on subsurface-core, and subsurface-core had a direct dependency on qt-models, this is bad. Moving a bit of code around I'v managed to clean this out, and also to clear a bit of uneeded code (GpsTracker and gpsTracker where basically the same thing.) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07mobile: allow save when local store is actualGravatar Jan Mulder
When starting ssrf-mobile, and the local divelist is identical to the cloud version (so same sha1), a save of local modifications to the cloud should be possible. This fix enables this by pretending that a suppressed load from cloud on start is still a valid load from cloud. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07QML UI: clean up notes field after editGravatar Dirk Hohndel
We don't want any of the rich text markup to sneak into our fields. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07QML UI: show the available GPS fixesGravatar Dirk Hohndel
So far the user can't interact with these. We should implement an ability to visualize the GPS fix and to delete it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07QML UI: trigger download of GPS fixesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-06QML UI: use the same units that Subsurface used when saving the dataGravatar Dirk Hohndel
We already keep those units around so the backend HTML exporter can match them. So it makes perfect sense to also apply them in the mobile app. Fixes #987 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-06Make sure that members are initialiedGravatar Dirk Hohndel
A couple of members could potentially have been used uninitialized - it's possible that this was the cause for people overwriting data in cloud storage with empty dive lists. See #985 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-05QML UI: refresh the dive list after editGravatar Dirk Hohndel
This fixes two issues. In general, after edits the dive list wasn't updated so it showed data inconsistent with what the dive details showed (clearly bogus). Even more annoyingly, when we change the date or time of a dive it could obviously move around in the dive list. So we need to resort the dive table and recreate the dive list. For really long dive lists this is possibly overkill, but in my testing this seemed very quick and much easier than trying to manually get this right, even in the case where the list wasn't resorted. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-05QML UI: allow edit of dive date and timeGravatar Dirk Hohndel
This is a bit more complicated because we are asking the user to edit the text field instead of giving them a date and time picker. This is not a great choice, but let's run with it for now. One downside is that the user is likely going to edit the date "Oct 29" -> "Oct 25" without adjusting the day of the week. And if we then try to parse that Qt correctly complains about an invalid date. So we hack around this by removing the day of the week from both the format and the date entered (which of course now will break things if the user did, in fact, adjust the day of the week). As I said, not a great solution. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04Cloud storage: fix potential crash when avoiding reloading dive listGravatar Dirk Hohndel
If we loaded the dive list from cache and then try to figure out if the remote repository had anything different, we were being super stupid if the SHA was identical... we had already cleared the dive list by the time we decided that we didn't need to load things. Granted, the model was still populated (oops), but the backend data structure was cleared and accesses to it (e.g., when drawing the profile) would cause things to crash. The helper function duplicates some code, but trying to not duplicate the code made things even harder to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04Give the user more information on cloud credentialsGravatar Miika Turkia
This gives the user a bit more information about the progress of setting the cloud credentials. IMO, especially the information that the credentials are invalid is crucial for the user experience. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01QML UI: use better Google maps linkGravatar Dirk Hohndel
This still isn't the user experience that I want, but at least now it's not a static map image anymore but an interactive map. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01QML UI: add feature to add current position when editing diveGravatar Dirk Hohndel
This isn't quite perfect yet. If it takes too long to get the GPS fix (i.e., if you save it before you get the fix), this will simply fail and not store a position. But in normal conditions (you check the box, you edit the data, you save), especially when outside on a dive boat, this should work fine. For the other cases we need to implement some kind of callback to still collect the data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01QML UI: handle editing of depthGravatar Dirk Hohndel
Getting closer to being able to really edit / add dives in the mobile UI. This works for manually added dives - needs a bit more thought for dives downloaded from dive computers as we don't necessarily want to change the maxdepth in conflict with the samples. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01QML UI: handle editing of durationGravatar Dirk Hohndel
I don't think these regular expressions are sufficiently exhaustive - but this is forward progress. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-31QML UI: process air and water temp when editedGravatar Dirk Hohndel
This is a little hacky as it changes the units based on user input - a little crude but works in the typical cases. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-29QML UI: add information about build time / run time Qt versionGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-27QML UI: if remote is same as local cache, don't load / process remoteGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-27QML UI: load from cache before trying to sync with the cloud serverGravatar Dirk Hohndel
This is a simple way to deal with a "no network" situation. But this isn't ideal, yet, if there is a slow network as the dive list will be reset again once the sync from the cloud finishes. So there is some more thought needed to make this work "mostly as expected". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26QML UI: change the way we extract input data from dive editGravatar Dirk Hohndel
Instead of doing the silly "onEditingFinished" we get the strings from the QML components at the time we commit the change. Much more logical, much more straight forward, no issues with the TextArea not having an onEditingFinished signal. This still has a few open todos: the temperatures aren't parsed, the edit screen is missing depth and duration, we can't edit the dive time (and it isn't passed in on the commit). But it's progress. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26QML UI: get add dive closer to being usefulGravatar Dirk Hohndel
Now we at least start out with the corret date, time and number. This still isn't functional as a lot of the data aren't used and the way you save the data is completely silly, but it's another step in the right direction. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26QML UI: don't crash when committing changes and unable to find the diveGravatar Dirk Hohndel
This mainly happens because add dive is completely broken right now, but in general it seems to be good policy not to blindly dereference this pointer... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26Two more helper functions for the QML managerGravatar Dirk Hohndel
I'm not sure this is the best way to do this - QML should be able to get to the model data directly (I hope?). But this seems to work and I need it to make Add Dive be semi-correct. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26QML-UI: add hacky, useless way to show the GPS location of a diveGravatar Dirk Hohndel
This is of course stupid and NOT what we want to do, but one could argue it's better than nothing (well, not sure, whatever). If we have a GPS location associated with a dive and you tap on the location name when showing the dive details, it opens a static image of a satellite map with a marker for the dive site. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-20QML-UI: log the full version at startGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-19QML-UI: allow toggling verbose mode from the UIGravatar Dirk Hohndel
Hidden in the Developer menu. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-19QML-UI: more log message when retrieving web user idGravatar Dirk Hohndel
At least one tester cannot retrieve their web user id. This should help us collect more data and figure out why this fails. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-19QML-UI: actually show the right text for missing cloud credentialsGravatar Dirk Hohndel
If we have no credentials or invalid credentials, update the text on the start page accordingly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-15QML UI: show better message about dive list at startGravatar Dirk Hohndel
Now the message should make more sense. First it tells you that it's looking for dives. Then you get some progress during the git download, and error messages if things failed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-07QML-UI: make dive edit almost sort of workGravatar Dirk Hohndel
So this has a lot of caveats: - right now it only works for buddy, divemaster and suit - you have to actually exit the field with your cursor or the change doesn't take - that's ridiculous, there must be a far more clever way to do this - because I use the onEditingFinished handler I can't do this for the Notes (so here's another reason why I KNOW that this is the wrong way to do this) But it shows in principle how this could be done and once someone who actually knows what they are doing gets their hands on the code I'm optimistic that this can be morphed into something much more useful. It does tie together the changes made in the previous commits so that both clicking around on the dive list gives the expected results and synching the data back to the cloud actually works. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-07QML-UI: that's not how you compare char pointers...Gravatar Dirk Hohndel
Well, at least it doesn't what you think it does. Let's use our little helper to actually compare the strings. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-04QML-UI correct cut and paste errorGravatar Dirk Hohndel
Stupidly the wrong functions were connected to the signals. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-04QML-UI: re-architect the way we access network resourcesGravatar Dirk Hohndel
We really need to verify that the credentials are valid before trying to access our backend resources. Trying to do so in a clean manner caused quite a bit of changes to how we retrieve the webservice userid and how we load the dive list from cloud storage. So instead of accessing the network resources directly, this adds a handler function that first checks the validity of the credentials (by using the rederict handler on the cloud server), and only calls the function that does the actual work (looks up the web service userid, loads the dives) if that succeeds. Right now there is no good user feedback mechanism - this just gets logged on the log page. But this is a massive improvement if there are issues with network connectivity or if the user mistyped their credentials. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03QML-UI: replace the two ways to log progress with oneGravatar Dirk Hohndel
The logging to the UI didn't work anymore since the message area had been removed in commit 8646934ba351 ("Simple DiveList as initial Page"). This way all the updates simply land on the Log page. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03QML-UI: open cloud storage once credentials were enteredGravatar Dirk Hohndel
This makes for a much more friendly first use experience: Open Subsurface-mobile, enter your cloud credentials, tap on Save and you see your dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03QML UI: different functions for saving Preferences and Cloud CredentialsGravatar Dirk Hohndel
Tapping Save on those two pages should only update the data that are actually available on those pages. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-02QML-UI: refuse to save to cloud unless you loaded from cloud, firstGravatar Dirk Hohndel
This prevents people from overwriting a perfectly fine repository with an empty one. Typically happens when you first enter your cloud credentials and then don't Load Dives right away. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-02QML UI: if load fails, don't continue processing dataGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-01QML-UI: make sure errors make it to the logGravatar Dirk Hohndel
get_error_message() clears the error message in the process, so calling it twice in a row does not do what you might think it does. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-01QML UI: add number of loaded dives to logGravatar Dirk Hohndel
This way we can see if loading dives succeeded at all. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-30QML UI: don't load dives before the UI has been instantiatedGravatar Dirk Hohndel
This should deal with a big part of the delay when starting the app. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-30Clear the Dive model before repopulating itGravatar Dirk Hohndel
Otherwise we could get duplicate dives in the dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>