Add a column to the equipment table that shows if a sensor is attached to a
tank, or which sensors would be available to attach to a tank that currently
doesn't have a pressure sensor associated with it.
Changing the sensor assignement can be undone.
This column is hidden by default as this is a somewhat unusual activity.
Signed-off-by: Michael Andreen <michael@andreen.dev>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This file was so confusing: A tabwidget containing a layout
containing a tabwidget. This strange situation is probably
due to moving the multi-dive warning message.
Remove the file, there seems to be nothing of importance
in there. All the UI was moved to the individual tabs.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The UI was updated before storing the dive. This had a nasty
effect: the current dive was shown in the profile and if that
was a manually added dive, the DivePlannerPointsModel was
overwritten. Thus the planned dive couldn't be saved anymore.
There is a comment why the UI switch was done beforehand.
But in my tests, this didn't seem to be valid anymore.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
From a user's perspective, the edit mode is not a different
application mode anymore. Therefore, don't change the background
of the profile.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Currently, when the profile is in edit mode, the user can't
save, exit, plan a new dive and is requested to save the
current dive. However, this makes no sense anymore, since
the profile always switches to edit mode when showing a
manually added dive.
If the user has any unsaved profile changes, the usual
dirty checks of the undo-system apply.
Only show above behavior when in the planner. There it is
useful because, these are not included in the undo system.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In ProfileScene::draw(), the divecomputer was calculated
thrice. Remove the two redundant calls.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The edit mode was hidden in a context-menu. With fine-grained
undo there seems to be no need to explicitly exit edit mode.
Therefore, always switch to edit mode when displaying a
manually added dive.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
There was always this weird asymmetry that the "maintab" widget
is one of the tabs itself, whereas the additional tabs were
treated as extra-widgets. Turn the first tab into explicit
source files to make the distinction between container and
content clear.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This only calls MainWindow::showProfile(), so simply call
that directly.
Moreover make two "public slots" private member functions,
since these were only called locally.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When the user undos/redos the profile should update even
when in edit mode. This is a bit more complicated than
anticipated:
1) We should not do the update when emitting an undo command
from the profile. But we *should* update if it is an undo
command from the maintab (change depth/time).
2) The divepointsplannermodel has to be reset. Side note:
the code is truly abysmal as it sends numerous changed-signals.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>
It is confusing when undoing a command and nothing happens
in the UI. Therefore, switch to the corresponding dive when
undoing/redoing a replan or profile edit.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
These two actions were using the same command with a flag
controlling the name of the command, which is shown in
the undo menu.
However, the replanDive does much more (such as changing
the notes) and in the future we may want to be more
fine-grained with respect to profile editing. Therefore,
split these commands into two separate ones.
Moreover, make the editProfile command more flexible.
Pass an enum describing the action instead and also
a counter indicating how many points have been
moved or removed.
Finally, don't consume the input dive in the editProfile
command, because we will want to keep the original dive
while editing the profile.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
It appears that the QML object that is created when assigning the source
to the StatsView in the ui can be garbage collected and therefore
destroyed and re-instantiated without our knowledge. So instead of
trying to keep a pointer around, we end up looking up the object address
when needed.
We still ask the JS code to not garbage collect the object - but that
clearly isn't enough to prevent it from being destroyed when the parent
widget changes.
Without this fix opening the statistics will crash with Qt6.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With Qt the forward declaration fails as the export to QML for the statistics requires
the MOC code to be able to determine the sizeof(struct dive).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A member function had a minute name change.
The SceneGraphBackend is now set via a string argument, not a magic constant.
Thankfully that appears to be backwards compatible.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The QVectorIterator is only available in Qt6 when you explicitly add the
include files.
Suggested-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This no longer compiles when defined in the .ui file. But functionally this
should be the same and it should work on Qt5 and Qt6.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This worked without that include in Qt5, but having it there doesn't hurt,
either, so instead of yet another conditional compile, let's just include it
everywhere.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use the explicit QBluetoothUuid instead of just QUuid and deal with new
constants and signal names.
At least with Qt6 we no longer need the ugly QOverload hack.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QStringRef is gone in Qt6 and mostly replaced by QStringView. The one major
difference is that direct comparisons with string literals are no longer
possible.
Thanks to Thiago Macieira for helping me avoid more conditional compilation
here.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We do want the -Wfloat-conversion warnings where they point out
potential bugs. But they are very distracting when they are triggered by
floating point literals (which the standard defines as double) passed to
a function expecting float arguments.
The fact that Qt6 changes the arguments to all these functions from
double to float is... hard to explain, but it is what it is. With these
changes, for the majority of cases we create inlined helpers that
conditionally compile to do the right thing. And in a handful of other
cases we simply cast to float (and accept that on Qt5 this then gets
cast back to double... for none of these cases the potential loss in
precision makes any difference, anyway - which likely is why the Qt
community made the decision to change the type of the arguments in the
first place).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This has bugged me forever. The existing file creates a warning on every single
compiler invocation. I really need to figure out if I can get this fixed
upstream. But while I'm at it, I submitted it here to make it easier to spot
warnings in the build output.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These no longer compile with Qt6 - but they are already duplicated in C++ code,
anyway. So we can simply remove them.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>