aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.h
AgeCommit message (Collapse)Author
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
Having subsurface-core as a directory name really messes with autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an autocomplete conflict and also was inconsistent with the desktop-widget name for the directory containing the "other" UI. And while cleaning up the resulting change in the path name for include files, I decided to clean up those even more to make them consistent overall. This could have been handled in more commits, but since this requires a make clean before the build, it seemed more sensible to do it all in one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04QML UI: allow user to disable automatic cloud syncGravatar Dirk Hohndel
This is useful if you are in an area with slow or spotty network and if you are fine with just saving to the phone. In order to sync to the cloud you either have to manually sync via the menu or turn this back on and hide the application. The commit also removes the old refresh from the Manage dives menu as the semantic of that was possibly destructive now that we no longer immediately save changes to git - those could be thrown away by selecting refresh before the app had a chance to save them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04QML UI: don't immediately save data after we make changesGravatar Dirk Hohndel
Much as this felt like the prudent thing to do, it makes the UI painful to use. In bad network conditions, with a large dive log, on a phone, the save operation can take more than a minute - which is just completely ludicrous. So instead we mark the dive list changed when we make changes and wait for the app to not be in the foreground. Once the OS tells us that we are hidden (on the desktop that generally means we don't have focus, on a mobile device it usually does mean that the app is not on the screen), we check if there are data to be saved and do so. There is of course a major problem with this logic. If the user switches away from Subsurface-mobile but comes back fairly quickly (just reacting to a notification or briefly checking something, changing a song, something... then the app may still be non-responsive for quite a while. So we need to do something about the time it takes us to save the git tree locally, and then figure out if we can move at least some of the network traffic to another thread. And we need to make sure the user immediately notices that the app is not crashed but is actually saving their data. But that's for another commit. tl;dr: CAREFUL, don't kill Subsurface-mobile before it had time to save your data or your changes may be gone. In typical use that shouldn't be an issue, but it is something that we need to tell the user about. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04Make accessingCloud an integer so it can convey more informationGravatar Dirk Hohndel
This will be used to simulate a progress bar eventually. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-02QML UI: don't go through manager object to show mapGravatar Dirk Hohndel
We can open URLs in the browser directly from QML. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-02QML UI: don't go through manager object to open user manualGravatar Dirk Hohndel
We can open URLs in the browser directly from QML. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-26QML UI: allow writing to App log from QMLGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-24QML UI: remove the checkbox for remembering the passwordGravatar Dirk Hohndel
In the context of the mobile app this simply makes no sense. If the user doesn't select this option, the app doesn't really work. So why have the option in the first place? Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-13QML UI: show user manual in browser windowGravatar Dirk Hohndel
This is so obvious... and I know others asked for this before. Should definitely have been in the first version... Fixes #1026 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08QMLManager: helper function for devivePixelRatioGravatar Dirk Hohndel
This allows us to use the single manager object to keep track of the dpr of the screen and to pass it on if it changes (or when it first becomes known). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: new property to tell the UI that we are accessing cloud storageGravatar Dirk Hohndel
This can then be used to give the user visual feedback (instead of them just thinking the app is hung). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02Add helper functions to identify the position of a dive in the dive listGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29QML UI: implement undeleteGravatar Dirk Hohndel
This code is very similar to the undo code in the desktop UI, but untangling that from the desktop seemed massive overkill; we don't have lists of dives to delete and undelete here - so this is actually much simpler and easier to maintain (I hope). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-28QML UI: we no longer use the return value of commitChanges()Gravatar Dirk Hohndel
So make it a void function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-23Add helper to delete dive from QMLGravatar Dirk Hohndel
Once again we make this save the changes to the local cache without being prompted. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13QML UI: enable edit of gasmixGravatar Joakim Bygdell
First cylinder only, show warning if there are more than one cylinder defined. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-10Better tracking of the status of the credentialsGravatar Dirk Hohndel
There are several parts of the UI that will do better if they know if the credentials that we have are incomplete (e.g., no password), invalid (server rejected them), valid (server accepted them) or potentially valid (we found a local cache for the email address, so that's likely correct, but because we are offline we cannot (or have not yet) verify the passord). So far this is specific for the mobile UI - it might make sense to try and use the same backend code and status tracking for desktop and mobile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-10Support function to print version stringGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-09QML UI: enable edit of cylinder pressuresGravatar Joakim Bygdell
First cylinder only, show warning if there are more than one cylinder defined. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-09QML UI: load from cache first when changing cloud credentialsGravatar Dirk Hohndel
We need to execute the same sequence of steps both when starting the app and when switching cloud credentials. This way things will work correctly when the device is offline and the user wants to switch accounts. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-08Remember status of specific cloud account in settingsGravatar Dirk Hohndel
What matters is that the cloud storage for a specific email address has successfully been synced - and we need to remember this across restarts of the app. This way Subsurface-mobile can work with different accounts, even if offline. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-05QML UI: enable editing of weightGravatar Dirk Hohndel
But only if there is only one weight system defined in the dive. Otherwise display a read only text that explains that this cannot be edited. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-29Add helper to remove dive from modelGravatar Dirk Hohndel
I tried various things to do this from QML but it just doesn't seem to work at all. So I gave up and instead added a trivial helper function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27Move helper function to DiveObjectsHelperGravatar Joakim Bygdell
As per Tomaz recomendation the helper functions from 19588ce and e072596 are moved from qmlmanager to DiveObjectsHelper. [Dirk Hohndel: merged with the latest code] Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-26Correct usage of QString on qmlmanagerGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-26We already have a QNetworkAcessManager global, use itGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25QML UI: Add helper function to get weightsGravatar Joakim Bygdell
Helper function that retrieved the total weight for a dive to be displayed on the DiveDetials page. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25QML UI: Add helper function to get cylinder infoGravatar Joakim Bygdell
Helper function that retrieves the cylinder description to be displayed in the DiveDetails. Only the first cylinder for a dive is retrieved. Signed-off-by: Joakim Bygdell <j.bygdell@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: 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-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-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-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>
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-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-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-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-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: 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-11-18Location service: move into subsurface-coreGravatar Dirk Hohndel
While this is primarily something targeted at a mobile device, with many of the 2 in 1 devices it is possible that the user might be running the desktop version of Subsurface on a mobile device. As a first step to make it possible to collect GPS fixes on such a device we need to make the infrastructure to do so available in the desktop application as well. This still needs to be hooked up in the desktop UI. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18QML UI: remove manual setting of web service useridGravatar Dirk Hohndel
It's just not user friendly to have two different user IDs for two different web services that we provide. Instead in the following commits we'll add a way to retrieve the location service web service userid with your cloud storage user id. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-14Location service: make distance and time threshold configurableGravatar Dirk Hohndel
Right now the distance is always in meters, the mobile app doesn't deal with units at all, anyway. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-13QML UI: add preference for webservice user idGravatar Dirk Hohndel
This handles the user id for the Subsurface webservice for GPS location tracking. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>