Commit graph

87 commits

Author SHA1 Message Date
Dirk Hohndel
c59a74029b Android: write appLog to file
The trick is to pick a path that is accessible from other applications.
In theory QStandardPaths::GenericDataLocation should provide that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-09 17:40:29 -07:00
Dirk Hohndel
fd96daca6a QML UI: add progress message variable
To be shared between C/C++ and QML code in order to show the updates
and potential error messages from libdivecomputer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-09 15:07:44 -07:00
Dirk Hohndel
206df227f8 QML UI: remember the theme
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23 19:49:57 -07:00
Dirk Hohndel
57e365222b QML UI: color the status bar on Android
This code is based on code from Marco Martin from the Kirigami Android
sample app. In order to simplify the QML code the QMLManager function is
there for all OSs, but it's a no-op on anything but Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-23 08:42:45 -07:00
Dirk Hohndel
b2b51c833a QML UI: redesign the user notification
The old system of cloud access updates with fake percentages just wasn't
helpful. Even worse, it hid a lot important information from the user.
This should be more useful (but it will require that we localize the
messages sent from the git progress notifications and make them more
'user ready').

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-17 23:22:37 -07:00
Jan Mulder
5c1d67e0c1 code cleanup: one more unused include
See c7a3509800. A forgotten include is now removed as well.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-16 05:31:41 +09:00
Jan Mulder
a7288cc912 QML UI: do not crash on selecting dive computers
For reasons unknown to me, the DCDeviceData instance was freed way too early,
and used afterwards, obviously resulting in a SIGSEGV. This commit creates
the DCDeviceData as a direct child of the QMLManager instance, ensuring
it does not get freed prematurely.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12 09:49:05 -07:00
Dirk Hohndel
b14a522f4f QML UI: move BT handling into core code
This shouldn't be part of the UI (qmlmanager), but part of our
overall handling of dive computers and BT devices.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11 13:55:41 -07:00
Jan Mulder
dbd1d1f41a Android BT: generalize pairing data
This adds a list of paired BT devices to the QMLManager class. In addition,
a very simple implementation is made of getting the paired BT devices on
Linux, so that we can test further processing of selecting the proper
devices, in a mobile-on-desktop situation.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-02 11:31:00 -07:00
Jan Mulder
ed392694db Android BT: pull the pairing data from a device
As Qt is not able to pull the pairing data from a device, a lengthy
discovery process is needed to see what devices are paired. On
https://forum.qt.io/topic/46075/solved-bluetooth-list-paired-devices
user s.frings74 does, however, present a solution to this using JNI.
Currently, this code is taken "as is".

Currently, only for Android (so not mobile-on-desktop, or even desktop).
And only generating logging data in the logcat.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-01 16:53:29 -07:00
Jan Mulder
f5adbe5662 Use #if defined() instead of #if
qtcreator (4.3.0) got confused whether BT_SUPPORT was defined. Using
work as expected.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-01 07:28:18 -07:00
Dirk Hohndel
be271e7d48 QML UI: add getBtAddress function
This allows us to get the BT address of the first dive computer that we found.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-31 10:14:24 -07:00
Dirk Hohndel
18eff8f2b3 QML UI: detect BT dive computers
If we find something that looks like a known BT dive computer, set
things up so that we can use it later. If multiple dive computers are
found, simply use the first.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-29 15:08:28 -07:00
Dirk Hohndel
1ab6b50a34 QML UI: start BT discovery
So far all this does is list all the BT devices that it finds
(and I worry if this will have negative battery implications
on a mobile device), but this should allow us to connect to
a standard BT dive computer (but that will of course require
more code to pick the right device).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-29 12:00:27 -07:00
Tomaz Canabrava
0e4c996f51 QML UI: Fill the product list
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 11:07:19 -07:00
Dirk Hohndel
8525805f04 Add SPDX header to mobile widgets and QML files
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Dirk Hohndel
6a50efd80a QML UI: create completion list for cylinders as well
We already have that for the other three fields where we offer auto
completion (buddy, divemaster, suit).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-14 17:32:45 -07:00
Dirk Hohndel
01d091fbd5 QML UI: better handling of device pixel ratio
In order to make sure we don't render the initial profiles with the
wrong scale on devices, we need to seed the device pixel ratio with the
device default and then update it once the window has been created.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-04 11:00:18 -07:00
Joakim Bygdell
674d8331f5 QML UI: Enable cylinder edit
This adds the option to select a cylinder when adding or editing a dive.
Due to limited screen size we restrict the editing to the first cylinder only.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-04 07:36:13 -07:00
Dirk Hohndel
5fa965df54 QML UI: prepare to enter the cloud PIN on mobile UI
This just creates the properties to connect QML and C++ code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-13 16:41:26 -07:00
Joakim Bygdell
80274b0968 Add init function to qmlmanager
In order to get autocomplete to work on manual dive add
we apparently need a separate init function.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-21 06:59:38 -07:00
Dirk Hohndel
ba9288fab6 QML UI: when first entering cloud credentials, force cloud connection
With offline the default now, we need to force a connection at least once
so that the repos are in sync. And then of course we need to return to the
correct state, regardless on whether this connection succeeded or failed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 11:08:33 -07:00
Dirk Hohndel
4ad73fb807 QML UI: when switching from no cloud to cloud usage, don't drop local data
This is rather simplistic, it just imports the local data into the remote
repository and therefore loses the git history of the local data - but I
wasn't able to make the git merge without shared base commit work, so I
went this much easier to implement route instead.

One thing we need to be careful about is that contacting the remote server
could fail. If we don't manage to merge the dives from cloud server and
local storage, we need to revery to no cloud status in order not to lose
the local data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 14:36:00 -07:00
Dirk Hohndel
4b1edceca0 Add helper function for the consumption of loaded dive data
This allows us to call that part of the process from multiple places
in the future.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
27fccbbe4e QML UI: when chosing 'no cloud', switch to dive list
Currently we don't remember that we picked 'no cloud' across restarts.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-22 11:59:16 -07:00
Dirk Hohndel
1819cc1ccc QML UI: make the state of the GPS service available to QML
This exposes a locationServiceAvailable property to QML and keeps it in
sync with the corresponding state in the GpsLocation widget.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-17 22:59:19 -07:00
Dirk Hohndel
ecf44bb2fa QML UI: quit on back key while showing dive list
Make sure you save first, though.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-15 14:42:08 -07:00
Dirk Hohndel
71d74f9e3c QML UI: rewrite the commitChanges function
I couldn't figure out how to break this down into small, useful commits.
Part of the problem is that I kept going while working on this and as you
can see from looking at the commit, diff tries so hard to find small code
fragments that moved around, that the diff overall becomes quite
unreadable and it seemed impossible to recreate the sequence of steps
after the fact.

It all started with adding the parsing for the GPS coordinates. But while
testing that code I found several issues with the rest of the function.
Most importantly it seemed ridiculous that we carefully tried to match the
texts that the DiveObjectHelper would create for the various fields,
instead of just using the DiveObjectHelper to do just that. And once I had
converted that I once again realized just how long and hard to understand
that function was getting and decided to break out some of the more
complex parts into their own helper functions.

But of course all this didn't happen in this logical, structured, ordered
way. Instead I did all of these things at the same time, testing,
rearranging, etc.

So in the end I went with one BIG commit that does all of this in one fell
swoop.

This adds four helper functions to deal with start time/date, duration,
location and gps coordinates, and depth of the dive.

To avoid mistakes when dealing with the GPS coordinates, there's another
helper to encapsulate the creation of the dive site and we switched to a
current GPS location.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-15 13:22:16 -07:00
Dirk Hohndel
6e6cce770b QML UI: keep QML manager and the UI in sync about selected dive
The manager can now directly update the index of the selected dive, and
the UI tells the manager the timestamp of the currently selected dive.
This allows the manager to pick the best possible dive as selected dive
if things change (for example if the dive list gets reloaded because it
changed in cloud storage).

Fixes #1009

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:43:33 -07:00
Dirk Hohndel
5909e438c9 Make it easy to access the sort model from the QML manager
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:43:33 -07:00
Dirk Hohndel
9a2e3ce7e8 Remove unused function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-13 09:28:55 -07:00
Robert Helling
7bca367c57 Upon undoing a dive deletion select that dive
Before it had the next dive still selected.

Fixes #1053

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-11 12:41:41 -07:00
Dirk Hohndel
18b7ee3875 QML UI: try to do the right thing for changes on all platforms
On Android we can save locally right away, but we don't want to make the user
wait for a network sync. Sadly, on Android currently the saving in the
background doesn't work and the save will run when the user comes back.
Definitely not ideal.

On iOS the situation is different - a save to the local git cache takes
surprisingly long. Must be the shitty file system they use or something.
Because of that we only mark the dive list changed and instead save the next
time the app is not in the foreground (which works on iOS but not on Android -
go figure).

On all the other OSs (I guess that would be desktop builds of
Subsurface-mobile? But there may be other mobile OSs that people might want to
build it on) we save both locally and to the cloud right away.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-10 19:22:16 -07:00
Dirk Hohndel
4ed369b975 QML UI: only force network access when user asks us to
So when the user taps on the manual cloud sync, we always force access to
the cloud server. Otherwise we only access the cloud server if
git_local_only isn't set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-08 12:37:17 -07:00
Dirk Hohndel
9f7e509f9a QML UI: break the sync into explicit save local and save cloud
This makes the code much cleaner and easier to understand and should allow
us to then switch back to doing at least the local save right after we make
any changes to the data.

This commit also tries to make sure that the accessingCloud status stays
correct and consistent throughout all the various success and error paths.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-06 11:47:12 -07:00
Dirk Hohndel
6a23e0ef66 QML UI: save with unchanged credentials returns to dive list
If the user is on the credentials page, doesn't change the credentials
but simply taps on save, they now get back to the dive list.

Fixes #1047

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-06 11:42:38 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
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-04 22:33:58 -07:00
Renamed from qt-mobile/qmlmanager.h (Browse further)