When using that to indicate the dive type at the start of the dive, it's
visually strange to have an event marker.
See #826
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Lots and lots and lots of header files were being included without being
needed. This attempts to clean some of that crud up.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A value of zero (which is the normal legacy one) remains "unknown", but
the divecomputer backend can now give both gasmix and cylinder number
this way.
Currently only the EON Steel backend does that, but it should be easy
enough to extend others too.
Also, fix the user-visible cylinder numbering in the cylinder change
tooltip to use a human-friendlier one-based numbering (ie first cylinder
is "cyl 1", not "cyl 0")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code tried to look up the cylinder index from the Qt data models,
which was not only horribly confusing, but was also buggy. I think the
index ends up being off by one when the first cylinder change is hidden
(because it's at the beginning of the dive), but I can't make heads or
tails of that crazy code, so there might be something else going on.
Just remove all the crazy code, and use the event data directly. Which
gas the gasmix and the (potential) explicit cylinder index already.
It's much more straightforward, and it just automatically gets the right
end result whether some other event is hidden or not.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
as we load dives and dives, new DiveEvents will be created
but the transparent pixmap never deleted, also this makes
the transparent pixmap only for the correct event, not for
all of them.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Some dive computers appear to have heading data in every sample. In order
to avoid a completely cluttered dive profile we no longer show a flag for
every heading event but instead show a basically transparent pixmap (which
is invisible to the user) that allows us to report the heading information
in the tooltip but leaves the profile uncluttered.
Fixes#586
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of the 30 second heuristic we only assume that this is an explicit
first gas if the event coincides the first sample.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This isn't Cobalt specific, this is specific to dive computers that
indicate the first tank that's in use with a gaschange event that
coincides with the first sample.
We need to make sure that we suppress showing that gas change event
(regardless which cylinder it goes to) and instead set the correct
cylinder index from the very start of the dive.
This works with the test data I have and doesn't seem to break thing with
any of the files that I tried... but I'm worried that this is not the
right way to do things.
Fixes#742
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Decode the gasmix data into a sane format when creating the event, and
add the (currently unused) ability to specify a gas change to a
particular cylinder rather than (or in addition to) the gasmix.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
current_dive is the selected dive, and displayed_dive is the one we are
currently drawing. They are quite often the same one, but not in the
case of adding a dive for example.
This fixes potential null pointer dereferences in the case of a blank
divelist, and makes sure we use the correct data in the case of adding
and planning dives.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Back in 4.0 we hide all gaschange events during the first 30 seconds,
not just gaschange events on second 0. Eg, the OSTC3 emits its gaschange
event on the first sample, which can be 2, 10 or 30 seconds into the
dive.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Replace get_gasmix_from_event and get_gasidx with get_cylinder_index.
get_cylinder_index actually knows about both types of gaschange events
and the difference between them.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For the info box, we can't use the event data, because its not 1:1
mapped to whats in the cylinder and what we actually switched to. Use
the plot_data here we already calculated what we are switching to.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[Dirk Hohndel: scaled PNG files and added the code to show them and
to make them somewhat bigger]
Signed-off-by: roberto forini <forini.r@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The initial gas change event is really special - it just specifies the gas
mix from the dive computer. So don't show it as an event if that already
matches the initial gas.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Lets just use pO₂ instead of PO2, ppO2, ppO₂, PO₂.
They all mean the same, but it's better to be
consistent
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After the switch to a central event decoder and just return gasmix from
that we printed things in permille, eg. EAN1000 and 180/550 which looks
kinda strange.
This fixes that by using gasname instead to give the gas a name.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We should never pass permille values around as integers. And we shouldn't
have to decode the stupid value in more than one place.
This doesn't tackle all the places where we access O2 and He "too early"
and should instead keep passing around a gaxmix. But it's a first step.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit bcdd6192fe ("Show translated event names in tooltip") I was
too aggressive in replacing the checking for event names with checking for
event types. It turns out that we are abusing an existing event type in
the planner (and use a different event name to mark the difference). By
just checking for the type this now caused incorrect information to be
displayed in the info box (a simply "PO2 warning" on a Suunto D9 could
turn into a "Bailing out to OC" notice).
The correct fix is to get our own range of SAMPLE_EVENT_xxx numbers from
libdivecomputer. Once we have those, we can do this the right way. For now
we just fall back to also checking the event name (which is what I wanted
to get away from so translated names don't trip us up).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The "is_air()" test works when we have the gases in permille, but not in
percent. In that case we can just check for He == 0 and O2 == 21.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In order for this to work we need to compare against the event type
instead of the event name - which makes much more sense to do, anyway.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add the option to edit the name of a bookmark to be more meaningful for
the user they prefer.
It works just as simple bookmarks and can be removed and hidden.
It won't accept names longer than 22 characters because longer names will
display as garbage text.
Also changed the code from displaying flag depending on event name to
depending on event type.
Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Turns out we unconditionally set all events as visible when redrawing the
dive - even with a comment that this should take into account if the event
is visible. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This got lost when we switched to the new profile.
Remove event works. Hide events does call hide() on the DiveEventItem but
for some reason it stays visible. I'll hope for one of the more
experienced Qt people to fix that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is very userfull for a ( yet to be implemented )
preference dialog about the animation speed, so the
user can enable / disable the animations or make it a bit
faster for it's taste.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This appears to correctly add the tooltip to the event item, but for some
reason the tooltip isn't displayed for most events.
Still needs more work.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This also fixes the whitespace in a function that I instrumented to figure
out what's going on. I restored it to its original state, but I couldn't
leave the whitespace unfixed...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For reasons that I don’t understand, the image is only shown if the event
happens to be at the same time as a depth sample. This is, however, not
specific to these image events, it seems to apply to all events.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The events were static on the canvas even if the profile changed its size
because of a toggle of the partial pressure gas. This patch makes events
move on the canvas to their correct place.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The DiveProfileItem contained much of the complexity and
algorithms for almost all line-based items on the canvas,
so I transformed that to a general abstraction and implemented
a new DiveProfileItem that uses it. this should reduce a
bit of code since the implementation of the PP Graphs, Temperature
Cylinder Pressure and maybe a few others will only need to
reimplement the paint() and the modelDataChanged() methods.
The rest is ready.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Simply pass a event to the item and it will know what
to do. The sad part is that this isn't true yet - there's
quite a bit of boilerplate that a lot of the items are needing,
but the good part is that the boolerplate is the same in
all of the items, which means that I can create a tiny bit
of abstraction to encapsulate it and the code will be
way smaller to setup the items on the canvas.
Right now the items are being correctly placed on the
right places. It doesn't supports hidding / showing yet.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>