Commit graph

542 commits

Author SHA1 Message Date
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
Murillo Bernardes
8f3ac0402c iOS: check for UUID instead of physical address
on iOS the address we display on Connection is an UUID, not
a physical address.

This change the pattern (on iOS) used to enable bluetooth_mode.

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2017-12-02 08:21:33 -08:00
Jan Mulder
806c7077f2 mobile: get GPS data from dive site name
When the user entered a dive site using autocompletion, it
is a known site, of which we might have a GPS location already.
Just fill the known site coordinates.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-25 08:13:42 -08:00
Jan Mulder
64704d6e5a mobile: autocomplete location names
Add the capability to select the location name from a list, constructed
from the known dive sites in the logbook.

Fixes: #546

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-25 08:13:42 -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
f3d978b8a5 QML UI: QtQuick to 2.6
Upgrade QtQuick to 2.6. Seeing a small artifact in the application
header, lets see what happens when upgrading more includes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
3b5375d553 QML UI: Kirigami to 2.2
When first tested this commit, especially the dive list was looking
terrible. However, after including newer SHA's from libkirigami, and
correcting lots of spacing/margin issue, a retest of this commit shows
no strange artifact any more, and the amount of warnings in the log
output is reduced significantly. So now, it appears save to
upgrade.

Notice that main.qml still uses Kirigami 2.0. and is not updated in
this commit. With version 2.2, there is a new way of theming, that
is not (yet) compatible with our current code. Blindly upgrading to
2.2 leads to a almost black dive list, wrong button colors, and
runtime errors in the log, due to the fact the direct setting from
QML Kirigami's Theme colors is not allowed any more.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Lubomir I. Ivanov
956b45ddfd map-widget: move the widget and its resources to 'map-widget'
Move all the map widget platform agnostic files to the
<subsurface-root>/map-widget folder.

This avoids the confusion about the desktop version of subsurface
using mobile components. The map widget is planned as a shared
component between the mobile and desktop versions.

desktop-widgets/mapwidget[.h/.cpp] still remain as those are specific
to the desktop version.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-05 14:48:56 -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
Jan Mulder
cf75e6451d QML UI: Scrolling in dive details
While testing the mobile app on Qt 5.9.2, I encounted a show stopping
issue. Select a dive in the dive list, go back to the dive list (as
selecting a dive opens the details), now scroll down to a different
dive, and select one. The app starts enumerating (moved smoothly
according to the specs) all the dives between the old and the new
selected dive. So, depending on the distance, this could take forever.
Explicitly: on 5.9.2. only.

From the Qt docs:

highlightFollowsCurrentItem : bool

If this property is true (the default value), the highlight is moved
smoothly to follow the current item. Otherwise, the highlight is not
moved by the view, and any movement must be implemented by the highlight.

End Qt docs.

Setting this property to false solves the issue. Tested on both Qt 5.9.1
and 5.9.2.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-29 11:08:10 -07:00
Lubomir I. Ivanov
9367610220 mapwidget: add the 'isReady' flag to the Map component
The 'isReady' boolean flag is now set to 'true' only
once the Component.onCompleted slot is reached.

The flag is then used as a safe-guard in the
onZoomLevelChanged slot. Calculate the small circle radius
(mapHelper.calculateSmallCircleRadius()) only if 'isReady'
is set to true.

Prevents a crash if the Map widget is not ready, yet a zoom
level is set via the 'zoomLevel' property. The crash happens
because mapHelper.calculateSmallCircleRadius() has a callback
to the Map component to estimate some points and distances of the
small circle.

Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-29 08:26:11 +01:00
Jan Mulder
6d81e19eae map widget: start with normal zoomlevel
Commit 344d976593 resulted in the start of Subsurface with a map of
the whole world. The user has to zoom in (assuming the case that the
first selected dive has a position), in evenry session. This is solved
by setting the zoomlevel at startup at the default value. Ok, this
results in a map of central London, UK, when starting Subsurface with
a dive without location, but is this as good as any map.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-29 08:26:11 +01:00
Jan Mulder
6bd5312dfa QML UI: prevent full overflow of bottom buttons
A not perfect improvement, but way better IMHO. Prevent the list of
downloaded dives to grow over the buttons at the bottom. Just a simple
change by adding a bottomMargin to the list.

Notice that there is still some overlap, but for now I consider this a
trade-off between the scarce screen real-estate and the wish to present
and much as possible dowloaded dives.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-27 19:28:42 +02:00
Jan Mulder
f25cc3a67f QML UI: repair long trip headers
Trip headers spanning more than one line where broken at incorrect
locations in the string. Not exactly sure, but I think this came with
the newest Kirigami SHA, and especially the Label change.

Carefully reading the code for the trip heading shows a "strange"
negative margin. So the margin is on the outside. This margin was
used to split the string, allowing for a small invisible part of
the string to present as trip header.

This is solved by this commit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-27 19:27:47 +02:00
Linus Torvalds
344d976593 Make the map widget more pleasant to use
This does two main things to the map widget:

 - if there are no coordinates, do *not* zoom out to the whole-world
   view. Just leave the map alone.

 - when zooming out to move to a new dive site, zoom back in to the same
   zoom level it was before.

These two changes make it much more pleasant to move between dives,
particularly as you move back-and-forth without losing the zoom level.

NOTE! The zoom level gets reset if you move dives _while_ zooming is
happening, and so moving quickly between dives will still end up losing
the original zoom level, replacing it with a bigger zoom-out that was
active _during_ a previous zoom.

That could be seen as a feature (moving incrementally to an "overview"
zoom when moving quickly between dive sites), but honestly it smells
more like a bug to me.  But regardless of that feature/bug, this new
zoom behavior is more pleasant than our older "always reset when
moving".

But it might be a matter of taste, so people should try this out and
comment.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation,org>
Cc: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-23 10:34:19 -04:00
Jan Mulder
a9b692f0c3 QML-UI: Download screen fixup
Again, mostly related to label change. First, the top button was "glued"
to the top of the screen, so added a little margin there. It
appeared that all the other items on the screen (progressbar,
2 button rows, and the downloaded dive list) where not moving down
due to the add of that little top margin. This was solved by
anchor-ing the items together. Finally, the text of a downloaded
dive was on the top of the delegate lines. Not sure where that came
from, but easily solved by centering it explicitly.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-19 14:55:30 -04:00
Jan Mulder
53ed1c7326 QML-UI: some more layout repair (dive details)
As in a525fff112, also the dive details top data was not nicely positioned
any more due to the deprecated and removed Kirigami.Label.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-19 14:55:30 -04:00
Jan Mulder
a525fff112 QML-UI: repair DiveList
The new SHA for Kirigami did all kinds of nasty things to our DiveList.
This commit tries to repair most of the damage. Nothing more than
some margins, anchors, and even a font that changed.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-18 06:30:51 -04:00
Jan Mulder
d623eccdef mobile: silence deprecated messages in logging about Kirigami.Label
Commit 8f6827ab12 brought a new SHA for Kirigami, but that introduces
a very noisy logging of "Kirigami.Label is deprecated. Use
QtQuickControls2.Label instead".

So, thats what done here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-17 15:32:27 +02:00
Jan Mulder
16b395a898 mobile: No cloud repo creation more explicit
Before this change, there was only one way to create the local
no cloud repo on the device. The user needed to add at least
one dive to the no cloud account (so that there is something
to save). While this worked in some scenarios, it could also
get things in an inconsistent state: credential status = CS_NOCLOUD
but no local repo. This was a dead end.

In this commit, the creation of the no cloud repo is made more
explicit. When asking for no cloud mode, just create an (empty)
repo for it when it does not yet exist, and otherwise, just
open the existing (possibly empty) repo.

Now, a user can have no cloud repo, next to (any number of)
cloud accounts.

This leaves one functional aspect left: how does a user abandon
the no cloud repo, by merging his data into a true cloud
account. This is code for this, that tries to do this merge in
a smart way. This seems to be broken (too). To be clear: this
is no part of this commit.

Fixes: #667

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-17 14:29:17 +02:00
Lubomir I. Ivanov
49c8c966fc qml-icons: add a third, grayed-out map marker
It can be difficult to distinguish the new marker
which is added on the map and has to be dragged
when editing a new dive location.

By adding a new grayed-out marker it becomes
possible to gray out all other markers, while
the current marker which is being edited is still
bright red.

Suggested-by: Dietrich Meyer <dietrich@sunnynames.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-15 17:28:39 -08:00
Lubomir I. Ivanov
07c91805d9 qml-icons: make mapwidget-marker.png even darker
This is done so that a de-selected marker is better
distinguished from the selected marker.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-15 17:28:39 -08:00
Lubomir I. Ivanov
4c7ce5c1aa mapwidget.qml: fix weird MouseArea bug in MapItemView
The QML map uses MapItemView. MapItemView needs a delagate
in the form of a MapQuickItem. The MapQuickItem needs a
'sourceItem' which would be used as the visual (e.g. marker)
on the map.

If the root sourceItem is of type Item, the marker becomes
non-clickable. If the root sourceItem is an Image, the clicks
work.

This patch removes the root Item, which makes the code
less organized, but at the same time it fixes the bug.

Bug reproduced on the following Qt versions on Ubuntu:
5.5.x, 5.7.x

Bug cannot be reproduced on Qt 5.9.x on Windows.

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-15 17:28:39 -08:00
Jan Mulder
ba4058667a mobile: enable switching BT on/off during session.
This commit implements possible switching BT on and off during a session,
so not needing a restart of the app when the user forgot to switch
it on when starting the app.

For this, the following needed to be done: 1) create a handler that
reacts on local BT device status changes. 2) repopulate the connection
list in the download screen when a BT status change is detected.

Notice the subtile change of the Q_INVOKABLE btEnabled() function
to a Q_PROPERTY. This gives a nice dynamic behaviour when
switching BT on/off with the app open.

Fixes: #556

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-12 09:43:40 +02:00
Dirk Hohndel
6578588ad9 QML UI: add missing icon
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-09 22:01:12 -07:00
Lubomir I. Ivanov
174b414436 map-widget: don't crash if the map QML failed to load
If the QML modules for QtLocation and QtPositioning are
missing the QML in mapwidget.cpp will fail to load,
which can lead to crashes.

To solve the issue check if the QML has loaded and set
a flag 'isReady' to true. If the loading has failed
load another QML which is for showing a red error text
in the lines of `MapWidget.qml failed to load!`.

If the map QML has failed, use a macro in all relevant
MapWidget members to turn them into a NOP. This approach
leaves the rest of the codebase intact - e.g. no checks
in classes which connect to the MapWidget class.

Fixes #596

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-07 08:09:05 -07: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
deff17fa36 Whitespace
This commit is empty when shown with '-w' - it just updates the
indentation after commit c00804eff6 ("QML UI: always start edit at top
of page").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 13:40:31 -07:00
Dirk Hohndel
c00804eff6 QML UI: always start edit at top of page
When starting to edit / add a dive, the Flickable needs to be positioned
at the top of the page, not the last position shown.

For clarity I'll do the re-indentation in the next commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 13:38:32 -07:00
Dirk Hohndel
3487612337 QML UI: add transition when switching to edit mode
The hard switch was not ideal. This isn't perfect, yet, but a step in
the right direction. The 'transitions' to change the visibility
properties are a bit odd, but that's how it's done in the examples as
well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 08:21:55 -07: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
636904e078 QML UI: make edit page scrollable
And have a tiny bit of space around it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
7f0c7eeb24 QML UI: change the dive edit to not be an overlay
This way the accidental closing of the edit (and loss of data)
should no longer happen.

See: #495

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
41f24f2859 QML UI: top padding for dive details
This used to work without manually adding space here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -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
Dirk Hohndel
b4b3864f50 QML UI: adjust icon names
These changed in Kirigami.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:52 -07:00
Jan Mulder
e2aaa43d8c QML UI: cleanup some whitespace and string formatting
This addresses some review comment on whitespace and translated
string formatting.

In the string formatting, a tiny additional change is made.
I wanted the email address in the explanation text in a bold
font. Using the HTML <b> for this, removed the /n newline
characters in the output. Apparantly, mixing these two
formatting styles does not work. No problem, replaced the
/n to HTML style too.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29 08:13:25 -07:00
Jan Mulder
dbed88bd81 QML UI: rework single credential page to two pages
This commit tries to implement most of issue #515. It reworks the
one credential page, which its dynamic PIN part, into two pages.
Main driver of selecting one of the two pages is the showPin
boolean. Page 1 contains the email/passwd field (and the
option to use a no cloud setup). Page 2 only contains the PIN
part (and the option to cancel the process).

The Kirigami central button does not seem very handy here. We
need, for example, a cancel, sign-in and register, only register,
etc. buttons, which are not easy to handle in specific icons.
Therefore, normal pushbuttons are chosen to deal with user
interaction, and the Kirigami button is removed from these
pages.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29 08:13:25 -07:00
Jan Mulder
81eb8466b2 QML UI: rework cloud credentials block
Previously, we could edit the cloud credentials in basically two
places. At startup of the app from a fresh install (and no previous
data on the device), and from the settings. Issue #515 proposes
only one way.

However, we need a way to access the new credential UI pages, so
that the pages at a fresh install of the app can be reused,
for example for account switching.

This commit replaces the settings cloud credentials block by
a simple (not editable) display of the current credentials, and
a button to access the initial pages, for all management tasks
on the credentials.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29 08:13:25 -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
Lubomir I. Ivanov
5eeefbff8b mapwidgetcontextmenu: use a QtQuick 2.0 import
Following on beb0d5703a, the context menu seems to work fine
with a much older QtQuick import - version 2.0.

The 2.7 import is technically a development leftover
and a minimal version should have been considered earlier.

On older Qt setups (e.g. 5.5.x) this might throw a:
'module "QtQuick" version 2.6 is not installed'

Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-09-16 08:35:29 -07:00
Jan Mulder
9a2d503d3b Unify credential states
Having two different enums around with more or less the same
definition has lead to unclear code. After removing two not needed
states on the mobile end, the remaining step to one enum for the
credential state becomes almost is simple rename operation.

Unfortunately, I do not know a way to embed a plain C enum
from pref.h into the QMLManager object. So after this, there
are still 2 enums around, but now identical.

This commit is not changing any functionality.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04 07:38:30 -07:00
Jan Mulder
190d80e509 mobile: remove superfluous state VALID_EMAIL
This is a no-brainer removal of the VALID_EMAIL state used in QMLManager.
All current usage of this state is "if state is VALID or VALID_EMAIL",
so there is no distinction between the two states.

It is even a little different. The comment suggests "when we can open
a local cloud storage, tied to a cloud account (so explicitly not
the no-cloud status), we have at least a valid email". While this
is formally true, this implies that there is also a cloud account
on the cloud server (ie. the cloud account is in a VERIFIED state).
In other words: currently, there can't exist a valid local storage
that is tied to a valid email adress, without valid cloud account
on the server.

Notice that this touches the discussion on GitHub for commit
e76f527fe5 (pull request #520). Can we implement the creation
of a valid cloud account without data link to the cloud server?
Currently, we need the server to confirm the email address (for
example for uniqueness reasons on server side). Obviously, we could
hack our way out of this, but we have a perfect solution already
in place. Create a no-cloud account, and transfer that later to
a true and valid cloud account.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04 07:38:30 -07:00
Jan Mulder
50891c838e QML UI: set the title of the right object
Intended was here to set the title of the Dive list with id: page,
instead of the startpage object.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04 07:38:30 -07:00
Dirk Hohndel
0c410aaf5d Adjust signature to match data we need
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:27:12 -07:00
Dirk Hohndel
beb0d5703a MapWidget works with slightly older QtQuick2
This allows building against older Qt.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 11:52:58 -07:00
Lubomir I. Ivanov
1da4f91cc8 mapwidgethelper: use dynamic creation of the Plugin object
The googlemaps plugin is about to support tile language
via the PluginParameter 'googlemaps.maps.language'.
To be able to pass the subsurface UI language (obtained
from the uiLanguage() helper) the Plugin has to be created
dynamically, only *after* the MapWidgetHelper is created.

MapWidgetHelper::pluginObject() now provides a QString which
contains the Plugin object and also include the uiLanguage
ISO value.

This string is used in mapwidget.qml as:
map.plugin = Qt.createQmlObject(pluginObject, rootItem)

This creates the Plugin object dynamically with the proper
UI language string, but also requires a couple of small changes:
- move the declaration of map.mapType after the
Qt.createQmlObject() call
- assign map.activeMapType after map.mapType has a value

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-24 13:11:39 -07:00
Lubomir I. Ivanov
f21ae69f7b mapwidget.qml: more improvements for the dynamic zoom-in/out
The QML Map has a couple of methods - toCoordinate(someQPointF) and
fromCoordinate(someQGeoCoordinate). Ideally, if one passes a point to
toCoordinate() and then attempts to convert the resulted coordinates
back to the point, the same point in the Map view port with minimal error
should be retrieved. That's not always the case - e.g. near
47.400200 -123.142066, which means that the methods are not exactly
*reliable* and there might be Map class bugs at hand.

The new zoom-in and zoom-out improvements try to work around the above:
- for both centerOnRectangle() and centerOnCoordinate(), if no good
zoom-out level is found (newZoomOut), the zoom-out is set to the default
value of defaultZoomOut. In practice, this prevents the case where the map
does not zoom-out at all when going from one place to another
- centerOnRectangle() now uses rectangle diagonals to estimate a fit,
instead of checking if 2 points (top-left and bottom-right) are visible
in the viewport. The usage of fromCoordinate() was giving bad results
in this case and comparing distances (diagonals) is more reliable
but more expensive on the CPU.

Due to the inconsistencies of toCoordinate() and fromCoordinate()
the dynamic zoom-in and zoom-out are still not ideal, but the current
implementation is somewhat usable with decent accuracy.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-10 09:08:28 -07:00
Rick Walsh
1409521eb2 DiveList.qml: set detailsWindow index before deleting dive from list
This appears to fix the mystery crashes that can occur when deleting a dive
from the dive list.

Fixes: #497

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-08-10 09:06:44 -07:00
Joakim Bygdell
3f1a20cbaa QML UI: GPS: remove header
Being the only page that still has an on page header
it makes sens to remove it.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-07 00:52:32 -07:00
Joakim Bygdell
e4d4718bae QML UI: GPS: remove margins
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-07 00:52:32 -07:00
Rick Walsh
7e4ba965d1 DiveDetailsEdit: make sure model data exists
This gets rid of TypeError messages, but does not appear to affect behaviour
qrc:///qml/DiveDetailsEdit.qml:254: TypeError: Cannot read property 'dive' of null
qrc:///qml/DiveDetailsEdit.qml:228: TypeError: Cannot read property 'dive' of null
qrc:///qml/DiveDetailsEdit.qml:216: TypeError: Cannot read property 'dive' of null
qrc:///qml/DiveDetailsEdit.qml:204: TypeError: Cannot read property 'dive' of null

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-08-07 00:51:51 -07:00
Lubomir I. Ivanov
00e401b61f mapwidget.qml: add menu action for selecting visible locations
MapWidgetContextMenu now has a new action (SELECT_VISIBLE_LOCATIONS),
that will invoke the MapWidgetHelper method selectVisibleLocations().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07 00:51:21 -07:00
Lubomir I. Ivanov
5db2460168 mapwidget.qml: implement centerOnRectangle()
First, this function calculates the zoom out effect until both the
current Map center and the target rectangle are visible - see the
"calculate zoom out" part.

Then it calculates a zoom level, so that the target rectangle
fits the viewport, but also so that the zoom is not too much (clamped).
see the "calculate zoom in" part.

NOTE: "centerStored" (the variable used to store the current map center)
is created using QtPositioning.coordinate(), because the code needs a new
object and not a reference of the map.center QGeoCoordinate object.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07 00:51:21 -07:00
Lubomir I. Ivanov
0fc9a3bf4a mapwidget.qml: add a couple of helpers
Add stopZoomAnimations(), which is really just a precaution
function to make sure we have stopped all animation of the
map before doing calculations! Since the animation *should*
be running in a separate thread, this would make sure the Map "center"
and "zoomLevel" properties do not change.

Add pointIsVisible(), which is a helper to determine
if a point created by map.fromCoordinate() method is inside
the viewport. fromCoordinate() has to be called without the
"false" (clip) flag for this to work.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07 00:51:21 -07:00
Lubomir I. Ivanov
d421660f91 mapwidgethelper: support tracking of all selected dive sites
MapWidgetHelper::centerOnDiveSite() now checks if more than
one dive sites are selected and finds the most top-left and
bottom-right ones in the coordinate system to form
a rectangle.

It also supports the special cases where a selected dive site
does not have coordinates or the case where only a single dive site
with GPS coordinates are selected.

TODO: implement mapwidget.qml::centerOnRectangle()
This QML function will receive a QGeoCoordinate based rectangle which
has to be centered in the viewport with animation.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07 00:51:21 -07:00
Lubomir I. Ivanov
6fb841887d mapwidget.qml: add better error reporing on a missing map plugin
For instance, if the 'googlemaps' geoservices plugin is missing
a new message is now shown:
"qml: MapWidget.qml: cannot find a plugin with the name 'googlemaps'"

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07 00:51:21 -07:00
Lubomir I. Ivanov
aea1cc4b8a mapwidget: use "satallite" maps instead of "hybrid"
Do so until the following issue is resolved:
https://github.com/vladest/googlemaps/issues/9

With the satellite map ([1]), the black tiles at relatively high
zoom levels over the Red Sea cannot be seen. Instead it shows white
tiles at the ultra-maximum zoom level at places.

As a side note, the "satellite" map does not have the country labels
which the "hybrid" map has.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07 00:51:21 -07:00
Dirk Hohndel
0476f6dc18 QML UI: Settings: remove more margins
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-03 16:00:09 -07:00
Dirk Hohndel
c004e31dc2 QML UI: CloudCredentials: better use of space
No idea why this was restricted to be so narrow. Also, making
the font of the label smaller and lighter seems visually more
pleasing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-03 15:31:23 -07:00
Dirk Hohndel
c043366b8f QML UI: remove unnecessary margin
This makes better use of the available space.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-03 15:30:32 -07:00
Dirk Hohndel
ada6a0d664 QML UI: remove unused code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-03 15:29:50 -07:00
Dirk Hohndel
2b9523dcff Merge branch 'googlemaps' of git://github.com/neolit123/subsurface into googlemaps 2017-08-02 18:53:52 -07:00
Joakim Bygdell
bc1a388952 QML UI: dive edit autocomplete
This makes sure that the autocompleting comboboxes never displays the scroll list where the user can pick an entry, and as such forces the view of a autocompleting textfield from the users point of view. The reasoning is that when scrolling in the drop down list it it possible to scroll to far and thus abort the ongoing edit by flicking away the edit page.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Joakim Bygdell
a9348607e7 QML UI: add more width to dive edit page
Mobile devices hare rather limited when it comes to screen size,
there is no point in reducing the availabel space more than neccecary.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Joakim Bygdell
29e704a1b2 QML UI: loose focus on endEditMode
This handles a cornercase where a user starts editing and then cances the divedit followed by a return to edit mode. The previously acive textfield would then be active again even though all changes are lost.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Joakim Bygdell
bc7d11860f QML UI: make sure textfields loose focus
For some reason the textfields on dive edit page did not loose focus when editing ended by press on the return key.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Joakim Bygdell
97f1dc0b01 QML UI: autocomplete objects should lose focus on selection
When the user makes a selection using the autocomplete function while editing a dive the keyboard should close and the selection list should disappear.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Joakim Bygdell
9e9e06aed6 QML UI: decrease fontsize on dive edit
Decrease the fontsize of the static text on the dive edits page.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Joakim Bygdell
6a47af2d16 QML UI: enable modification of ratings
This enables editing of visibility and ratings for a dive.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Joakim Bygdell
9d7eb33a33 QML UI: display rating and visibility stars
Display rating and visibility stars on the dive details page. See #495

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Joakim Bygdell
ee17d54753 Add star icons
Add star icons from the material repository.
https://material.io/icons/
The icons are under Apache License Version 2.0

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02 18:49:47 -07:00
Lubomir I. Ivanov
5cb1d28861 mapwidget.qml: use a custom built googlemaps plugin
This patch makes use of the geolocation plugin "googlemaps"
for Qt Location with source code from here:
https://github.com/vladest/googlemaps

The change from the ESRI plugin is that it requires new indexes
for the Hybrid ([3]) and Street ([0]) map types.

There are more zoom levels in this plugins, but our default zoom-in
settings seem to transition well to it.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-02 00:51:12 +03:00
Robert C. Helling
757985bf2a Smaller buttons on map widget
... so they take up less space while still being clickable.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-07-31 16:55:12 -07:00
Dirk Hohndel
855dd0d1aa QML UI: stop showing location labels earlier
We are stepping by 2 - so 11 makes it clear that at 12 the labels are
shown, but at 10 they are not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-31 12:57:07 -07:00
Lubomir I. Ivanov
69f8fc3c5b map: whitespace cleanup in QML and C++ files
- remove ";"s
- remove {} where not needed or move them to the same line

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
591c4bfcca mapwidget.qml: track the coordinatesChanged() signal in QML
The C++ side for the desktop version already does that. Add a slot
for that in QML, for later use in the mobile version.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
f6896c3b8e mapwidget.qml: use darker text color for the deselected markers
Use "lightgrey" instead of "white" for deselected markers.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
5270688483 mapwidget.qml: add new logic for zooming and editing support
The editing support is added via dragging. It is handled via the
MouseArea's drag.target of the MapQuickItem. The drag target changes
with the model selectedUuid.

"mapAnimationZoomIn" now also does an initial zoom-out before moving
to a new location.

centerOnCoordinate() now pefroms calculations to determine how much
the animation needs to zoom out. What it does is it reduces the Map
zoomLevel util both the current and the new target coordinates are visible.
It then restores the zoomLevel and performs animation based on newZoomOut.

animateMapZoomIn() is now obsolete.

The patch also includes the following smaller changes:
- remove the setSelectedUuid() call in deselectMapLocation()
This is now handled in C++
- sets "defaultZoomIn" to 12.0
- use ">=" when determining if a mapItem text should be visible

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
3589e2e952 mapwidget.qml: add visual tracking of editMode from MapWidgetHelper
The MapWidgetHelper QML instance now has the slot onEditModeChanged()
which toggles the visiblity of a newly added message box that
notifies the user if editing mode is enabled.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
ff4924f650 mapwidgethelper: change centerOnDiveSite()
Call setSelectedUuid() from C++ also center on coodinates instead
on a MapLocation, as there is no point to pass the MapLocation object
back to QML.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
f7095aa89e mapwidgetcontextmenu: slight increase of element size
Increase the font and element height a little to make it
easier to click.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
f2a8bab01e mapwidget.qml: include map location text
The MapItemView delegate now includes a white Text element.
It uses the MapLocation "name" property as text.
This text is only visible if the map zoom is above "textVisibleZoom".

For hundreds of dives, using the DropShadow effect for the text
makes it laggy. Instead, using a fake drop shadow (duplicate black
Text under the default text) makes it much better.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
8c7d1a1163 mapwidget.qml: add zoom-in and zoom-out buttons
The buttons are positioned bellow the "toggle map type" button
and increment / decrement the zoom by "zoomStep" (2 for now).

Also clamp the zoom-in level to "map.maximumZoomLevel".

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
f94aa61009 mapwidget.qml: ";" and variable declaration cleanup
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
38d9759198 mapwidget.qml: add double click on zoom
Double clicking a marker or the newly added MouseArea now performs
a +2 zoom-in over a period of 500ms and centers on that clicked
coordinate.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
f1020a02ce mapwidget.qml: store the selected dives count in "nSelectedDives"
Different actions might be performed depending on the count of selected
dives - e.g. deep zoom only for a single selected dive.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
c078e350e0 mapwidgethelper: emit a selectedDivesChanged() signal
The signal emits a QList<int> filled with dive idexes from the
main backend dive table.

The MapWidgetHelper QML instance handles that in onSelectedDivesChanged().
This will only be needed for the mobile version, as the desktop version
should connect it's own slot in MapWidget.cpp.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
5ea702199b maplocationmodel: make setSelectedUuid() accept "fromClick" flag
The idea of this flag is to be able to only to emit the
selectedLocationChanged() signal when the user clicked on the map
(fromClick == true).

MapWidgetHelper::selectedLocationChanged() listens for this signal
and only then it will select nearby dives based on a "small-cicle".

If "fromClick" is false, it's the backend or the dive list that
updated the selection and MapWidgetHelper::selectedLocationChanged()
should no be called.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
747f3d8cab mapwidget.qml: call calculateSmallCircleRadius() on zoom changes
Each time the zoom changes MapWidgetHelper::calculateSmallCircleRadius()
is called, and the "small circle" radius is stored in both C++ and QML.

On the C++ side this radius will be used to select multiple nearby
dives.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
66b2f0c88c mapwidget.qml: call "copy to clipboard" actions in the maphelper C++
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
621dd53a43 mapwidget.qml: open current location in Google Maps
openLocationInGoogleMaps() now can be used to open a URL in an
external browser, triggered by the context menu. Use the same
Google Maps URL formating as in main.qml showMap().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
4d0d0e102b mapwidgetcontextmenu: add the actionSelected() signal
The actionSelected() signal is now dispatched when the user selects
an action from the menu (see the "actions" object). Then the declaration
of the MapWidgetContextMenu object in mapwidget.qml can catch that
signal in the onActionSelected() slot and obtain the action via
switch() branching.

The actions enumeration is kept in QML for now, with the idea that
specific C++ methods from the mapwidgethelper class will be called
directly (if marked as Q_INVOCABLE), instead of a generic
onMapAction(action) C++ method in the helper. But if the actions
are possible from QML (like copying to clipboard) and are also
small and non-expensive, it might be better to keep them
in mapwidget.qml.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
413e471244 mapwidgetcontextmenu: rearrange some of the QML declarations
- move the readonly properties near the top of the root Item
- move the rest of the properties bellow the readonly properties
- make the ListView Timer as a child of the ListView
- slight rename of the timer ID

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
18d910f6a7 mapwidgetcontextmenu: add the ListView component
NOTES:
- the ListView object uses lsitItemDelagate to display all elements from
the model listModel
- onCountChanged() is used to adjust the x position based on the
maxItemWidth property which is calculated when the items are populated
with text
- onVisibleChanged() is used to deselect the last selected item by
calling listModel.selectedIdx = -1
- onOpacityChanged() i sued to make sure that the View is hidden if the
opacity becomes 0.0
- inside the View there is a MouseAre which obtains the selected item via
indexAt(x,y)
- there is a Timer with id listViewVisibleTimer, which is called each
time the user selects an item from the list and the timer performs a
"delayed hide"
- a couple of State and a Transition objects are used to preform smooth
fade-in / out animation when the ListView is hidden or becomes visible

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
95b0d43104 mapwidgetcontextmenu: add a listViewIsVisible integer property
This property would act like a state flag. If -1 (default) no QML State
animation will be pefromed, otherwise the ListView will either fade in
(1), or fade out (0) when the user clicks the context menu button
(Image) or selects an item from the list.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
4808f5f9b6 mapwidgetcontextmenu: add a model delegate for the ListView
The ListView delegate is a simple Component with a parent Rectangle.
It contains a text field with the ListView action.

This patch also defines some properties for the delegate animations
and looks. The property maxItemWidth tracks the width of all item
text, and makes the width of all items be of that value.

The above prevents potential issues when a fixed width item is used
and some translated language string cannot be fit inside of it.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
eeb53e965e mapwidgetcontextmenu: create a ListModel for the context menu
Menu item indexes are enumerated in the object menuItemIndex, while
menuItemData, holds an array of objects which will define the number
of items, with indexes (idx) and text (itemText).

When the ListModel is created, it's dynamically populated from
from menuItemData.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
7dfb168f7f mapwidgetcontextmenu: position the contextMenu on the map
The anchor of the menu itself will be positioned near the edge of the
map widget, while the menu contents will have negative coordinates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
de73cf1c90 mapwidgetcontextmenu: add an Image for the context menu toggle
- add the PNG file into the QRC
- add a simple scale animation for the Image on click

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
70a8402911 mapwidgetcontextmenu: add placeholder QML
This QML component will be used to provide a context menu for the
QML map widget. Include the file in QRC and test it's creation
in MapWidget.qml.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
b0cf820bef mapwidget.qml: move the new map type toggle on top of the map
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
09a0f74bd8 mapwidget.qml: animate the map type toggle image on click
Add a SequentialAnimation that performs a slight animation of the
toggle image scale.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
8487873029 mapwidget.qml: add an small icon (top-left) to toggle the map type
Clicking the image toggles the map.activeMapType value from type
STREET to type SATELLITE.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
468f3b57c0 mapwidget.qml: simplify the map type enumeration into "mapType"
Make the "enumeration" local to the Map object for now.
This will possibly break if another plugin is used in place of the
ESRI plugin, but it will simplify the map toggle button which is about
to be implemented next.

If support for multiple plugins is added on runtime a simple
helper function will be needed that will check the current plugin "name".
And return the appropriate supportedMapTypes[X] for e.g. STREET of that
plugin.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
8b22435809 qrc: add a couple of images for the map type toggles (satellite/street)
The QML based map will have a toggle in the top left corner to toggle
between the satellite and steet tiles.

The images are created specifically for use in this Qt Location widget
and are free for use in Subsurface.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
88c6d98265 qrc: yet another slight rename for the map markers resources
Use a "mapwidget-" prefix for both the QRC and the file names.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
ce309c15a7 mapwidget.qml: use a seprate animation for zooming out
The animation sequence when deselecting a zoomed in map location, should
be:
- zoom out completely
- pan to center

To achieve that a new animation object is created - "mapAnimationZoomOut"
The previous zoom in animation is renamed to "mapAnimationZoomIn".

The map functions centerOnMapLocation() and deselectMapLocation()
now call the helper functions animateMapZoomIn() and animateMapZoomOut().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
6aa57ce7f7 mapwidget.qml: reduce the properies in mapAnimation to single lines
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
250fc1e03f mapwidget.qml: don't use the onSourceChanged() slot for flag animation
It's best to only animate the flags when clicked, thus play the animation
in the onClicked() slot from the MouseArea.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
23c56b3c31 mapwidget.qml: add deselectMapLocation()
When called this function will zoom-out the map and set it's center to
(0, 0)

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
3e3b4baee2 mapwidget.qml: remove some redundant "map." references
Inside the Map object, properties can be referenced directly.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
a8f6c99fc0 mapwidget.qml: add the animateMapTo() helper function
To be used to center the map on a dive location or reset the map
if a dive from the dive list doesn't have GPS coordinates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
033eec9500 mapwidget.qml: use map.newZoom and map.defaultZoomIn
When centering on a map location, use the predefined zoom
map.defaultZoomIn.

Later the map should be able to center on (0, 0) and zoom-out
if a dive doesn't have GPS data.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
6299a3c93b mapwidget.qml: whitespace and ';' cleanup
The rest of the QML code in subsurface doesn't use the ';' to
end a line of code or a declaration. Remove all the redundant ';'.

Also clean extra blank lines.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
2d101b7252 mapwidget.qml: play little animation on marker clicks
If a marker is clicked it's source image changes, which will
call the onSourceChanged() slot. If a marker is selected
play the newly added sourceItemAnimation which is a short scale
animation for the image.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
24d5485a88 mapwidget.qml: update the Z order of selected markers
If a marker is selected bring it up front (high Z value) else set
it behind everything else.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
6c640158e8 mapwidget.qml: add some properties for zoom and center
These properties will be used when zooming-in on a map location
or when zooming out if no map location is selected.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
b4740803a1 mapwidgethelper: pass a MapLocation object to QML in centerOnDiveSite()
The function in QML centerOnCoordinate() is now renamed
centerOnMapLocation() and accepts a MapLocation object, so that
a marker is selected (based on UUID).

In MapWidgetHelper::centerOnDiveSite(), the pointer to a MapLocation
is retrieved via MapLocationModel::getMapLocationForUuid(). Added in the
previous commit.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
f2608edc56 mapwidget.qml: track the marker selection
Add a MouseArea to the MapItemView delagate and onClick set
the "mapHelper.model.selectedUuid" to the uuid of the clicked marker.
This updates the "selectedUuid" property inside MapLocationModel.

Based on "mapHelper.model.selectedUuid" it is now possible to
show two seprate images for selected / deselected markers.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
ea5221bcf0 qrc: use a separate image for the selected and unselected markers
The image for the unselected marker is now a slightly darker flag.
Same behaviour as the current Marble implementation.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
476670cb8d mapwidgethelper: pass a QGeoCoordinate to the QML map
Rename the QML function "centerOnCoordinates" to "centerOnCoordinate"
and pass a QGeoCoordinate to it in ::centerOnDiveSite().

This will prevent the creation of a QGeoCoordinate object on the
QML side and instead it will be created in C++.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
f44645b6fe maplocationmodel: store the coordinate as QGeoCoordinate
Instead of maintaining a seperate latitude/longitude values
in C++ and passing them to QML separatelly, pass them as a QGeoCoordinate.

This reduces the number of model "roles" and also prevents the creations
of extra objects in QML (e.g. via QtPositioning.coordinate(..)).

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
d783984443 mapwidget.qml: implement the MapItemView with delegate
MapItemView is the QML class that handles the "create map markers based
on a model". In this case the model is created as part of the
MapWidgetHelper, so here passing "mapHelper.model" to the "model"
property is enough.

The delegate receives coordinates from the model as "model.latitude",
"model.logitude" and converts them to QGeoCoordinate.

The "sourceItem" image for the delagete is just an image ATM and is
fetched from QRC.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
2cb8fee827 add the SPDX-License-Identifier to new source files
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
0678e5936c mapwidget.qml: implement some map animation
When calling centerOnCoordinates() the map will now animate over a
period of 3 seconds the zoom level and over 2 seconds the center
of the map.

Can be tweaked and improved later on.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
5f2e60142a mapwidget.qml: add the function centerOnCoordinates()
This function can be called to center the map on a specific coordinates.
For the C++ version call it via QMetaObject::invokeMethod() in
centerOnDiveSite().

TODO: add QML property animations.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
5266a5e84b MapWidget.qml: reference the Map object in the MapWidgetHelper object
The idea here is that the Map object can be controlled from C++ via
the "m_map" private member. Also, for the mobile version, QML code can
call the same C++ methods (if marked as Q_INVOCABLE).

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
0d75dec0fa MapWidget.qml: create an instance of MapWidgetHelper
This instance in the QML code itself will be accessed by both the
mobile and desktop version. That way, the map code between
the two Subsurface versions will be shared.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
ccaaff42a3 mapwidget.qml: enumerate the ESRI map types of interest
Add a local "enumeration" (object) for the two possibly map types
of interest: SATELLITE and STREET.

Use SATELLITE by default.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
e9d4bdcf4e map: use Item instead of Rectangle in MapWidget.qml
The root element is now an Item and also doesn't have explicit
anchors and dimensions as these will be handled by the parent:
- on desktop: a QQuickWidget
- on mobile: any QML based QQuickItem

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
42980e51d3 map: add new marker resource image
This new marker image is free for use in Subsurface. Custom made
in CorelDraw and Photoshop.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
a73a56284c map: add placeholder MapWidget.qml in mobile-widgets/qml
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Jan Mulder
e6ee87efec Revert "QML UI: color the status bar correctly"
This reverts commit d22f67925e.
2017-07-28 07:30:44 -07:00
Dirk Hohndel
f3271c973f QML UI: remove obsolete debugging code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-26 06:31:14 -07:00
Jan Mulder
bb7dcc25c7 QML UI: remove "show password" switch and only show pw on first entry
Like the subject says. We do not want the password to be made
visible, so a switch to show it, is useless and is therefore
removed. Futher, the entry mode is set to PasswordEchoOnEdit,
which causes the passwd to be visible (for easy entry), but
can't be made visible again after save/end edit.

Fixes: #512

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-26 22:30:43 +09:00
Jan Mulder
e1e1c4b650 QML UI: remove some dead code
Removed some unused alias defines.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-26 21:57:11 +09:00
Jan Mulder
d22f67925e QML UI: color the status bar correctly
In commit e9503cfa3d re-coloring of the status bar was
forgotten. Added here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-26 21:57:11 +09:00
Joakim Bygdell
1ebd7dd430 QML UI: add missing id line in our button
The missing id line in our own button generates an error in log and makes the buttons to fat.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 14:13:22 +09:00
Joakim Bygdell
25fd8c1727 QML UI: use a lighter text color for the selected dive
Use the ligther text color on the secondary row of text when a dive is selcted in the divelist

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 14:13:22 +09:00
Joakim Bygdell
e9503cfa3d QML UI: use primaryColor instead of darkerPrimaryColor
In most places we wrongly used the darker primary color instead of the primary color.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 14:13:22 +09:00
Joakim Bygdell
0e0b5cee22 QML UI: replcae the "map it" button
Replace the "map it" button implementation with our own button.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 01:39:26 +09:00
Joakim Bygdell
9d2c4dcd3c QML UI: replace button on DC download page
Replace the generic buttons on the DC download page with our own.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 01:39:26 +09:00
Joakim Bygdell
4bcbe8e3a0 QML UI: add our own styled button
Add out own styled button as resource.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 01:39:26 +09:00
Joakim Bygdell
ae33422ede QML UI: replace all checkboxes with our own
As per title, helps simplify theme modifications.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 01:39:26 +09:00
Joakim Bygdell
fe425924e4 QML UI: add our own styled checkbox
Add out own styled checkbox as resource.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 01:39:26 +09:00
Joakim Bygdell
071db08b14 QML UI: replace all switches with our own
As per title, helps simplify theme modifications.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 01:39:26 +09:00
Joakim Bygdell
93ec03105e QML UI: add our own styled switch
This adds a switch styled for us, size is about the same as the material default.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-26 01:39:26 +09:00