Commit graph

15167 commits

Author SHA1 Message Date
Berthold Stoeger
64e6e435f8 Core: remove "when" field of struct dive_trip
The when field gives the time of the first dive. Instead of keeping
this field in sync, replace it by a function that determines the time
of the first dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18 16:50:09 -08:00
Berthold Stoeger
431b2bb845 Coding style: fix indentation in addDivesToTrip()
addDivesToTrip() had one level of indentation too much owing
to a copy-and-paste error. Remove.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18 16:50:09 -08:00
Berthold Stoeger
243962a67a Dive list: move sort-functionality into core
To make sorting more controlled, move all sorting functions into
the core. For this, introduce a "dive_or_trip" structure, which
represents a top-level item. Adapt the DiveTripModel accordingly.
There are now three sorting functions:
	1) dive_less_than
	2) trip_less_than
	3) dive_or_trip_less_than
These should be used by all sorting code. By moving them to a
single place, the mess can hopefully be cleaned up.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18 16:50:09 -08:00
Berthold Stoeger
ef98a4ff5a Dive list: keep dives-in-trip list ordered after shift-times
On shift-times, the list of dives in a trip may become disordered.
Reestablish order with sort_table().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18 16:50:09 -08:00
Berthold Stoeger
9d3a5fa997 Dive list: implement trip_less_than function
As a step towards proper sorting, introduce a trip_less_than()
function in core. It simply sorts by the first dive, which should
be unique as dives may belong to only one trip.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18 16:50:09 -08:00
Berthold Stoeger
6b283e598a Dive list: replace dive-list of trips by a table
The dives of each trip were kept in a list. Replace this by a
struct dive_table. This will make it significantly easier to
keep the dives of a trip in sorted state.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18 16:50:09 -08:00
Berthold Stoeger
bc7afebc23 Core: add add_dive_to_table() function
Up to now, dives were added to the global dive table with
add_single_dive(). Split out the funtionality to add a dive to
an arbitrary dive in the add_dive_to_table_function(). The
difference compared to record_dive_to_table is that dives
are added at a specific position or the sort-criterion given
by dive_less_than(). This will allow to use a dive tabe for trips
instead of a linked list.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18 16:50:09 -08:00
Berthold Stoeger
0618aa737f Core: unify insert_trip() and insert_trip_dont_merge()
There were two versions of the insert_trip() function: one
would merge trips if a trip with the same date already existed,
the other wouldn't. The latter was introduced with the dive-list
undo work.

The problem is that the "date" of a trip (i.e. the first dive)
seems ill-defined as this is a volatile value. Moreover in
the context of making dive-import undoable this is a very
dangerous notion, as the caller needs control over when the dives
are added to a trip.

Therefore, unify these two functions and never merge trips.
The decision on merging dives now has to made by the caller.
This will be implemented in a future commit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18 16:50:09 -08:00
Daniel Krupp
c48056300d Fix Cressi interface ftdi opening bug
The Cressi specific PID was not used
when  serial_ftdi_open_device tried
to open the device.

Reported-by: Daniel Krupp
Signed-off-by: Daniel Krupp <daniel.krupp@gmail.com>
2018-11-18 20:01:28 +02:00
Miika Turkia
b609b06b11 Mobile: visual indication for copy and paste operations
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:33:27 +08:00
Miika Turkia
71a70a1a51 Mobile manual: section about copy-paste
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:33:27 +08:00
Miika Turkia
5f32cc508f Add symlink for Documentation/mobile-images
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:33:27 +08:00
Miika Turkia
4508d9e6ff Changleog entry for mobile copy-paste
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:33:27 +08:00
Miika Turkia
577e295d2f Mark cache invalid to get data saved
Seems that we need to invalidate the cache to get the modifications
actually saved.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:31:44 +08:00
Miika Turkia
88d5eccb17 delete-copy-paste buttons layed out properly
Now these buttons are finally shown with long press and seem to be
working more-or-less as intended.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:31:44 +08:00
Miika Turkia
37e7602a1e Verify that copy is done
Naturally the paste button should be disabled, if this is the case, but
it still makes sense to do this check.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:31:44 +08:00
Miika Turkia
76a68f71a4 Support for copy-pasting specific fields on mobile
Initial implementation/prototype of copy-paste support for
Subsurface-mobile. The UI part is really lacking; right now the copy
button is initially visible and paste is achieved by long press on a
dive and clicking the paste button when it appears. Delete is currently
not possible at all, as I just failed to layout the buttons properly
using QML. It just sounds so simple, to put all the copy-paste-delete
buttons next to each other...

The data to be copied is currently hard-coded. A dialog to choose
inteded fields would be nice, but it'll take quite a bit effort to get
used to QML enough to be able to hack something together.

Anyway, this seems to work, even though the UI is not always reflecting
the paste without switching dives (when testing on laptop).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:31:44 +08:00
Berthold Stoeger
49d1144336 Dive list: use dive trip time as additional sort criterion
The DiveTripModel places dives after trips in chronologically
ascending mode if the dive and the trip start at the same instant.
But in the core the sort order was undefined. This could lead
to a discrepancy. Therefore, implement the same sort-criterion
in the core code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-16 16:57:14 -08:00
Berthold Stoeger
7046c8b342 Dive list: invert sort-direction to reflect core
Traditionally, the DiveTripModel has its data sorted in opposite
direction to the core-data (chronologically descending vs. ascending).
This bring a number of subtle problems. For example, when filling
the model, trips are filled according to the *last* dive, whereas
later insertion points are according to the ->when value from the
core, which depends on the *first* dive.

As a start of fixing these subtleties, change the sort direction
to reflect the core-data. Ideally, this should lead to a removal
of the redundant data-representation.

Since the model is now sorted in ascending order, sorting has to
be enabled in the DiveListView constructor to reflect the
default-descending order.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-16 16:57:14 -08:00
willemferguson
1aef22116c More accurate CNS calculations (following comments on github)
Update table of maximum oxygen exposure durations, used in CNS calulations.
This table shows the official NOAA maximum O2 exposure limits
(in seconds) for different PO2 values. It also gives
slope values for linear interpolation for intermediate PO2 values
between the tabulated PO2 values in the 1st column.
Top & bottom rows are inserted that are not in the NOAA table:
(1) For PO2 > 1.6 the same slope value as between
1.5 & 1.6 is used. This exptrapolation for PO2 > 1.6 likely
gives an underestimate above 1.6 but is better than the
value for PO2=1.6 (45 min). (2) The NOAA table only
tabulates values for PO2 >= 0.6. Since O2-uptake occurs down to
PO2=0.5, the same slope is used as for 0.7 > PO2 > 0.6.
This gives a conservative estimate for 0.6 > PO2 > 0.5. To
preserve the integer structure of the table, all slopes are
given as slope*10: divide by 10 to get the valid slope.
The columns below are:
po2 (mbar), Maximum Single Exposure (seconds), single_slope,
Maximum 24 hour Exposure (seconds), 24h_slope */

Then update Calculations of the CNS for a single dive  -
this only takes the first divecomputer into account.
The previous version of the code did a table lookup and
used the max O2 exposure for the next-higher PO2 category.
This gave a shorter max O2 exposure time and a higher CNS
contribution for a specific dive segment, resulting in a
slightly conservative value of CNS, often some 2 - 3 % too high.
This code does an interpolation for PO2 values inbetween
PO2 entries in the lookup table and therefore results in a more
accurate maximum O2 exposure time for that PO2.
The maximum O2 exposure duration for each segment
is also calculated based on the mean depth of the two
samples (start & end) that define each segment. The CNS
contribution of each segment is found by dividing the
time duration of the segment by its maximum exposure duration.
The contributions of all segments of the dive are summed to
get the total CNS% value. This is a partial implementation
of the proposals in Erik Baker's document "Oxygen Toxicity Calculations" */

Overall, this PR does not radically alter the existing CNS calculation,
it only makes it more accurate and more consistent by doing
interpolation and by using mean segment depth to find PO2.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2018-11-16 16:56:42 -08:00
Berthold Stoeger
1b77255807 Dive list: correctly translate trip date
Adapt get_trip_date_string() to use the same logic as get_dive_date_string():
Use the static "loc" object to translate date. Before, the trip
date was shown in C locale.

Reported-by: Philippe Massart <philippe@philmassart.net>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-16 16:55:55 -08:00
Dirk Hohndel
82aa0da5ec Update README and ReleaseNotes for 4.8.4
Trim back CHANGELOG
Add entry for recent fix for multiple dive master in mobile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15 18:11:03 +08:00
Dirk Hohndel
97f56ae4f5 Latest translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15 18:11:03 +08:00
Dirk Hohndel
2f6fb9b683 Update list of supported dive computers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15 18:11:03 +08:00
Dirk Hohndel
aaddeb3089 Update libdivecomputer
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15 18:11:03 +08:00
Jocke
03143f1ef1 Mobile: Allow multiple divemasters
While not something that many will use, editing a dive on
Subsurface-mobile should not result in data loss.
This makes the divemaster field behave in the same way as the buddy
field with regards to multiple entries.

Fixes #1853

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15 18:10:13 +08:00
Dirk Hohndel
15c7ee5db0 MXE: respect an MXE build type already defined
And use that to have our Travis build still work with the existing MXE
build container as well as the even older, pre-compiled MXE binaries
used in the windows build.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-14 17:06:10 +08:00
Dirk Hohndel
5963a15bbd MXE: add missing Qt5PositioningQuick.dll
Without this the map won't load.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-14 00:20:18 -08:00
Dirk Hohndel
cb89ee49a3 MXE: switch to i686-w64-mingw32.shared.posix.dw2
This allows us to build QtWebKit again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13 20:43:13 -08:00
Dirk Hohndel
9da3988ec6 Android: pick the correct C++ runtime
Yet another fallout of the switch to the NDK toolchain.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13 17:17:54 +08:00
Dirk Hohndel
c608cfd643 Android: build for android-16
That's the minimum platform that we have used for a while now,
corresponding to Android 4.1 and newer (i.e., quite ancient).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13 16:45:29 +08:00
Dirk Hohndel
a250642479 Android: find Qt cmake modules
With a recent change to the qt-android-cmake project we are now using
the toolchain file bundled with the NDK, and that forces all cmake
modules to be part of the NDK tree - which breaks the way we find our Qt
installation.  This is a hack to work around this as it undoes this
setting, which I'm sure is well intentioned to prevent host system
issues in this cross build scenario.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13 15:51:17 +08:00
Dirk Hohndel
a58cd3eb13 Android: explicitly build with gcc
Our Android build currently fails with clang.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13 15:51:17 +08:00
Dirk Hohndel
1868bd38b6 Android: qt-android-cmake no longer ships a toolchain file
Instead use the one that comes as part of the NDK.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13 13:16:29 +08:00
Dirk Hohndel
a316ed6e6c Latest translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-12 21:12:45 -08:00
Berthold Stoeger
bef756073a Coding style: remove stray ';'
There was a stray semi-colon on the beginning of a line in
DiveObjectHelper.cpp. Remove it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-12 20:55:41 -08:00
Berthold Stoeger
282e6a9f48 Cleanup: remove unsused flags in struct dive_trip
Usage of the flags expanded, selected and fixup was removed some
time ago. Remove the flags too.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-12 20:55:41 -08:00
Dirk Hohndel
63b47ff530 Latest translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-05 07:57:30 -08:00
Berthold Stoeger
da3ea59a25 Dive list: let sort arrows reflect sort order for NR and DATE
The old code always sorted by "ascending" by default. But
because users typically want their new dives top, "ascending"
was defined for NR and DATE, such that it is actually descending.
Turn these around and intitialize these two fields as
default-descending.

This is possible using the Qt::InitialSortOrderRole role
in DiveTripModel::headerData().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-05 07:55:53 -08:00
Berthold Stoeger
64a1a50e10 Dive list: remove sortColumn and currentOrder members
Since the QHeaderView of DiveListView is now the authority
over sort-column and sort-order, it makes little sense
to keep these as member variables. That would only risk
inconsistencies. Remove them and query the QHeaderView
instead.

We still need to keep track of currentLayout, as we
have to detect if it changes to change the underlying
model from tree to list or vice-versa.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-05 07:55:53 -08:00
Berthold Stoeger
f2f18b4e16 Dive list: split reload() in reload() and setSortOrder()
The DiveListView code had a very fundamental problem with its
header: Each had its own idea of who is responsible for sorting.
Since we can't easily change QHeaderView, accept QHeaderView
as the authority on sort-column and order.

To make this possible, split the reload() function in two
distinct functions:
 - reload() reloads the model and sorts according to the
   current sort criterion.
 - setSortOrder() tells the header to display a certain
   sort criterion. If this is a new criterion, it will then
   emit a signal. In this signal, resort according to that
   criterion.

Thus, the actual sorting code has to be moved from the
headerClicked() to a new sortIndicatorChanged() slot.
Morover, the sorting of the QHeaderView has to be used.

Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-05 07:55:53 -08:00
Guillaume GARDET
236373b6ba Documentation: update and merge french manuals
Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
2018-11-05 07:49:40 -08:00
Berthold Stoeger
83ed75f4ab Dive list: use proper comparison when comparing dive to trip
The DiveTripModels are sorted in *reverse* chronological order.
Therefore, when comparing a dive against a trip, the dive has
to be inserted if the dive has a *later* date. Change the
comparison accordingly.

Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-04 08:04:27 -08:00
Berthold Stoeger
a2b3d0ff06 Undo: fix addition of multiple dives
The generic addInBatches() function is used to add batches of
contiguous sets of dives to the dive-list models. The loop
searching for the end of the batch used the wrong index and
would therefore not properly cut the batches.

Fix this.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-04 08:04:27 -08:00
Berthold Stoeger
76f38ff33b Dive list: invert default sort order for sort by date / number
Commit 6dc1d239f8 introduced a
well-defined sort order in the case of equal contents. It changed
the code for sorting by date to simply use the order of the
source model.

BUT: The source-model was already sorted in descending order
on date. Thus setting the default order on descening by date,
the data was then presented as *ascending* by date.

Change this back to descending by always using default-ascending
in the filter model.

Ultimately, the source model should simply reflect the ordering
of the core-data (ascending on date), but such a change is
too invasive shortly before release.

Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-02 07:46:01 -07:00
Lubomir I. Ivanov
1ba15a91ae CHANGELOG.md: add entry about experimental BTLE support
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-11-01 11:44:41 -07:00
Lubomir I. Ivanov
7e6ef4287c user-manual: add notes about state of BTLE on Windows
Add an "important" message that the support is experimental
and that the latest version of Windows 10 and drivers is needed.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-11-01 11:44:41 -07:00
Dirk Hohndel
cdc9666281 Core: use British translations in South Africa
For unrecognized locales we use en_US by default. It makes much more sense for
South Africa to use en_GB.

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-01 09:30:14 -07:00
Dirk Hohndel
c7b64b6819 Update translations
Pull current translations from Transifex and add the new numerus cases to the
en_US 'translation'.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-01 09:10:36 -07:00
Dirk Hohndel
0ef5239c56 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-01 07:55:37 -07:00