- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
If a divesite doesn't have a GPS location we want to deselect
the currently selected markers and zoom out the map. In the Map
QML object the function deselectMapLocation will handle that.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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>
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>
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>
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>
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>
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>
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>
When MapLocationModel updates the selected marker, MapWidgetHelper now
receives a signal. The slot is named selectedLocationChanged().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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>
The "uuid" property will be the one from the dive_site. At first it
will also be used to track the active marker/flag selection.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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>
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>
This method should be used if many markers are added at once.
It's main purpose is to reduces the number of beingInsertRows()
calls.
Make MapWidgetHelper::reloadMapLocations() use it.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
reloadMapLocations() is the method which is called when the list
of markers (model) should be cleared and re-populated with new MapLocation
objects.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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>
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>
The idea here is that the QML code should be able to fetch a model
from the MapWidgetHelper instance which is instantiated inside the
QML code; fetch it in the lines of "mapHelper.model".
This way, updates at the backend would be reflected on the Map QML widget.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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>
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>
MapWidget sould not handle any of the map backend.
Instead it should just pass calls to MapWidgetHelper.
Do that for centerOnDiveSite().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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>
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>
The idea with this class is that it should be used by both the mobile
and desktop version.
TODO STEPS:
1) the class should be registered in both the mobile and desktop version
with qmlRegisterType<MapWidgetHelper>...
2) the MapWidget.qml should create an instance of this class.
3) this way the helper will be part of the QML and both the desktop and
mobile version can have access to it.
4) the desktop version as a first implementation can just use findChild()
in desktop-widgets/mapwidget.cpp.
5) desktop-widgets/mapwidget.cpp on the desktop should just translate
calls from the rest of the desktop-widgets to this helper class.
6) the mobile version access to this object would be easy but is off the
scope for now.
7) the idea, when implementing the desktop support is to make it so
that when implementing the mobile version later, no or only minimal
changes would be required to the MapWidgetHelper class.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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>
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>