aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveeventitem.cpp
AgeCommit message (Collapse)Author
2014-07-18Correct usage of current_dive to displayed_diveGravatar Anton Lundin
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>
2014-07-17Hide gachange events in the first 30 secondsGravatar Anton Lundin
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>
2014-07-17Use get_cylinder_index instead of get_gasidxGravatar Anton Lundin
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>
2014-07-17Use plot_data cylinderindex instead of event dataGravatar Anton Lundin
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>
2014-07-10Use different gas change iconsGravatar roberto forini
[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>
2014-07-01Don't show gaschange events at the beginning of a diveGravatar Linus Torvalds
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>
2014-06-28Profile: change event icon for gaschangeGravatar Dirk Hohndel
This is not ideal, but it gets us closer to what we need. Fixes #556 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-28Profile: remove old picture event handling codeGravatar Dirk Hohndel
We now handle pictures differently. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-23Be more consistent in partial pressure namingGravatar Henrik Brautaset Aronsen
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>
2014-06-08Gas was printed in permille, use gasname insteadGravatar Anton Lundin
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>
2014-06-01Encapsulate the horrid gas encoding in gas change eventsGravatar Dirk Hohndel
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>
2014-05-05Fix bug in handling of fake SAMPLE_EVENT_PO2 eventsGravatar Dirk Hohndel
In commit bcdd6192fe45 ("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>
2014-04-29Fix test for "air" in tooltip display of gaschangeGravatar Dirk Hohndel
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>
2014-04-29Show translated event names in tooltipGravatar Dirk Hohndel
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>
2014-04-03Edit name option for bookmarksGravatar Yosef Hamza
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>
2014-03-16New profile: fix event hiding logicGravatar Dirk Hohndel
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>
2014-03-15New profile: add event manipulation to context menuGravatar Dirk Hohndel
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>
2014-03-11Support Animation Speed via Settings.Gravatar Tomaz Canabrava
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>
2014-02-27Massive automated whitespace cleanupGravatar Dirk Hohndel
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>
2014-02-25New profile: add event info to tooltipGravatar Dirk Hohndel
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>
2014-02-23Don't try to setup event if it is NULLGravatar Dirk Hohndel
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>
2014-02-22New profile: add image pixmaps for image eventsGravatar Robert C. Helling
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>
2014-02-15Move the events when a partial pressure graph is enabled / disabledGravatar Tomaz Canabrava
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>
2014-02-08Fix the rest of item visibilities and a few alignment fixes.Gravatar Tomaz Canabrava
Every item is now back on the profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Fix compile time warningsGravatar Dirk Hohndel
Plus some small whitespace fixes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Transform the DiveProfileItem to an Abstract GeneralizationGravatar Tomaz Canabrava
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>
2014-01-17Added a DiveEventItem that knows how to handle itself.Gravatar Tomaz Canabrava
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>