Commit graph

12511 commits

Author SHA1 Message Date
Robert C. Helling
515b7b5fea Allow for o2 breaks in binary search stop time finder
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29 06:49:44 -07:00
Robert C. Helling
33fa336be6 Find deco stop time by binary search instead of iteration
This allows to go to much smaller granularity without severe
performance penalty. It should also increase performance for
long decompression times.

Currently this leads to missing cached tissue factors, the caching
has to be adopted to this.

Also, for the time being this breaks the bottom gas breaks feature.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29 06:49:44 -07:00
Robert C. Helling
82aac4efff Make plan take dive and decotimestep as arguments
...rather than use a global variable and a macro.

This should be a no-op in preparation to allow planning
several versions of a dive.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29 06:49:44 -07:00
Robert C. Helling
58d7948871 Change color to red if minimum gas is violated.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29 06:49:44 -07:00
Dirk Hohndel
c465ec586c On Fedora, qmake is qmake-qt5
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 15:12:43 -07:00
Dirk Hohndel
2d405a1ebb Another signed/unsigned warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 14:53:59 -07:00
Dirk Hohndel
548c062aa5 Another unused variable
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 14:48:05 -07:00
Dirk Hohndel
0c410aaf5d Adjust signature to match data we need
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:27:12 -07:00
Dirk Hohndel
ea8de175a7 Remove unused function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:19:48 -07:00
Dirk Hohndel
abc6c7d2b3 Assignment instead of test for equality
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:17:19 -07:00
Dirk Hohndel
a8194fddc5 Time is unsigned here
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:15:43 -07:00
Dirk Hohndel
0813d2168a Remove some unused variables
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:14:46 -07:00
Dirk Hohndel
aabcff9c54 Move unused code into the disabled block
These varaiables are only used in the code that we currently
aren't compiling.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:11:44 -07:00
Dirk Hohndel
e0b1d2dc84 Tex export: remove incorrect code
These two variables are calculated later in the function and the
same two lines of code are there again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:08:22 -07:00
Dirk Hohndel
8fdddf371b cmake: try to find the Googlemaps plugin on Linux
Different flavors of Linux put this in different subdirectories. Just
have cmake find the plugin for us.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 11:52:58 -07:00
Dirk Hohndel
beb0d5703a MapWidget works with slightly older QtQuick2
This allows building against older Qt.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 11:52:58 -07:00
Dirk Hohndel
78922a5445 INSTALL file: add two more dependencies for Debian/Ubuntu
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 11:52:58 -07:00
Dirk Hohndel
d3340fe9ae build.sh: make Qt private headers available if missing
This is based on a script that Lubomir worked on and sent to the mailing
list.

Suggested-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 11:51:53 -07:00
Dirk Hohndel
8cd4c73217 build.sh: find qmake earlier in the script
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 11:49:39 -07:00
Dirk Hohndel
d6c013f303 Hide signed/unsigned comparison warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 09:38:52 -07:00
Dirk Hohndel
2acdb32e83 Enable googlemaps plugin from build directory on Linux
With this change, when running Subsurface from the build directory, it
should find a googlemaps plugin that was installed into the
install_root.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-25 09:02:55 -07:00
Lubomir I. Ivanov
12ea31ef78 mapwidgethelper: use system_default_directory() for cache
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-24 13:11:39 -07:00
Lubomir I. Ivanov
1da4f91cc8 mapwidgethelper: use dynamic creation of the Plugin object
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-24 13:11:39 -07:00
Miika Turkia
fb151df883 Shearwater Perdix
Reportedly the case 2 corresponds to Perdix, so it might be that both
Petrel and Perdix use same model number (or the model is mistaken
before).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-08-24 13:06:50 -07:00
Miika Turkia
a20aa850da Support for air pressure on Shearwater Desktop import
Fixes #548

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-08-24 13:06:50 -07:00
Miika Turkia
7d22b52afc Grab correct dive number on Shearwater Desktop import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-08-24 13:06:50 -07:00
Dirk Hohndel
5de49401c8 Improve error message when opening dive computer fails
Instead of the (usually incorrect) text about insufficient privileges,
just mention a generic error and suggest that the user creates a
libdivecomputer log file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-21 08:13:19 -07:00
Linus Torvalds
6554e4f21e Update the OSTC dive computer configuration to use the generic 'timesync' interface
Jef made the OSTC interface be a generic 'dc_device_timesync()' and so
the old OSTC-specific code doesn't exist any more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-20 21:03:52 -07:00
Dirk Hohndel
0bb93c76fd Mac build: fix package creation
libssh2.1 is a dependency of libgit2, not of the main executable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-20 20:45:36 -07:00
Jan Mulder
a072c635bc fix weights rounding
Simplify and fix prestation of weights. Due to the attempt to round
only the grams part (by just adding 50 to it, and truncating
afterwards) a weird effect was introduced. For example, a value
0.98 was presented as 0.10. Just replay the old logic, and see
what happens. Rewrote the logic to a simpler and better one.

fixes: #532

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-08-10 09:13:26 -07:00
Anton Lundin
9f290dcdb0 DLF: Parse more measurements, import GPS
This add support for parsing more measurements, and now imports GPS data
to.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-10 09:09:53 -07:00
Anton Lundin
070c7e545b DLF: Parse Divesoft Liberty data better
There is something with ndl / tts / temp in the Liberty DLF files. If
that bit is set, the values are bogus. There is something more to it
here which I haven't figured out.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-10 09:09:53 -07:00
Anton Lundin
8f6f9cd39d DLF: Parse diluent changes as a gaschange event
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-10 09:09:53 -07:00
Anton Lundin
f0303802dd DLF: Import setpoint changes.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-10 09:09:53 -07:00
Anton Lundin
366ad82a98 DLF: Restructure loop into a for loop
We always step forward 16 bytes, so make it a for loop so a continue
won't throw us into a eternal loop.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-10 09:09:53 -07:00
Lubomir I. Ivanov
98e869d4f1 mapwidgethelper: fix wrong logic in selectVisibleLocations()
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-10 09:08:28 -07:00
Lubomir I. Ivanov
f21ae69f7b mapwidget.qml: more improvements for the dynamic zoom-in/out
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-10 09:08:28 -07:00
Robert C. Helling
514c298600 More details for TeX export
Include the gasname, get rid of more spaces in front of units,
update the template to use new gas fields.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-10 09:08:02 -07:00
Robert C. Helling
d5d97870c3 Move the decision how to typeset unit to TeX-style file
This way, the user can adopt those once and for all for all
her dives. This includes the space between number and unit symbol.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-10 09:08:02 -07:00
Robert C. Helling
0c426c37b2 Use letters instead of digit in TeX macro names
TeX doesn't like digits there, so let's use letters

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-10 09:08:02 -07:00
Robert C. Helling
de47c96763 Cleaning up TeX export
Removed some merge artefacts and made sure code compiles and
produces wellformed TeX. Shortend some comments.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-10 09:08:02 -07:00
Ben McCandless
72e302a1c2 Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.

Previously, the exporting to TeX generated a document that contained
very limited information about the dive.  For example: the only details
reported about air consumption were delta pressure and SAC.  In addition
no data was reported about what equipment (weights, tanks, suit) was
used.

Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences.  Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments.  Volume
units do not export an ideal character string, so another string was
substituted.

This update adds the following information:
   * GPS Location
   * Dive computer used
   * Max, Min, Air, and Water Temperatures
   * Average depth
   * Number of cylinders listed, mix, and start/end pressure for each
   * Total weight used, and the description and quantity of each weight
   * Dive rating (previously, only visibility was reported)
   * Buddy
   * Dive master
   * Suit

This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"

Future work:
   * The export currently only includes the first entry in the tag list.
   * Future versions should export all tags.
   * Ideally, this would export a screenshot of the dive location.
   * Create a table of correct size for weights and cylinders.
   * It would be nice to have a bit more control over the generation of
     profile images, but that may be beyond me.

Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-10 09:08:02 -07:00
Rick Walsh
1409521eb2 DiveList.qml: set detailsWindow index before deleting dive from list
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-10 09:06:44 -07:00
Linus Torvalds
e04ef1df1e Fix the overprinting of gas name and pressure value on the profile
When I massaged the code to do multiple gas pressures in commit e1b880f4
("Profile support for multiple concurrent pressure sensors") some of the
Y offsetting code got cut out as being too specific to the old
o2pressure code.

But I removed a bit too much, leaving the label (gas name) and number
(gas pressure) overlapping.

This should fix it.

If we really care about multiple gas pressure labels overlapping each
other, we'll have to revisit this code, but the old two-gas case didn't
do a very good job either (both that old code - and this new version -
can look very good in particular cases, but there are cases where it
won't work so well).

So we may need to revisit this eventually, but this gets it looking fine
for the normal cases.

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-07 00:57:58 -07:00
Joakim Bygdell
3f1a20cbaa QML UI: GPS: remove header
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-07 00:52:32 -07:00
Joakim Bygdell
e4d4718bae QML UI: GPS: remove margins
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-07 00:52:32 -07:00
Rick Walsh
7e4ba965d1 DiveDetailsEdit: make sure model data exists
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-07 00:51:51 -07:00
Lubomir I. Ivanov
00e401b61f mapwidget.qml: add menu action for selecting visible locations
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-07 00:51:21 -07:00
Lubomir I. Ivanov
93896e54db mapwidgethelper: add the selectVisibleLocations() method
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-07 00:51:21 -07:00
Lubomir I. Ivanov
5db2460168 mapwidget.qml: implement centerOnRectangle()
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-07 00:51:21 -07:00