Commit graph

139 commits

Author SHA1 Message Date
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
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
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
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
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
Jocke
bd8eec5c8e Mobile: fix adding new dive
All the changes to multi cylinder editing broke the option to add a new dive.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Dirk Hohndel
fbf94d4a7b QML UI: add callback to run after app is fully initialized
And then use that to check for pending Intents on Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
f8d551ac6e QML UI: don't show bogus warning if page stack is reset
As we clear all the pages from the stack, we can briefly have no valid currentItem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
e19944ce14 QML UI: when triggering download page, set up vendor/product/connection
This only works if the USB device contains enough information to do so.
We need to collect more information to understand what information we
get if those get plugged in. Maybe we'll get only the vendor and need to
leave it to the user to set the product (which we can do by passing an
index of -1 for product).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
842210c80d QML UI: show download page when device was plugged in
Unless, of course, the user was editing or adding a dive - that would
be annoying to have interrupted (even though, of course, it's the user
plugging in the device which would trigger this in the first place).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
a3ddd823bb QML UI: add property to pass detected device name to UI
If the user plugs in a device on Android we get a device string that
should allow us to figure out which dive computer was plugged in. Make
that string available to the QML UI.

Right now all we do is log it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
jan Iversen
8d66633fe7 core: make qPref::cloud_status the only version of the enum
add enum to qPref and remove elsewhere
update source core to reference qPref.

the enum cannot be in pref.h because it is to be used in qml and Q_ENUM
need the enum to be defined as part of the class

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-10 10:30:50 -07:00
Dirk Hohndel
1ccf21f08d QML UI: improve banner in global drawer
The asynchronous load seemed to be (at least one of) the culprit(s) of
the banner occasionally not showing up.
Making the font for the cloud ID smaller looks better (and works much
better for long email addresses).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 11:50:14 +09:00
Dirk Hohndel
ca84d96a50 QML UI: show the cloud credentials in the global drawer banner
This is an additional side-benefit of rolling our own banner.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-18 06:32:23 +09:00
Dirk Hohndel
c8ef3d7924 QML UI: build our own icon and header for global drawer
Kirigami appears to have a bug that makes it fail to show our icon.
With this we can be much more flexible in what we show in the top area
of the global drawer.

Fixes #1331

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-18 06:32:23 +09:00
jan Iversen
b8eb348f54 mobile: move settings from qmlmanager to qmlprefs
add settings variables/functions to qmlprefs
remove settings variables/functions from qmlmanager
change manager. to prefs. in qml files for setting variables/functions

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-15 14:12:14 -07:00
jan Iversen
d0e9f62624 mobile: add qmlprefs class
add class to cmake and pro
register class

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-15 14:12:14 -07:00
jan Iversen
f7fde20a2c mobile: main.qml, change load of dive.jpg
change load of dive.jpg to reflect new location.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
1c9bd08d55 mobile: clean qml dir (move dive.jpg to icons)
Cleanup qml dir by moving dive.jpg to the icon dir

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
Dirk Hohndel
d2d46d848a QML UI: fix incorrect icon references
Not sure why this has worked in the past - it was simply wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 18:57:08 -07:00
Dirk Hohndel
f8742a48b2 QML UI: show offline notice when going offline
The logic was backwards and showed the notice when the user switched to
auto sync mode.

Fixes #1204

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 08:12:56 -07:00
Dirk Hohndel
6b9a1f3850 QML UI: change auto cloud sync menu texts
This way the menu items describe what happens when you tap on that menu
item.  That seems more consistent and intuitive.

See #1204

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 08:08:24 -07:00
Lubomir I. Ivanov
49f566d6d8 main.qml: handle mapPage in pageStack.onCurrentItemChanged()
When the slot pageStack.onCurrentItemChanged() is reached
make sure that the stackView becomes non-interactive.
This prevents swiping left on the map to "go back".

Also, always reload the map markers when the map becomes visible.
This is not optimal and instead something in the lines of:
  DiveList.model.onChanged()
is a much better solution.

Ideally the map reload should happen on dive removal, dive addition,
dive edits and sync from cloud.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
fe9c3d4c95 main.qml: add a drawer action for the map
This action uses the Breeze icon "map-globe.svg" and calls
showMap().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
68da4de643 main.qml: modify showMap() to not accept location
showMap() uses a location to open Google Maps in a browser.
Make showMap() a generic function to push the mapPage on the view
stack.

Update the calls to this function from child widgets and pages.
Also either call mapPage.centerOnLocation()
or mapPage.centerOnDiveSiteUUID() depending if the caller
wants the map to center on a dive site or on map coordinates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
61c90efc6b main.qml: create an instance of MapPage
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Jan Mulder
76a7c860f1 Mobile QML UI: wideScreen property change
See also 15cdcdbc6. There, we introduced the wideScreen (set to true)
to evade a (cosmetic) bug in (most likely) Kirigami. The top dive
was partially obscured on the start of the app. And by setting the
wideScreen to true, the application header became of a fixed height.

Numerous changes further in Kirigami, we can now set this property to
false. This results in a correctly displayed divelist at the start of
the app, and *also* an application header that correcly hides itself
when scrolling up, and displays itself again when scrolling down. So,
a behavior that is common to, for example, mobile brouwsers.

This all said. I still believe this is a workround for strange behavior.
In fact, we should not need to set this wideScreen property at all,
and Kirigami should behave correct in all cases (true, false, unset
at our end). It behaves correctly when set to true or false, but
still displays a partially hidden top item in the dive list when
unset.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-24 11:39:49 -08:00
Jan Mulder
e7ccb7d4d9 Mobile QML UI: color the application header correctly
Also, this got broken after the Kirigami to verion 2.2 in main.qml.
So, set the header background color according to our theme setting.

Notice, that there is a remaining issue here. We could color the
text color in the header, but now, this seems impossible (or I
do not understand how and where to set this).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
bd10a8442a Mobile QML: main.qml to Kirigmi 2.2
This is a long standing issue. I wish to keep up with Kirigami developments
including new versions of their controls, but this is not always easy.
While we upgraded to Kirigmi 2.2 for most of our QML earlier, using this
new version of main.qml breaks numerous stuff. In fact, so much that
we just needed to wait.

With the progress in Kirigmi, it is now possible to upgrade, with still
some issues on our side to be fixed, but this is manageble now.

The main show-stopper was a construct to set our theme colors, for example:
Kirigami.Theme.highlightColor = Qt.binding(...)
This is not posssible any more, as the Kirigami.Theme has made these
readonly on their end.

This commit just removes the assignments to the now readonly theme
items. And the setting of a correct theme color for the action button.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
83259008e7 mobile cleanup: unduplicate code and do not loop over dives (3)
See e6e1473e6. Exact same commit but here for the
list of divemaster. The careful reader will spot a
small addition to the clearDetailsEdit() QML function.
Two more field are cleared.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
572fc47071 mobile cleanup: unduplicate code and do not loop over dives (2)
See e6e1473e6. Exact same commit but here for the
list of buddies.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
fed2c5b6a1 mobile cleanup: unduplicate code and do not loop over dives (1)
This is the first of a set of commits that are (very) similar.
It appeared that a number of more or less static lists, which are
constructed by a loop over all dives in the logbook, were executed
when changing focus to a next dive. For example, the in this
commit addressed list of used dive suits.

What was wrong was that the suitList was linked to a dive. There
is only a need to construct the list of used suits when data is
changed (and obviously, once on startup of the app). Further, it
appeared that a lot of code was duplicated and that we can use
(in this case) the same code from the desktop completionmodels.cpp.

Basically, this commit involves the following changes:
- include completionmodels.cpp in mobile and desktop (so move
it from the desktop only category to the generic category).
- remove double code from DiveObjectHelper.cpp
- Do not differentiate in the init phase and the normal refresh
of the list
- the per dive logic is now only the getting of a previously
constructed list (in init or update of the divelist).

There are no visible changes in the UI, other than a better
performance when scrolling over dive details.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
a5b44362c6 mobile: newer Kirigami SHA
This commit consists of the following 3 parts:
1. There are 2 source files added, adapt our build process
accordingly.
2. Due to a change in icon and kirigami QML prefixes, we need to
adapt for this as well. Changed mobile-resources.qrc for that.
When this would not be changed, the icons will not be found.
3. To further prepare for the future, abandon the iconName
property in favour of the new icon grouped property, which
can have more attributes than only the name. But currently
it is only a syntactic change.

Tested on Android device, and no visible changes.

Signedoff-by: Jan Mulder <jlmulder@xs4all.nl
2018-01-03 14:04:08 +01:00
Jan Mulder
ff3b107a9d mobile: close GPS menu drawer when selected
This is mainly a cosmetic improvement. The GPS menu stayed
visible, when selecting most of the options. This looks weird,
as the close of the menu is also an indication of the selected
action carried out. So, just close it

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-26 13:08:37 -08:00
Jan Mulder
5e116db1a1 CHANGELOG.md
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18 15:23:23 +01:00
Jan Mulder
825afb4db4 mobile: exit edit mode when navigating away from edit page
Navigating using the breadcrumb in the header did leave the
dive detail edit (and add) mode in such a way that (for example)
navigation in the dive list was suspended. Obviously, it is
debatable what should be done. Saving the edits/add, or
cancelling them. For now, this commit cancels them
silently. This is the exact same thing that is happening when
the user selects the dive list from the drawer menu.

Fixes: #932

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18 15:23:23 +01:00
Jan Mulder
62ef78b5e8 mobile: show message when going offline
Trivial fix. Show the message "Turning off automatic
sync to cloud ..." when turning automatic sync to offline. Just
a more logical moment to show this message. Also rephrase the
message "Enable auto sync" to "Auto sync enabled". It shows
a status, and not an action.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-14 17:01:51 +01:00
Robert C. Helling
4a9add167f Don't close menu after click
I consider it more natural for example for the GPS menu
to stay open when an action is clicked. So this turns off
the general close but has to trigger it on individual items.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-06 06:00:22 -08:00
Robert C. Helling
89bd0cfdbd Unify capitalization
Sorry, this introduces a new string...

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-05 10:11:57 +01:00
Murillo Bernardes
78aface44a iOS: Display GPS menu
Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2017-12-03 08:19:00 -08:00
Jan Mulder
fea111cb3a QML UI: QtQuick.Layouts to 1.2
And again, no visual changes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
e9903d1835 QML UI: QtQuick.Controls to version 2.2
Tested fine without visual changes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
15cdcdbc69 QML UI: show divelist from the top
In commit bdf6dc7828, we pulled in some changes from Kirigami.
I checked all the new commits and they seemed just fine, and a
test (on desktop) on both Qt 5.9.1. and 5.9.2 showed no obvious
problems.

However, some time later, working on something else, I compiled
from Android to test, and saw some strange behavior in the dive
list. The topmost dive is partially hidden behind the application
header on startup of the app, but can be pulled down. Not a big
deal, but is does not look right.

After tedious testing, bisecting, etc, I found commit
d0f3941a4d7f4d4c6 in Kirigami (obviosuly, it was not clear from
the start that it was in Kirigami, as I could well have been
some error in Subsurface, or even Qt). Mentioned commit is
trivial, and handles with the wideScreen property of the
application window. With wideScreen = false, the bug is
visible, when true the bug is gone.

This all said. Just set the wideScreen to true, which can
definitely be considered a workaround. I exspect that this
commit can be reverted later on when Kirigami is fixed.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-30 18:42:58 +01:00
Dirk Hohndel
d1a18b36b4 QML UI: open v2 user manual
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 12:14:08 +03:00
Dirk Hohndel
2dd8a2ad7b QML UI: download icon in main menu
We need a white path drawn on the dark action button, but a black path
drawn for the main menu.

(looks like a white space change snuck in here)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:13:46 -07:00
Dirk Hohndel
ec7a878149 QML UI: avoid warning before currentTheme is set
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Jan Mulder
2e91de9d95 mobile: initialize credential data in one place
It appears that the onCompleted of the StartPage item is triggered
before the onCompleted of the rootItem. This is logical as the
Startpage is a child of the rootItem. And, yes, this does matter.
As the divelist also contains the logic for initial cloud
registration (and is the default page shown in a state where
the cloud credentials are valid (CS_VERIFIED state)), we need to
know the correct credential state at start of the app.

The move of this one line of code makes sure of that, in addition
to setting the credential state from the preferences. Now, the
setupActions function can reference correct credential data.

This is further preparation for a better cloud creation
process from mobile.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29 08:13:25 -07:00