Commit graph

620 commits

Author SHA1 Message Date
Jan Mulder
a95e658946 Mobile: factor out syncToCloud [3/3]
After the previous commits, we now have a preference that nicely
preserves the state of the UI, and we have the well known git_local_only
global, that is used to denote whether we want to use to local repo
only, or we want to interact with the online cloud as well.

This commit gets rid of the now superfluous syncToCloud logic. Instead
we simply set the git_local_only directly.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09 10:03:21 -07:00
Jan Mulder
87b8155576 Mobile: preserve auto download status [2/3]
Hook up the new preference to the UI. So now, an earlier choice
if automatic or manual download to the cloud is preserved in
between sessions. Strictly speaking this fixes issue 1725.

Notice that there is also a higly related syncToCloud thing
present. As factoring out that seemingly duplicate piece
of code is non-trivial, this will be done in a seperate
commit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09 10:03:21 -07:00
Jan Mulder
26234d326f Mobile: no switch to auto cloud in no-cloud mode
We disabled the drawer menu button to switch between auto/manual
sync when in no cloud mode. Unfortunately, disabeling does not
give a visual cue to the user (like greyed out). Instead, just
make this button invisable in no cloud mode.

In conjunction a question. The manual sync to cloud menu item
takes you to the Cloud Credetials page in case pressed in
no cloud mode. While valid, this seems strange. This is not
changed in this commit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09 10:03:21 -07:00
Jan Mulder
68fdc0b6f4 QML UI: set proper active background color for downloaded dives
And another simple one. Make the active background of the
dowloaded dives follow the theme.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
3c18618bfb QML UI, trivial: set proper background color GPS list
The background color was plain white, where we use a slightly different
color in other places.  In addition, the background when clicking on a row
did not follow the theme setting. Consistency fix.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
a8f45406bd QML UI, consistency: add text attribute for all actions
Something I only see on mobile-on-desktop, so at this point in time
not very relevant to the device apps. When hovering on the action
button, a toast message shows a hint box. These where empty in some
cases. So, just give the actions a text attribute where it was
missing.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
684e3eec6b QML UI, cleanup: remove usesless Item
Trivial cleanup. A QML Item is intendend for visual items, so embedding
a timer in it is plain useless.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
42eae7e48b Mobile: simpify startup logic
When starting the mobile app, I noticed a short display of an empty
page with title "Cloud creditials" just before showing the
divelist. Simply a not nice visual effect.

This commit simplifies some logic and resolves this. As the code
in this part is fragile, this is tested for normal and clean
startup of the app, switching credentials, from no cloud to
valid account (which even nicely imports the no cloud dives:
this surprised me as I have never seen this working).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-02 22:27:19 +02:00
Jocke
b29f6ef2c0 Mobile: remove all related data when forgetting DCs
We need to delete all related data when forgetting dive computers or we will
have an issue if we connect a DC from the same vendor but of a different model.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-02 18:40:47 +02:00
Jocke
c504c08097 Mobile download from DC: improve selection logic
Improve the logic when auto selecting a DC for download.
Some USB cables only supply vendor information  but we can select the correct
model if we have downloaded from it before.
For BT/BLE our discovery process adds the device name to the address, so we need to keep that in mind when we try to match against what we seen before.
When we have a positive match for a DC we have seen before we deactivate the
corresponding button of our saved DCs.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-01 06:32:41 -07:00
Jan Mulder
9b199602c6 Mobile QML UI: bump Kirigami imports to 2.4
Primarily for reasens of keeping up with upstream. And hopefully
bugfixes and added functionality.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:29:46 -07:00
Jan Mulder
e321d1563e QML UI: clip divedetails Listview
A technically trival commit, but one with long story. This commit
basically reverts dd1d90b529 (1.5 year ago). While upgrading
Kirigami after Kirigami commit 26b8bdea24c39, we suddenly have
overlapping divelist and details pages in case they are both
on the pageStack (this occurrs when navigating from divedetails
to the divelist using breadcrumb navigation). At this point, its
not clear (to me) if this the by design of Kirigami, or an unintended
effect of the mentioned Kirigami commit.

This all said. Simply clipping resolves our issue of overlapping
pages, and it does not harm.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:29:46 -07:00
Jan Mulder
bec029c766 QML UI: trivial resize of datebox
Something that I simply overlooked earlier with respect to scaling the
divelist. The trip databox did scale a bit, but it was not nicely
related to the hight of the trip header. So there was a tiny
overflow on the small scale on a small device. Fixed here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:28:18 -07:00
Jan Mulder
c6a4250a58 QML UI: correct trip separator line
Partially cosmetic and partially a bug fix. 1) the seperator line
between trips and dives that are not in a trip was drawn in the
background color => the line was invisible. 2) When looking very
closely, there was a 1-2 pixel wide error between the seperator line
between trips and dives that are not in a trip. 3) there was a comment
that the trip separator needed to be extra thick. IMHO, this
looks ugly, and is superfluous as there is a nice sidebar along
the dives that belong to the trip. Finally, the line shall not
be displayed when not in a trip.

So, basically, the line (the QML rectangle) is completely rewritten,
to take care of all issues. There is 1 hack: the line color is
taken from the dive separator line. But its fully unclear to me
where that color is defined in Qt/QML or Kirigami, so I hardcoded
the proper color. That just works.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30 08:16:52 -07:00
Jan Mulder
40a65a2e6b QML UI: center delete from divelist button
A small cosmetic change. The delete from divelist button was "glued"
to the top of the line. Not nice, so just center it vertically, and
make the button a tiny bit smaller, so that it fits nicely on the line.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30 08:16:52 -07:00
Jan Mulder
751286e4e7 QML UI, cleanup: no reason for 2 overlapping mouseareas
Fully usure why the code was as it was. The trip header had 2
overlapping mouse areas, to expand the trip and vise versa. Simply
remove the smallest one.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30 08:16:52 -07:00
Jan Mulder
bce952615c QML UI, cleanup: do not use iconSizes for unrelated sizing
A very unimportant change, but found when looking through the code
for places where size of icons where used. The one changed here
has nothing to do with icon related placement of a string, so
its replaced by a way more logical placement of the affected string.

Simply center the "no dives in the dive list" for an empty logbook
on the screen, instead of at some random place in the upper left
corner. Like I said: very unimportant, but it just looks nicer
in the UI.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30 08:16:52 -07:00
Jan Mulder
0ad7df9859 mobile, QML UI: Settings page scalability
A relatively big change for such a simple page. Most relevant
changes are:

1) Do not use Kirigami.Header anymore. It appears that this header
has word wrapping on (and we cannot override that). This is
annoying on this page, as headings seems randomly be split over
2 lines, even in cases where there is more than enhough room to
display it on one line. And as the Kirigami.Header is just a
trivial wrapper of a Text field, we can simple replace it.

2) A lot of the toplevel GridLayouts had width properties set. These
are not needed (and confused my debugging code), so they are removed
withput any visual change. As a general rule, do not try to set
properties that are not needed. In general, it can only lead to
binding loops or undefined behavior.

3) Add a font size to our Theme. The step from regular to title size
was a little too big.

4) And, obviously, numerous font.pointSize lines are added to actually
resize the font.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-27 06:36:22 -07:00
Jan Mulder
441e06cdb8 mobile, QML UI: whitespace in dive details page
There was a strange big margin at the top of the the dive details
page. Just make it a bit more "normal".

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Jan Mulder
97031da0d8 mobile, QML UI: margings and paddings in download screen
There was a significant of not needed whitespace on the download from
DC page. Most importantly, the bottom buttons where not on the bottom,
so we had to truncate the downloaded dives early (to prevent overflowing
the buttons). Further, a tiny bit of padding is removed between the
3 top pull down items.

All this, results in the diplay of more dives without scrolling.
For example, previously, only 1 dive (with 1 stored DC) was shown
on my 5.5" device, and now 3 (scale: regular).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Jan Mulder
8ab8a67f81 mobile, QML UI: make SsrfCheckBox resizable
Changed some hard coded size and positioning of the SsrfCheckBox,
in such a way that is scales nicely to the current setting of the
mobile_scale.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Jan Mulder
7367d2535f mobile, QML UI: fix overlapping button
The select buttons in the downloaded dives delegate overlapped
the dive data. Simple margin change fixes this.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Jan Mulder
be1d3a7986 mobile, QML UI: ssrfButton and download controls resizable
Make the ssrfButton and the pull down menu's on the download page
resizable. Notice that also the contents of the pulldown
menu's is scaled based on the font size.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Berthold Stoeger
0aab39b35d Mobile: use editText instead of currentText in Suit and DiveMaster boxes
A user reported problems with editing the Suit and DiveMaster fields.
Apparently, editing does not change the currentText. Without doing
a deeper analysis, simply use editText (a more proper fix might be
changing the currentIndex on editing).

(Parially?) fixes #1694

Reported-by: Mark Powell <mcpowell123@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-25 09:27:16 -07:00
Jan Mulder
6850e6d567 mobile, QML: correct font scaling of the divelist
Changing the scale, it seems that the header of trips is not rescaled.
The reason for this is simple. That string does not use our manipulated
font but a different one. In fact, this is the only ocurrence on the
divelist that did not scale. However, other screens hardly rescaled at
all. All these will be fixed in seperate commits.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 16:01:39 +02:00
Jan Mulder
b332dd108a mobile, QML: scale font from the buttons
After the work in the previous commit, it gets very simple to implement
font scaling. Just assign a the new desired font scale to the used
font metrics. The QML engine does all the work.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 16:01:39 +02:00
Jan Mulder
c2c751c164 mobile, QML: introduce basePointSize in subsurfaceTheme
By manipulation the used font pointSize property, we can dynamically
scale fonts and derived UI objects. At the same time, we have
some logic to determine the default font, its size, etc, for example
depending on screen properties. The scaling of the UI (and its font)
does not need to interfere with those defaults.

However, when we want to reset the pointSize, we alter the default, so
a backup of the default is needed. Ok, not al full backup, as the only
thing we like to manipulate is the pointSize, to which we want to be
able to return.

All this leads to this commit. A basePointSize property is added, that
is initialized from the default. Due to the binding logic of the QML
engine, it is not a classic initialization, but a binding between the
2 properties. We need to break that binding explicitly, so that
the original PointSize is always preserved.

In addition, a display of the new font property is added to the
developers theme test.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 16:01:39 +02:00
Jan Mulder
a9c6b1472b mobile, QML: do not user a local font metric object
This theme test display created a new local FontMetrics object, that
does not per definition correspond with the "global" font metric
as defined in main.qml. The fix is simple. Display the font theme
data based on the one and only font metric from main.qml

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 16:01:39 +02:00
Dirk Hohndel
be0468b706 QML UI: add settings for scale factor
The visual feels backwards as the selected one is grayed out...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-25 15:58:17 +02:00
Dirk Hohndel
38307a5b3c QML UI: ensure we use the correct default font
It seems the documentation is incorrect - unless you explicitly set the
ApplicationWindow font to the the Application Font (just writing this
down sounds so silly...), it doesn't actually work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-25 15:58:17 +02:00
Jocke
c68ac31425 Mobile/download DC: disable selected DC button
Disable the button for the currently selected DC.
This gives an extra visual hint of which DC is currently selected.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:35:43 +02:00
Jocke
2d3777ce87 Mobile/settings: clear all of qPrefDiveComputer.vendor
To prevent stale data in the download DC path we need to clear the entire
 qPrefDiveComputer.vendor() object when the user purges the used DCs.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:35:25 +02:00
Jocke
3b8f36ff13 Mobile/Settings: Disable unusable option
Disable the "Forget DCs" button when there is no DCs saved. 

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:35:02 +02:00
Jocke
69cead138b Mobile/download DC: simplify startup
Since we now store the last used DCs in out preferences we can use the information
to pre-populate the DC selector.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:34:49 +02:00
Jocke
0a3130cd86 Mobile/downloadDC: always start with empty index
To prevent stale data being visible always set the combobox indexes to -1

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:34:36 +02:00
Jocke
c4d6886daf Mobile: let Flow object use all of the parent width
There is no point in further restricting the width of the Flow object.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:33:11 +02:00
Dirk Hohndel
0ae57cfe92 Mobile/remember DCs: try to match device names
We only store the address part of the connection name, so don't try to find an
exact match, try to find the sub-string.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
a5b56d0ba0 Mobile/settings: add button to forget remembered dive computers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
500f4c44fc Mobile/remember DCs: allow the buttons to flow
The hard grid may look nicer on bigger screens, on smaller screens it's
a problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
52c70a3594 Mobile/remember DCs: add UI for the mobile app
This uses the same backend as the desktop version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Jocke
5b37d87e2d Update divelist when changing units
We need to explicitly refresh the divelist when switching between
metric and imperial unit systems. Or the changes will not be visible until
we restart the app or scroll outside of what's in the current cache.
This will update both the divelist view and the dive profiles to show the new units.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-22 14:44:59 -07:00
Jocke
a63be142b5 Mobile: add units selection to settings page
Add the option for the user to set the desired unit system for
Subsurface-mobile regardless of system locale

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-19 14:41:03 -07:00
Jan Mulder
c11a4e4633 Mobile: rename UI string for webservice
Trivial rename of a UI string. The string "Subsurface GPS data webservice"
reminds me too much of the legacy webservice.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-19 14:05:14 -07:00
jan Iversen
c9122283cc mobile-widgets: replace qmlprefs::theme with qPrefDisplay::theme
Shortcut and use qPrefDisplay::theme() direct

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-12 20:18:32 -07:00
jan Iversen
51bc41b517 mobile-widgets: remove setTimeThreshold from system
Use qPrefLocationService::set_time_threshold and remove from
qmlprefs.cpp and qmlmanager.cpp

Remark: mobile UI shows time in minutes, while it is stored (and calculated)
in seconds. Therefore a /60 when reading and *60 when setting.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-12 20:18:32 -07:00
jan Iversen
baa828e900 mobile-widgets: move distanceThreshold handling to qPref
Remove distanceThreshold from qmlprefs and use qPref instead
update qml

no user experience change

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-12 20:17:39 -07:00
jan Iversen
c454f6954f mobile-widgets: make show_developer persistent
Remove developer from qmlprefs and use qPref instead
Update qml

show_developer is saved on disk, and thus remembered between starts.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-12 20:16:46 -07:00
jan Iversen
d0edc29636 core,tests: change qml register function
In order to address the C++ object directy in qml, a different
registration is needed.

qmlRegisterType, registers the C++ class, allowing qml code to inherit
from it and make qml objects. This is needed for graphical elemnets
like profile and map

setContentProperty, registers the C++ object, thus allowing signals to be
catched.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11 17:22:58 -07:00
Jan Mulder
987e221f8e Mobile: Remove webservice, remove UI components
This is the first commit related to the removal of the GPS
webservice. It is nothing more then removing 2 buttons from the
menu to upload and download from the server, so technically
a trivial change.

As with the desktop application: Be very careful here as this
forces our users to use Subsurface-mobile, and a online cloud
account as that is the way to transfer GPS data from a mobile
device to the desktop.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-10 07:50:50 -07:00
Jocke
02af3463d0 Mobile: add default cylinder UI
Add the UI components to let the user set the default cylinder and select
the chosen cylinder when adding a new dive.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-25 07:01:42 -07:00