summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-07-28mapwidgetcontextmenu: rearrange some of the QML declarationsGravatar Lubomir I. Ivanov
- 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-28mapwidgetcontextmenu: add the ListView componentGravatar Lubomir I. Ivanov
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-28mapwidgetcontextmenu: add a listViewIsVisible integer propertyGravatar Lubomir I. Ivanov
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-28mapwidgetcontextmenu: add a model delegate for the ListViewGravatar Lubomir I. Ivanov
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-28mapwidgetcontextmenu: create a ListModel for the context menuGravatar Lubomir I. Ivanov
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-28mapwidgetcontextmenu: position the contextMenu on the mapGravatar Lubomir I. Ivanov
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-28mapwidgetcontextmenu: add an Image for the context menu toggleGravatar Lubomir I. Ivanov
- 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-28mapwidgetcontextmenu: add placeholder QMLGravatar Lubomir I. Ivanov
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-28qrc: use "MapWidget.qml" as a QRC aliasGravatar Lubomir I. Ivanov
Apparently, if it's required to import a QML component inside any QML file from resource, the compoment QRC alias has to have the same name as the component - e.g. add QRC alias MapWidgetContextMenu.qml allows creating a MapWidgetContextMenu compoment inside MapWidget.qml. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: move the new map type toggle on top of the mapGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: animate the map type toggle image on clickGravatar Lubomir I. Ivanov
Add a SequentialAnimation that performs a slight animation of the toggle image scale. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add an small icon (top-left) to toggle the map typeGravatar Lubomir I. Ivanov
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-28mapwidget.qml: simplify the map type enumeration into "mapType"Gravatar Lubomir I. Ivanov
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-28qrc: add a couple of images for the map type toggles (satellite/street)Gravatar Lubomir I. Ivanov
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-28qrc: yet another slight rename for the map markers resourcesGravatar Lubomir I. Ivanov
Use a "mapwidget-" prefix for both the QRC and the file names. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: use a seprate animation for zooming outGravatar Lubomir I. Ivanov
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-28mapwidget.qml: reduce the properies in mapAnimation to single linesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper.cpp: call deselectMapLocation() in QMLGravatar Lubomir I. Ivanov
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>
2017-07-28mapwidget.qml: don't use the onSourceChanged() slot for flag animationGravatar Lubomir I. Ivanov
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-28mapwidget.qml: add deselectMapLocation()Gravatar Lubomir I. Ivanov
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-28mapwidget.qml: remove some redundant "map." referencesGravatar Lubomir I. Ivanov
Inside the Map object, properties can be referenced directly. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add the animateMapTo() helper functionGravatar Lubomir I. Ivanov
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-28mapwidget.qml: use map.newZoom and map.defaultZoomInGravatar Lubomir I. Ivanov
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-28mapwidget.qml: whitespace and ';' cleanupGravatar Lubomir I. Ivanov
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-28mapwidget.qml: play little animation on marker clicksGravatar Lubomir I. Ivanov
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-28mapwidget.qml: update the Z order of selected markersGravatar Lubomir I. Ivanov
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-28mapwidget.qml: add some properties for zoom and centerGravatar Lubomir I. Ivanov
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-28mapwidgethelper: pass a MapLocation object to QML in centerOnDiveSite()Gravatar Lubomir I. Ivanov
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-28maplocationmodel: add the helper method getMapLocationForUuid()Gravatar Lubomir I. Ivanov
getMapLocationForUuid() accepts a UUID, searches the MapLocation table and returns a pointer. Make use of the new method in setSelectedUuid(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper: add a slot to handle marker selection from the modelGravatar Lubomir I. Ivanov
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>
2017-07-28mapwidget.qml: track the marker selectionGravatar Lubomir I. Ivanov
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-28maplocationmodel: add a "selectedUuid" property to MapLocationModelGravatar Lubomir I. Ivanov
Inside the QML Map class there is a MapItemView item. This item uses a delegate that receive a "model" property from the MapLocationModel, but infact that's a QObject with the MapLocation defined properties. That's how MapItemView works. The problem here is that "model" QObject cannot be cast back to a MapLocation as the meta data in there does not include a MapLocation sub-class, for some reason. Even if using propery() on that QObject to fetch data like coordinates works, instead of storing this strange object pointer, store the MapLocation UUID (from dive_site) which is a uint32_t. setSelectedUuid() deals with this oddity and finds the correct MapLocation pointer in the table and dispatches a selectedLocationChanged() signal for it. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: add a "uuid" property to MapLocationGravatar Lubomir I. Ivanov
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>
2017-07-28qrc: use a separate image for the selected and unselected markersGravatar Lubomir I. Ivanov
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-28mapwidgethelper: pass a QGeoCoordinate to the QML mapGravatar Lubomir I. Ivanov
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-28maplocationmodel: use QVector for the MapLocation storageGravatar Lubomir I. Ivanov
QVector is faster, use it for "m_mapLocations" instead of QList. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: small whitespace cleanupGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: add the addList() methodGravatar Lubomir I. Ivanov
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>
2017-07-28mapwidget: call MapWidgetHelper::reloadMapLocations()Gravatar Lubomir I. Ivanov
MapWidgetHelper::reloadMapLocations() is now called from MapWidget::reload() and MapWidget::repopulateLabels(). The mobile version should do similar. NOTE: These MapWidget methods names are from the Marble "port". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper: add the reloadMapLocations() methodGravatar Lubomir I. Ivanov
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>
2017-07-28maplocationmodel: store the coordinate as QGeoCoordinateGravatar Lubomir I. Ivanov
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-28mapwidget.qml: implement the MapItemView with delegateGravatar Lubomir I. Ivanov
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-28maplocationmodel: implement the clear() and add() methodsGravatar Lubomir I. Ivanov
- add() will be used to add a MapLocation to the model with beginInsertRows()...endInsertRows() - clear() will be used to clear the model with beginRemoveRows()... endRemoveRows() NOTE: emiting dataChanged() does not seem to update the QML view for this model so calling being<..>Rows() seems to be the "correct Qt approach" to do this. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.cpp: register the MapLocation and MapLocationModel typesGravatar Lubomir I. Ivanov
Apparently the "safe way" is to register C++ types is before the QML code has loaded. The idea here is that the QML code should know about these type definitions and be able to operate with them. TODO: do the same for the mobile version. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28qmlmapwidgethelper: maintain an instance of MapLocationModelGravatar Lubomir I. Ivanov
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>
2017-07-28qt-models/cmake: build maplocationmodel.cppGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28qt-models/maplocationmodel: add new classes for map model based handlingGravatar Lubomir I. Ivanov
The QML Map widget requires a QAbstractListModel based model to operate with good performance. Technically gpslistmodel.cpp can be used for that same purpose (e.g. has GPS coordinates), but the way it updates may complicate the Map widget integration. Thus, a new model is created - MapLocationModel, with items of type MapLocation, for an attempt for a clean project structure on the C++ side. For now it only handles latitude and longitude. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28add the SPDX-License-Identifier to new source filesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: implement some map animationGravatar Lubomir I. Ivanov
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-28mapwidget.qml: add the function centerOnCoordinates()Gravatar Lubomir I. Ivanov
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>