aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml
AgeCommit message (Collapse)Author
2017-10-17mobile: No cloud repo creation more explicitGravatar Jan Mulder
Before this change, there was only one way to create the local no cloud repo on the device. The user needed to add at least one dive to the no cloud account (so that there is something to save). While this worked in some scenarios, it could also get things in an inconsistent state: credential status = CS_NOCLOUD but no local repo. This was a dead end. In this commit, the creation of the no cloud repo is made more explicit. When asking for no cloud mode, just create an (empty) repo for it when it does not yet exist, and otherwise, just open the existing (possibly empty) repo. Now, a user can have no cloud repo, next to (any number of) cloud accounts. This leaves one functional aspect left: how does a user abandon the no cloud repo, by merging his data into a true cloud account. This is code for this, that tries to do this merge in a smart way. This seems to be broken (too). To be clear: this is no part of this commit. Fixes: #667 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-15qml-icons: add a third, grayed-out map markerGravatar Lubomir I. Ivanov
It can be difficult to distinguish the new marker which is added on the map and has to be dragged when editing a new dive location. By adding a new grayed-out marker it becomes possible to gray out all other markers, while the current marker which is being edited is still bright red. Suggested-by: Dietrich Meyer <dietrich@sunnynames.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-15qml-icons: make mapwidget-marker.png even darkerGravatar Lubomir I. Ivanov
This is done so that a de-selected marker is better distinguished from the selected marker. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-15mapwidget.qml: fix weird MouseArea bug in MapItemViewGravatar Lubomir I. Ivanov
The QML map uses MapItemView. MapItemView needs a delagate in the form of a MapQuickItem. The MapQuickItem needs a 'sourceItem' which would be used as the visual (e.g. marker) on the map. If the root sourceItem is of type Item, the marker becomes non-clickable. If the root sourceItem is an Image, the clicks work. This patch removes the root Item, which makes the code less organized, but at the same time it fixes the bug. Bug reproduced on the following Qt versions on Ubuntu: 5.5.x, 5.7.x Bug cannot be reproduced on Qt 5.9.x on Windows. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-12mobile: enable switching BT on/off during session.Gravatar Jan Mulder
This commit implements possible switching BT on and off during a session, so not needing a restart of the app when the user forgot to switch it on when starting the app. For this, the following needed to be done: 1) create a handler that reacts on local BT device status changes. 2) repopulate the connection list in the download screen when a BT status change is detected. Notice the subtile change of the Q_INVOKABLE btEnabled() function to a Q_PROPERTY. This gives a nice dynamic behaviour when switching BT on/off with the app open. Fixes: #556 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-09QML UI: add missing iconGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07map-widget: don't crash if the map QML failed to loadGravatar Lubomir I. Ivanov
If the QML modules for QtLocation and QtPositioning are missing the QML in mapwidget.cpp will fail to load, which can lead to crashes. To solve the issue check if the QML has loaded and set a flag 'isReady' to true. If the loading has failed load another QML which is for showing a red error text in the lines of `MapWidget.qml failed to load!`. If the map QML has failed, use a macro in all relevant MapWidget members to turn them into a NOP. This approach leaves the rest of the codebase intact - e.g. no checks in classes which connect to the MapWidget class. Fixes #596 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-07QML UI: open v2 user manualGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05WhitespaceGravatar Dirk Hohndel
This commit is empty when shown with '-w' - it just updates the indentation after commit c00804eff6 ("QML UI: always start edit at top of page"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05QML UI: always start edit at top of pageGravatar Dirk Hohndel
When starting to edit / add a dive, the Flickable needs to be positioned at the top of the page, not the last position shown. For clarity I'll do the re-indentation in the next commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05QML UI: add transition when switching to edit modeGravatar Dirk Hohndel
The hard switch was not ideal. This isn't perfect, yet, but a step in the right direction. The 'transitions' to change the visibility properties are a bit odd, but that's how it's done in the examples as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04QML UI: download icon in main menuGravatar Dirk Hohndel
We need a white path drawn on the dark action button, but a black path drawn for the main menu. (looks like a white space change snuck in here) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04QML UI: make edit page scrollableGravatar Dirk Hohndel
And have a tiny bit of space around it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04QML UI: change the dive edit to not be an overlayGravatar Dirk Hohndel
This way the accidental closing of the edit (and loss of data) should no longer happen. See: #495 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04QML UI: top padding for dive detailsGravatar Dirk Hohndel
This used to work without manually adding space here. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04QML UI: avoid warning before currentTheme is setGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04QML UI: adjust icon namesGravatar Dirk Hohndel
These changed in Kirigami. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-29QML UI: cleanup some whitespace and string formattingGravatar Jan Mulder
This addresses some review comment on whitespace and translated string formatting. In the string formatting, a tiny additional change is made. I wanted the email address in the explanation text in a bold font. Using the HTML <b> for this, removed the /n newline characters in the output. Apparantly, mixing these two formatting styles does not work. No problem, replaced the /n to HTML style too. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29QML UI: rework single credential page to two pagesGravatar Jan Mulder
This commit tries to implement most of issue #515. It reworks the one credential page, which its dynamic PIN part, into two pages. Main driver of selecting one of the two pages is the showPin boolean. Page 1 contains the email/passwd field (and the option to use a no cloud setup). Page 2 only contains the PIN part (and the option to cancel the process). The Kirigami central button does not seem very handy here. We need, for example, a cancel, sign-in and register, only register, etc. buttons, which are not easy to handle in specific icons. Therefore, normal pushbuttons are chosen to deal with user interaction, and the Kirigami button is removed from these pages. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29QML UI: rework cloud credentials blockGravatar Jan Mulder
Previously, we could edit the cloud credentials in basically two places. At startup of the app from a fresh install (and no previous data on the device), and from the settings. Issue #515 proposes only one way. However, we need a way to access the new credential UI pages, so that the pages at a fresh install of the app can be reused, for example for account switching. This commit replaces the settings cloud credentials block by a simple (not editable) display of the current credentials, and a button to access the initial pages, for all management tasks on the credentials. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29mobile: initialize credential data in one placeGravatar Jan Mulder
It appears that the onCompleted of the StartPage item is triggered before the onCompleted of the rootItem. This is logical as the Startpage is a child of the rootItem. And, yes, this does matter. As the divelist also contains the logic for initial cloud registration (and is the default page shown in a state where the cloud credentials are valid (CS_VERIFIED state)), we need to know the correct credential state at start of the app. The move of this one line of code makes sure of that, in addition to setting the credential state from the preferences. Now, the setupActions function can reference correct credential data. This is further preparation for a better cloud creation process from mobile. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-16mapwidgetcontextmenu: use a QtQuick 2.0 importGravatar Lubomir I. Ivanov
Following on beb0d5703a0e, the context menu seems to work fine with a much older QtQuick import - version 2.0. The 2.7 import is technically a development leftover and a minimal version should have been considered earlier. On older Qt setups (e.g. 5.5.x) this might throw a: 'module "QtQuick" version 2.6 is not installed' Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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 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-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 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-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-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>