Commit graph

19567 commits

Author SHA1 Message Date
Michael Keller
70aefd4db4 Fix coverity Scan Workflow.
Update the virtual machine to run on Ubuntu 22.04 ('latest' at the time
of writing).

Signed-off-by: Michael Keller <github@ike.ch>
2023-09-26 23:16:36 +13:00
Jef Driesen
97a76a6615 Report an error if enabling notifications fails
If enabling the notification fails, receiving data packets is not
possible. Instead of silently ignoring this fatal problem and trying to
continue, report the error back to the caller.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-09-14 09:52:29 +12:00
Robert C. Helling
81f35c1ecf Properly handle the planner state
This does two independent things:

It sets the planner state early enough so the appropriate
default profile for the planner is created (without
safety stop).

Upon cancelling the planner, it resets the profile widget
to profile more (rather than planner) as otherwise upon
the next change into the planner the planner model is
not properly initialized.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2023-09-12 06:48:33 +02:00
Robert C. Helling
83e7f537fb Text versions of Subsurface icon
To be used on Subsurface merch, this introduces versions
of the Subsurface icon with the program's name and web
address.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2023-08-16 12:11:23 +02:00
Michael Werle
fae68b7a68 fix: merge_pressure does not calculate starting pressures correctly
The existing logic correctly calculates the minimum (ie, ending) pressure, but not the maximum
(ie starting) pressure.

For example, 2 tanks A and B with manual pressures (same tank on subsequent dives, which were
then merged):
A: 205 - 84
B: 83 - 55

When merging the starting pressures, the call is : merge_pressure(205, 0, 83, 0, false)

The final comparison is:
  if(false && 205 < 83) return 205;
  else return 83;

-> So 83 is returned even though 205 should have been.

Signed-off-by: Michael Werle <micha@michaelwerle.com>
2023-08-09 14:35:32 +02:00
Michael Keller
26f20b805d Desktop: Consider Severity when Hiding Events.
When events are hidden in the profile, only hide events with the same
name and the same severity (flags).
From discussion in https://github.com/subsurface/libdc/pull/54.

Signed-off-by: Michael Keller <github@ike.ch>
2023-08-04 01:11:12 +12:00
Michael Keller
b324849d0c Housekeeping: Update libdivecomputer Submodule.
Update `libdivecomputer` submodule to the latest version.

Signed-off-by: Michael Keller <github@ike.ch>
2023-08-03 00:08:59 +12:00
Michael Keller
8f0380fd05 Equipment: Fix 'used' Gas Selection for CCR Dives.
Fix how gases are marked as 'used' and kept from being deleted in the
equipment tab for CCR dives.
It does not make sense to treat the (arbitrary) first gas in the list
with a usage type of 'diluent' or 'oxygen' as 'used' and prevent the
user from deleting it. Dive computers report the initial diluent and
any other diluents used through a 'gaschange' event, so the actually
used diluents are already picked up as part of gaschange event based
logic.
Also clarify the selection of the first diluent used as a default if no
gaschange events exist.
Also fixed the test data - gases that have a pressure change should be
included in the profile if they do not have a gas change recorded
against them by other dive computers, even if they are oxygen.
A secondary problem shown by this is that the pressure change is not
applied to the profile - the pressure is currently shown as constant on
the start pressure. But this is for another pull request.

Signed-off-by: Michael Keller <github@ike.ch>
2023-07-25 12:05:51 +12:00
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
Michael Keller
5e293689fd CI: Disable Broken Ubuntu bionic Build.
Disable the build, as this has not been working for some time, and is
creating a distraction.

Signed-off-by: Michael Keller <github@ike.ch>
2023-07-23 15:48:00 +12:00
Rafael M. Salvioni
8f8f901aa8 Check "hasDCSalinity" is null in updateWaterTypeWidget()
Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-07-14 19:47:34 +12:00
Michael Keller
5511cd13d7 Add forcedFirmwareUpgradeSupported to supportedDivecomputers.
Signed-off-by: Michael Keller <github@ike.ch>
2023-07-11 07:30:49 -07:00
Michael Keller
4ac27e3c71 Desktop: Load the Dive Computer List in 'Configure Dive Computer' Dynamically.
Load the dive computer list in the 'Change Settings on Dive Computer'
dialog dynamically.
Also incorporate suggestions from
https://github.com/subsurface/subsurface/pull/3925#issuecomment-1595784076.

Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Michael Keller <github@ike.ch>
2023-07-11 07:30:49 -07: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
90e5de8357 Mobile: Make Cloud Auto Synch Status Easier to Understand.
Add an explicit checkbox to the 'cloud auto synch' status toggle in the
mobile 'Dive Management' menu in order to make it more intuitive to
understand.
This isn't super pretty, but I think it will improve the usability. A
prettier way to achieve this will be to redesign the `ic_cloud_off.svg`
/ `ic_cloud_done.svg` in order to make them intuitively recognisable as
unchecked / checked checkboxes.
Example of a support request caused by confusion from the current
implementation: https://groups.google.com/g/subsurface-divelog/c/9X-hTt9NFlE/m/ZcqtdOOhBQAJ

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-26 07:54:48 -07:00
Michael Keller
e260780c9d Export: Fix Cylinder Pressures in CSV Export.
Fix the cylinder pressures in the CSV summary export. Only show
pressures derived from `pressure` attributes in samples for the first
cylinder. Add support for showing pressures derived from `pressure0` ...
`pressureX` attributes.
Also cleaned up unit conversions, and changed tabs to spaces.
From discussion in
https://github.com/subsurface/subsurface/pull/3906#issuecomment-1575980882.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-25 16:24:52 -07:00
Salvador Cuñat
5d708c0d92 Build script: Qt has tagged versions currently
It looks like Qt company has LGPLed versions tagged wich simplifies
things a bit while building, e.g. 5.15.3 current workaround matches
"v5.15.3-lts-lgpl" tag.

Background: Debian Sid is currently at Qt 5.15.8 which is impossible to
build from scratch with current script as only a few git versions are
tagged in the script format "v5.15.8".

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2023-06-25 09:47:56 -07: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
b5007bde67 Desktop: Regroup File Menu Entries.
Regroup the file menu entries to give the dynamically generated
'recently opened files' their own section.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-17 20:19:35 +02:00
Michael Keller
bceb367dc3 Cleanup: Use Correct Naming for Private Members.
Rename inconsistently named private members introduced in #3923.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-17 17:18:35 +02:00
Michael Keller
b0d5b23227 Desktop: Add Meaningful Error Messages for libdivecomputer Dump.
Add meaningful error messages when creating a libdivecomputer dump. In
particular show if creating a dump is not supported on the dive computer
that is used.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-17 12:06:34 +02:00
Michael Keller
a0cb6ad6d7 Desktop: Remove Unused Class Members.
Remove unused class member variables in
`profile-widget/diveprofileitem`.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-16 15:49:40 +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
35d88fa6ce Build: Fix build warning on MacOS.
Fix a build warning for an unused variable.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-12 08:04:30 -07:00
Berthold Stoeger
3939cc8da2 core: use range based for and std::string in enumerate_devices()
Just because now we can...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-06-03 12:54:24 +02:00
Berthold Stoeger
81cd91f78b core: more std::[w]string conversions in windows.cpp
No free()in necessary means less convoluted control flow.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-06-03 12:54:24 +02:00
Berthold Stoeger
a3f540fe34 core: fix warnings in windows.cpp
The compiler was (correctly) complaining about a const char *
to char * conversion.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-06-03 12:54:24 +02:00
Berthold Stoeger
540cba07f3 core: use C++ std::strings for default directory and filename
The memory management and string concatenation was hard to follow.

Since the mobile files ios.cpp and android.cpp were already
converted to C++, let's do the same for Unix, Windows and MacOS.

Simply store the default directory and filename in a function-level
static string. Thus, it will be initialized on first call and
freed on application exit. Since the std::string data is
guaranteed to be contiguous and zero-terminated, it can be used
from C code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-06-03 12:54:24 +02:00
Michael Keller
7771b444a1 Build system: Fix Windows Build Script.
Fix a bug preventing the `mxe` symlink from being created.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-01 07:04:50 -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
a127c4ac63 Mobile: Make Gradient Factor Range Consistent with Desktop.
Change the range to be 10 to 150.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-30 16:21:41 +02:00
Michael Keller
50438b0456 Mobile: Fix Editing of Gradient Factors
Fix the issue that Gradient Factors cannot be set to 100 in the mobile
version. This is done by changing the edits from a text box to a spin
edit, which seems to be a better match for numerical values.
As a side effect this also solves the issue that the keyboard for the
text edit is not properly displayed when settings are opened when dive
details are already on the page stack.

Fixes #3911.

Reported-by: @gbetous
Signed-off-by: Michael Keller <github@ike.ch>
2023-05-30 16:21:41 +02:00
Michael Keller
5d7f294407 Desktop: Rework Setting of Custom Date / Time Formats.
Rework the setting of custom date / time format preferences:
- fix bug causing case changes if custom format case insensitively
  matches a drop down entry;
- fix invalid format examples in tooltip;
- update URL for the format documentation;
- add support for quoted literals to the format validity warning.
From discussion in
https://github.com/subsurface/subsurface/issues/3849#issuecomment-1481239270.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-30 11:24:37 +02: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
62c2e9f07c Libraries: Update libdivecomputer.
Update libdivecomputer to include the changes from the libdivecomputer
v0.8.0 release:
- Divesoft Freedom and Liberty support
- A couple of iostream abstraction layers: a new 'packet layer' and a
  HDLC layer, moving code from low-level dive computer downloaders to
  generic iostream layers.
- misc minor updates

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-28 14:13:29 -07:00
Michael Keller
7ee5b10810 Desktop: Remove 'renderSVGIcon' methods.
Remove `renderSVGIcon()` and `renderSVGIconWidth()`, as QPixmaps can be
loaded directly from SVG, and support scaling.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-28 14:11:37 -07:00
Michael Keller
2ef6cd89cc Desktop: Use SVG directly for icons.
Use SVG files as source for icons where they exist, and remove the
respective PNG artefacts generated from the SVG files from the
repository.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-28 14:11:37 -07:00
Michael Andreen
9e95746797 profile: Fix so min pressure is not always 0
Signed-off-by: Michael Andreen <michael@andreen.dev>
2023-05-23 13:12:48 +02:00
Michael Andreen
7217506072 profile: Use all sensors to scale the pressure graph
It's possible for the first sensor to start with a pressure
significantly lower than other sensors.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2023-05-23 13:12:48 +02:00
Berthold Stoeger
a7889d1f4e cleanup: fix typo: verboseEnabebled -> verboseEnabled
Not really relevant, because it only affects debugging output.

But shows why I dislike weakly typed, non-compiled languages.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-05-20 20:07:22 +02:00
Michael Keller
9e059be4ca Android: Improve build instructions
Improve the build instructions for Android. Provide a complete script
for building in a re-usable container.
Also changed the Android packaging README to markdown.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-20 07:49:30 -07: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
84d9d0abe7 Desktop: Fix incorrect use of 'free()'.
Use 'xmlFree()' to free memory returned by libxml.
Follow-up to #3900.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-19 10:51:02 +02:00
Michael Keller
d7bfb9d61e Desktop: Fix memory leak during XSLT transformation.
Fix a memory leak occurring during XSLT transformations.

Fixes #3899.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-18 16:44:15 +02:00
Michael Keller
361baeda01 Fixed CSV parsing tests.
We now parse CSV and not TSV files.

Signed-off-by: Michael Keller <github@ike.ch>
2023-05-18 10:31:31 +03: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
Berthold Stoeger
cf95c3bd82 cleanup: remove unnecessary string duplication
I don't understand why the functions must be called on a copy
of the string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-05-02 09:35:01 +02:00
Michael Keller
15bf145f14 Desktop: Fix build for Qt6
This seems to be needed to make the build work with Qt6, which is needed for M1 based Macs.

Signed-off-by: Michael Keller <github@ike.ch>
2023-04-26 07:14:07 +02:00