Commit graph

250 commits

Author SHA1 Message Date
James Wobser
4f3b26f9b6 Implement Seac SeacSync databaser parser.
Dives for the seac action computer are imported by the seacsync
program into two tables in an sqlite3 database.

The dive information is read from the headers_dive table.
The dive_data table is then queried for each dive to get samples.

The seac action computer is the only current supported computer
by the seacsync program. It only supports two gas mixes, so the
parser will toggle between two cylinders whenever it detects a
change in the active O2 mix.

Dive start time is stored in UTC with a timezone offset.
A helper function to read this was added to qthelper.

Default cases have been added to some switch statements
to assist in future development for other dive types and
salinity.

Example database has been added to ./dives/TestDiveSeacSync.db

Signed-off-by: James Wobser <james.wobser@gmail.com>
2020-09-04 15:54:08 +03:00
Robert C. Helling
c6fa415880 Improve resolution of profile export
The way we export the profile image (as direct export but
also used for printing) is that we render the profile
from the screen to a Pixmap and save that to a file. Unfortunately
this results in very bad resultion and a blurred image.

This is an attempt to improve that situation but it's still far
from perfect: Rather than a QPixmap and grab, I now use a QImage
(where I can set the size) and render, and indeed the picture resolution
(when vied at fixed size) get's better this way. The disadvantage
is that icons get smaller at the same rate und so
there is a natural limit on how big we can get. Maybe somebody
with better Qt knowledge can take off from here. In my opinion
this is already a step in the right direction.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-03 11:46:17 -07:00
Robert C. Helling
7e82205e9b Planner: Properly initialize salinity
When the dive has no explicity salinity, our conversion
between pressure and depth assumed salt water. Make this
explicity by using the corresponding macro.

When the planner starts and no salinity is set explicity,
set the water type chooser to salt water to reflect
our default assumption.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-09-02 09:43:38 -07:00
Michael Werle
f5ba42e933 Add an "Edit Gas Change" right-click option.
This new option allows a user to select a new destination tank for an
existing "Gas Change" event. This is useful when Subsurface's heuristics
get tanks wrong after an import from a divecomputer. The use-case arose
from sidemount divers with air-integrated transmitters as well as carrying
a deco tank.

Signed-off-by: Michael Werle <micha@michaelwerle.com>
2020-08-26 07:11:49 -07:00
Robert C. Helling
62d87e9d25 Planner: handle zero length segments when replanning
When setting up a dive for replanning, we ignored zero length segments as those
tend to be generated by gas changes. But it is possible to enter those in the
planner and the replanning should not ignore those. So be
more clever about gas changes. Let's add 10 seconds so we are not at two depths
at the same time and help since add_stop also does not like zero length
segments (it thinks we are trying to replace a waypoint).

Fixes #2901

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-08-24 08:30:00 -07:00
Dirk Hohndel
14f47c627d Add CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-08-22 19:35:58 -07:00
Berthold Stoeger
f24fe10765 core: fix dive renumbering logic on import
0249e12 split up the dive import logic in multiple steps. Thereby,
the one of the conditions for renumbering the imported dives (is
the last old dive numbered) got messed up: The first number of the
new dive was compared to the total number of old dives, which makes
no sense.

- Simply check for the number of the last existing dive (if any).
- Don't remember the number of old dives - the original table is
  not modified anyway.

Fixes #2731

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-08-17 13:21:49 -07:00
Dirk Hohndel
d1de3f77ee Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-08-16 16:23:19 -07:00
Dirk Hohndel
ff32737157 update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-07-14 10:57:10 -07:00
Robert C. Helling
912e1faaf2 Make MND display depend on O2 narcotic preference
A while ago, we introduced a preference whether O2 should
be considered narcotic. We used this when computing
best mix or when entering the He content via MND. But
we forgot to make the displayed MND depend on this
preference. This patch add this.

Fixes #2895

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-07-11 10:37:49 -07:00
Linus Torvalds
628c7c8f13 Fix dive merging with multiple cylinders
We did something really horribly wrong when merging cylinders.  It's
been broken since commit 7c9f46a ("Core: remove MAX_CYLINDERS
restriction"), and used some really strange logic.

This rewrites the logic to be (I think) a bit more easy to understand.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-29 10:44:01 -07:00
Dirk Hohndel
2f460277f4 update README and ReleaseNotes for 4.9,6
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-20 10:51:48 -07:00
Linus Torvalds
7f0ee3d8e2 core: fix libdivecomputer dc_custom callbacks structures
The last time those changed, we forgot to update serial_ftdi. In that change
set_latency had been removed from libdivecomputer and poll and ioctl had been
added. This caused the callbacks to no longer be aligned correctly and the
functions were called with the wrong arguments through the wrong function
pointers, leading to crashes.

Instead of the fragile assumptions about order and type of function pointers,
use named initializers. And while we are at it, fix that for the bluetooth
implementation as well.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-18 09:05:13 -07:00
Dirk Hohndel
b013611707 Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Dirk Hohndel
bea898c077 Update ReleaseNotes and README for 4.9.5
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-12 12:43:51 -07:00
Dirk Hohndel
8a4a9382d3 mobile/dive-details: restrict width of tags field
Having a lot of tags (or more precisely, a tags string that is very long) could
cause the width of the dive details view to extend past the width of the the
page. The txtTags label was missing a maximum width, and to make the result
more useful, I also added correct wrapping and elide to the mix (stupidly, we
had the wrap and width for the fixed name of the field ('Tags'), but not for
the user determined content of that field).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-08 12:27:50 -07:00
Dirk Hohndel
e00e72d430 mobile: add option to merge local cloud cache data
The UI is ugly, and of course this is hidden in the developer options that have
to first be enabled in the advanced settings. As I mentioned in the previous
commit, I believe the actual risk that something gets damaged here is very low,
but still, explaining this so it makes sense to the casual user may be a bit...
difficult.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07 19:47:52 -07:00
Dirk Hohndel
afdcccc9fe mobile/dive-edit: fix broken editable combo boxes
This is a partial revert of commit 99438121c4 ("mobile/dive-edit: use template
components and theme colors")

Clearly the information given in the Qt documentation on how to theme ComboBox
is flat out broken. The trade-off between 'better dark theme' and 'broken user
experience' is fairly easy to make.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-30 11:19:54 -07:00
Dirk Hohndel
2690325623 Android: install translations into the right place
When updating the NDK I forgot to adjust the install destination for the
translations.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-27 12:41:14 -07:00
Miika Turkia
79f90effe9 Update changelog
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-26 11:33:33 -07:00
Dirk Hohndel
9deb4f4a22 mobile/credentials: email address must be lower case
I could have sworn that I have fixed this several times in various places,
but apparently (as shown by todays support emails) it's still possible to
setup a mixed case email address. So let's try to solve this problem at
the very top.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-25 08:36:01 -07:00
Berthold Stoeger
2d17edeb40 desktop: localize salinity value
The salinity value was not displayed with localized thousands separators.
E.g. to a user of a German locale the density read as slightly over
1 g/l, when it should be approximately 1000 g/l. For consistency, also
localize that value.

Also localize the CNS and OTU numbers, even though these should
(hopefully!) never come with thousands separators.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-25 08:33:08 -07:00
Berthold Stoeger
00ff63f186 desktop: update date and time fields if user changes format
This was more painful than expected, because we get the "preferences"
changed signal too early when the user switches to system format.
The correct format is set by the preferences-widget, not the preferences
subsystem.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22 10:00:43 -07:00
Dirk Hohndel
2bd9138a24 update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-18 13:00:03 -07:00
Dirk Hohndel
878dd1f518 add missing CHANGELOG entry
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-17 14:07:12 -07:00
Berthold Stoeger
a7440ce277 filter: properly search for tags
The old code used get_taglist_string() and split the resulting
string at commas to get the list of tags. This was wrong for two
reasons:
1) It was buggy. Every tag but the first would start with a leading
   space and thus not be found.
2) It was inefficient. The tag list was concatenated, just to be split
   again.

Turn the tag list directly into a QStringList and remove whitespace
for good measure.

Fixes #2842.

Reported-by: Hartley Horwitz <hhrwtz@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-16 12:40:08 -07:00
Berthold Stoeger
1777df405f desktop: don't call plotDive with doClearPictures = true
This was an old "optimization" to avoid double plotting of the
pictures, first by the profile itself, then by the picture tab.
Since the profile now updates the pictures itself, this must
be removed: The picture tab doesn't do it anymore.

Fixes #2833

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-16 10:10:30 -07:00
Dirk Hohndel
a1a51e5d89 core/bt: always add bt name for devices
If the user asks to have all BT/BLE devices shown, we should behave
consistently to the case of a recognized dive computer and always show the
device name. In almost all cases the BT/BLE address (and even worse on
iOS/macOS the weird uuids) are completely meaningless.

If there isn't a name, don't add a leading space in order to make it easy to
detect if we have an address without a name (which almost certainly isn't a
dive computer, so it should be towards the end of the list of addresses - which
will be handled in a later commit).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-15 04:05:06 +03:00
Dirk Hohndel
658089d763 core/bt: match DC descriptor in lower case
This fixes a rather subtle bug.

In btdiscovery.cpp we are detecting dive computers based on their BT name and
are setting up product+vendor as the key for that lookup. QMap always uses case
sensitive comparisons and a tiny inconsistency snuck into our code.
libdivecomputer names for the Aqualung dive computers i200C / i300C / i550C end
in an upper case C (as matches the official branding), but in btdiscovery.cpp
we have those names with lower case c. And therefore didn't recognize these
dive computers.

Obviously this is easy to fix by fixing those three strings, but I decided that
it was silly to set ourselves up for similar oversights in the future. So
instead I switched the matching of the descriptor to simply be allways all
lower case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-15 02:49:46 +03:00
Dirk Hohndel
1f942ab556 Update CHANGELOG
This includes cleaning up the old CHANGELOG I forgot to delete for the release
as well as mentioning the libdivecompute updates.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14 12:57:08 -07:00
Berthold Stoeger
9298466037 desktop: update statistics tab when cylinders changed
The cylinder-based statistics where not updated when an undo
command edited cylinder data. Do so.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-06 11:44:22 -07:00
Robert C. Helling
786963aba9 Changelog for variations checkbox
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-05-05 08:56:33 -07:00
Miika Turkia
977b50ba22 Update changelog
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-04 10:43:40 +02:00
Dirk Hohndel
389bfcc671 ReleaseNotes for 4.9.4
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-02 10:26:17 -07:00
Berthold Stoeger
d787e8812c profile: for maxtime calculation include the sample after the last event
When plotting profiles with surface segments, there were strange
artifacts. As we found out with Robert, these were due to the fact
that the calculated maxtime was set to the last event which is just one
second inside the surface segment. This terribly confused the profile
code. For example, it didn't properly allocate samples for the surface
segment.

Thus, when calculating maxtime, consider the last sample beyond the
last event.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 12:36:28 +02:00
Dirk Hohndel
b0dfc0d0ff maps: show the dive site when opening Google map
I'm not sure if Google used to show the POI marker at the center location in
the past or if this is actually a new feature. Either way this appears to do
the right thing in my testing.

Note that we need a 'plus' to connect the point of interest cooridnates,
but a 'comma' to connect the map center coordinates.

Reported-by: Chirana Gheorghita Eugeniu Theodor <office@adaptcom.ro>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-19 18:52:15 -07:00
Dirk Hohndel
7d86a3fdea update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-18 09:00:21 -07:00
Dirk Hohndel
6d187b5f4a
Merge pull request #2643 from bstoeger/cylinder4
First steps of cylinder-editing undo
2020-04-11 11:03:05 -07:00
Dirk Hohndel
42c974edd7 Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-10 17:18:17 -07:00
Berthold Stoeger
0bd821183d undo: implement gas switch
This is a bit hairy as - in theory - one gas switch can remove
other gas switch(es) at the same timestamp. However, I did not
find a way to test it. Moreover, it is not clear whether the
dive-tabs are properly updated on undo/redo.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07 00:13:35 +02:00
Berthold Stoeger
fb76eb9a1a delegates: don't use starts-with search to fetch cylinder/weight data
In the wightsystem-type and cylinder-type delegates, when entering
data, when entering known weight- or cylinder-types, some ui fields
(notably weight, size and working-pressure) are automatically filled
out. The search was using the default flags provided by Qt: starts-with
and case-insensitive.

This had a few strange effects, when entering a string that is the
beginning of a known string (e.g. "AL6" when "AL63" already exists):

1) The wrong data was used if the new string didn't exist.
2) For cylinders it was impossible to create new cylinder types whose
   name is the starting string of a different type.
3) For weights, the new type was not added to the list of known types.
   This, however, is no problem, because it will be added by the undo
   command anyway. A future commit will address that redundancy.

Therefore use only the case-insensitive flag (which has to be performed
by passing the MatchFixedString flag - very weird).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-06 08:41:39 -07:00
Dirk Hohndel
46c6a3cb92 CHANGELOG update
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 16:10:50 -07:00
Dirk Hohndel
f92c7a20d2 Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04 12:00:25 -07:00
Dirk Hohndel
2a802721f4 Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 20:33:11 -07:00
Dirk Hohndel
286100c10a Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31 08:42:20 -07:00
Dirk Hohndel
7f2eaba574 CHANGELOG update
This remove the old pre-3.0 entries and adds entries for 3.0.0->master

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-30 09:16:55 -07:00
Dirk Hohndel
f9b8d16a0d Add CHANGELOG entry for mobile UI for dive invalid flag
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-21 14:31:37 -07:00
Berthold Stoeger
4e47cdfa2c Undo: implement invalidate-dive command
Connect command to context menu.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-20 15:20:44 -07:00
Dirk Hohndel
fe9a2ab5c3 Mobile user manual: some updates for Subsurface-mobile 3.0
This needs more work and especially new screen shots, but for now this
covers at least some of the most important changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-16 07:58:20 -07:00
Dirk Hohndel
b92b5998ff mobile UI: re-enable download status when restarting download
When tapping on 'retry' we didn't clear the flag that decided which message to
display.

Fixes: #2651

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-07 16:48:34 -08:00