Commit graph

18121 commits

Author SHA1 Message Date
Dirk Hohndel
64913bba47 android: add qmake based build for Subsurface-mobile
Several features that are needed to create Android bundles with the
current NDK and QT 5.15 aren't easily available when using cmake. Given
that we already do a qmake based build for iOS, I decided to simply
switch Android to that as well.

An added complication is that some of the magic that qmake uses to do
the right things fails if the .pro file isn't in the root directory of
your project. So this is right now somewhat inconsistent with the way we
build for iOS. Something that should get cleaned up in the near future
as it makes no sense to maintain two separate .pro files.

This commits also adds a new build shell script to drive the assembly of
all the dependencies. Once again this is a new file with the old one
left in place for now (but to be removed fairly soon).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-19 17:18:33 -08:00
Dirk Hohndel
3a00ac0157 android: add new build setup script
This installs the required versions for most components, switches us to
Qt 5.15, current SDK, NDK, and the current OpenSSL version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-19 17:18:33 -08:00
Dirk Hohndel
fd88058060 android: update Subsurface-mobile manifest for Qt 5.15
With the switch to the bundle build (introduced at Qt 5.14) a couple of the
settings in the manifest had to change.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-19 17:18:33 -08:00
Dirk Hohndel
480cdca0e9 mobile: hack around error with readonly properties
This used to work, and still works with Qt 5.15 on the desktop, but on
Android we get a fatal error trying to open the app. So let's just add
another hack on top of all the other hacks we already have.

Eventually we need to bite the bullet and update Kirigami. I just wish
that wasn't such a pain.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-19 17:18:33 -08:00
Dirk Hohndel
47c837cc42 core/picture: don't compile all on mobile
We don't support adding pictures and videos on mobile, so let's not
referernce the infrastrutcture that's needed for that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-19 17:18:33 -08:00
Dirk Hohndel
afb062611c build-system: use libgit2 1.0.1 if building from source
We still only require v0.26 from an API perspective, but it seems
backwards to build that version when building from source as we do for
macOS or Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-19 17:18:33 -08:00
Dirk Hohndel
9f98369106 ios: correct capitalization of filename
This was changed in commit 9ed886e4be ("Cleanup: lower-case filenames in
core/subsurface-qt/") but since iOS builds happen on a case-insensitive
file system, no one ever noticed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-19 17:18:33 -08:00
Dirk Hohndel
d6d3c9a02f core: fix incorrect QString::asprintf/vasprintf usage
These are static functions, they cannot be used as a method on an object to
construct that object.

commit aa5f2e7c73 ("cleanup: replace deprecated sprintf()/vsprintf() calls")
introduced this bug in an ill-advised attempt to deal with a deprecation
warning.

This caused us to not print GPS coordinates in the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-17 12:56:40 -08:00
Berthold Stoeger
71389cfa92 cleanup: remove empty function MainTab::reload()
This used to reload the completion models. Moreover, remove two
obsolete member-function declarations.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-14 10:01:50 -08:00
Berthold Stoeger
38a784f5af desktop: automatically reload completion-models
Instead of programatically reload the completion models, listen
to the relevant signals in the models. To that goal, derive all
the models from a base class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-14 10:01:50 -08:00
Berthold Stoeger
52d5125926 undo: add a general dives-imported signal
Add a general dives-imported signal for those cases where we
want to fully rebuild models, notably, the completion models.
The divesAdded signals are too fine, because they are sent
per trip and we don't want to reload these models multiple
times per import.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-14 10:01:50 -08:00
Berthold Stoeger
67d956b44c cleanup: remove macros from qt-models/completionmodels.cpp
There were macros to auto-generate functions to reload the models.
One was only used once and therefore is pointless. The other can
be replaced by a function with a pointer-to-member-variable argument.

While doing this, adapt the coding style.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-14 10:01:50 -08:00
Robert C. Helling
10bedf02d0 Gracefully handle infinite MND for oxygen
When breathing pure oxygen and considering it not
narcotic, there is not maximal narcotic depth and
the formula divides by zero. So better, handle this
case separately.

Fixes #3080

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-11-13 11:10:48 -08:00
Dirk Hohndel
78da1869ce Update README and ReleaseNotes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-12 11:24:50 -08:00
Berthold Stoeger
b390fb368d desktop: update completion models if dive was edited
In the main-tab, when changing tag, buddy or divemaster,
update the corresponding completion model.
This is a quick-fix and the wrong thing to do. It works only
if the currently shown dive is changed, which is not a given.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-12 11:22:12 -08:00
Berthold Stoeger
0272f118ae printing: properly initialize DPI value
The DPI value in the print_options structure was never initialized.
This could lead to random DPI values and crashes. How this ever
worked is a mystery.

Therefore, read and write the DPI value from the settings just
as the other print-options. And initialize the corresponding dialog
widget to this value.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-12 11:20:54 -08:00
Dirk Hohndel
6d93a14d18 build-system: giving up on TestGitStorage
It is completely incomprehensible why these fail. And why randomly restarting
sometimes fixes them, and often doesn't. At this point there is no incremental
value in having this test. If it were to ever catch a real bug, we wouldn't
realize it because we are too well trained to ignore the problem.

Very disappointing, but IMHO the right thing to do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-12 11:19:55 -08:00
Dirk Hohndel
69e7baf682 build-system: allow building only a 64bit Windows installer
This is simply a time optimization that is sometimes useful

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-12 11:19:55 -08:00
Dirk Hohndel
10a026b2ff filter: avoid Windows crash
The scope confusion between s (the for loop variable) and s (the function
argument) caused a crash in the s.split() on Windows.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-12 07:46:52 -08:00
Dirk Hohndel
6133796cda Update latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-10 08:39:25 -08:00
Dirk Hohndel
d3a3263671 Update Supported Divecomputers list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-09 07:13:16 -08:00
Dirk Hohndel
95a82ef035 Update ReleaseNotes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-08 16:15:25 -08:00
Dirk Hohndel
79c7ac347a Update to latest libdivecomputer
Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-DS9

  Merge upstream libdivecomputer from Jef:

   - support the Scubapro Aladin A2

   - improve Cressi Goa support

   - parse and report Oceanic firmware versions

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-08 16:12:50 -08:00
Dirk Hohndel
cd0aec4f17 Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-08 15:58:16 -08:00
Dirk Hohndel
947a100d45 translations: brute force adjustment of tranlated text
Thanks to commit 299ba20364 ("Update translation source strings") all
the translated terms in the Command classes are now part of the base
class. So remove the references to the subclasses in the translation
sources as well.

Fixes: #3068

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-08 14:56:19 -08:00
Dirk Hohndel
299ba20364 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-08 14:41:40 -08:00
Dirk Hohndel
8e3f7f9565 desktop: fix translation implementation
We need to always call the tr() function of the base class. This will have
consequences for our translations.

See: #3068

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-08 14:39:26 -08:00
Dirk Hohndel
51d0cb7aba Update README, ReleaseNotes and CHANGELOG
This is the first step towards the 4.9.8 release.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-07 15:59:08 -08:00
Dirk Hohndel
58ea215881 desktop: minor tweak for dark modes
This ensures that the BT/BLE devices are legible, regardless of light or dark
mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-07 15:23:53 -08:00
Berthold Stoeger
41c0fb4039 filter: don't escape '&' in filter-preset menu
When constructing an action, '&' is used as the keyboard shortcut
marker. Since this mangles preset names, use the setIconText()
function of the action instead.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-07 14:08:39 -08:00
Berthold Stoeger
5caac4c480 filter: don't render filter preset name as HTML text
QLabels must be explicitly set to not accept HTML input.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-07 11:37:51 -08:00
Berthold Stoeger
396598430b desktop: fix saving of column-widths of device and site tables
Qt's memory management scheme is completely broken and messes
with common expectations.

QObjects are organized as a tree. The children are destroyed
in the destructor of QObject. This means that they are destructed
after the destructor of the parent object has run and its
sub-object were destructed. Obviously, this makes no sense as
the child objects should be able to access their parent at
any time.

To restore the commonly expected deterministic order of
construction and destruction, one might simply do away with
Qt's silly object tree and organise things using classical
subobjects. However, that breaks with the Qt-generated UI
classes: The objects generated by these classes are *not*
destructed with the UI class. Instead, they are attached
to the widget's QObject tree. Thus these are again destructed
*after* the widget! Who comes up with such a scheme?

In our case this means that we cannot have models used for
TableViews as subobjects, because the TableView needs the
model to save the column widths in the destructor. Which,
as detailed above is called *after* the desctructor of the
widget! Thus, turn these models into heap-allocated objects
and add them to the QObject tree.

Funilly, this exposes another insanity of Qt's QObject tree:
Children are destructed in order of construction! One would
expect that if objects are constructed in the sequence
A, B, C one can expect that C can, at any time, access B and A.
Not so in Qt: The destruction order is likewise A, B, C!

Thus, take care to init the widgets before the model. Jeez.

Finally, print a warning in the column-saving code of
TableWidget, so that these kind of subtleties are caught
in the future.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-07 11:37:51 -08:00
Berthold Stoeger
291768b63c desktop: rename table widget in DiveComputerTab to "devices"
The custom TableView widget saves the table width on destruction.
For that, it uses the "objectName()". Since the table of the
DiveComputerTab was simply called "table" in the UI file, the
widths were saved in that generic section. To avoid future
name-conflicts, rename the widget to "devices".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-07 11:37:51 -08:00
Berthold Stoeger
68b63534a3 desktop: maximize size of last column in filter-preset table
This was just ugly: the column with the "trash" symbol and the
name had the same size. On creation of the object, make the last
column expand and adapt the size of the "trash" column according
to its content.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-07 11:37:51 -08:00
Dirk Hohndel
360123d432 mobile: add missing word to location warning
Thanks to Johan, one of our Swedish translators for noticing this
oversight.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-05 14:22:15 -08:00
Dirk Hohndel
1d7a44ea8b Update translation source strings
This removes a few unnecessary strings from the recent desktop changes
that were reverted.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-04 16:12:45 -08:00
Berthold Stoeger
04149623c1 core: don't construct std::string from null in device.cpp
Recently the QStrings were replaced by std::strings in device.cpp
so that they can be accessed from C-code. However, libstd being
modelled after C, constructing a std::string from a NULL pointer
leads to a crash.

Fix one case where this was overlooked.

Moreover, replace a null-pointer check by empty_string(), to
treat NULL and "" equally.

Reported-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-04 15:53:15 -08:00
Dirk Hohndel
be3190db8a revert preference settings for title color
Because of subsequent changes there is no clean way to just revert the changes
introduced in commit 8b36cf1051 ("desktop: offer different colors for info tab
titles"), so this manually removes the parts we don't need anymore.

This also restores a tooltip value that was inadvertantly removed in that
commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-04 14:51:55 -08:00
Dirk Hohndel
6201ac34b4 desktop: automatically pick a good theme title color
The preference setting seemed far too strange to do this. And not very user
friendly. So instead we figure out if this is a dark theme or not by looking at
text and background colors in the palette, and make sure we get notified if
that changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-04 14:47:10 -08:00
Dirk Hohndel
4c6b00f812 Update translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-04 12:13:17 -08:00
willemferguson
335d3f9c07 Reorganise the current statistics tab
As the title above says....

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-11-04 11:34:26 -08:00
Dirk Hohndel
041b51f930 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-04 11:01:28 -08:00
Dirk Hohndel
9e38b2552b update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-03 23:08:39 -08:00
Dirk Hohndel
814cda7183 desktop: generalize the colorization of the tab widget
Instead of doing it just for the Information tab, do it for all of the tabs.
There's still room for improvement. But this certainly feels more consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-03 23:08:39 -08:00
Dirk Hohndel
7d18a525f1 desktop: allow update of tab widget colors at run time
Adding a new virtual function to all of these classes may seem like overkill,
but of course the idea is that likely we'd allow similar changes to all of
them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-03 23:08:39 -08:00
Dirk Hohndel
00dd98163f cleanup: random small whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-03 23:08:39 -08:00
willemferguson
8b36cf1051 desktop: offer different colors for info tab titles
Add a preference option to set the color of the text on the information tab to
either MediumBlue, LightBlue or Black. The last two of these colors are meant
to enable areadable font contrast on displays with dark mode.
The choice is saved with the other preferences.

[Dirk Hohndel: this isn't really about dark mode, so changed many of the types
	       and variable names, changed the user visible texts, and
               addressed some whitespace issues]

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-03 23:08:39 -08:00
Salvador Cuñat
1ff488a439 smtk-import: Add support for new devices model
Include devices Ids in the DC data.
Ensure we always set a DC model string for manual dives or unsupported devices.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2020-11-01 14:52:34 -08:00
Dirk Hohndel
c5ab9647d5 build-systsem: move back to Xcode 11
It appears that Xcode 12 applies some rather self defeating logic when picking
build architectures in release builds for the simulator. It adds aarch64 by
default and I can't find a way to turn that off from the command line. At the
same time, you can't link against the simulator if you have build with aarch64
as the aarch64 simulator doesn't exist, yet.

Since I couldn't get any of the claimed workarounds to work, I'm forcing Xcode
11 to be used in the Action.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-01 14:28:09 -08:00
Berthold Stoeger
386e08b69c parser: don't crash when parsing <weight> tags
When encountering a <weight> tag, we would parse into the last
weightsystem. However, we only create weightsystems when
encountering <weightsystem> tag. Therefore, this code would
either crash or overwrite the previous weightsystem.

Instead, create a new weightsystem for each <weight> tag.

Moreover, make sure that inside a <weightsystem> tag a
weightsystem actually exists. This should be the case,
but who knows...?

Reported-by: Nihal Gabr <gabr.nihal@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-01 10:59:39 -08:00