summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml
AgeCommit message (Collapse)Author
2017-07-28mapwidget.qml: add zoom-in and zoom-out buttonsGravatar Lubomir I. Ivanov
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-28mapwidget.qml: ";" and variable declaration cleanupGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add double click on zoomGravatar Lubomir I. Ivanov
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-28mapwidget.qml: store the selected dives count in "nSelectedDives"Gravatar Lubomir I. Ivanov
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-28mapwidgethelper: emit a selectedDivesChanged() signalGravatar Lubomir I. Ivanov
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-28maplocationmodel: make setSelectedUuid() accept "fromClick" flagGravatar Lubomir I. Ivanov
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-28mapwidget.qml: call calculateSmallCircleRadius() on zoom changesGravatar Lubomir I. Ivanov
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-28mapwidget.qml: call "copy to clipboard" actions in the maphelper C++Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: open current location in Google MapsGravatar Lubomir I. Ivanov
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-28mapwidgetcontextmenu: add the actionSelected() signalGravatar Lubomir I. Ivanov
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-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-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-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-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-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: 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-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>
2017-07-28MapWidget.qml: reference the Map object in the MapWidgetHelper objectGravatar Lubomir I. Ivanov
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-28MapWidget.qml: create an instance of MapWidgetHelperGravatar Lubomir I. Ivanov
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-28mapwidget.qml: enumerate the ESRI map types of interestGravatar Lubomir I. Ivanov
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-28map: use Item instead of Rectangle in MapWidget.qmlGravatar Lubomir I. Ivanov
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-28map: add new marker resource imageGravatar Lubomir I. Ivanov
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-28map: add placeholder MapWidget.qml in mobile-widgets/qmlGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>