aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveeventitem.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-05 09:28:58 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-05 09:32:13 -0700
commit3063991e4ed22932c3c66d3970d22f4f9a513bbf (patch)
treed65608d0fd795f59db1f5f4504c9f4e6e27ba13a /qt-ui/profile/diveeventitem.cpp
parent8de1a736693e1fa4ff2cf79b284b44c3b2e1d639 (diff)
downloadsubsurface-3063991e4ed22932c3c66d3970d22f4f9a513bbf.tar.gz
Fix bug in handling of fake SAMPLE_EVENT_PO2 events
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>
Diffstat (limited to 'qt-ui/profile/diveeventitem.cpp')
-rw-r--r--qt-ui/profile/diveeventitem.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp
index 2f2bec60e..873c6abbe 100644
--- a/qt-ui/profile/diveeventitem.cpp
+++ b/qt-ui/profile/diveeventitem.cpp
@@ -92,12 +92,14 @@ void DiveEventItem::setupToolTipString()
name += tr("air");
else
name += QString(tr("EAN%1")).arg(o2);
- } else if (type == SAMPLE_EVENT_PO2) {
+ } else if (type == SAMPLE_EVENT_PO2 && name == "SP change") {
name += QString(":%1").arg((double)value / 1000);
} else {
name += QString(":%1").arg(value);
}
- } else if (type == SAMPLE_EVENT_PO2) {
+ } else if (type == SAMPLE_EVENT_PO2 && name == "SP change") {
+ // this is a bad idea - we are abusing an existing event type that is supposed to
+ // warn of high or low PO2 and are turning it into a set point change event
name += "\n" + tr("Bailing out to OC");
} else {
name += internalEvent->flags == SAMPLE_FLAGS_BEGIN ? tr(" begin", "Starts with space!") :