Commit graph

18274 commits

Author SHA1 Message Date
Berthold Stoeger
fa6eb6144b printing: move #includes from headers to source files
To decrease include-file interdependencies.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17 13:03:56 -08:00
Berthold Stoeger
2239ffe13c printing: remove YearInfo structure
This is a wrapper around "stats *" used to pass statistics
through Qt's weird metatype system. Not needed anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17 13:03:56 -08:00
Berthold Stoeger
bdf990d40e printing: replace dive master by dive guide in templates
This does not rename the variables, only the user-visible output.
Case "Dive guide" vs. "Dive Guide" is according to the rest of
the templates.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17 13:03:56 -08:00
Berthold Stoeger
0310eb31da printing: refactor if and loop code
The loop code was buggy: the current position was only increased
inside when executing the loop once. This would obviously fail
for empty lists. Moreover, the whole thing was quite difficult
to reason about, since a reference to the current position was
passed down in the call hierarchy.

Instead, pass from and to values to the parse function and
create a generic function that can search for the end of
loop and if blocks. This function handles nested if and for
loops.

The if-code now formats the block only if the condition is true.
The old code would format the block and throw it away if not
needed.

This should now provide better diagnostics for mismatched tags.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17 13:03:56 -08:00
Berthold Stoeger
f42a70586b printing: remove objects QVariant map
An artifact from the old grantlee code: the whole parser state
was kept in an untyped QVariant map. One case was particularly
bizarre: the options were a class member and yet added to the
weird map.

Replace this by a strongly typed state structure. Ultimately,
this will allow us to replace the "dive object helper".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17 13:03:56 -08:00
Berthold Stoeger
0cbb448740 cleanup: make templateOptions and printOptions reference types
These two structs describe options used during printing.
They are passed through numerous classes as pointer. In this
case, reference semantics are preferred, as references:
 - can never be null
 - can not change during their lifetime
This not only helps the compiler, as it can optimize away null
checks, but also your fellow coder. Moreover, it prevents
unintentional creation of uninitialized references: one can't
create an instance of a class without initializing a reference
member. It does not prevent references from going dangling.
However, pointers have the same disadvantage.

Contains a few whitespace cleanups.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17 13:03:56 -08:00
Dirk Hohndel
7bdd968e05 build-system/iOS: fix minimum iOS version supported
Qt requires iOS 10, let's not pretend that we can support ancient iOS 6.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
e3a83dcc90 build-system/iOS: remove outdated build-ios directories
The places we build things are still rather inconsistent for historic reasons -
this definitely deserves some more cleaning up.
The top level build-ios dir was completely unused, and the build location for
the googlemaps plugin was inconsistent with all of the other build dirs.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
856a0d36f5 mobile: update version to 3.1.1
3.1.0 was never released, but this is a quick hack to work around a versioning
issue in the iOS app store. Not ideal, but at least it works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
eacf766ae8 add CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
6043b223cb mobile: adapt resource names
With the new Kirigami the URI for the backwards and forwards arrows apparently
changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
fb3d1b3073 Android: improve documentation and setup script
This has now been verified to work on a fresh clean Ubuntu 20.04 install, both
using the docker image route as well as the full local build system.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
dbf2e3a857 GitHub Action/iOS: build in the right directory
The way I test things locally I build in the directory above the subsurface
directory. Let's match this on GitHub as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
de194d56be GitHub Actions: better job names
This makes it more obvious which action actually failed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
08c72605aa Github Actions: switch to Ubuntu 20.04
19.10 is no longer receiving updates and causing problems when running
the tests. 20.04 also uses Qt 5.12.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
f092d81866 build-system/iOS: ensure icons are bundled
We already did this for Android, so let's just always do it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
e00f8d4602 build-system/iOS: remove obsolete .pro file
We now use a shared one in the root directory.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
55dc445188 build-system/iOS: create the build directory parallel to subsurface
This seems more consistent with how we do things elsewhere.
Also make sure that the ssrf-version.h file is created in the correct
directory.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
80b5e7990a build-system/iOS: build Kirigami separately for iOS as well
Since the integrated build no longer seems to work, this creates a separate
Kirigami build using qmake (as I couldn't make Kirigami's cmake build work).

The install target tries to install into the Qt install which may not be
possible with a user account, so this instead uses the built library directly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
320b4a77ef build-system/iOS: ensure cmake works for Qt builds
I stumbled across needing this when trying to build Kirigami via cmake (just
like on Android). I abandoned that attempt, but there seems to be no harm in
adding this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
c5074c8af5 build-system/Android: work around missing C compiler in our build container
This of course needs to be fixed in the build container itself, but
for now this might be enough to make progress.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
4070c76501 build-system/Android: we need to collect the ABIs earlier
That's what happens if you develop a script like this sequentially.
We need to have the ABIs picked in order to build googlemaps, otherwise
this fails with the build container as that only includes the ARM
libraries and tools.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
6439a9b441 build-system/mobile: force using our own ECM build
If the OS has an older one installed, that is found first and the
build fails. This way we know that ours is used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
70470ffa45 build-system: configure git when running GitHub Action
In order to apply the patches for Kirigami, git insists on having
a valid user name and email.

Also, don't build the mobile app when preparing the AppImage. That
build already takes way too long and we test this in a few other
actions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
a7d6736665 build-system/Android: handle resource issues
It appears that the Kirigami shaders aren't bundled with the app. They
should be part of the plugin, but somehow they aren't. This way things
at least 'mostly work'.

We also need the icons. And to make this a bit more structured, move
those resource declarations into the Android part of the qmake file
until we know how all this works out on iOS.

The Android app is still fairly unusable with all kinds of weird font
problems and many other issues, but at least it once again starts.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
820fefb372 mobile: more build hackery
So while the documentation explicitly says that you need to have the
getInstance()registerTypes() call, that clearly is not supported if you
build kirigami as a library. Even the required include file doesn't
exist in the install-root.
So let's try some other way to make this work. Heck if I know what the
correct way of doing this might be.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
2fd464893b android/build-system: build kirigami as library
Doing it this way using the cmake build system at least gets us to the point
where everything links and appears to fit together. It still doesn't work at
all, but hey, progress.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
732d7ac8c8 mobile/qmake: use correct Kirigami files
And don't try to build kirigami in the same qmake run. The inclusion of the
.pri file doesn't appear to lead to a build that works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
582a2479ac build-system/mobile: remove old script
This was just kept around for reference.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
1720791786 kirigami: maintain our patches relative to upstream
Having them as commits like this should make it easier to migrate them
as we update the underlying Kirigami version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
3c89964d79 mobile/kirigami: add the shaders as resource
These should already be part of the kirigami plugin, but without explicitly
adding them here they appear to not get found at runtime.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
241d6105c0 mobile: fix implementation of menu back feature
With the updates to Kirigami I slightly modified the hack that we use to
implement that, as a result we call pop() directly on the globalDrawer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
24bb4d7677 mobile/kirigami: install our own copy of ECM
Instead of relying on this being available as a system resource, treat it
the same way as we treat Kirigami and the Breeze icons.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
a883fce612 mobile: re-add breeze icons
This time from the cloned repo.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
d9d3588d55 mobile: add yet another import path to find Kirigami QML module
This needs some careful testing across the different OSs we are trying
to support.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
1f9fa8b462 mobile: avoid warning in QML code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
35ca8e4c66 mobile: don't use reserved word
This used to work, but with current QML/Kirigami it throws an error.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
0e7fd632c1 mobile: silly whitespace cleanup
Simply because it bugged me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
9c208e88d6 mobile/Android: register the Kirigami plugin
According to the Kirigami documentation, this is only required on Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
9f21699cd1 mobile: use 3rdparty build of Kirigami
This should allow us to use the kirigami version that was built as 3rdparty
component.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
0851224b6c mobile/kirigami: first steps to switching to Kirigami 5.76
Our half-assed manual build of Kirigami was becoming completely unmaintainable.
So let's try to use the build method that the Kirigami team recommends. Which
unfortunately requires us to have access to the KDE extra cmake modules (ECM).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Berthold Stoeger
daebd0ad0e core: correct AL* tankinfo sizes.
Recently (d16a9f118a) the tankinfo table was made dynamic, which
means that the default tankinfos are added programatically.
Thereby, the wrong function was used for AL* type of cylinders:
metric instead of imperial. Fix those.

Reported-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17 08:10:56 -08:00
Berthold Stoeger
8d93192537 cleanup: remove MainWindow::stateBeforeEdit member
The last user was removed in accf1fcc8f.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:50:56 -08:00
Berthold Stoeger
53c2f34930 cleanup: remove unused typedefs
Last users removed in ca6aa38139.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:50:56 -08:00
Berthold Stoeger
296a391faa prefs: add option to display only actually used tanks
A user complained about the default cylinders list. Provide
a preferences option to turn this off.

When changing the preferences, the tank-info model will be
completely rebuilt. Currently, this is a bit crude as this
will be done for any preferences change.

Suggested-by: Adolph Weidanz <weidanz.adolph@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:49:59 -08:00
Berthold Stoeger
11e576ffbf core: remove the "no-name" tank info
There was a tank info with an empty name. According to a comment,
this is needed for the "no cylinder" case. However, we now support
empty cylinder tables, so this is not needed anymore. Therefore,
remove it.

Make sure that the user can still enter the empty name, just in
case. But don't save the size and pressure in that case.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:49:59 -08:00
Berthold Stoeger
a55c7ff079 desktop: don't save data to the "no-name" tank
There seems to be no point to saving data to the tank with
the empty name. Don't save tank-pressure and size to that
tank info.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:49:59 -08:00
Berthold Stoeger
d16a9f118a core: free tank info table on exit
This is obviously a pure code-hygiene thing. But with the new
dynamic tank info table, this becomes trivial, so let's do it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:49:59 -08:00
Berthold Stoeger
50b11024d6 core: keep tank infos in a dynamic table
The list of known tank types were kept in a fixed size table.
Instead, use a dynamic table with our horrendous table macros.
This is more flexible and sensible.

While doing this, clean up the TankInfoModel, which was leaking
memory.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:49:59 -08:00
Berthold Stoeger
2e328c7633 cleanup: remove unused #undefs in mainwindow.cpp
These macros were removed 2016-ish.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12 15:52:40 -08:00