Commit graph

98 commits

Author SHA1 Message Date
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
Dirk Hohndel
e774c8077b QML UI: allow edit of dive date and time
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-05 22:53:32 -08:00
Dirk Hohndel
3bfa8de2f7 Cloud storage: fix potential crash when avoiding reloading dive list
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-04 17:55:37 -08:00
Miika Turkia
9cebcb836f Give the user more information on cloud credentials
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-04 10:00:44 -08:00
Dirk Hohndel
e856f816f2 QML UI: use better Google maps link
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-01 22:24:05 -08:00
Dirk Hohndel
fa338a26b8 QML UI: add feature to add current position when editing dive
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-01 17:26:26 -08:00
Dirk Hohndel
a0aa27e864 QML UI: handle editing of depth
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-01 00:55:34 -08:00
Dirk Hohndel
2c28b16b26 QML UI: handle editing of duration
I don't think these regular expressions are sufficiently exhaustive - but this
is forward progress.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01 00:55:25 -08:00
Dirk Hohndel
da5d904d34 QML UI: process air and water temp when edited
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-31 18:16:46 -08:00
Dirk Hohndel
f3065230a3 QML UI: add information about build time / run time Qt version
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-29 17:29:46 -08:00
Dirk Hohndel
bbcc6fb3c2 QML UI: if remote is same as local cache, don't load / process remote
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-27 10:06:33 -08:00
Dirk Hohndel
739d7d74e7 QML UI: load from cache before trying to sync with the cloud server
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-27 10:06:33 -08:00
Dirk Hohndel
99a5a743c4 QML UI: change the way we extract input data from dive edit
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-26 22:57:47 -08:00
Dirk Hohndel
0962b504ce QML UI: get add dive closer to being useful
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-26 21:37:18 -08:00
Dirk Hohndel
dce3869339 QML UI: don't crash when committing changes and unable to find the dive
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-26 21:24:29 -08:00
Dirk Hohndel
ce2b910cdb Two more helper functions for the QML manager
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-26 20:02:23 -08:00
Dirk Hohndel
bf239e7c42 QML-UI: add hacky, useless way to show the GPS location of a dive
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-26 13:33:11 -08:00
Dirk Hohndel
a639332edf QML-UI: log the full version at start
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-20 08:02:05 -08:00
Dirk Hohndel
c3ebeadb34 QML-UI: allow toggling verbose mode from the UI
Hidden in the Developer menu.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-19 18:41:50 -08:00
Dirk Hohndel
41c59c1c8d QML-UI: more log message when retrieving web user id
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-19 16:20:20 -08:00
Dirk Hohndel
b9cd6bf38e QML-UI: actually show the right text for missing cloud credentials
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-19 16:08:10 -08:00
Dirk Hohndel
a26eda9700 QML UI: show better message about dive list at start
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-15 13:33:53 -08:00