We must add one more entries than there are days, because the
entries describe the values between histograms.
The root cause of the problem here is that a histogram axis
is misused for a continuous day-axis.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This got broken in commit 7417f865cd ("cleanup: un-singletonize
ShiftTimesDialog") and no one ever noticed.
We need to intitialize the when variable and set up the initial texts in
order for the time shift dialog to show the correct information. Doing
this in the ButtonClicked member (right before the dialog is destroyed)
makes absolutely no sense.
Fixes#3535
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This used to be one of the tab-widgets, which was illogical
and caused confusion. Notably, erroneously clicking on the
tab header led to a reset of the dive selection.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Render a warning sign in front of the event string
in the infobox. This is done in rich text.
Note: This shows the warning sign for all events,
not just warnings.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
When zoomed in, the profile position was moved by hovering with
the mouse. What a horrible user experience. This is especially
useless if we want to implement an interactive profile on mobile.
Instead, let the user start the panning with a mouse click. The
code is somewhat nasty, because the position is given as a
real in the [0,1] range, which represents all possible positions
from completely to the left to completely to the right.
This commit also removes the restriction that the planner handles
can only be moved when fully zoomed out. It is not completely
clear what the implications are. Let's see.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Also allow editing sensor on a cylinder with already attached sensor.
This will swap the sensor data with the cylinder that it is taking the
sensor data from, removing the need for adding an extra temporary
cylinder when swapping two sensors.
Signed-off-by: Michael Andreen <michael@andreen.dev>
This was added for Android a while ago, but now this works on iOS as well which
is a very welcome addition for the recipient of these support emails (i.e. me).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For Ratio dive computers we can't tell by the Bluetooth name which model it is.
There are BT only models and BLE only models. The failure case here was a user
on iOS (BLE only) with a BLE only dive computer which we didn't recognize
because previously we returned a BT only device (which isn't supported on an
iPhone), and the lookup won't return a valid descriptor if the transport needed
isn't available.
These days BLE is far more common, so return a BLE enabled name by default, but
try a BT only name just in case.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For some reason the flag to exclude . and .. breaks this functionality.
It works just fine without that flag, so let's just remove it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When a dive has both real dive computers as well as at
least a planned version (which is just another dive
computer with a special name), only use the data from
real dive computers for aggregate values like maxdepth,
dive time, average depth etc in order not to have
imagined data on the dive list, statistics etc.
Macro-magic-provided-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This is crazy: when view() is called, the dive-site-suggestion
popup (DiveLocationListView) clears its WA_InputMethodEnabled
flag. This makes key composition not work as long as the
popup is open.
Thus, when showing the popup, explicitly set the flag.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The liter symbol is written as 'ℓ'. To allow searching for
that, normalize unicode strings to their base letter. This
corresponds to the 'compatibility' mode.
We might also think about stripping diacritics.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
It's confusing to have the same name refer to two different models.
Unfortunately, that's what Aqualung is doing by simply changing the
model number and serial number, but not the external branding.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of trying to find matching cylinders, trigger on the cylinder
number first and then only edit that n-th cylinder if it matches the one
in the current dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In a sign how few people use these additional properties AND use multiple
dive computers, this took a couple of years to get noticed... but yes, we
do need to merge those properties as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Arguably every dive should at least have one cylinder, but an imported
dive from divelogs.de might end up without one. Sadly, that breaks
assumptions that we make in the cylinder remapping.
To work around it, force at least on cylinder to be assumed in the merge
code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.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>
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>
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>
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>
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>
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>
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>
This way they are available in both mobile and desktop version.
Without this, the icons weren't shown on iOS and Android.
Fixes#3214
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
For reasons I don't understand, the device pixel ratio was taken into account
twice. And as a result the transformation applied to the profile made us show
only the top left part of it - but enlarged (depending on the DPR).
This code fixes that problem by simply forcing the transformation used by the
painter to be the identity matrix. I worry that this could be wrong in some
situations, but for now it seems to fix the problem.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way we can have attachment of fairly arbitrary size (which should
be extremely useful for long libdivecomputer logs). This isn't quite as
intuitive as what we did before - the user needs to pick an email app to
share with), but that doesn't seem too bad - and also... this way they
can share logfiles via Dropbox or analyze them in other apps).
If the file share fails for some reason, we fall back to the old method
with passing the combined logs as body to the support message.
As an implementation detail this keeps the correct path for the app log file around
(this was stupidly overwritten before).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If a merge mishap creates inconsistent data for a dive in git storage,
where the dive references a dive site that no longer exists, the app
would crash when trying to open the cloud storage.
I don't think a NULL dive could ever happen, but this seems fairly cheap
insurance.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When in the planner, ESC should cancel the plan.
However, when the user manipulates the dive-handles in the
profile and presses ESC, first nothing happens, then an obscure
message appears.
The reason is that ESC "shortcuts" are introduced in two places.
To fix this, remove the ESC shortcut in the profile (the planner
widget cancels the plan anyway) and replace all the shortcuts in
the profile with a simple override of the keyPressEvent().
The latter is not strictly necessary, but hopefully avoids further
complications with multiple shortcuts. And the code is easier
to follow too.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In general, replace "dive master" by "dive guide".
However, do not change written dive logs for now. On reading,
accept both versions.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
User report: when switching focus between windows, the
cursor position gets lost. This is due to a note-edit
command being fired, which then overwrites the notes tab.
To prevent this, don't update the notes field when placing
a command. Moreover, generally don't update the dive
selection when placing a command as that also rewrites all
the values.
Should this be extended to other fields?
Fixes#3365
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When the file system of the Zurich gets full, the only way to continue to
download from it, is to disconnect and reconnect the dive computer (which
resets the FAT file system that it emulates to 'empty').
This solution is rather hacky and weird because it does a hard count down in a
busy loop, but given the narrow use case, this may be acceptable.
This also adds support for the UEMIS_DIVE_OFFSET environment variable that
allows the user to skip dives on the device.
[refactored by Dirk Hohndel]
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was a user request: Sort bar charts by height of the bars.
Obviously, this can only work for categorical charts, not for
histograms.
The UI is a break from the old concept: the sorting is chosen
based on the chart, whereas for the rest of the features, the
viable charts are presented based on the binning, etc.
I found it confusing to have the possible charts be selected
based on sorting. I.e. if a non-bin sort mode is selected,
the histogram charts disappear. On the flip side, this would
be more consistent. We can change it later.
For value-based bar charts, there are three sort modes: by
bin, by count (i.e. number of dives in that bar) and by
value (i.e. length of the bar). This hopefully satisfies all
needs.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The undo commands for depth and duration editing cleared
the samples of the dive computer. They relied on the profile
automatically creating a fake profile. However, at some point
that code got removed. Therefore, do it explicitly in the undo
command.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
CCRs are different. It does not make sense to compute
a depth dependent SAC. You could compute the rate of O2
consumption but even that is likely wrong (as O2 in the
diluent would enter that as well), so simply don't attempt
it.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Air is a special gas that does not contain oxygen according
to gasmix.o2.fraction. If you want to use the fo2, you
need to use get_o2() to treat this special case correctly.
This fixes a bug when setting the MND of a gas containing
21% oxygen when o2 is considered not narcotic.
Reported-by: Christoph Gruen <gruen.christoph@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>