aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets
AgeCommit message (Collapse)Author
2017-09-04Unify credential statesGravatar Jan Mulder
Having two different enums around with more or less the same definition has lead to unclear code. After removing two not needed states on the mobile end, the remaining step to one enum for the credential state becomes almost is simple rename operation. Unfortunately, I do not know a way to embed a plain C enum from pref.h into the QMLManager object. So after this, there are still 2 enums around, but now identical. This commit is not changing any functionality. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04mobile: remove superfluous state INCOMPLETEGravatar Jan Mulder
And here, the removal of a second superfluous state from QMLManager. This is true no-brainer. While this state was set once troughout the entire mobile code, it was never tested for this state. Testing shows that it is safe to change to the UNKNOWN state. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04mobile: remove superfluous state VALID_EMAILGravatar Jan Mulder
This is a no-brainer removal of the VALID_EMAIL state used in QMLManager. All current usage of this state is "if state is VALID or VALID_EMAIL", so there is no distinction between the two states. It is even a little different. The comment suggests "when we can open a local cloud storage, tied to a cloud account (so explicitly not the no-cloud status), we have at least a valid email". While this is formally true, this implies that there is also a cloud account on the cloud server (ie. the cloud account is in a VERIFIED state). In other words: currently, there can't exist a valid local storage that is tied to a valid email adress, without valid cloud account on the server. Notice that this touches the discussion on GitHub for commit e76f527fe530636 (pull request #520). Can we implement the creation of a valid cloud account without data link to the cloud server? Currently, we need the server to confirm the email address (for example for uniqueness reasons on server side). Obviously, we could hack our way out of this, but we have a perfect solution already in place. Create a no-cloud account, and transfer that later to a true and valid cloud account. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04mobile: go to the correct credential stateGravatar Jan Mulder
When we want to go the NOCLOUD credential state, do not go the incorrect INCOMPLETE state. This is the first in a series of unraveling the preference parameter prefs.cloud_verification_status and the data that is carried around in the QMLManager::credentialStatus_t. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04QML UI: set the title of the right objectGravatar Jan Mulder
Intended was here to set the title of the Dive list with id: page, instead of the startpage object. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-08-26Adjust signature to match data we needGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26MapWidget works with slightly older QtQuick2Gravatar Dirk Hohndel
This allows building against older Qt. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-24mapwidgethelper: use system_default_directory() for cacheGravatar Lubomir I. Ivanov
The default location which is used when the PluginParemeter "googlemaps.cachefolder" is not specified should be ~/.cache/googlemaps on Linux or /user/<name>/appdata/local/cache/googlemaps on Windows. This patch moves the cache to the default system location where we store the printing templates, cloudstorage and the default user XML file. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-24mapwidgethelper: use dynamic creation of the Plugin objectGravatar Lubomir I. Ivanov
The googlemaps plugin is about to support tile language via the PluginParameter 'googlemaps.maps.language'. To be able to pass the subsurface UI language (obtained from the uiLanguage() helper) the Plugin has to be created dynamically, only *after* the MapWidgetHelper is created. MapWidgetHelper::pluginObject() now provides a QString which contains the Plugin object and also include the uiLanguage ISO value. This string is used in mapwidget.qml as: map.plugin = Qt.createQmlObject(pluginObject, rootItem) This creates the Plugin object dynamically with the proper UI language string, but also requires a couple of small changes: - move the declaration of map.mapType after the Qt.createQmlObject() call - assign map.activeMapType after map.mapType has a value Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-10mapwidgethelper: fix wrong logic in selectVisibleLocations()Gravatar Lubomir I. Ivanov
Looking for already existing locations with m_mapLocationModel->getMapLocationForUuid() will not cover dive sites which are too close to each other and are skipped when creating MapLocations. See reloadMapLocations() and the usage of MIN_DISTANCE_BETWEEN_DIVE_SITES_M. Constructing a new QGeoCoordinate for the already retrieved dive site (ds) coordinates ensures that we are traversing *all* dive sites at the backend and not only those visible on the map. Fixes the issue where not all dives in the DiveList are selected, even if a dive clearly happened on a location currently visible in the map viewport (map -> context menu -> select visible dive locations). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-10mapwidget.qml: more improvements for the dynamic zoom-in/outGravatar Lubomir I. Ivanov
The QML Map has a couple of methods - toCoordinate(someQPointF) and fromCoordinate(someQGeoCoordinate). Ideally, if one passes a point to toCoordinate() and then attempts to convert the resulted coordinates back to the point, the same point in the Map view port with minimal error should be retrieved. That's not always the case - e.g. near 47.400200 -123.142066, which means that the methods are not exactly *reliable* and there might be Map class bugs at hand. The new zoom-in and zoom-out improvements try to work around the above: - for both centerOnRectangle() and centerOnCoordinate(), if no good zoom-out level is found (newZoomOut), the zoom-out is set to the default value of defaultZoomOut. In practice, this prevents the case where the map does not zoom-out at all when going from one place to another - centerOnRectangle() now uses rectangle diagonals to estimate a fit, instead of checking if 2 points (top-left and bottom-right) are visible in the viewport. The usage of fromCoordinate() was giving bad results in this case and comparing distances (diagonals) is more reliable but more expensive on the CPU. Due to the inconsistencies of toCoordinate() and fromCoordinate() the dynamic zoom-in and zoom-out are still not ideal, but the current implementation is somewhat usable with decent accuracy. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-10DiveList.qml: set detailsWindow index before deleting dive from listGravatar Rick Walsh
This appears to fix the mystery crashes that can occur when deleting a dive from the dive list. Fixes: #497 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-08-07QML UI: GPS: remove headerGravatar Joakim Bygdell
Being the only page that still has an on page header it makes sens to remove it. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-07QML UI: GPS: remove marginsGravatar Joakim Bygdell
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-07DiveDetailsEdit: make sure model data existsGravatar Rick Walsh
This gets rid of TypeError messages, but does not appear to affect behaviour qrc:///qml/DiveDetailsEdit.qml:254: TypeError: Cannot read property 'dive' of null qrc:///qml/DiveDetailsEdit.qml:228: TypeError: Cannot read property 'dive' of null qrc:///qml/DiveDetailsEdit.qml:216: TypeError: Cannot read property 'dive' of null qrc:///qml/DiveDetailsEdit.qml:204: TypeError: Cannot read property 'dive' of null Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-08-07mapwidget.qml: add menu action for selecting visible locationsGravatar Lubomir I. Ivanov
MapWidgetContextMenu now has a new action (SELECT_VISIBLE_LOCATIONS), that will invoke the MapWidgetHelper method selectVisibleLocations(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidgethelper: add the selectVisibleLocations() methodGravatar Lubomir I. Ivanov
The new method selectVisibleLocations() contains a routine to find all visible MapLocation objects in the Map viewport and select the dives associated to said MapLocation objects. This method is to be invoked from the QML context menu. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidget.qml: implement centerOnRectangle()Gravatar Lubomir I. Ivanov
First, this function calculates the zoom out effect until both the current Map center and the target rectangle are visible - see the "calculate zoom out" part. Then it calculates a zoom level, so that the target rectangle fits the viewport, but also so that the zoom is not too much (clamped). see the "calculate zoom in" part. NOTE: "centerStored" (the variable used to store the current map center) is created using QtPositioning.coordinate(), because the code needs a new object and not a reference of the map.center QGeoCoordinate object. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidget.qml: add a couple of helpersGravatar Lubomir I. Ivanov
Add stopZoomAnimations(), which is really just a precaution function to make sure we have stopped all animation of the map before doing calculations! Since the animation *should* be running in a separate thread, this would make sure the Map "center" and "zoomLevel" properties do not change. Add pointIsVisible(), which is a helper to determine if a point created by map.fromCoordinate() method is inside the viewport. fromCoordinate() has to be called without the "false" (clip) flag for this to work. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidgethelper: support tracking of all selected dive sitesGravatar Lubomir I. Ivanov
MapWidgetHelper::centerOnDiveSite() now checks if more than one dive sites are selected and finds the most top-left and bottom-right ones in the coordinate system to form a rectangle. It also supports the special cases where a selected dive site does not have coordinates or the case where only a single dive site with GPS coordinates are selected. TODO: implement mapwidget.qml::centerOnRectangle() This QML function will receive a QGeoCoordinate based rectangle which has to be centered in the viewport with animation. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidget.qml: add better error reporing on a missing map pluginGravatar Lubomir I. Ivanov
For instance, if the 'googlemaps' geoservices plugin is missing a new message is now shown: "qml: MapWidget.qml: cannot find a plugin with the name 'googlemaps'" Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-07mapwidget: use "satallite" maps instead of "hybrid"Gravatar Lubomir I. Ivanov
Do so until the following issue is resolved: https://github.com/vladest/googlemaps/issues/9 With the satellite map ([1]), the black tiles at relatively high zoom levels over the Red Sea cannot be seen. Instead it shows white tiles at the ultra-maximum zoom level at places. As a side note, the "satellite" map does not have the country labels which the "hybrid" map has. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-03QML UI: Settings: remove more marginsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-03QML UI: CloudCredentials: better use of spaceGravatar Dirk Hohndel
No idea why this was restricted to be so narrow. Also, making the font of the label smaller and lighter seems visually more pleasing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-03QML UI: remove unnecessary marginGravatar Dirk Hohndel
This makes better use of the available space. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-03QML UI: remove unused codeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-02Merge branch 'googlemaps' of git://github.com/neolit123/subsurface into ↵Gravatar Dirk Hohndel
googlemaps
2017-08-02QML UI: dive edit autocompleteGravatar Joakim Bygdell
This makes sure that the autocompleting comboboxes never displays the scroll list where the user can pick an entry, and as such forces the view of a autocompleting textfield from the users point of view. The reasoning is that when scrolling in the drop down list it it possible to scroll to far and thus abort the ongoing edit by flicking away the edit page. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02QML UI: add more width to dive edit pageGravatar Joakim Bygdell
Mobile devices hare rather limited when it comes to screen size, there is no point in reducing the availabel space more than neccecary. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02QML UI: loose focus on endEditModeGravatar Joakim Bygdell
This handles a cornercase where a user starts editing and then cances the divedit followed by a return to edit mode. The previously acive textfield would then be active again even though all changes are lost. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02QML UI: make sure textfields loose focusGravatar Joakim Bygdell
For some reason the textfields on dive edit page did not loose focus when editing ended by press on the return key. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02QML UI: autocomplete objects should lose focus on selectionGravatar Joakim Bygdell
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>
2017-08-02QML UI: decrease fontsize on dive editGravatar Joakim Bygdell
Decrease the fontsize of the static text on the dive edits page. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02QML UI: enable modification of ratingsGravatar Joakim Bygdell
This enables editing of visibility and ratings for a dive. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02QML UI: display rating and visibility starsGravatar Joakim Bygdell
Display rating and visibility stars on the dive details page. See #495 Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-02Add star iconsGravatar Joakim Bygdell
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>
2017-08-02mapwidget.qml: use a custom built googlemaps pluginGravatar Lubomir I. Ivanov
This patch makes use of the geolocation plugin "googlemaps" for Qt Location with source code from here: https://github.com/vladest/googlemaps The change from the ESRI plugin is that it requires new indexes for the Hybrid ([3]) and Street ([0]) map types. There are more zoom levels in this plugins, but our default zoom-in settings seem to transition well to it. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-31Smaller buttons on map widgetGravatar Robert C. Helling
... so they take up less space while still being clickable. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-07-31QML UI: stop showing location labels earlierGravatar Dirk Hohndel
We are stepping by 2 - so 11 makes it clear that at 12 the labels are shown, but at 10 they are not. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-31mobile: make sure old credentialStatus is definedGravatar Jan Mulder
In commit e76f527fe53063, the scenario of switching between 2 already VERIFIED cloud accounts was identified, which was working poorly. It needed a restart of the app to get the new account visible. Reason for this, was the setting of the credentialStatus to the value of an undefined (never set) old credentialStatus. This commit makes sure we have a defined credentialStatus, just before changing it to the new one. A really mini step forward, as the behavior is still not perfect. Now, the user has to select the dive list manually, after entering credentials of the new clould account. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
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>