This must be the number one support request we get. I can't believe we never
thought of adding a button to do this.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When trying to build the integrated user manual,
the linker stopped with the error message "undefined reference to vtable ...".
This is a subtle bug, connected to the qt preprocessor MOC.
Adding "set(CMAKE_AUTOMOC ON)" to the desktop-widgets/CMakeLists.txt fixed the problem.
For more information, see:
https://github.com/bincrafters/community/issues/466https://cmake.org/cmake/help/latest/prop_tgt/AUTOMOC.html
Signed-off-by: Simeon Geiger <simeon.geiger@gmail.com>
We use the latter pretty consistently, so let's remove the few
left instances of the former.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Mostly irrelevant std::move() stuff of copy-on-write Qt objects,
a few real bugs, a timestamp_t downconversion and some codingsyle
adaptation.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On the InformationTab a signal is emitted when programatically
setting the index of the dive mode combobox which in turn then
edits the dive.
Usually not a problem, because the editing code realizes that
the value is not changed. It is however a problem when multiple
dives are selected.
Therefore, block the signals when setting the index. Same for
the other comboboxes on the same page.
Fixes#3960.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The DivePlannerWidget was initialized before the planner models.
However, it attaches these (non existing) models to the comboboxes.
That can't work. Initialize in correct order.
Fixes#4014
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Unfortunately Coverity doesn't understand that most Qt data
structures are copy-on-write. It's a mis-feature of Qt, but
it is the way it is. Thus, passing by value is not an issue.
Out of ca. 25 warnings only two were legit. Let's silence
the others by either std::move()ing or passing by reference,
as would be idiomatic C++, which Qt is not.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This hasn't been used on the backend in a long time (and appears to get
stripped out on several platforms). No point in keeping it around.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While the update to the copyright year really isn't required, it just looks
better.
By using the canonical instead of the git version in user visible strings we
are creating more consistency in how we refer to the version.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Increase the precision of the setpoint that can be specified per planned
leg of the dive to 0.01 mbar.
Some rebreather models (APD Inspiration) support this precision for
setpoint setting.
Motivated-by: https://groups.google.com/g/subsurface-divelog/c/pD5gYlG5szI/m/G8_as4TyBwAJ
Signed-off-by: Michael Keller <github@ike.ch>
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>
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>
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>
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>
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>
Regroup the file menu entries to give the dynamically generated
'recently opened files' their own section.
Signed-off-by: Michael Keller <github@ike.ch>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Don't access the global current_dc, but pass it to the sensor and
tank-use delegates, when the current dive or dive computer changes.
The same pattern is already realized for the tank and weight models.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The dive-equipment tab has a number of "delegates" for editing
tanks sizes, etc. Instead of allocating them, make them subobjects.
The main point here is that, in an upcoming commit, the sensor
delegate will have to be accessed to change the current dive computer.
So far it didn't have a name and therefore was hard to access.
By making it a subobject it also gets a name.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
An attempt at limitting accesses to the globals current_dive and
dc_number. These globals do not make sense on mobile.
The parent widget of the tab-widgets remembers the currently
displayer dive and dive computer and the individual widgets
access these values from there.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Make it possible for the individual tab-widgets to access the
parent widget. In principle this could have been done by
downcasting the pointer returned by parent(), but this makes
it explicit.
The goal here is to store information on the selection,
current dive, etc. without repeating it in every subwidget.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On selection change, pass down selection (including current
dive and dc) to the tab widgets. Ultimately, this should
remove access to global variables. A number of new accesses
are marked as TODO. They shall be removed in due course.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The signals/slot names for dive selection changes were a mess.
Unify on divesSelected(). Firstly, selectionChanged() is a Qt
thing. Secondly, it is consistent with tripSelected().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This was very weird: a setSelection() call was always followed
by a selectionChanged() call, though sometimes in convoluted
ways. Notably, the formed was called by the DiveListView, the
lattern then by the MainWindow.
Let's just merge these two functions.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In DiveListView user actions (select-all, key-press,
mouse-release) were intercepted to send the selection-changed
signal if the selection changed.
However, with the recent cleanups, this can be done
directly from selectionChanged(), since in all cases (at
least the ones I tested), the part of the function that
is responsible for manual selection changes is called
only once.
This avoids quite some complex code flow.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When manually selecting a trip, the selectionChanged()
virtual function was manually selecting the dives of the
trip and thus ultimately recurse into itself.
So far this seems to work OK, but better to avoid this
recursion by setting the programmaticalSelectionChange
flag.
I'd like to send the selection-changed signal directly
from selectionChanged() and this recursion would lead
to double signals.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The trip selection code was an awkward layering violation.
Whereas dive selections due to dive undo-commands trickled
down via DiveTripModel-->MultiFilterSortModel-->DiveListView,
for trip editing, the DiveListView directly intercepted the
TripEdited signal.
Instead, mimic the dive-selection code. This is a bit longer
but more consistent and logical. The undo/redo of trip changes
is now also a "programmatical" change of the selection.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
After sending a selection-change signal, there follows a current
dive changed signal. Combine these two into a single signal, since
usually the current dive is changed when the selection is changed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of accessing the global dc_number from the
DivePlannerPointsModel and the CylinderModel, pass them
in the respective initialization functions.
The dc_number global might not make sense on mobile.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>