Commit graph

50 commits

Author SHA1 Message Date
Dirk Hohndel
1f0b716021 QML UI: new property to tell the UI that we are accessing cloud storage
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-02 17:13:42 -08:00
Dirk Hohndel
3b37844708 Add helper functions to identify the position of a dive in the dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 04:46:26 -08:00
Dirk Hohndel
abab031ed2 QML UI: implement undelete
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-29 15:42:33 -08:00
Dirk Hohndel
10af45d6dc QML UI: we no longer use the return value of commitChanges()
So make it a void function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-28 15:45:26 +01:00
Dirk Hohndel
2772ab8764 Add helper to delete dive from QML
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-23 14:07:49 +01:00
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
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
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
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
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
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
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
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
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
19e95efd6f Random whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 06:14:45 -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
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
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
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
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
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
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
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
Dirk Hohndel
fd78f8dc1a QML-UI: re-architect the way we access network resources
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-04 19:51:35 -08:00
Dirk Hohndel
2fc99092fb QML-UI: replace the two ways to log progress with one
The logging to the UI didn't work anymore since the message area had been
removed in commit 8646934ba3 ("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-03 16:01:17 -08:00
Dirk Hohndel
a0b83dc2f1 QML UI: different functions for saving Preferences and Cloud Credentials
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-03 14:30:30 -08:00
Dirk Hohndel
f17041e1cb QML-UI: refuse to save to cloud unless you loaded from cloud, first
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-02 18:49:02 -08:00
Dirk Hohndel
456cc3955a Location service: move into subsurface-core
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-18 18:34:49 -08:00
Dirk Hohndel
18e52c1da4 QML UI: remove manual setting of web service userid
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-18 13:12:34 -08:00
Dirk Hohndel
76d0763527 Location service: make distance and time threshold configurable
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-14 09:10:06 -08:00
Dirk Hohndel
d65b756c4f QML UI: add preference for webservice user id
This handles the user id for the Subsurface webservice for GPS location
tracking.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-13 17:15:28 -08:00
Dirk Hohndel
4b39971978 Location service: apply the saved GPS fixes to dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 20:23:00 -08:00
Dirk Hohndel
cd7d6ae6e5 Location service: toggle the service from the main menu
That way we don't track the user's location until explicitly asked to do
so.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-11 15:28:10 -08:00
Dirk Hohndel
e7b2f04bec Location service: consistent way to output information
qDebug is nice when testing on the desktop, but it has to go to the
message area on an Android device to make things easy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-11 12:38:11 -08:00
Grace Karanja
ee13c5c282 QML UI: Add QML Log viewer
Add the ability to preview the application log in QML.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:49:09 -07:00
Grace Karanja
8d03d26480 QML UI: Start Add Dive feature
Start working on the add dive feature, to enable the user add a
new dive using the mobile UI.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:14 -07:00
Grace Karanja
ea11eff279 QML UI: Implement saving of cloud password
If the user ticks the 'Save Password' box, then we save the password
for future use.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-22 09:53:19 +03:00
Grace Karanja
df1a1f7034 QML UI: Implement saving of dives
This implements saving of some dive details to the cloud service. When the
user closes an open dives, any changed details will be cached, and when they
click on the 'Save Changes' button is pressed, the changes will be saved to
the cloud.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-17 19:12:39 +03:00
Grace Karanja
866d67c5e7 QML UI: Load dives from cloud
Load dives from the Subsurface cloud service using the user's saved
credentials. This will display the dives in the same way as loading
them from a local file.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-10 06:03:56 -07:00
Grace Karanja
5791f580df QML UI: add cloud credential fields to the QMLManager class
These fields will be used by the QML Ui to save/retrieve the user's
cloud credentials.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-10 06:03:20 -07:00
Grace Karanja
59be048549 Add QMLManager class
Add a QMLManager class. This class will be used as a link between
the C++ and QML aspects of the mobile application.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:19:42 -07:00