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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>