Commit graph

12 commits

Author SHA1 Message Date
Dirk Hohndel
ea83b5ed37 Core: remove dive.h from files that don't need it
Of course, quite a few of them indirectly get it through other header
files.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14 10:13:39 -07:00
Lubomir I. Ivanov
48c032bb8e mapwidget-mobile: do not animate the first selection
centerOnLocationHard() is added in MapPage.qml so that
on `firstRun` the map is hard panned to the desired location
without animation.

This affects the selection of a new "Dive details" -> "Map it" or
when opening a GPS location in the map.

The idea behind this change is to avoid starting the map animation
from an arbitrary location such as [0,0] or London. Also, to not
start the map zoomed out completely and then zoom in on a selected
dive.

For this change to work, add the helper getCoordinatesForUUID()
to qmlmapwidgethelper.cpp/.h and use it to obtain the
QGeoCoordinates for a dive site UUID.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-04-02 13:47:43 -07:00
Lubomir I. Ivanov
fbbb6ba4fb qmapwidgethelper: make adjustmets for the mobile version
The mobile version is limited as it does not support dive list
selection of multiple dives and editing multiple dives.

Also the dive list on mobile does not follow the same indexing as
the desktop version dive list.

Use the SUBSURFACE_MOBILE macro and for:
- centerOnDiveSite() either deselect map markers or center on
a single one (never on a rectangle like the desktop version)
- selectedLocationChanged() and selectVisibleLocations() return
a list of single dive ID

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
8fa2295a61 qmapwidgethelper: add centerOnDiveSiteUUID()
centerOnDiveSiteUUID() is a helper to center the map on a dive_site
UUID instead of a dive_site pointer.
Make it call centerOnDiveSite().

Make both this function and reloadMapLocations() Q_INVOKABLE
as these are going to be called from QML.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
eb8772d967 qmapwidgethelper: move includes to the header
Add the following includes in the header -
<QVariant> and <QGeoCoordinate> otherwise the
mobile build fails.

It is unclear how the desktop build does not complain
about this.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Jan Mulder
92a5e0644e cleanup: Uninitialized pointer field
CID: 208335

Mainly to silence Coverity, as I do not believe this caused
any problem.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-28 17:30:25 +01:00
Lubomir I. Ivanov
8bc61f42cb map-widget: use 'getter' function coordinate() for MapLocation
Avoid using qvariant_cast() with getRole() in favor of
MapLocation::coordinate() in MapWidgetHelper::reloadMapLocations().

This makes the code more readble.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-27 22:59:22 +01:00
Lubomir I. Ivanov
b564debe21 map-widget: start dive site editing with coords pre-entered
Once the user starts editing a dive site, make sure to pass
coordinates of either the current map center (if a new MapLocation
is being added) or the coordinates of the existing MapLocation.

The "Dive site management" coordinates text field would receive
these new coordinates after the displayed_dive_site struct
is updated and the coordinatesChanged() signal is emitted.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-27 22:59:22 +01:00
Lubomir I. Ivanov
d9cfcae88b map-widget: move the map with the edited dive site
Once the user starts editing the coordinates by hand
(from the "Dive site management" UI) make sure to
update the map to center on those user entered
coordinates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-27 22:59:22 +01:00
Lubomir I. Ivanov
746874a78e map-widget: allow real-time updates of edited markers
This patch allows updating the location of map markers
while editing a dive site and updating the text in the
LocationInformationWidget in real-time.

Currently it is only possible to see the marker changes by
clicking 'Apply'.

The modification required the following changes:
- add the MapWidget::updateCurrentDiveSiteCoordinatesToMap() slot
and call it each time the GPS text updates
- separate the updateCurrentDiveSiteCoordinates(FromMap/ToMap) logic
by having the FromMap/ToMap suffix to method names
- make MapWidgetHelper::updateCurrentDiveSiteCoordinatesToMap()
call a new MapLocationModel::updateMapLocationCoordinates()
method, which updates selected location coordinates and the model
- add MapLocation::setCoordinateNoEmit() that does not emit
a signal when updating a coordinate

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-09 12:40:25 -08:00
Lubomir I. Ivanov
89ccdc3178 map-widget: use current center when editing new markers
When starting to edit a new dive location, create
a marker at the current map center instead of zooming
out and centering on the 0,0 coordinate.

This will help (and speed up) a lot the edition,
if the user needs to add numerous dive markers
at a specific location close to each other.

refs #754

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-09 12:40:25 -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
Renamed from mobile-widgets/qmlmapwidgethelper.cpp (Browse further)