aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.cpp
AgeCommit message (Collapse)Author
2016-03-05Introduce separate version number for Subsurface-mobileGravatar Dirk Hohndel
This is hard coded in version.cmake for now. The intent is to go to 1.0 in the first release version and to increment from there whenever we create an update. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03QML UI: show notification for saving dives to cloud as wellGravatar Dirk Hohndel
Fixes #1014 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03QML UI: ensure that cloud notification is always clearedGravatar Dirk Hohndel
All error cases need to reset it as well. And it's easier to reset it right after we come back from parse_file() instead of trying to track all the exit cases after that. 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-02QML UI: update profile when editing duration of manually added diveGravatar Dirk Hohndel
We need to make sure that a new fake DC is created after the duration was changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: update the correct dive in the model when committing a changeGravatar Dirk Hohndel
When manually adding a dive and moving it in the dive list (by editing it's start time) we could create a situation where the dive list internally was correct, but the dive list model on screen showed an incorrect dive list with the new dive in two different spots. 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-20QML UI: further validation in the C++ codeGravatar Dirk Hohndel
Don't allow negative depth or depth beyond 500m. Additional checks that the gas mix is possible (even thought QML code SHOULD only allow valid combinations). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20Add option to allocate the samples in fake_dc()Gravatar Dirk Hohndel
We (ab)use fake_dc() to create a pleasing profile for a manually added dive. Based on it's intended use, fake_dc() simply handed back a dc structure that pointed at staticly allocated samples - that's obviously (now that I think about it) going to blow up in my face if I edit a manually added dive more than once. So now we have an option for fake_dc() to actually allocate the samples - this way the rest of the code can treat these samples as we would treat samples created any other way. We can free them and replace them with a new set. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20After freeing the samples, clear the pointerGravatar Dirk Hohndel
Otherwise we might end up trying to free them a second time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20QML UI: fix recreation of profile after dive editGravatar Dirk Hohndel
We only need to deal with this if the dive changed. And in that case, if we calculate a new fake DC, we need to clear out the meandepth as otherwise the algorithm will try to match both max and mean depth. Since the user potentially changed the max depth that could have very odd consequences. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-15QML UI: no longer change unit preferences when parsing editsGravatar Dirk Hohndel
When the user explicitly sets the units when editing or adding dives, we used to change the display preferences. This was changed for some but not all fields in commit 6252d0cd3bda ("While parsing weight and pressure we should not change the users settings") Now we do this consistently for all inputs. Also, when editing the depth of a manually added dive, we now throw away the samples (as those are certain to be inconsistent). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14Remove debug outputGravatar Dirk Hohndel
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-13While parsing weight and pressure we should not change the users settings.Gravatar Joakim Bygdell
Now it is possible to enter a specific unit that is different from the unit stored in the preferences. If only numbers are inputed the unit will be the same as specified by the users preferences. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12QML UI: when saving edits, really only save them locallyGravatar Dirk Hohndel
This should have been obvious. Without explicitly asking for only local git activity, it will connect to the remote. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12QML UI: don't even try to connect if email or password are emptyGravatar Dirk Hohndel
This way the user gets better messages on the screen. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12QML UI: more progress update on start pageGravatar Dirk Hohndel
Again, to help track down where things hang. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12QML UI: more progress information on the start pageGravatar Dirk Hohndel
Since some users report hangs when changing credentials it would be useful to see how far the application got. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-11QML UI: clear up more data when changing credentialsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-10Invalidate the remembered git SHA when changing credentialsGravatar Dirk Hohndel
Otherwise, when switching back and forth between two logins, during the second switch the dive list is not loaded as the code checks against the remembered git SHA before rewriting the dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-10Reset the authentication cache when trying new credentialsGravatar Dirk Hohndel
Otherwise Qt attempts to be smart and re-uses previously successful username (email) and password. This is an odd corner case, but it seems the right thing to do. 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-10QML UI: more accurate messages on the start pageGravatar Dirk Hohndel
Now the text shown better reflects what's going on, especially when the credentials are invalid. 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: dive edit, treat numeric input of duration as full minutesGravatar Joakim Bygdell
When editing the duration of a dive, if only numbers are entered they are treated as full miuntes. Signed-off-by: Joakim Bygdell <j.bygdell@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-08Sync load from cloud status when changing cloud storage accountsGravatar Dirk Hohndel
Since this variable is specific to the cloud credentials in use, we need to reset it when we change credentials. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-08Always sync with cloud server when updating backend dataGravatar Dirk Hohndel
It makes no sense to only do this the very first time we connect to a cloud storage account. The existing code only happened to work because we incorrectly tried to maintain the loadFromCloud status across restarts of the application. So one bug hid another bug. 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-06QML UI: make time parsing more lenientGravatar Dirk Hohndel
White space between numbers and units should be ignored. 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-28QML UI: make manually added dives more like those added on desktopGravatar Dirk Hohndel
By giving them a fake profile we can actually edit the dive profile in the desktop app. Fixes #998 Fixes #1000 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-28QML UI: clear out empty strings from the UIGravatar Dirk Hohndel
Right now the UI shows "--" as place filler for empty data. That may or may not change - but while it's there, we should not store that string in the corresponding string fields of the dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27QML UI: avoid clearing and rebuilding the dive list modelGravatar Dirk Hohndel
This causes all profiles to be rendered which is a massive performance concern. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27QML UI: fix Qt's broken handling of two digit years in datesGravatar Dirk Hohndel
Because dives in 1912 are unlikely to be added to my dive log... 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-27QML UI: on edit only request location if user checks the boxGravatar Dirk Hohndel
The code inexplicably always checked for a gps location. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27QML UI: fix precision of total weight displayedGravatar Dirk Hohndel
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: If a dive has multiple cylinders show "Multiple" in the details pageGravatar Joakim Bygdell
Since we are short on space on the mobile version, lets just show "Multiple" if a dive has multiple cylinders. 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 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-20QML UI: fix bugs in change detection on dive editGravatar Dirk Hohndel
We were comparing apples to oranges on a few items and therefore more or less always assumed that a dive had been modified. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>