summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-17 14:15:19 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-17 14:39:30 +0000
commit8856417b2fb783ad3e8dcf95ddc9292cc1c5ba52 (patch)
treecd386687738935a5f901c376d3631b99444a7265
parent0c3f13d128f366b036a77dfd2d195cbcac8547ba (diff)
downloadsubsurface-8856417b2fb783ad3e8dcf95ddc9292cc1c5ba52.tar.gz
Allow translation of the cylinder use strings for the UI
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--dive.c7
-rw-r--r--qt-ui/modeldelegates.cpp7
-rw-r--r--qt-ui/models.cpp2
3 files changed, 9 insertions, 7 deletions
diff --git a/dive.c b/dive.c
index e9ecf3a92..56c0de0ec 100644
--- a/dive.c
+++ b/dive.c
@@ -26,10 +26,11 @@ static const char *default_tags[] = {
QT_TRANSLATE_NOOP("gettextFromC", "deco")
};
-const char *cylinderuse_text[] = { "OC-gas", "diluent", "oxygen" };
+const char *cylinderuse_text[] = {
+ QT_TRANSLATE_NOOP("gettextFromC", "OC-gas"), QT_TRANSLATE_NOOP("gettextFromC", "diluent"), QT_TRANSLATE_NOOP("gettextFromC", "oxygen")
+};
const char *dctype_text[] = { "OC", "CCR", "PSCR" };
-
int event_is_gaschange(struct event *ev)
{
return ev->type == SAMPLE_EVENT_GASCHANGE ||
@@ -586,7 +587,7 @@ void copy_cylinders(struct dive *s, struct dive *d, bool used_only)
int cylinderuse_from_text(const char *text)
{
for (enum cylinderuse i = 0; i < NUM_GAS_USE; i++) {
- if (same_string(text, cylinderuse_text[i]))
+ if (same_string(text, cylinderuse_text[i]) || same_string(text, translate("gettextFromC", cylinderuse_text[i])))
return i;
}
return -1;
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index 85be9ba62..9720e3f9e 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -1,10 +1,11 @@
#include "modeldelegates.h"
-#include "../dive.h"
-#include "../divelist.h"
+#include "dive.h"
+#include "divelist.h"
#include "starwidget.h"
#include "models.h"
#include "diveplanner.h"
#include "simplewidgets.h"
+#include "gettextfromc.h"
#include <QtDebug>
#include <QPainter>
@@ -286,7 +287,7 @@ QWidget *TankUseDelegate::createEditor(QWidget * parent, const QStyleOptionViewI
{
QComboBox *comboBox = new QComboBox(parent);
for (int i = 0; i < NUM_GAS_USE; i++)
- comboBox->addItem(QString(cylinderuse_text[i]));
+ comboBox->addItem(gettextFromC::instance()->trGettext(cylinderuse_text[i]));
return comboBox;
}
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 9464d6c37..f22a1f6c9 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -173,7 +173,7 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
ret = get_depth_string(cyl->depth, true);
break;
case USE:
- ret = QString(cylinderuse_text[cyl->cylinder_use]);
+ ret = gettextFromC::instance()->trGettext(cylinderuse_text[cyl->cylinder_use]);
break;
}
break;