Commit graph

380 commits

Author SHA1 Message Date
Michael Keller
5fae7ce7a0 Equipment: Include Unused Tanks in Merge if Preference is Enabled.
Include unused tanks in merges of multiple logs into a single dive if
the 'Show unused cylinders' preference is enabled.
Also rename the preference (in code) to `include_unused_tanks` to
reflect the fact that it is already used in more places than just the
display (exporting, cloning dives).
Simplified the cylinder model to make forced inclusion of unused tanks
dependent on use of the model in planner.
Leaving the persisted name of the preference as `display_unused_tanks`
to avoid resetting this for all users - is there a good way to migrate
preference names?

Signed-off-by: Michael Keller <github@ike.ch>
2023-07-25 11:19:03 +12:00
Michael Keller
cb6f768865 Equipment: Mark Gas Mixes Reported as 'inactive' as 'not used.
Mark gases that are reported as 'inactive' by the dive computer as 'not
used' in the Equipment tab.

Requires https://github.com/subsurface/libdc/pull/52.

Signed-off-by: Michael Keller <github@ike.ch>
2023-07-23 18:55:20 +02:00
Rafael M. Salvioni
695c37499a Core: Fix bug salinity and pressure values in mbar <-> depth conversion
The conversion between mbar and depth sometimes uses DC's salinity, sometimes user's salinity. By other hand, it uses surface pressure given by user in calculation.
This fix try to standartize this values, using them from same source.

Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-07-11 13:26:24 +12:00
Rafael M. Salvioni
1e082affdd Fix salinity combo/icon when DC doesnt have salinity info
Today salinity combo is editable if one of these rules matches: The dive was manually entered or if salinity edition is allowed in preferences.
However we can have cases that dives were downloaded but its doesn't have salinity info.

This fix considers if there's a DC salinity info to decides combo edition and if salinity change indicator will be showed or not.
If DC doesn't have salinity, the UI behavior is the same of a manual dive

Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-07-09 20:36:46 +12:00
Michael Keller
ce67c8b902 Desktop: Add a Button to Hide the Infobox in the Dive Profile.
Add a button that allows the user to hide the infobox with statistics
about the point in the dive under the mouse cursor in order to be able
to see the full dive profile unobstructed.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-25 14:40:23 +02:00
Michael Keller
700bba7e30 Desktop: Use Persisted Device Information for Dive Computer Configuration.
Use the dive computer / device information that was persisted when
previously downloading dives or configuring the dive computer in the
dive computer configuration dialog.
Also rename 'Connect with bluetooth' and 'Cancel' buttons in the dialog
to make them more consistent with what they do.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-12 12:40:44 -07:00
Michael Keller
4c193d7bdf Desktop: Rework the Summary CSV Export XSLT.
Rework of the XSLT used to generate the Summary CSV export:
- fixed a bug causing invalid CSV to be generated for double quotes
  (`""`);
- changed quoting and escaping to be compliant with RFC 4180;
- changed output to contain information for all cylinders for all dives
  (instead of limiting the number of cylinders to howevermany are used
   for the last dive);
- added an index to the cylinder data headings;
- changed unit designators to use `[]` instead of `()`;
- some minor improvements to the XSLT.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-31 20:11:39 +03:00
Michael Keller
6002387d7b Desktop: Add Multi-Tank Support for Profile Ruler.
Add support for tracking the gas usage across multiple tanks to the 'bar
used' and SAC values shown for the profile ruler.
The following rules are implemented:
- a tank is considered 'used' if at least one bar has been consumed;
- only used tanks are taken into account for calculations;
- 'bar used' is only shown if all tanks used have the same (or unknown)
  volume;
- SAC is only shown if all tanks used have a known volume.

Fixes #3902.

Reported-by: @pabdakine
Signed-off-by: Michael Keller <github@ike.ch>
2023-05-30 11:21:12 +02:00
Michael Keller
2aa13ea9d7 Desktop: Add mergeing into the selected dive site.
When editing a dive site in the 'Dive sites' view, add a context menu
entry to allow mergeing of the displayed dive site into the dive site
seleted in the 'Near dive sites' list.
This merge has the opposite direction of the existing 'Merge into
current site' function, which can simplify the workflow when maintaining
a large number of dive sites, as the facilities to sort dive sites in
the 'Dive sites' view does not have a way to sort by location or
proximity.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-20 07:24:39 +02:00
Michael Keller
1bd7806dcf Desktop: Change 'CSV summary dive details' output from TSV to CSV.
Change the output formato for the Export / 'CSV summary dive details'
from TSV to CSV, to make it consistent with the menu item name, and with
the other 'CSV' export function.
This was changed to TSV by @mturkia in
6c82578540,
but I could not find any discussion as to why.
Also removed replacement of the field separator in any fields, as,
according to the CSV RFC (https://datatracker.ietf.org/doc/html/rfc4180)
this is not required as long as the fields containing separators are
enclosed in quotes, and any quotes within the fields are doubled up.
Tested with a fairly large log file, and importing into Google Sheets is
working fine for the output produced.
Also made capitalisation of the Export menu items consistent.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-18 10:31:31 +03:00
Michael Keller
a38ea971a0 Import: Add option to sync time on dive computer download
Add an option for users to sync the dive computer time with the PC time
every time dives are downloaded.
Obviously this will only work on dive computers that have time
synchronisation support in libdivecomputer, for other computers a notice
is logged.
The selection for this option is persisted as a preference.

Signed-off-by: Michael Keller <github@ike.ch>
2023-04-17 07:56:02 -07:00
Dirk Hohndel
ad8aa988f0 Merge branch 'add_ostc4_force_firmware_update' of https://github.com/mikeller/subsurface
together with the libdc change this should now work

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-03-29 10:36:29 -07:00
Robert C. Helling
e27653374d Add printing option for page orientation
Strangely enough, half of the infrastructure was
already there, it just wasn't hooked up to a UI
element

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2023-03-28 21:08:37 -07:00
rafsalvioni
2f4b415e91 Saves default sea water salinity in log
Some DCs only report water type, without salinity level. Subsurface
fixes most of these cases using default levels, but when the type of water
is Sea/Salt, this fix was not saved.

This causes a bit confusion, mainly if the user defines own salinity level.

Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-03-28 20:51:36 -07:00
Michael Keller
9da7ec4828 Desktop: Fix use of bluetooth address for remembered dive computer.
Fix a bug causing the bluetooth address not being used when downloading
from a 'remembered' dive computer if the device selection is populated.
This specifically excludes MacOS, as 'remembering' bluetooth connections
does not seem to be working there as per
https://github.com/subsurface/subsurface/pull/2158#issuecomment-508933672.
I am not super sure why we are _not_ trying to use the 'remembered'
device if the device selection is populated (`ui.device->currentIndex()
== -1`) - maybe this should be clarified in a comment?

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-28 20:51:07 -07:00
Michael Keller
324fbfa685 Desktop: Add option to force overwrite firmware for OSTC4.
In order to support development of the open source firmware of the
OSTC4.
Requires changes in libdivecomputer.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-18 00:11:08 +13:00
Michael Keller
5b263a8f4e Desktop: Add notes column to dive list table.
Add a column for dive notes to the dive list table.
The column is disabled by default.
As requested in
https://groups.google.com/g/subsurface-divelog/c/PEFre85Ek1M.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-16 17:53:20 +01:00
Michael Keller
b9b47092c1 Desktop: Fix bug in diveplan for CCR dives with multiple segments.
Fixes a bug reported in
https://groups.google.com/g/subsurface-divelog/c/8N3cTz2Zv5E:
When planning a CCR dive with multiple segments, the textual dive plan
was showing a non-existent gas change with bogus data.  The first part
of the fix is uncluttering of the message printed: Since this change is
_after_ the current diveplanpoint the data needs to come from `nextdp`
and not `dp`.  The second part is that the message is not printed any
more if the current and the following segments have been manually added:
According to comments in the code the change should only be printed on
the segment _before_ the change if this segment is an ascent segment
that is followed by a manually entered segment.

Signed-off-by: Michael Keller <github@ike.ch>
2023-03-01 15:35:55 +01:00
Dirk Hohndel
e11c196a6a Update libdivecomputer
Merge upstream updates from Jef Driesen:

 - Deepblu Cosmiq+ support has been merged upstream

 - Oceans S1 support has been merged upstream

- Various new models supported: Cressi Donatello, Scubapro G2 TEK, new
  Excursion v6+ firmware.

- misc core changes, most notably supporting a new annoying specialized
  binary format for decomode, because Jef still can't deal with
  strings.

- lots of small details

(all the work done by Linus - I'm just adding this to Surface)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-02-20 12:02:25 -08:00
Michael Keller
ec0c6833a0 Fix invalid bailout gas choice when planning a CCR dive.
Fixes a bug reported in
https://groups.google.com/g/subsurface-divelog/c/8N3cTz2Zv5E:
When planning a CCR dive with OC bailout, the diluent gas may be chosen
as the first OC bailout gas, despite being set up with a use type of
'diluent', and likely not being available for open circuit breathing.
`best_first_ascend_cylinder` is now initialised to an invalid value
(instead of the first cylinder, which may or may not be a diluent
 cylinder), and its subsequent use is guarded by a validity check.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-17 10:49:24 +01:00
Berthold Stoeger
eb5d4f2a15 desktop: fix multi-dive editing of cylinders
3629a87 changed the handling of cylinders in multi-dives edit.
Not only should the cylinders be the "same", but also at the
same position. The code did not check whether the edited dives
even had that many cylinders, leading to a null-pointer
dereference.

Check whether the cylinder exists before comparing it.

Fixes #3578.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-02-10 20:09:34 +01:00
Michael Keller
1e3d378ad9 Cylindermodel: Improve editing of tank use
Use the drop down for editing the tank use in the gas list in both the
equipment tab and the dive planner.
The tank use column is now available in the equipment tab for all dives
and not just CCR dives, as 'not used' is a valid entry in both cases.
However, if the current dive is an OC dive, only 'OC-gas' and 'not used' are
shown.
There still seems to be a problem that in some cases, when opening the
planner after selecting an existing CCR dive the drop down in the
planner does not list CCR gas uses - for some reason `displayed_dive`
does not seem to be updated correctly on opening of the planner. But I have not been able to
reproduce this consistently, and changing 'Dive mode' fixes this.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-07 14:20:29 +01:00
Kim Delmar
1ed995aa7a html export: update CHANGELOG.md
Signed-off-by: Kim Delmar <62100831+KimDelmar@users.noreply.github.com>
2023-02-05 14:32:09 +01:00
Michael Keller
72c40a18c2 Desktop: Fix brightness configuration for OSTC4
The Heinrichs Weikamp OSTC4 introduced an additional
'Cave' brightness level that is dimmer than all existing ones.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-03 08:22:13 +01:00
Michael Keller
321c8d92dc Improvement: Show gases as diluent by default for CCR dives.
Instead of adding all gases read from a dive computer as part of a dive
log as 'OC-gas', add gases as 'diluent' if the dive has a dive mode of
'CCR'. This creates consistency with the ppO2 for CCR dives being
tracked as sensor readings or a fixed setpoint, and not as the ppO2 of
the current gas ad depth.
A follow up question from this is whether gas use in the cylinders list
on the Equipment tab should be user editable. This seems to be
inconsistent at the moment, with gas constituent percentages downloaded
from the dive computer being editable, but gas use not.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-01 21:26:48 +01:00
Martin Splitt
1b5de2d33b Update CHANGELOG.md
Signed-off-by: Martin Splitt <martinsplitt@google.com>
Signed-off-by: Martin Splitt <splitti@google.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-01-19 06:56:52 -08:00
Dirk Hohndel
763ce015ff update libdc
garmin: relax string parsing sanity checks

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-01-02 17:01:53 -08:00
Berthold Stoeger
5bd5ff2c2d statistics: fix zero-range on value axis
The code that calculates the bounds of the value axis was broken
when all items had the same value. In that case, increase the shown
range explicitly. It doesn't really matter how much the range
is increased, because all items will be at the center of the graph.

Also, don't overwrite the "decimal" value of the class. That was
just weird.

Fixes #3544.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-19 15:06:22 -08:00
Robert C. Helling
741099bdbb Show correct gas density in CCR mode
When collecting the data for the infobox, we have
already computed the current partial pressures of the
breathing gas taking into accoutn the divemode. Use
those rather than fractions (which for CCR mode are
those of diluent) to compute the gas density.

Reported-by: Pietro Tranquillini <p.tranquillini@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-11-08 10:43:47 -08:00
Berthold Stoeger
56c91a46b6 statistics: add enough entries for date axis
We must add one more entries than there are days, because the
entries describe the values between histograms.

The root cause of the problem here is that a histogram axis
is misused for a continuous day-axis.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-10-19 14:35:15 -07:00
Dirk Hohndel
7b5381b6de desktop: make time shift dialog show correct times
This got broken in commit 7417f865cd ("cleanup: un-singletonize
ShiftTimesDialog") and no one ever noticed.

We need to intitialize the when variable and set up the initial texts in
order for the time shift dialog to show the correct information. Doing
this in the ButtonClicked member (right before the dialog is destroyed)
makes absolutely no sense.

Fixes #3535

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-19 13:29:29 -07:00
Dirk Hohndel
98f1f670c4 Update README and ReleaseNotes for 5.0.10
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-01 13:28:49 -07:00
Berthold Stoeger
7c8dc016b5 mobile: flip through dive computers on mobile
UI fixed by Dirk.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-10-01 18:47:16 +02:00
Berthold Stoeger
17033d0d83 desktop: make dive site list an independent widget
This used to be one of the tab-widgets, which was illogical
and caused confusion. Notably, erroneously clicking on the
tab header led to a reset of the dive selection.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-23 15:50:49 +02:00
Robert C. Helling
77a5ca4234 For warnings, show icon in infobox
Render a warning sign in front of the event string
in the infobox. This is done in rich text.

Note: This shows the warning sign for all events,
not just warnings.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-09-12 19:30:31 +02:00
Berthold Stoeger
edf2a2f4f4 profile: implement panning of profile
When zoomed in, the profile position was moved by hovering with
the mouse. What a horrible user experience. This is especially
useless if we want to implement an interactive profile on mobile.

Instead, let the user start the panning with a mouse click. The
code is somewhat nasty, because the position is given as a
real in the [0,1] range, which represents all possible positions
from completely to the left to completely to the right.

This commit also removes the restriction that the planner handles
can only be moved when fully zoomed out. It is not completely
clear what the implications are. Let's see.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-09-03 13:51:00 -07:00
Michael Andreen
a39e69c497 Use combo box for moving sensor data
Also allow editing sensor on a cylinder with already attached sensor.
This will swap the sensor data with the cylinder that it is taking the
sensor data from, removing the need for adding an extra temporary
cylinder when swapping two sensors.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2022-09-03 13:38:34 -07:00
Berthold Stoeger
6d77d814a8 parser: allow import of dive sites without UUID
Fixes #3493.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-08-31 13:56:04 -07:00
Dirk Hohndel
87387b7e7e mobile: send logfiles as attachments on iOS as well
This was added for Android a while ago, but now this works on iOS as well which
is a very welcome addition for the recipient of these support emails (i.e. me).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-30 09:18:06 -07:00
Dirk Hohndel
0a4689c2e6 Ratio BLE detection fix
For Ratio dive computers we can't tell by the Bluetooth name which model it is.
There are BT only models and BLE only models. The failure case here was a user
on iOS (BLE only) with a BLE only dive computer which we didn't recognize
because previously we returned a BT only device (which isn't supported on an
iPhone), and the lookup won't return a valid descriptor if the transport needed
isn't available.

These days BLE is far more common, so return a BLE enabled name by default, but
try a BT only name just in case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-30 07:20:33 -07:00
Dirk Hohndel
8c644547fb mobile: fix reading of cache dir
For some reason the flag to exclude . and .. breaks this functionality.
It works just fine without that flag, so let's just remove it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-08-28 19:51:03 -07:00
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
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
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
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
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
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
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
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