diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-04-29 22:37:19 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-04-29 22:38:55 -0700 |
commit | bcdd6192fe457c878128f07125b32144a3ebe6bd (patch) | |
tree | ddcd4e69554517e6f593bd80bc3c593844d511eb | |
parent | 7eaa2c62c44c6b4b09f65ed5cbcfaef61e47d5d7 (diff) | |
download | subsurface-bcdd6192fe457c878128f07125b32144a3ebe6bd.tar.gz |
Show translated event names in tooltip
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>
-rw-r--r-- | planner.c | 3 | ||||
-rw-r--r-- | qt-ui/profile/diveeventitem.cpp | 10 |
2 files changed, 8 insertions, 5 deletions
@@ -12,6 +12,7 @@ #include "divelist.h" #include "planner.h" #include "gettext.h" +#include "libdivecomputer/parser.h" #define TIMESTEP 1 /* second */ #define DECOTIMESTEP 60 /* seconds. Unit of deco stop times */ @@ -263,7 +264,7 @@ struct dive *create_dive_from_plan(struct diveplan *diveplan) /* Check for SetPoint change */ if (oldpo2 != po2) { if (lasttime) - add_event(dc, lasttime, 20, 0, po2, "SP change"); // SAMPLE_EVENT_PO2 + add_event(dc, lasttime, SAMPLE_EVENT_PO2, 0, po2, "SP change"); oldpo2 = po2; } diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp index 54e3e4cbf..a75b8956d 100644 --- a/qt-ui/profile/diveeventitem.cpp +++ b/qt-ui/profile/diveeventitem.cpp @@ -6,6 +6,7 @@ #include "dive.h" #include "profile.h" #include <QDebug> +#include "gettextfromc.h" extern struct ev_select *ev_namelist; extern int evn_used; @@ -76,10 +77,11 @@ void DiveEventItem::setupPixmap() void DiveEventItem::setupToolTipString() { // we display the event on screen - so translate - QString name = tr(internalEvent->name); + QString name = gettextFromC::instance()->tr(internalEvent->name); int value = internalEvent->value; + int type = internalEvent->type; if (value) { - if (name == "gaschange") { + if (type == SAMPLE_EVENT_GASCHANGE || type == SAMPLE_EVENT_GASCHANGE2) { int he = value >> 16; int o2 = value & 0xffff; @@ -90,12 +92,12 @@ void DiveEventItem::setupToolTipString() name += tr("air"); else name += QString(tr("EAN%1")).arg(o2); - } else if (name == "SP change") { + } else if (type == SAMPLE_EVENT_PO2) { name += QString(":%1").arg((double)value / 1000); } else { name += QString(":%1").arg(value); } - } else if (name == "SP change") { + } else if (type == SAMPLE_EVENT_PO2) { name += "\n" + tr("Bailing out to OC"); } else { name += internalEvent->flags == SAMPLE_FLAGS_BEGIN ? tr(" begin", "Starts with space!") : |