Commit graph

19769 commits

Author SHA1 Message Date
Dirk Hohndel
2241a28499 build-system: make map support its own thing
Making this simply depend on Qt5 or Qt6 was short-sighted as work on QtLocation
upstream continues. Instead break this out as its own option.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
890f21bd58 whitespace cleanup
Random, I know. But it bugged me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Dirk Hohndel
65ef08f167 git: remove file global is_subsurface_cloud
Just like the rest of the git repo related information, this is already
included in the git_info struct.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-17 22:14:34 -07:00
Linus Torvalds
7e632173e0 Collect and convert git repo data to 'struct git_info'
We have this nasty habit of randomly passing down all the different
things that we use to look up the local and remote git repository, and
the information associated with it.

Start collecting the data into a 'struct git_info' instead, so that it
is easier to manage, and easier and more logical to just look up
different parts of the puzzle.

This is a fairly mechanical conversion, but has moved all the basic
information collection to the 'is_git_repository()' function.  That
function no longer actually opens the repository (so the 'dry_run'
argument is gone, and instead a successful 'is_git_repository()' is
followed by 'opn_git_repository()' if you actually want the old
non-dry_run semantics.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-04-17 22:14:34 -07:00
Dirk Hohndel
acc4dc57af core: work around water temperature bug in Tecdiving DiveComputer.eu
It appears to send a first sample with a water temperature of 0 C. If the next
sample contains a more likely water temperature, overwrite the first one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-13 14:29:10 -07:00
Dirk Hohndel
514edfec07 build-system: work around latest GitHub Action issue
This suddenly started. A couple of build would fail because the git submodule
checkout fails because of directory ownership issues. Hopefully this will fix
it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-12 23:35:25 -07:00
Dirk Hohndel
795cf1bee2 libdc integration: correctly parse DC_FIELD_SALINITY response
libdivecomputer tries to be super careful in what it tells us. It only offers a
density value if that is something that the dive computer explicitly supports,
otherwise it just offers back a flag. We need to then update the density value
ourselves.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-12 22:29:17 -07:00
Dirk Hohndel
ecfbf2a9ba update libdivecomputer
- Genesis React Pro: fix serial number
- OSTC: use deco model instead of dive mode for deco model information

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-04 14:36:56 -07:00
Michael Andreen
be2bdb8650 undo: Clear undo stack on file close
The undo stack is only relevant to the dives that were loaded at the
time the command was executed. If a file is closed, by specifically
closing it or opening another file, then the undo commands will
reference dives that aren't available anymore. Clearing the undo stack
ensures that we don't crash or accidentally do some undefined
modifications to the currently open file.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2022-04-03 08:34:39 -07:00
Berthold Stoeger
ada4632ff1 profile: remove last dc_number access from profile code
dc_number is a global variable indicating the currently displayed
dive on desktop. It makes no sense on mobile, since multiple
profiles can be active at the same time. Therefore, the profile
code should not access this global, but use the dc number that
is passed in.

This removes the last access.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-04-03 08:29:05 -07:00
Robert C. Helling
96e825fb2e Allow more than one media file when importing from the web
To import media files from the web, increas the size of the
dialog box and allow several URLs separated by newlines.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2022-04-01 08:28:05 -07:00
Anton Lundin
bc2de35242 configure-dc: Add support for ostc3 Auto SP mode
Way back in time, in HwOS 1.86 a CCR mode was added which automatically
switched between setpoints based on depth.

This entry was never added in our system to configure the dc, and caused
the issue seen in #3304

This adds the Auto SP mode, to the dropdown, thus fixing #3304.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2022-03-28 13:46:37 -07:00
Dirk Hohndel
f1c1e0ccee prepare for 5.0.8 release
I forgot to clean up the CHANGELOG file for the previous release, and some of
the commits in this release were missing CHANGELOG entries.

This should make sense now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-27 17:41:24 -07:00
Dirk Hohndel
fe53644150 translations: fix Portuguese parent translation
I didn't pay attention and entered the wrong flavor of Portuguese as the
parent translation. The one for Portugal is complete and should be the
parent, back-filling the one for Brazil where needed.

Suggested-by: Christof Arnosti <charno@charno.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-27 17:11:05 -07:00
Dirk Hohndel
b3a55e145f Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-27 17:07:45 -07:00
Quentin Young
7136ee463c core: allow separators ,; after degree-style coord
Tweak the Lat/Long coordinate parser to allow coordinates of the form:

12.1049° N, 68.2296° W

The coordinate parser works by tokenizing coordinates one at a time.
Consequently it is invoked twice on user input to get latitude and then
longitude. Normally, after parsing the first coordinate, intervening
characters such as , or ; and any whitespace would be discarded from the
input before parsing the second coordinate. Prior to this patch, if the
coordinate format was in degrees followed by a sign (N is a sign in this
example), the parser would skip the bit of code that fast forwards past
any intervening separators and whitespace (, in this example). This
resulted in coordinates of this form not being accepted, because the
second parse would start with , 68.2296° W and reject this as an invalid
coordinate.

To rectify this, the bit of code that fast forwards past separators and
whitespace has been broken out from the tokenization loop and performed
as a final step after a single coordinate has been completely parsed and
validated. Doing it this way makes it independent of the state of the
tokenizer, so that the fast-forward code will always execute once a
coordinate has been successfully parsed.

I've also centralized the list of allowed separators into its own static
string; this is necessary as part of the patch but should also make
allowing additional separator characters between coordinates trivial in
the future, if needed.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2022-03-27 16:37:10 -07:00
Quentin Young
dbbb39e0f7 CODINGSTYLE.md: note that macros should be caps'd
Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2022-03-27 16:37:10 -07:00
Dirk Hohndel
9745f80431 translations: load parent language translations
Many language have country specific differences. We recognize different
flavors of English (US, UK (and South Africa)), German (Germany and
Switzerland), and Portuguese (Brazil and Portugal). For many other
flavors of the languages that we have translations for we have no
support and the way we hard-coded the fallbacks in the past was odd and
meant that in the cases where we do have two flavors, missing strings in
one weren't taken from the other (English as the default language being
the exception).

This tries to do a better job of recognizing some of those parent
languages and loading translators for them, first. Which means if we
then find a translator for the specific language (i.e., de_CH), strings
missing in that translation are next searched in the parent language
(de_DE), before finally providing the source language string (en_US).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-26 14:10:16 -07:00
Dirk Hohndel
0a8344e613 Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-26 07:54:04 -07:00
Michael Andreen
386a3a35bc profile: Plot sensor data from other dive computers
If the current dive computer doesn't have a sensor for the cylinder then
check if another dive computer has sensor data available and use that
for the plot.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2022-03-26 07:32:50 -07:00
Dirk Hohndel
a363ad0910 build-system: fix failing installer builds
Both for Windows and macOS the installers actually didn't work correctly.

It turns out that the nifty trick (which is the officially documented way of
doing this) for setting up Qt5 OR Qt6 doesn't actually set up all of the
variables correctly - at least not on Windows and macOS.

Instead of trying to figure out why that part is failing, I decided to simply
immediately re-run the find_package for Qt5 if we don't find Qt6.

In the Windows case there was an additional problem: A very subtle typo where a
Qt5 turned into a Qt (which alone would have broken things).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-23 19:43:40 -07:00
Dirk Hohndel
b4e56ebef1 Prepare for Subsurface 5.0.7 release
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-21 18:49:44 -07:00
Dirk Hohndel
370e2db64a Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-21 18:41:27 -07:00
Dirk Hohndel
2886104b1d mobile: allow date only when adding/editing dives
Apparently some people try to manually enter older dives where they don't
have data about the dive time and therefore want to only capture the dive
date.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-18 08:57:55 -07:00
Dirk Hohndel
ccda4f557c mobile: fix broken undo stack initialization
We would dereference the undoAction before the command infrastructure
was initialized which led to a crash in the mobile app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-18 08:57:55 -07:00
Dirk Hohndel
56068f51cb Latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-18 08:57:55 -07:00
Dirk Hohndel
6b187e011f Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-18 08:57:55 -07:00
Berthold Stoeger
ba95edc2d2 statistics: switch themes on the mobile version
When changing the theme to a dark theme, also change the
statistics theme. The code is a mess, because it crashes
when setting the theme right at the beginning. Therefore,
there is a "theme has been set" flag. Also, this directly
accesses the ThemeInterface singleton object. I have no
time to fight QML, sorry.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
1cff14fa7f cleanup: replace function static variable by member variable
Global variables are evil. In this case not a problem, since
this is a singleton anyway. However, it is bad style and does
unnecessary thread synchronization.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
510f623c77 cleanup: remove unnecessary includes
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
144e81e8f8 statistics: make fonts themeable
Move the various font objects the the StatsTheme structure to enable
different font weights for different themes.

For the dark theme, switch to a bold font, because the thin white
font was barely visible.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
5f91c69f9c statistics: create themes on demand
Create the themes only when needed (singleton pattern). If
the themes should do more than colors, such as for example
fonts, it is not clear whether that can be done before main()
runs. By creating the themes on demand, the Qt UI should
be initialized in the constructors of the themes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Dirk Hohndel
7f1107408d statistics: add a rough dark theme
Some of the colors (like the bin colors or the highlight yellow) stay
the same, others are adjusted to fit better with a dark background.

This is far from perfect, but it's ok-ish.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-16 15:26:54 -07:00
Berthold Stoeger
b5aac29cea statistics: collect colors in a StatsTheme class
To enable rudimentary theming, collect all colors in a new
theme class. The class has to be passed down to the various
items.

In general the items save a reference to the them in the
constructor. Alternatively, they might also just query
the StatsView everytime they need to access a color.
For now, it's hard the say what is preferred: a reference
per item or a function call per invokation?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 15:26:54 -07:00
Dirk Hohndel
56e02dbcc0 mobile: update version to 3.4.4
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-16 14:41:20 -07:00
Berthold Stoeger
8a544f74ec stats: make textures "global objects"
These were leaking. Instead register them as global objects,
so they will be deleted on exit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Berthold Stoeger
ee9344eccf desktop: make MainWindow a "global object"
Thus, we don't have to delete it explicitly on exit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Berthold Stoeger
16aa761e86 core: make the QUndoStack a "global object"
Thus, it will be freed before application exit.

Freeing it later led to crashes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Berthold Stoeger
8577b00cb7 core: add class that collects global objects to be deleted on exit
We have a prevailing problem with global QObjects defined as
static global variables. These get destructed after main()
exits, which means that the QApplication object does not
exist anymore. This more often than not leads to crashes.

In a quick search I didn't find a mechanism to register
objects for deletion with QApplication. Therefore, let's
do our own list of global objects that get destructed
before destroying the QApplication.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Dirk Hohndel
197ea2b655 build-system: update Ubuntu targets
Hirsute no longer accepts builds, but Jammy apparently does.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-16 11:00:59 -07:00
Dirk Hohndel
c94e2b5d3f build-system: switch submodule protocol
As of today, GitHub no longer allows the 'git://' protocol, so we need to
switch the submodule and our other references to cloning git repos to
'https://' instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-16 06:46:07 -07:00
Dirk Hohndel
af88d34227 build-system: updates to GitHub Actions
Hirsute is EOL, so we need to move to Impish.
Adding Fedora 35 allows us to do a simple test against Qt 6.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-14 17:36:55 -07:00
Michael Andreen
451be04400 Fix merge problem in EditSensors
Need to save the current dc as a member variable so we can apply redo
and undo to the correct dc later.

Signed-off-by: Michael Andreen <michael@andreen.dev>
2022-03-14 09:34:16 -07:00
Dirk Hohndel
6354f97321 fix merge problem
I guess I get what I deserve.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 16:59:32 -07:00
Berthold Stoeger
ed83f6ce32 profile: only keep pointer to plot_info in ruler objects
Now this one was strange:

The ruler items keep a copy of the plot_info struct. However,
only a shallow copy is made (the actual plot data is not copied).
This means that the data is only valid as long as the source
plot_info is valid. But if that is guaranteed, we simply can
keep a pointer instead of the full object.

I wonder if it wouldn't be better still to keep a pointer to
the profile and query that for the plot info?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-13 15:08:01 -07:00
Berthold Stoeger
f9b9582a64 core: fold display.h into profile.h
The only things in display.h were profile related, so the
split between these two files is not comprehensible.
In fact profile.h includes display.h, because it needs the
struct defined therein. Let's just merge these two files.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
1496bbc314 core: move device related functions from display.h to device.h
It is ominous that these functions were declared in display.h.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
04241ebb9d core: remove select_dc() function
The only caller misused this function to get access to the
current divecomputer. Remove it, since selection of the
current divecomputer is handled by the MainWindow.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
e9aaab3c19 core: remove dc_number declaration from display.h
The global variable is already declared in dive.h

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00
Berthold Stoeger
d5fafc0e44 core: remove current_dc macro
There were only three users of that. For now do it inline, but
we may think about a separate function, which is only available
on desktop.

Moreover, add nullptr-checks, even if they are not strictly
necessary.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-13 15:07:33 -07:00