Commit graph

119 commits

Author SHA1 Message Date
Joakim Bygdell
ae116c5bc8 QML UI: enable edit of gasmix
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-13 10:04:05 -08:00
Joakim Bygdell
6252d0cd3b While parsing weight and pressure we should not change the users settings.
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-13 10:03:50 -08:00
Dirk Hohndel
692719f230 QML UI: when saving edits, really only save them locally
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-12 22:14:17 -08:00
Dirk Hohndel
e5e5ab7480 QML UI: don't even try to connect if email or password are empty
This way the user gets better messages on the screen.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 22:06:38 -08:00
Dirk Hohndel
1f5cf4b42d QML UI: more progress update on start page
Again, to help track down where things hang.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-12 12:17:47 -08:00
Dirk Hohndel
093c5fa5ff QML UI: more progress information on the start page
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-12 06:54:52 -08:00
Dirk Hohndel
f925711185 QML UI: clear up more data when changing credentials
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-11 22:46:35 -08:00
Dirk Hohndel
5e3b2741ac Invalidate the remembered git SHA when changing credentials
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-10 21:24:10 -08:00
Dirk Hohndel
9d131807d7 Reset the authentication cache when trying new credentials
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-10 21:08:20 -08:00
Dirk Hohndel
e26e50f2e4 Better tracking of the status of the credentials
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-10 21:00:43 -08:00
Dirk Hohndel
b7e353b7f6 QML UI: more accurate messages on the start page
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-10 21:00:21 -08:00
Miika Turkia
3bdaf00546 Support function to print version string
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-10 15:16:09 -08:00
Joakim Bygdell
8566523b43 QML UI: dive edit, treat numeric input of duration as full minutes
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-09 13:05:21 -08:00
Joakim Bygdell
8c9883cfcf QML UI: enable edit of cylinder pressures
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-09 12:11:09 -08:00
Dirk Hohndel
87f62dfaa8 QML UI: load from cache first when changing cloud credentials
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-09 07:53:22 -08:00
Dirk Hohndel
10ca667403 Sync load from cloud status when changing cloud storage accounts
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-08 11:14:11 -08:00
Dirk Hohndel
801ce01585 Always sync with cloud server when updating backend data
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-08 11:12:43 -08:00
Dirk Hohndel
c1b3de6190 Remember status of specific cloud account in settings
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-08 11:10:21 -08:00
Dirk Hohndel
6d8d956853 QML UI: make time parsing more lenient
White space between numbers and units should be ignored.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-06 12:07:42 -08:00
Dirk Hohndel
a4ec520601 QML UI: enable editing of weight
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-02-05 22:54:47 -08:00
Dirk Hohndel
9f7ecbb53e Add helper to remove dive from model
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-29 07:50:38 -08:00
Dirk Hohndel
66b08f53f2 QML UI: make manually added dives more like those added on desktop
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-28 22:09:40 -08:00
Dirk Hohndel
106bb07cff QML UI: clear out empty strings from the UI
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-28 14:07:27 -08:00
Dirk Hohndel
bda0b01216 QML UI: avoid clearing and rebuilding the dive list model
This causes all profiles to be rendered which is a massive performance
concern.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27 15:11:37 -08:00
Dirk Hohndel
e895374e4b QML UI: fix Qt's broken handling of two digit years in dates
Because dives in 1912 are unlikely to be added to my dive log...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27 15:07:10 -08:00
Joakim Bygdell
9342dedb26 Move helper function to DiveObjectsHelper
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-27 11:18:44 -08:00
Dirk Hohndel
4abe73ff2a QML UI: on edit only request location if user checks the box
The code inexplicably always checked for a gps location. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27 10:16:25 -08:00
Dirk Hohndel
a74175324a QML UI: fix precision of total weight displayed
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27 10:16:25 -08:00
Tomaz Canabrava
1773f5e447 Correct usage of QString on qmlmanager
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-26 09:51:45 -08:00
Tomaz Canabrava
6575a0b4b8 We already have a QNetworkAcessManager global, use it
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-26 09:51:38 -08:00
Joakim Bygdell
5afda93b71 QML UI: If a dive has multiple cylinders show "Multiple" in the details page
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-25 12:55:04 -08:00
Joakim Bygdell
e0725966b1 QML UI: Add helper function to get weights
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-25 11:14:33 -08:00
Joakim Bygdell
19588ce139 QML UI: Add helper function to get cylinder info
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-25 11:14:30 -08:00
Dirk Hohndel
60e0a6e833 QML UI: fix bugs in change detection on dive edit
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>
2016-01-20 13:56:28 -08:00
Miika Turkia
a329d44de0 If set imperial units explicitly on mobile app
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-20 08:48:23 -08:00
Dirk Hohndel
19e95efd6f Random whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 06:14:45 -08:00
Dirk Hohndel
82b2b709bc QML UI: Store the dive duration in dive and (fake) divecomputer
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-10 22:08:42 -08:00
Dirk Hohndel
0d9892645c QML UI: only store the new date/time if they are valid
Otherwise we are overwriting valid data with midnight, Jan 1, 1970.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 22:07:58 -08:00
Dirk Hohndel
a27d78af03 Save a dive has to mean "save to local storage" on mobile
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-10 21:40:03 -08:00
Dirk Hohndel
60d5463311 Remember in settings if we ever synced with the cloud
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-10 21:38:44 -08:00
Dirk Hohndel
4f10f7f7ae QML UI: refresh divelist after GPS data was successfully applied
And create a helper to do so to make the code simpler.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 20:44:22 -08:00
Dirk Hohndel
b1f90b6aa0 QML UI: partial, slow and incomplete implementation of delete GPS fix
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-08 23:18:41 -08:00
Tomaz Canabrava
89eed5d36e Untangle Library Linkage
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-08 08:04:04 -08:00
Jan Mulder
78eacb6a0c mobile: allow save when local store is actual
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-07 22:32:24 -08:00
Dirk Hohndel
624e44e73d QML UI: clean up notes field after edit
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-07 22:30:58 -08:00
Dirk Hohndel
b6ae6979e5 QML UI: show the available GPS fixes
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-07 21:41:52 -08:00
Dirk Hohndel
2b1ffb3cc4 QML UI: trigger download of GPS fixes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 21:41:52 -08:00
Dirk Hohndel
5860913e41 QML UI: use the same units that Subsurface used when saving the data
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-06 21:58:02 -08:00
Dirk Hohndel
9a28807dd3 Make sure that members are initialied
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-06 16:58:46 -08:00
Dirk Hohndel
4db5e840bf QML UI: refresh the dive list after edit
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-05 22:59:29 -08:00