mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
795992b1f7
commit
dc03b7e7d6
1 changed files with 4 additions and 3 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue