Commit graph

19159 commits

Author SHA1 Message Date
Michael Andreen
9b4263aa87 Allow editing sensors through equipment tab
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>
2022-03-12 11:24:50 -08:00
Berthold Stoeger
ec96cbaab5 cleanup: remove maintab.ui
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>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
357e115121 planner: update UI after having saved the dive
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>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
1fbdc387c8 profile: properly initialize zoomedPosition
This was not set to zero in the constructor, making valgrind
go crazy. Rightly so.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
a41742ab4d profile: don't change background color in "edit mode"
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>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
fd35fbb349 desktop: prevent exit only in plan but not in edit mode
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>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
b1384b286f cleanup: remove redundant get_dive_dc() calls
In ProfileScene::draw(), the divecomputer was calculated
thrice. Remove the two redundant calls.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
dea58bd67c profile: automatically enter edit mode
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>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
63664061eb cleanup: replace empty TabBase constructor by using directive
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
a4dbe51aee cleanup: remove TabBase::enter/exitEditMode() functions
Since the edit mode was removed, these became unnecessary.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:33:34 +01:00
Berthold Stoeger
152016d293 cleanup: break out the dive-notes tab
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>
2022-03-12 18:33:32 +01:00
Berthold Stoeger
2657ec9016 cleanup: remove MainWindow::refreshProfile()
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>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
4c46a11ed1 profile: update profile in edit mode on undo
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>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
5aa67c134b desktop: remove edit mode of maintab
This was only used for profile-editing, which is now managed
by the profile-widget.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
fce48367cd undo: more fine-grained undo of profile editing
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>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
c5c8bfec65 undo: switch to dive after replan / profile edit
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>
2022-03-12 18:32:22 +01:00
Berthold Stoeger
ea0c030770 undo: split replanDive and editProfile commands
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>
2022-03-12 18:32:22 +01:00
Dirk Hohndel
2368a183e1 Qt6: prevent QML object from being garbage collected
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
2ede1a4563 cleanup: replace deprecated methods
Sadly the replacements are new in Qt6.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
300248f446 Qt6: use the newer createCentral() API
This will cause us problems when using Qt6 on Android - but I don't see
this happening any time soon.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
240b2dc4df macOS: warn about harmless but annoying errors on M1 Macs
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
ddeafcfad5 Qt6: more QtLocation dependent parts in the CMakeLists.txt
These didn't really cause errors, but they were simply wrong to have there.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
eb1849d7ba Qt6: more CMakeLists.txt cleanup
We used yet another version dependent variable. This one is even weirder as it is
an undocumented one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
aad4282fc3 Qt6: fully define dive structure
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
41fd72c815 Qt6: small API changes
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
c3cc3155fc Qt6: add include files to keep QVectorIterator working
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
fc66352c3c Qt6: if we want the QString argument we need the TextChanged slot
I'm surprised this worked correctly in Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
5d506e4152 Qt6: move connection into C++ source
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
63f0af201e Qt6: add required QFile header
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
6700d617b8 Qt6: the help button is now opt in instead of opt out
This seems much more reasonable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
8b463ca158 Qt6: add missing includes
This class is only available via Qt5 compatibility and for that we need the
explicit include.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
3321904434 Qt6: deal with changed QtConcurrent::run API
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
f9b2d4fa25 Qt6: adjust for changed argument types
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
e61509b032 Qt6: deal with changes to window and layout geometry APIs
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
e29ecf2c9a Qt6: update to newer APIs for QDateTime
Fortunately, these were already available in Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
6f46238fc4 Qt6: Bluetooth API changes
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
78361ef8e3 Qt6: deal with changes from QStringRef to QStringView
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
47d900bee5 Qt6: don't build MapWidget
Since Qt6 doesn't include QtLocation anymore, we can't build MapWidget.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
ce254bee57 build-system: update cmake to allow Qt5 and Qt6
Qt6 builds of course still fail, but now they are at least possible.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
c4319e3995 build-system: Qt6 so far is missing Qt Location
So don't try to find the private headers and don't try to build the googlemaps
map plugin.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
da3417123a build-system: take Qt6 into account
We should find qmake - but in case there's only a qmake-qt6 binary,
try to use that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
59fe2f3d7e cleanup: prevent distracing conversion warnings
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
81ed23583e macOS: fix broken .pc file for libmtp
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
325addf385 cleanup: fix incorrect QFuture return value
I'm a abit confused why that didn't cause an error with Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
df610752c7 cleanup: don't add QKeySequence values
These should be handled as logical OR operations as they are bits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
9b3a9904b2 cleanup: remove duplicate connections in .ui files
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>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
cbad9607e8 cleanup: remove unused argument and private member
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
5dd3d1897f build-system: small cleanups for the CMakeLists.txt
Simply removing outdated things that will be in the way.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
e223cb3500 build-system: correctly build OpenSSL on ARM Macs
The OpenSSL configure script requires us to pass in the correct build spec.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
7dc3afba31 build-system: update to current OpenSSL version
This is required to compile it on ARM64 Macs (and of course also is
the right thing to do overall).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00