If we change the gps location of a dive that didn't have a dive site associated
before (which is the normal case when a dive was just downloaded from a dive
computer), a new dive site is created with that GPS fix and added to the dive.
We need to mark that dive as changed in order for the changes to be saved to
storage.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Currently, we do substring search. Implement starts-with and
exact mode (for example when search for "Cave vs. Cavern" tags).
For each textual search criterion add a combo-box.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This also deals with a bug we had before where we didn't re-start the calculation
for the various sizes from the assumption of 'at least 21 grid units'. Now you can
rotate the device and the right thing will happen.
Small warning - this checks the orientation of the screen, which is exactly what
you want it to do on your device. When running mobile on desktop this may not be
what you expect. Even if the window has a portrait aspect ratio, your screen is
likely still landscape... so testing this feature in mobile on desktop mode is a
bit harder...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When the cylinders became a dynamic data structure, a get_cylinder() call
suddenly could return a NULL pointer. So use get_or_create_cylinder() for the
first call when parsing the user's data.
Also, deal with an oddity where the string lists look different because an
empty list technically isn't the same as a list with one empty string.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This seems to work much more reliably as it specifically compares the cursor
position to the visible bottom and top of the screen.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When editing a dive site, the user can search for close dive sites
to merge duplicates. Dive sites without location are treated as
being located at 0N0E. This makes no sense, because:
When selecting a dive site without location, we shouldn't list
dive sites close to 0N0E.
Likewise when having a dive site close to 0N0E, we shouldn't list
dive sites that have no location.
Therefore, ignore these cases.
This also means that now dive sites without location are not
considered as close to other dive sites without location. That
might be a debatable point.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This appears to prevent Bluetooth from working.
Fixes: #2370
Suggested-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As per request from users on scubaforum.com, this adds
the current gradient factor to the deco information of
the infobox. Up to now, this information was only
graphically represented in the pressure bar graph
and the heatmap. This gives a numerical value.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
When selecting all dives via CTRL-A or manually and the trips
were not expanded, the QSelectionModel sends a single
selectionChanged signal per trip. We are reloading the map
in every call, making this very slow.
I couldn't figure out how to make QSelectionModel behave more
nicely, therefore I chose the nuclear option: Remove the map
reloading from selectionChanged() and hook into all functions
that do selection changes. In these functions, first call the
original code and then do the selection-changed operations.
This will certainly need some tuning.
Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The code seemed to do something really reasonable by picking one of the
supported OSTC versions - except that the one it picked didn't support
BT/BLE and therefore our logic of recognizing dive computers on iOS
failed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If there is a local cache, we at least once successfully accessed the cloud, so
this is a valid cloud based git tree.
Without this change we run into a subtle bug: after a fresh install, or when
switching users, when the cloud data is accessed the very first time, we don't
remember that this was indeed loaded from the cloud. So if we then download
from a dive computer or make any other changes to the dive log, we cannot save
those dives to cloud storage - but we fail silently doing so. Which to the user
would look that inexplicable data loss.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When displaying segment or stop times in the planner notes, we always
round to the next full minute. This can mean for example that we
round down more often than rounding up with the result that the sum
of the segment times does not match the total runtime and can for example
lead to stops that are shown with 0min duration.
With this patch, we increase the reference time of the last display only
by the duration time actually shown. This way, the rounding errors don't
accumulate but having rounded down previously makes rounding up the next
time more propable.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
When computing the best mix for a target depth, for helium, one
can either require that the partial pressure of N2 is the same
as at the target depth or the partial pressure of N2 plus O2.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
When clicking "done" on the dive site edit screen, the diveSite
member variable was reset to nullptr in acceptChanges() at the
beginning of the function. This prevented posting an undo-command
as a consequence of the active widget losing focus.
Reset the diveSite variable after exiting dive-site mode, which
causes the active widget to lose focus.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of copying the displayed dive, generate an undo command.
This makes the replanning an undoable action and fixes a bug
where the dive details have not been updated correctly.
Fixes#2280
Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In dive site mode, export selected dive sites, not dive sites
of selected dives.
Fixes#2275.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The application could be crashed by
1) Create dive site
2) Edit dive site
3) Undo until dive site is removed
4) Continue editing now non-existing dive site
Therefore, hook into the dive-site-deleted signal and if the
currently edited dive site is deleted, close the widget.
When closing the widget, make sure that the potentially
dangling pointer is reset to zero so that there is no
other potential use-after-free bug.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To recognize HTML-notes the text was scanned for <div> tags. But
apparently the planner notes do not feature such a thing. Therefore
extend recognition of HTML to <table> tags.
Note we can't use the <html> or <span> tags, because these are
*always* produced by the QTextEdit::toHtml() function.
Fixes#2265
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The create_plot_info_new() function releases old plot data. This
can only work if the plot_info structure was initialized previously.
The ProfileWidget2 did that by a memset, but other parts of the code
did not.
Therefore, introduce a init_plot_info() function and call that when
generating a plot_info struct. Constructors would make this so much
easier - but since this is called from C, we can't use them.
Fixes#2251
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On the main tab, the trip time was not shown when switching to
a trip. Implement showing of the trip date in a function, as the
undo-code will also have to update the trip date in certain
circumstances.
Fixes#2207
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This button only closes the filter panel but doesn't clear it.
Reported-by: Adric Norris <landstander668@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Commit 0c38754916 introduced a
bug in MapLocationModel::reload() by setting an entry in the
name-to-location map before the location was initialized.
Move the setting of the map entry back where it was before:
after the assignment of the location variable.
Moreover, define the location variable directly on allocation
of the location to avoid thus bugs in the future.
Why did we not get a "might be used unitialized" warning
anyway?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>