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>
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>
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>
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>
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>
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>
In commit e76f527fe5, 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>
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>
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>
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>
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>
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>
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 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>
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>
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>
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>
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>
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>
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>
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>