Commit graph

324 commits

Author SHA1 Message Date
Dirk Hohndel
f1c1e0ccee prepare for 5.0.8 release
I forgot to clean up the CHANGELOG file for the previous release, and some of
the commits in this release were missing CHANGELOG entries.

This should make sense now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-27 17:41:24 -07:00
Quentin Young
7136ee463c core: allow separators ,; after degree-style coord
Tweak the Lat/Long coordinate parser to allow coordinates of the form:

12.1049° N, 68.2296° W

The coordinate parser works by tokenizing coordinates one at a time.
Consequently it is invoked twice on user input to get latitude and then
longitude. Normally, after parsing the first coordinate, intervening
characters such as , or ; and any whitespace would be discarded from the
input before parsing the second coordinate. Prior to this patch, if the
coordinate format was in degrees followed by a sign (N is a sign in this
example), the parser would skip the bit of code that fast forwards past
any intervening separators and whitespace (, in this example). This
resulted in coordinates of this form not being accepted, because the
second parse would start with , 68.2296° W and reject this as an invalid
coordinate.

To rectify this, the bit of code that fast forwards past separators and
whitespace has been broken out from the tokenization loop and performed
as a final step after a single coordinate has been completely parsed and
validated. Doing it this way makes it independent of the state of the
tokenizer, so that the fast-forward code will always execute once a
coordinate has been successfully parsed.

I've also centralized the list of allowed separators into its own static
string; this is necessary as part of the patch but should also make
allowing additional separator characters between coordinates trivial in
the future, if needed.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2022-03-27 16:37:10 -07:00
Berthold Stoeger
ba95edc2d2 statistics: switch themes on the mobile version
When changing the theme to a dark theme, also change the
statistics theme. The code is a mess, because it crashes
when setting the theme right at the beginning. Therefore,
there is a "theme has been set" flag. Also, this directly
accesses the ThemeInterface singleton object. I have no
time to fight QML, sorry.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Dirk Hohndel
69cb33fd2e build-system: move profile specific icons into separate QRC
This way they are available in both mobile and desktop version.
Without this, the icons weren't shown on iOS and Android.

Fixes #3214

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 15:05:55 -07:00
Berthold Stoeger
fce48367cd undo: more fine-grained undo of profile editing
Place undo commands for every change of the profile, not
only on "saving". Move the edit-mode from the mainwindow
and the maintab to the profile widget.

This is still very rough. For example, the only way to exit
the edit mode is changing the current dive.

The undo-commands are placed by the desktop-profile widget.
We might think about moving that down to the profile-view so
that this will be useable on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:32:22 +01:00
Dirk Hohndel
f8eb5140e2 mobile/profile: fix scaling of profile for HDPI screens
For reasons I don't understand, the device pixel ratio was taken into account
twice. And as a result the transformation applied to the profile made us show
only the top left part of it - but enlarged (depending on the DPR).

This code fixes that problem by simply forcing the transformation used by the
painter to be the identity matrix. I worry that this could be wrong in some
situations, but for now it seems to fix the problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-01 14:16:25 -08:00
Dirk Hohndel
83d6143f97 Android: use shareFile for support email
This way we can have attachment of fairly arbitrary size (which should
be extremely useful for long libdivecomputer logs). This isn't quite as
intuitive as what we did before - the user needs to pick an email app to
share with), but that doesn't seem too bad - and also... this way they
can share logfiles via Dropbox or analyze them in other apps).

If the file share fails for some reason, we fall back to the old method
with passing the combined logs as body to the support message.

As an implementation detail this keeps the correct path for the app log file around
(this was stupidly overwritten before).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-01 14:16:25 -08:00
Dirk Hohndel
3b42aada18 core: avoid crash when reading corrupted git data
If a merge mishap creates inconsistent data for a dive in git storage,
where the dive references a dive site that no longer exists, the app
would crash when trying to open the cloud storage.

I don't think a NULL dive could ever happen, but this seems fairly cheap
insurance.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-28 14:31:19 -08:00
Berthold Stoeger
777a57356b profile: fix ESC in planner
When in the planner, ESC should cancel the plan.

However, when the user manipulates the dive-handles in the
profile and presses ESC, first nothing happens, then an obscure
message appears.

The reason is that ESC "shortcuts" are introduced in two places.

To fix this, remove the ESC shortcut in the profile (the planner
widget cancels the plan anyway) and replace all the shortcuts in
the profile with a simple override of the keyPressEvent().

The latter is not strictly necessary, but hopefully avoids further
complications with multiple shortcuts. And the code is easier
to follow too.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-19 10:47:49 -08:00
Berthold Stoeger
b3c58e7172 models: export dive guide in DiveTripModel
We might want to display that in the dive list.

Fixes #3382.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:37:16 -08:00
Berthold Stoeger
9e0712d5dc core: replace dive master by dive guide
In general, replace "dive master" by "dive guide".

However, do not change written dive logs for now. On reading,
accept both versions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:35:43 -08:00
Berthold Stoeger
889827aadb desktop: don't update notes field when executing command
User report: when switching focus between windows, the
cursor position gets lost. This is due to a note-edit
command being fired, which then overwrites the notes tab.

To prevent this, don't update the notes field when placing
a command. Moreover, generally don't update the dive
selection when placing a command as that also rewrites all
the values.

Should this be extended to other fields?

Fixes #3365

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-02-15 09:34:23 -08:00
Oliver Schwaneberg
04c5ab0e36 Uemis support: hack around the need to reconnect the Uemis Zurich
When the file system of the Zurich gets full, the only way to continue to
download from it, is to disconnect and reconnect the dive computer (which
resets the FAT file system that it emulates to 'empty').

This solution is rather hacky and weird because it does a hard count down in a
busy loop, but given the narrow use case, this may be acceptable.

This also adds support for the UEMIS_DIVE_OFFSET environment variable that
allows the user to skip dives on the device.

[refactored by Dirk Hohndel]

Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-15 09:31:35 -08:00
Dirk Hohndel
ab8533eeaa update libdivecomputer
Add support for latest BLE hardware in OSTC dive computers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-14 12:42:33 -08:00
Berthold Stoeger
1e5191e33e statistics: add a sort mode for categorical bar charts
This was a user request: Sort bar charts by height of the bars.
Obviously, this can only work for categorical charts, not for
histograms.

The UI is a break from the old concept: the sorting is chosen
based on the chart, whereas for the rest of the features, the
viable charts are presented based on the binning, etc.

I found it confusing to have the possible charts be selected
based on sorting. I.e. if a non-bin sort mode is selected,
the histogram charts disappear. On the flip side, this would
be more consistent. We can change it later.

For value-based bar charts, there are three sort modes: by
bin, by count (i.e. number of dives in that bar) and by
value (i.e. length of the bar). This hopefully satisfies all
needs.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-01-04 11:14:24 -08:00
Berthold Stoeger
cbe6d89767 profile: fix editing depth / duration
The undo commands for depth and duration editing cleared
the samples of the dive computer. They relied on the profile
automatically creating a fake profile. However, at some point
that code got removed. Therefore, do it explicitly in the undo
command.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-04 09:40:08 -08:00
Robert C. Helling
07745893e5 Don't attempt to compute SAC for CCR dives
CCRs are different. It does not make sense to compute
a depth dependent SAC. You could compute the rate of O2
consumption but even that is likely wrong (as O2 in the
diluent would enter that as well), so simply don't attempt
it.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-11-24 11:03:51 -08:00
Dirk Hohndel
9c900415f3 Update README and ReleaseNotes for 5.0.4
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-10-14 19:35:27 -07:00
Robert C. Helling
41258647d2 Don't access gasmix.o2.fraction
Air is a special gas that does not contain oxygen according
to gasmix.o2.fraction. If you want to use the fo2, you
need to use get_o2() to treat this special case correctly.

This fixes a bug when setting the MND of a gas containing
21% oxygen when o2 is considered not narcotic.

Reported-by: Christoph Gruen <gruen.christoph@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-10-01 08:50:36 -07:00
Dirk Hohndel
539455071c update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Josh Torres
4e93d38482 Adding changelog entry for rich text support
Signed-off-by: Josh Torres <torres.josh.j@gmail.com>
2021-09-07 08:51:40 -07:00
Josh Torres
da6eb9d947 Add changelog entry
Signed-off-by: Josh Torres <torres.josh.j@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-06 13:00:42 -07:00
Dirk Hohndel
33dc5478d8 update README and ReleaseNotes for 5.0.3
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-20 20:26:26 -07:00
Robert C. Helling
c634a07e38 Planner: Correctly compute CNS and OTU for bailout segments
For dives with mixed divemode, one needs to check sample.setpoint
to figure out if the segment is an OC segment and the po2 needs
to be computed from the gasmix and ambient pressure.

This fixes #3310

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-08-19 10:58:08 -07:00
Dirk Hohndel
9b669d91e0 mobile: add ability to edit tags
We already showed the tags, but we didn't allow the user to edit them.

This tries hard not to create inconsistent or illogical tags by trimming
white space and being careful with how the tags are added.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 19:09:59 -07:00
Dirk Hohndel
3faff0b7f0 update Changelog and user manual
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-18 13:22:02 -07:00
Dirk Hohndel
f7e222718a desktop: avoid crash when changing dive logs
If the last displayed dive had events, those DiveEventItems had slots connected
that would update those icons if things changed. When closing the dive log and
switching to a different one, those slots were still called and would then access
freed memory (the event structure from that old dive that is long gone by then).
This code explicitly deletes those DiveEventItems which also removes those signal
slot connections.

Fixes #3305

Sugested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-16 18:37:59 -07:00
Dirk Hohndel
75fdb8676b core: add downloaded GPS to existing dive site
If we download a first dive computer and add a dive site to the dive (by
setting a location name for example), and then download from another
dive computer that provides us with GPS data, we should keep the
existing dive site information, but add the GPS data from the freshly
downloaded dive computer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-08-15 09:31:17 -07:00
Dirk Hohndel
42eb39fc4a changelog: add summary of recent changes
First step towards doing another release.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-23 11:49:24 -07:00
Dirk Hohndel
8ac0519a99 desktop: explicitly enable shortcuts
The changes in commit 4daf687876 ("profile: remove [disable|enable]Shortcuts()
signals") resulted in us no longer enabling the shortcuts on the desktop (at
least on macOS where I debugged this). This placement of the call feels like a
bit of overkill, but at least it shouldn't be wrong.

Fixes #3293

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-07-23 10:20:50 -07:00
Dirk Hohndel
32cec6a775 update README, ReleaseNotes, and supported dive computers for 5.0.2
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-06-30 10:53:31 -07:00
Berthold Stoeger
0b190243dd profile: remove internal event-copy (fix deleting/renaming events)
The DiveEventItem had an internal copy of the event. It passed
that copy to the undo-machinery, which of course didn't work.

Simply keep a pointer to the event. All changes to a dive no
pass via the undo-machinery, which causes a reload of the profile,
so this should be safe.

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-05 11:29:00 -07:00
Robert C. Helling
09bbd846da The planner should not always ascent from the depth of
the last manually entered waypoint but consider the
possibility that it should first top where we are
before the next stop depth has cleared.

Reported-by: David Carron

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-05-07 08:16:41 -07:00
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