summaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-01 17:55:09 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-01 18:03:32 -0800
commitdc03b7e7d689156c14a036283702944a8ca4d767 (patch)
tree09dea171549ce149431dbee1e5053dc09412369d /qt-ui/profilegraphics.cpp
parent795992b1f7a3d9c136f00d67459acf75426cb4e8 (diff)
downloadsubsurface-dc03b7e7d689156c14a036283702944a8ca4d767.tar.gz
We need the correct context to translate event names
Qt assumes that all strings are in the context of the class in which you use them. So when we want to display the translated event names from within the ProfileGraphicsView we need to make it explicit that these are strings that come from the C part of the code. Doing that showed another bug in the code where we foolishly compared the translated text to a fixed string. Not smart. Fixes #312 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profilegraphics.cpp')
-rw-r--r--qt-ui/profilegraphics.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 7645cba88..b1798f750 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -27,6 +27,7 @@
#include "../device.h"
#include "../helpers.h"
#include "../planner.h"
+#include "../gettextfromc.h"
#include <libdivecomputer/parser.h>
#include <libdivecomputer/version.h>
@@ -969,10 +970,10 @@ void ProfileGraphicsView::plot_one_event(struct event *ev)
item->setPos(x, y);
scene()->addItem(item);
- /* we display the event on screen - so translate */
- QString name = tr(ev->name);
+ /* we display the event on screen - so translate (with the correct context for events) */
+ QString name = gettextFromC::instance()->tr(ev->name);
if (ev->value) {
- if (ev->name && name == "gaschange") {
+ if (ev->name && strcmp(ev->name, "gaschange") == 0) {
int he = get_he(&dive->cylinder[entry->cylinderindex].gasmix);
int o2 = get_o2(&dive->cylinder[entry->cylinderindex].gasmix);