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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The profile knows which divecomputer it is plotting. No point
in accessing a global variable (which isn't even defined on
mobile).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The dive was passed as an argument to update_event_name(), but
the divecomputer was derived from the global dc_number variable.
That makes no sense. Therefore, pass the dc_number as argument
and update the only caller (smtk-import).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
split_divecomputer() is passed a dive and a divecomputer number.
However, it accesses the currently visible dc!
This would be a nasty bug if it werent for the fact that it is
called when placing an undo command and there it is passed the
current dive and divecomputer anyway.
Nevertheless, fix this.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>