Commit graph

19802 commits

Author SHA1 Message Date
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
Michael Keller
e60baff940 Desktop: Fix bug when synching to the cloud
Fix a bug introduced in 8cd451fc33 causing
an error to be thrown every time trying to do 'Save to cloud storage'.

Signed-off-by: Michael Keller <github@ike.ch>
2023-04-21 15:18:49 +02:00
Berthold Stoeger
a8d2b2ff70 divelog: fix erroneous use of std::move()
This has to be applied to the object, not the pointer to the object.
Fixes a double-free crash introduced in 8cd451f.

Alternatively, we could use std::swap() for C++98 charm and perhaps
better readability for people unfamiliar with C++11. Nowadays,
std::move() is more idiomatic though. Shrug.

Reported-by: Michael Keller <github@ike.ch>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-18 13:15:50 +02: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
Berthold Stoeger
cb410fe1ba cleanup: don't define empty inline constructor
Just use the constructor of the parent class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
e70e3082c9 planner: remove getRebreatherMode() from planner-model
There was this completely weird loop that the planner-widget would
call the planner-model to get the current rebreather mode, which
would then access the dive in the planner widget. Just keep those
things in the planner widgets.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
1fb9d6236b planner: initialize dive selection mode in constructor
There is no point in repopulating this regularly, as the
content does not change.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
4c02d1c279 planner: get rid of global displayed_dive variable
Allocate the dive in the planner. This is all a bit convoluted
and needs more cleanup.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
b5682369f8 planner: remove global model instances
The only user of the DivePlannerPointsModel and the
GasSelectionModel is the planner. Let's keep these models
there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
3dd09b31e3 planner: move repopulation of models to planner
The gas and dive-type models were repopulated in the
diveplanner model. The former are used in the planner.
However, the latter is also used outside of the planner,
when editing non-planned dives. Thus the former shouldn't
be repopulated by the latter, but by the code that needs
it.

Side note: repopulating the dive-type model seems to
make no sense whatsoever since the values never change,
but let's keep it for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
d51589b9a7 printing: don't access displayed_dive in printing code
To phase out this global variable, avoid access of displayed_dive
in the printing code. This is used when printing a plan. Instead,
when in plan-mode, pass the planned dive to the printing code
as a single dive to be printed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
80df790efc desktop: remove EditPlannedDive application state
The last user of that state was removed in 9bbd8b8169.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
d65f2f422c planner: access divemode (a.k.a. rebreathermode) from model
The mode was accessed via the global `displayed_dive`. In an effort
to remove globals, access it via the DivePlannerPointsModel instead.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
c5d6e0f44f core: make owning pointers a top-level features
The undo-code uses owning pointers based on std::unique_ptr to
manage lifetime of C-objects. Since these are generally useful,
move them from the undo-code to the core-code. In fact, this
eliminates one instance of code duplication.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
5b1557ccb1 core: don't clear displayed_dive when clearing data
displayed_dive used to contain the currently displayed (as in
shown on the profile) dive. However, now it is only a "scratch"
dive used by the planner and initialized every time the planner
is started. There is no point in clearing this dive when clearing
the dive data. In fact, the dive should probably be cleared when
the planner finishes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00
Berthold Stoeger
cad80e5a53 selection: move current dc logic to profile widget
The current dc global makes no sense on mobile. Therefore,
move the logic of the currently displayed dive computer
to the profile widget and remove the dc_number global
variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00