Commit graph

291 commits

Author SHA1 Message Date
Berthold Stoeger
9ee8807af7 export: show progress dialog for TeX exports
The TeX exports may hang the UI for a long time.

Show a progress-dialog that is updated after every exported dive
and allows the user to cancel the export.

This is pretty lame, because it is synchronous (export still runs
in UI thread) and therefore the UI still is sluggish. But it
is an improvement.

Since the TeX-exporting code is in a shared directory (desktop and
mobile), this uses a slim interface class. Mobile does not
yet use TeX export, but you never know. Better than #ifdefs
sprinkled all around, I reckon.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-05-06 08:21:04 -07:00
Berthold Stoeger
8cd389c0af printing: use sensible font-size in profiles
The font-size in printed profiles is based on the size of the profile
in the main window. This makes no sense. Why should changing the
window size change the font-size on printouts?

Matter of fact, when making shrinking the height of the window to
its minimum, comical printouts are obtained (font way too big).

Therefore use an arbitrary rule: Say that profiles 600 pixels high
look reasonable and then scale up to the actual size on the printout.

This may need some tweaking for high-DPI mode. But that seems not
to be supported on desktop anyway?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-04-02 08:22:00 -07:00
Dirk Hohndel
289cf3f9c5 prepare for Subsurface 5.0 / Subsurface-mobile 3.2 release
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-24 10:07:24 -07:00
Robert C. Helling
7c62f7541c Use PSCR gas when computing O2 toxicity
Both the calculations for CNS and OTU did not take
into account the pO2 drop when using a PSCR. Furthermore,
there was some unit confusion due to not using internal
units.

Reported-by: arosl
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-03-12 22:24:23 +01:00
Robert C. Helling
fb11f8efa6 Describe CCR changes in documentation
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-02-26 08:42:30 -08:00
Berthold Stoeger
646aead629 desktop: disable animation when selecting multiple dives
Selecting many dives when the animation was active
was increadibly slow, so disable it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-10 14:33:15 -08:00
Dirk Hohndel
f29534e07f mobile/UI: update dive edit layout
This feels much more responsive to various screen widths to me.
Instead of a fixed grid this is now a Flow that is tries to make much
better use of the space available on the user's device. It's not always
perfect, but to me at least a massive improvement.

The commit is almost unreadable because of the re-indentation and the
move of a block of fields to earlier in the form (as that made it much
easier to flow everything). But with show -w you can get a better idea.

We have a Flow around all the fields, we pair each label with the
corresponding input field, and then have a few additional Flows to
ensure that the cylinders always start in the first column.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-19 12:42:47 -08:00
Doug Junkins
31e26fd144 mobile: add GF fields for ceiling calculation
Adds fields to the advanced preferences page to modify GFLow and GFHigh for
the Buhlmann decompression model for calculating ceilings. Updated preferences
code to set the Buhlmann parameters in core/deco.c when the GF prefs are
updated.

Signed-off-by: Doug Junkins <douglas.junkins@gmail.com>
2021-01-19 12:34:46 -08:00
Dirk Hohndel
702d09df9f mobile/GPS: fix two errors in the GPS handling
First, the time zone adjustment was wrong - this as written could only
ever have worked in UTC or by pure chance.

Second, the order of alerting the UI of the availability of a GPS fix
was also incorrect creating a race between the UI and our data
structures.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-13 13:52:00 -08:00
Berthold Stoeger
1a0f6f53ed undo: set dive mode to CCR in undo command, not profile code
When setting a CCR setpoint, the profile code(!) would turn
the dive into a CCR dive. Not only should the display layer
not alter dives, this also means that the action is not
undoable.

Move that to the appropriate undo command, where it makes
more sense, but obviously also makes things more complicated.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-11 09:31:36 -08:00
Berthold Stoeger
5692f0d68a undo: add missing invalidate_dive_cache() calls
The AddWeight, RemoveWeight, EditWeight and ReplanDive
commands were missing invalidate_dive_cache() calls.
Add them to ensure that the dives are written to git
logs on save.

Fixes #3150

Reported-by: Peter Zaal <peter.zaal@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-11 08:42:17 -08:00
Dirk Hohndel
0ff1145fd8 update CHANGELOG
This also includes the already merged statistics for mobile.
All of this still needs to be added to the user manual.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10 15:57:39 -08:00
Dirk Hohndel
68dd039a81 statistics: add CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-03 13:56:18 -08:00
Dirk Hohndel
eacf766ae8 add CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Berthold Stoeger
296a391faa prefs: add option to display only actually used tanks
A user complained about the default cylinders list. Provide
a preferences option to turn this off.

When changing the preferences, the tank-info model will be
completely rebuilt. Currently, this is a bit crude as this
will be done for any preferences change.

Suggested-by: Adolph Weidanz <weidanz.adolph@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:49:59 -08:00
Dirk Hohndel
3e8bd6caa3 Get ready for 4.9.10
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-20 13:53:26 -08:00
Dirk Hohndel
d6d3c9a02f core: fix incorrect QString::asprintf/vasprintf usage
These are static functions, they cannot be used as a method on an object to
construct that object.

commit aa5f2e7c73 ("cleanup: replace deprecated sprintf()/vsprintf() calls")
introduced this bug in an ill-advised attempt to deal with a deprecation
warning.

This caused us to not print GPS coordinates in the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-17 12:56:40 -08:00
Robert C. Helling
10bedf02d0 Gracefully handle infinite MND for oxygen
When breathing pure oxygen and considering it not
narcotic, there is not maximal narcotic depth and
the formula divides by zero. So better, handle this
case separately.

Fixes #3080

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-11-13 11:10:48 -08:00
Dirk Hohndel
78da1869ce Update README and ReleaseNotes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-12 11:24:50 -08:00
Dirk Hohndel
10a026b2ff filter: avoid Windows crash
The scope confusion between s (the for loop variable) and s (the function
argument) caused a crash in the s.split() on Windows.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-12 07:46:52 -08:00
Dirk Hohndel
51d0cb7aba Update README, ReleaseNotes and CHANGELOG
This is the first step towards the 4.9.8 release.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-07 15:59:08 -08:00
Dirk Hohndel
9e38b2552b update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-03 23:08:39 -08:00
Dirk Hohndel
f53aa42838 Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-30 16:36:08 -07:00
Berthold Stoeger
c6188bbe47 devices: connect DiveComputerModel to undo-command
Instead of modifying the device table directly, call the undo
commands. Moreover, don't keep our own copy in the mode - show
the original version. Connect to the appropriate signals.

This means that the calls from the DiveComputerManagement
dialog have to be removed, since this mode of editing is
not supported. The whole dialog will be removed in a future
commit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:04 -07:00
Berthold Stoeger
d543196059 desktop: overwrite drag & drop in TagWidget
The interaction of Qt's drag & drop with GroupedLineEdit was
exceedingly weird. The user was able to scroll the viewport
making the text invisible.

This implements a very primitive alternative drag & drop
functionality: dropped text is regarged as a distinct tag.
This means that it is not possible to modify existing tags
by dropping in the middle of them. Arguably, this might even
be better than arbitrary drag & drop. But even if not perfect,
this fixes a very nasty UI behavior.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24 09:49:36 -07:00
Dirk Hohndel
0278f3f90c Update Changelog
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-24 09:47:37 -07:00
Dirk Hohndel
0aaa654433 build-system: switch to current libhidapi
A few years ago the upstream for libhidapi changed - it became part of the
libusb GitHub org. Switching to the latest version appears to fix some odd
problems with talking to the Suunto Eon Steele/Core dive computers on macOS (at
least I can no longer reproduce the problem after switching to the current
version).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-16 14:14:50 -07:00
Lubomir I. Ivanov
5931be4c88 CHANGELOG.md: add note about fixing missing Vista theme
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2020-10-09 07:31:54 -07:00
Berthold Stoeger
6729428b6a core: improve merging of cylinders pressures
When merging cylinders pressures derived from samples were taken
as maximum of the start and minimum of the end pressure, which
makes sense, since we believe that this is the same cylinder.

However, for manually entered pressures, this was not done.

Moreover, when one dive had manual pressures and the other only
pressure from samples, the manual pressure was taken. However,
that could have been the wrong one, for example if the end
pressure was manually set for the cylinder of the first part of
the dive, but not the last.

Therefore, improve merging of manuall set pressures in two ways:
1) use maximum/minimum for start/end pressure
2) if the pressure of one cylinder was manually set, but not for
   the other, complete with the sample pressure (if that exists).

Fixes #2884.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-05 12:59:02 -07:00
Berthold Stoeger
7b196a5ef9 desktop: allow moving dives to arbitrary trips
The UI only allowed adding dives to trips above or below the
current dive (and even that is buggy). This is a strange
restriction, since trips are designed to be non-contiguous.

Allow adding dives to any trip using the new trip selection
dialog. The undo-command is already there, so only little
code to write.

This feature was requested on the mailing list.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03 10:01:13 -07:00
Berthold Stoeger
06c35026d6 desktop: fix paging through dive list with page-up key, etc
In the dive list we have horrible code, which intercepts all events
to save the selection before/after the event. This was necessary
because we couldn't get Qt's selection data flow under control.

This means intercepting all events that can change the selection.
The page-up, page-down, home and end keys were forgotten. Add these
cases.

Fixes #2957.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-02 11:10:28 -07:00
Berthold Stoeger
068194b2e5 CHANGELOG.md update concerning new filter system
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29 16:14:31 -07:00
Robert C. Helling
efdc875aa3 Use correct pO2 when computing MOD in equipment tab
The cylinder model is used both in the planner and the
equipment tab. We have three preferences for the pO2 that
is used to compute MOD: In the planner, there is one for
the bottom part of the dive and another one for deco.
Those are set in the planenr UI. There is another value,
controlled in the Tec Prefernces. That one should be
used in the equipment tab rather than the one from
the planner.

Fixes #2984

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-09-29 15:46:55 -07:00
Dirk Hohndel
a469dfa348 mobile/dive-list: correctly update view when changing dive date
If the dive timestamp changes, the dive could move in the dive list. But the
current dive actually doesn't change (it's still the same dive, right?). Yet
we need to update the dive list as well as the shown dive (especially if this
is after adding a dive, which is first inserted with the current time and then
updated with whatever the user enters).

Fixes: #2971

Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-27 14:16:18 -07:00
Berthold Stoeger
f42dee8ac2 selection: when changing current dive make sure it is selected
When an undo command selected invisible dives, a current dive outside
of the list of selected dives was chosen. This could have the very
unfortunate effect that the current dive was set, though not selected.
From an UI point of view this meant that the dive was displayed, but
edits would not be registered.

Change the setClosestCurrentDive function to select the current dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-20 18:23:57 -07:00
Berthold Stoeger
43390d4a9a dive list: on reload update filter status
At some time, when introducing the global reset signal the filter
stopped being reloaded when loading a new log. This leads to very
strange UI behavior: dives disappear when editing fields unrelated
to the filter.

Therefore, when reloading the model, reset the filter. One might
argue whether this is the correct place. On the other hand, we
might even make the filter a sub-object of the dive-list model.
Let's think about this.

Partially solves #2961

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-20 18:21:56 -07:00
Dirk Hohndel
767f0a4f3e Update ReleaseNotes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-19 19:29:22 -07:00
Berthold Stoeger
75be59c76d media: read timestamp from mvhd header of MP4/QuickTime videos
ExifTools (and probably other meta-data editors) modifies the
mvhd creation date, but leaves the individual creation dates
in the tracks unchanged. Therefore, use the mvhd atom.

Reported-by: Eric Tanguy <erictanguy2@orange.fr>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-19 11:11:16 -07:00
Dirk Hohndel
836936a767 documentation: updates for ReleaseNotes and README
Prep for 4.9.7, but also some minor tweaks to the README.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-12 10:48:48 -07:00
Berthold Stoeger
72312bec2f desktop: on weight type change, don't overwrite weight if already set
When importing from other software, it happens that weights are imported
without their type. When the user changes the type, the imported weight
is overwritten, which is not exactly a friendly behavior.

On the other hand, when changing the type after creation of a weight
entry, it is preferrable to set a default weight. This is convenient
for people who commonly use the same weight.

As a compromise, set the default weight only if it was unset. We
recognize this by a weight value of 0 g.

Fixes #2938

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-12 10:36:36 -07:00
Berthold Stoeger
fbd2160af2 desktop: make completion of equipment types substring search
User request: when entering a cylinder type, do a substring
search. For example, when entering "100" also find "AL100".
Currently, a starts-with search was used.

This is simply done by setting the "filterMode" of the
ComboBoxDelegate to "Qt::MatchContains".

Suggested-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-10 08:58:03 -07:00
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