Commit graph

19294 commits

Author SHA1 Message Date
Berthold Stoeger
acd385048a Prefer real data over planned
When a dive has both real dive computers as well as at
least a planned version (which is just another dive
computer with a special name), only use the data from
real dive computers for aggregate values like maxdepth,
dive time, average depth etc in order not to have
imagined data on the dive list, statistics etc.

Macro-magic-provided-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-08-25 13:38:12 -07:00
Berthold Stoeger
1c00f9f233 core: use free_dive() to free dive
One would think that calling free() on a dive structure, as the code
did in some places, would lead to a memory leak.

(Insert rant about C memory management.)

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-22 09:34:25 -07:00
Berthold Stoeger
252761498a liquivision: use uint32_t for event time
This is stored as uint32_t, so no reason to use the larger time_t.
It appears to be, after all, relative to the dive start.

Coverity was complaining about the down-conversion later in the code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-22 09:34:25 -07:00
Berthold Stoeger
cfa0c9c735 desktop: make DiveLocationModel entries "editable"
If the entries in the DiveLocationModel don't have their entries
set as editable, the auto-completion popup turns of composition
if such an item is highlighted (see Qt code in
/src/widgets/itemviews/qabstractitemview.cpp), thus disabling
composition of multi-key characters.

Therefore, set this flag. Seems weird, but what should we do!?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-22 09:20:45 -07:00
Berthold Stoeger
9455ca7061 desktop: set composition flag in dive site list
This is crazy: when view() is called, the dive-site-suggestion
popup (DiveLocationListView) clears its WA_InputMethodEnabled
flag. This makes key composition not work as long as the
popup is open.

Thus, when showing the popup, explicitly set the flag.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-22 09:20:45 -07:00
Michael Werle
881a9cac4e cleanup: fix compiler warnings in recently edited files.
Replace NULL -> nullptr
Remove spurious semicolon

Signed-off-by: Michael WERLE <micha@michaelwerle.com>
2022-08-21 18:53:35 -07:00
Michael Werle
efb1832db8 Map Short Names - add preference setting
Adds a preference setting in the "Default" settings tab to toggle whether
to display shortened names in the Map.

TODO: instead of using the generic "settingsChanged" signal, it would be much
more efficient to only update items based on the actual setting which was
changed.

Signed-off-by: Michael WERLE <micha@michaelwerle.com>
2022-08-21 18:53:35 -07:00
Michael Werle
3dbba5ae69 Map Short Names - display shortened names on the map.
Only the last component of the Site Name is displayed, otherwise the full
name is displayed. Site Name components are separated using slash (/)
characters.

For example, if the full dive-site name is
"Japan / Izu Peninsula / Atami / Chinsen-Aft" then only "Chinsen-Aft" is
displayed on the Map.

Signed-off-by: Michael WERLE <micha@michaelwerle.com>
2022-08-21 18:53:35 -07:00
Berthold Stoeger
c897edc13e parser: fix DLF import
In bc3b56a969, the import of the dive mode was simplified,
by replacing an if-else-if chain by bit manipulations.
However, the bitmask was wrong: 0b00111000 is 0x38 not 0x30,
which means that "odd" dive modes were not recognized as such.

Bug found by coverity.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-20 14:31:39 +02:00
Dirk Hohndel
32bc034f41 mobile: add ability to delete cloud account
Apple store rules require this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-13 14:08:37 -07:00
Berthold Stoeger
941aaf5b65 desktop: let tag-widget completion popup accept composition events
Attn: horrible hack!

For some reason the completion-popup does not have the
Qt::WA_InputMethodEnabled flag set. Thus, if the popup is open
composition of characters breaks.

Therefore, when starting completion, explicitly set the flag
on the popup.

This is 100% not how this was intended, but seems to work for
now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-13 11:19:37 -07:00
Berthold Stoeger
803727395b desktop: improve composition on TagWidgets
The TagWidgets hook into the textChanged() signal to invoke
the word-completer. However, that signal is also emitted for
composition-keys, making composition impossible if the completer
decides that it should show some entries.

Instead, hook into the inputMethodEvent() function, where one
can test whether a real character was input.

Also, don't hook into cursorPositionChanged(), since that led
to an uncanny cascade of reparse() calls when editing text.

The UI experience is still rough as sometimes the completer
popup steals the focus and hinders further entry.

Also, this doesn't fix the location field, which is its own class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-13 11:19:37 -07:00
Dirk Hohndel
21eb108cfd update to latest libdivecomputer
Garmin: Don't require sub directories for fit files
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-06 14:18:22 -07:00
Linus Torvalds
05e1294be9 git parser: handle left-over multi-line quoted strings better
The git save format is designed to be entirely line-based, where all the
dive data is on individual lines that are independent.

That is very much by design, so that you can merge these files
automatically, and not worry about what it does to the context (contrast
this to structured files like JSON or XML, where you have multiple
levels of indentation, and the context of a line matters).

So the parser can just ignore any conflict markers, and parse everything
one line at a time.

Well, almost.

We do have *one* special form of multi-line context, where flowed text
(think things like dive notes) will have one "header line" that starts
the note, and then it can continue for several lines until the final
line that ends the quote.

In such a situation, the dive merging can result in a partially merged
string note, which has the ending line from one dive, and then continues
with more string data from the other dive.

That will confuse our parser mightily, because it will have seen the end
of the string, and parsed the rest of those string comments as garbage lines.

That part in itself is fine - the garbage lines won't pass as any real
data (because they don't start with a proper keyword), but while parsing
that garbage the *next* end of the string will be seen as a start of a
new string.

And *that* then confuses the git parser to think that the line after
that is now part of the string, and so it won't correctly parse the
non-string line that follows.

To give a more concrete example, the git dive data (here indented and
abbreviated) might look like this:

	suit "5mm long + 3mm hooded vest"
	notes "First boat dive.
		Giant-stride entry."
		Saw a turtle."
	cylinder vol=10.0l description="10.0ℓ" depth=66.019m

where the two notes from the two dives were

	notes "First boat dive.
		Giant-stride entry"

and

	notes "First boat dive.
		Saw a turtle."

respectively, and the merged result contained parts of both.

When we parse this, we will parse the 'notes' line as having the string

	First boat dive.
	Giant-stride entry

which is fine. But then the next line will be that

	Saw a turtle."

and now the ending double quote character on that line will be seen as
the beginning of a new string, and the cylinder information on the next
line will then be mixed up.  The resulting mess will be ignored, but in
the process the data on the "cylinder" line will basically have been
lost.

There are several ways to deal with this, but this particular fix
depends on the fact that we can recognize stale string continuation
lines: they are either empty (for an empty line), or they start with a
TAB character.

So to solve the problem with the mis-identified end quote, this
recognizes that we're in such a "stale left-over comment line" context,
and will just skip such lines entirely.

That does mean that when you have conflicts in dive note sections due to
having edited the dive concurrently on different machines, you may just
lose some of the edits.

But this way at least you shouldn't lose any other data due to the merge
conflict.

NOTE! We could try to improve on this by instead noticing that a "end of
multi-line string has a continuation entry on the next line", and just
say "ok, that wasn't a real end after all".

But that would be an independent thing anyway - this "ignore stale text
comment lines" logic would be required anyway, in case those stale text
comments ended up somewhere *else* than right after another text line.

So do this more important fix first.

Reported-by: Michael Werle
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-08-01 11:31:54 -07:00
Berthold Stoeger
d68fd2922c trivial: remove obscure division-assignment operator
In utc_mkdate() we find the interesting statement
        val = timestamp /= 60;
which not only calculates timestamp / 60, but also overwrites
timestamp with the new value. However, timestamp is never used
in the remainder of the function, because the whole point is to
switch to 32-bit types. Thus, replace the division-assignment
by a simple division operator to avoid head-scratching.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-01 11:30:53 -07:00
Dirk Hohndel
c554b57859 iOS: the SDK references APIs that we don't use
And the way this gets bundled into an iOS app means that we have to declare
permissions that we don't use because the SDK we use could use them. On some
level I can understand that logic, but in general... this is just dumb.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-01 09:49:18 -07:00
Dirk Hohndel
8a9359a03c mobile: update version to 3.4.6
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 12:12:02 -07:00
Dirk Hohndel
05ed2e70b5 build-system: impish is EOL
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 12:11:19 -07:00
Dirk Hohndel
8831a364ff update list of supported dive computers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 12:07:45 -07:00
Dirk Hohndel
067ed39503 build-system: try to hack around Qt 5.15.3 in Jammy
The Qt Company apparently didn't feel the need to have the correct
tags in all of the module directories. So this now has to manually
pick the correct SHA. What a pain.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Dirk Hohndel
8a6a03f89f prepare for 5.0.9 release
Update README and move CHANGELOG to ReleaseNotes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Dirk Hohndel
ec9829bbd6 build-system: move to Ubuntu Jammy
Impish is EOL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Dirk Hohndel
e92b1a5692 Update libdivecomputer
Merge upstream changes from Jef Driesen:
     - New dive computer support:
        - Ratio iX3M 2
        - Sherwood Amphos Air 2.0
     - Cleanups and fixes

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Dirk Hohndel
fd1b22a417 Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-31 10:26:25 -07:00
Jon Massey
53fa568b90 fix: translate email/pw warning
pass email/pasword format warning QString to translate method

Signed-off-by: Jon Massey <jon.massey@thedatalab.org>
2022-07-24 16:56:36 +02:00
Jon Massey
10b4cc9149 Improve UX for cloud email/password checking
State requirements for email address and
password format within cloud preferences UI

If email address or password entered in cloud
preferences, raise a warning within a
QMessageBox instead of the less-visible
report_error method

Signed-off-by: Jon Massey <jon.massey@thedatalab.org>
2022-07-24 16:56:36 +02:00
Berthold Stoeger
50ff94eb8f filter: normalize text of fulltext search to base letters
The liter symbol is written as 'ℓ'. To allow searching for
that, normalize unicode strings to their base letter. This
corresponds to the 'compatibility' mode.

We might also think about stripping diacritics.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-07-08 11:38:44 -07:00
Dirk Hohndel
4bac5dbb66 build-system: allow adaptive building without WebKit
This should avoid build failures on platforms where we don't know if
QtWebKit will be available or not.

The options for printing and user manual are awkward to work with. This
all needs to be cleaned up at some point. Right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-07-07 10:19:22 -07:00
Dirk Hohndel
21de82144a update libdivecomputer
Initial support for Shearwater Petrel 3 and Perdix 2

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 14:18:12 -07:00
Dirk Hohndel
eb1284683a core: add new Shearwater dive computer names
The code works ok falling back to just Perdix and Petrel 2, but
it looks confusing to the user to see an incorrect name in the
connection drop down.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 11:15:53 -07:00
Dirk Hohndel
e41d877e53 build-system: don't wait for copr builds
This really only matters for my build automation setup, but since I
build from the files in the repo... I have to push this into master.
Otherwise my build processes stall until the builds on the COPR site
finish. Which isn't useful.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 10:46:24 -07:00
Dirk Hohndel
76985d554f Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 10:38:44 -07:00
Dirk Hohndel
ee708a904c core: consistent naming of the new Aqualung i200C models
It's confusing to have the same name refer to two different models.
Unfortunately, that's what Aqualung is doing by simply changing the
model number and serial number, but not the external branding.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 10:28:29 -07:00
Dirk Hohndel
d0a4bc331c update to experimental libdc
Initial support for new version of Aqualung i200C

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-14 16:35:05 +00:00
Dirk Hohndel
49f69947e3 mobile: update version to 3.4.5
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-13 03:40:00 +00:00
Dirk Hohndel
7ff1683ec9 BLE: add newer model for Aqualung i200C
At least one user has an i200C that shows a GI.... serial number and
BLE name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-13 03:31:21 +00:00
Dirk Hohndel
9e1c04344b mobile: enable MAP_SUPPORT
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-13 03:30:01 +00:00
Dirk Hohndel
3629a87fcc Change semantic for editing cylinders for multiple dives
Instead of trying to find matching cylinders, trigger on the cylinder
number first and then only edit that n-th cylinder if it matches the one
in the current dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-09 16:29:03 -07:00
Dirk Hohndel
19b221d203 core: add missing properties to the dive merge
In a sign how few people use these additional properties AND use multiple
dive computers, this took a couple of years to get noticed... but yes, we
do need to merge those properties as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-08 13:29:37 -07:00
Dirk Hohndel
cf216ec9e4 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-05 16:42:08 -07:00
Dirk Hohndel
5ee1a4fe17 update libdivecomputer
Add support for the Seac Screen and Action
Add support for the Cressi Michelangelo

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-05 16:37:16 -07:00
Robert C. Helling
0f2cdd16dc Deal with negative variation times
When computing plan variations, deco can get shorter when
staying longer when the last step is actually already at
off gasing depth. FRACTION forces unsiged, so this introduces
a sign aware version of FRACTION that returns a sign character
in addition.

Reported-by: Patrick Naujoks <p.naujoks@me.com>

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-06-04 14:19:05 -07:00
Dirk Hohndel
404365c24a update libdivecomputer
Garmin: decode dive mode

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-06-01 08:56:47 -07:00
Vlad A
30a964c508 Added option to choose between different depth grid quantization schema.
This allows having 3m depth grid for metric users.

* All original properties ( named diferently ) were renamed to three_m_based_grid everywhere to be consistent.
* Plus other small changes requested during review.

Signed-off-by: Vlad A. <elf128@gmail.com>
Signed-off-by: Vlad A <elf128@gmail.com>
2022-05-21 17:29:40 -07:00
Dirk Hohndel
15f3918171 build-system: small fixes for Fedora copr build
The extra trailing 'dot' broke the cmake build on Rawhide.
This also tries to give more consistent Summary and Description text for
the Subsurface and Subsurface-test repos on copr.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-17 10:25:30 -07:00
Dirk Hohndel
c2f0a6f3e1 update libdivecomputer
Garmin: Handle file names in short format

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-14 11:09:40 -07:00
Dirk Hohndel
c1e7cd1428 build-system: consistently mark git directories safe
Even on platforms that don't have the new git version, yet.
And using the convoluted way to create an environment variable that should
point to our checked out tree in the GitHub Action. The more obvious ways
have resulted in failed builds for obscure reasons.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-14 10:28:56 -07:00
Dirk Hohndel
8ead205c8c build-system: initial spec file for Fedora copr build
This should allow us to automate builds using the Fedora infrastructure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-12 11:10:02 -07:00
Dirk Hohndel
df5c715afa build-system: work around git change in Fedora 35 build
Not sure why I didn't include that earlier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-05-12 11:09:12 -07:00
Jim Wobser
89c6015cde Handle Mulitple Seac Computers colliding during import
The Seac importer was getting samples based only on dive number,
which was causing samples from different computers but with the
same dive number to become interleaved.

To correct this, the SQL statement was updated to use the
dive_id to query for samples. The table schema uses dive_id
as a primary key, which will enforce uniqueness.

Additionally, deviceid is hashed from the the device_id string.

Reported-by: David Brebera <david.brebera@gmail.com>
Signed-off-by: Jim Wobser <james.wobser@gmail.com>
2022-05-12 11:07:03 -07:00