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>
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>
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>
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>
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>
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>
Back when I wrote this code I made a typo. This fixes it.
Reported-By: Alexander Gottwald <jugendtrainingtsck@gmail.com>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
When I unified the sample pressures in commit 11a0c0cc70 ("Unify
sample pressure and o2pressure as pressure[2] array") I did all the
obvious conversions, including the conversion of the Poseidon txt file
import:
case POSEIDON_PRESSURE:
- sample->cylinderpressure.mbar = lrint(val * 1000);
+ sample->pressure[0].mbar = lrint(val * 1000);
break;
case POSEIDON_O2CYLINDER:
- sample->o2cylinderpressure.mbar = lrint(val * 1000);
+ sample->pressure[1].mbar = lrint(val * 1000);
break;
which was ObviouslyCorrect(tm).
But as so often is the case, obvious doesn't actually exist. The old
"o2cylinderpressure[]" model had an implicit sensor associated with it,
and that implicit sensor mapping wasn't obvious, and didn't get fixed.
It turns out that the way the Poseidon sensor mapping works, the O2
cylinder is cylinder 0, and the diluent cylinder is cylinder 1, so just
use the add_sample_pressure() helper to set both sensor index and
pressure value.
And since we now do all the sensor indexing right, we can also get rid
of some manual cylinder sample pressure code, because the generic dive
fixup will just DTRT. It used to screw up because the diluent sensor
number was wrong before, and the import code tried to work around that
by hand.
Reported-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
...even when not showing transitions, this makes the
first stop look more like a stop (since it does not include
several minutes of ascent).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Build in a 'build' subdirectory and use the INSTALL_ROOT. Also make sure
you find qmake on custom Qt installations.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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 would work only if the folder:
$BASEDIR/"$MXEDIR"/usr/i686-w64-mingw32.shared/qt5/plugins/geoservices
contains such a file.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The source code is pulled from the forked repository at:
git@github.com:Subsurface-divelog/googlemaps.git
It's rebased if needed, build using 'make -j4' and then
installed.
Signed-off-by: Lubomir I. Ivanov <neolit123@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>
Until we get some solution from upstream this patch to Kirigami hides the action button when the keyboard is visible.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Calling access() makes no sense at all on android, but this atleast
fixes a compilation error on ndk 15+.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
In the serial api for libdivecomputer is ok to send NULL as the int
pointer actual, if you dont't care about how many bytes that where
actually read or written.
This makes sure we don't crash if the ble backend where ever used with
such a backend.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
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>
This is really unrelated to my recent "multiple gas pressures" work, but
the test case from Gaetan Bisson showed that the logic for which
cylinders to show in the equipment tab was less than optimal.
We basically used to show only cylinders that were actively used, unless
you had the "display_unused_tanks" preference option set. That comes
from some dive computers reporting a *lot* of cylinders that the diver
really doesn't even have with him on the dive. And showing those extra
dummy cylinders gets pretty annoying after a time, which is why we
default to not showing unused tanks.
However, in Gaetan's case, he had a total of four cylinders on the dive:
the O2 and diluent bottle for the rebreather dive, and then bailout
bottles (both air and deco). And while the bailout bottles weren't
actually used, Gaetan had actually filled in all the pressure details
etc for them, and so you'd really expect them to show up. These were
*not* just some extraneous default cylinder filled in by an over-eager
dive computer.
But because the bailout wasn't used, the manual pressures at the end
were the same as at the beginning, and the "unused cylinder" logic
triggered anyway.
So tweak the logic a bit, and say that you show cylinder equipment not
only if it has been used on the dive, but also if it has any pressure
information for it.
So the o nly cylinders we don't show are the ones that really have no
interesting information at all, except for possibly the cylinder tank
type itself (which is exactly what the over-eager dive computer case
might fill in, usually in the form of a default cylinder type).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So the manual gas pressure case keeps showing issues, and in many ways it
really is a fairly complex thing, since it needs interpolation of the
intermediate pressures - possibly over several gas changes.
So you might have beginning and ending pressures for one cylinder, but
then use another cylinder in between.
We've historically got all the code to do this, but the big rewrite for
multiple cylinder pressures didn't get all the details right, and so
here's a few more fixes for the case that was shown by a dive by Robert
Helling. Hopefully we're approaching the old code situation, except now
with concurrent gas pressure handling support.
Reported-by: Robert Helling <helling@atdotde.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The core to plot manually entered pressures without any sample data did
the obvious thing: it ended the pressures at the end of the dive as
indicated by the last sample.
However, that obvious thing didn't actually work, because sometimes the
last sample is long long after the dive has actually ended, and we have
no plot_info data for that.
This depends on the dive computer used: most dive computers will not
report samples after the end (even if they may internally remember them
in case the diver just came up to the surface temporarily), but some
definitely do. The OSTC3 is a prime example of that.
Anyway, the code was fragile and wrong - even if passed a time past the
end of the plot_info data, "add_plot_pressure()" should just have
associated that with the last entry instead. Which also allows us to
simplify the whole endtime logic entirely, and just use INT_MAX for it.
Gaetan Bisson's test-case also showed another oddity: we would plot the
gas pressure even for cylinders that had no has use (ie beginning and
ending pressures were the same). That's kind of pointless in so many
ways. So limit the manual pressure population to cylinders that
actually have seen use.
Reported-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Google Maps API V3 *does* require a key if one needs to generate
a lot of payed trafic and monitor said trafic, otherwise it doesn't:
https://stackoverflow.com/a/8785844
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>