summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
AgeCommit message (Collapse)Author
2017-07-29Trivial log string correctionGravatar Jan Mulder
The PIN (and cloud account creation) is not limited to the desktop (any more). Correct the string accordingly. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-28Switch new files to unix line endingsGravatar Dirk Hohndel
I thought we had this automated, but Lubomirs commits introduced a few files with dos line endings. This is purely a change of line endings, no other changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-28map: whitespace cleanup in QML and C++ filesGravatar Lubomir I. Ivanov
- remove ";"s - remove {} where not needed or move them to the same line Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: track the coordinatesChanged() signal in QMLGravatar Lubomir I. Ivanov
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>
2017-07-28mapwidget.qml: use darker text color for the deselected markersGravatar Lubomir I. Ivanov
Use "lightgrey" instead of "white" for deselected markers. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: add new logic for zooming and editing supportGravatar Lubomir I. Ivanov
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>
2017-07-28mapwidget.qml: add visual tracking of editMode from MapWidgetHelperGravatar Lubomir I. Ivanov
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>
2017-07-28mapwidgethelper: add methods for editing MapLocationsGravatar Lubomir I. Ivanov
updateCurrentDiveSiteCoordinates() should be called from QML when a marker changed it's location. it emits the coordinatesChanged() signal, which should be tracked in the MapWidget class. The MapWidget class should emit the same signal to the MainWindow (Marble does that). editMode is now a boolean property, which should put the QML map into editing mode. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper: add the same logic for markers as in globe.cppGravatar Lubomir I. Ivanov
The marble globe tracks dive sites with the same name and discards such that are less than 50 meters apart. We already store names in MapLocation objects, but using a QMap<QString, MapLocation *> to check the names is probably faster with the expense of using more memory. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper: change centerOnDiveSite()Gravatar Lubomir I. Ivanov
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>
2017-07-28mapwidgetcontextmenu: slight increase of element sizeGravatar Lubomir I. Ivanov
Increase the font and element height a little to make it easier to click. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.qml: include map location textGravatar Lubomir I. Ivanov
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>
2017-07-28maplocationmodel: add the "namer" propertyGravatar Lubomir I. Ivanov
The MapLocation QObject now has a QString property "name", which is translating the dive_site->name member. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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-28mapwidgethelper: obtain a list of nearby divesGravatar Lubomir I. Ivanov
Based on a current location (MapLocation), iterate the dive list and add nearby dives (distance smaller than m_smallCircleRadius) to a local QList property (m_selectedDiveIds). 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-28mapwidgethelper: add means to obtain a small circle radiusGravatar Lubomir I. Ivanov
Based on a QGeoCoordinate, calculateSmallCircleRadius() calls some QML Map methods to obtain how big a circle is in meters if a circle is drawn over the Map widget with radius SMALL_CIRCLE_RADIUS_PX pixels. This is called a "small circle" of a sphere: https://en.wikipedia.org/wiki/Circle_of_a_sphere This "small circle" radius becomes huge if the map is zoomed out, while quite small if the map is really zoomed in. The idea behind this circle is to be able to select multiple nearby dives, when clicking on the map (TODO). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidgethelper: skip dive sites which are near each otherGravatar Lubomir I. Ivanov
Use QGeoCoordinate::distanceTo() to skip dive sites which are too close (50m) to dives sites which are already added as MapLocations. 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-28mapwidgethelper: add the method copyToClipboardCoordinates()Gravatar Lubomir I. Ivanov
This method uses the helper printGPSCoords() to format the coordinates of a location into either decimal or sexagesimal. The selection is handled by the boolean flag "formatTraditional" and the user preferences flag - prefs.coordinates_traditional. 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-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>