summaryrefslogtreecommitdiffstats
path: root/core/equipment.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-07-15 22:16:56 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-07-18 05:42:55 -0700
commitb862e028c6695e9adfdffc2b46ad3c433ec7f214 (patch)
tree79ab8cc4addc868daedc741dc688f4f38d1cffc6 /core/equipment.c
parent342d04631eca0b2cc6138d2361e41a29ffb982e0 (diff)
downloadsubsurface-b862e028c6695e9adfdffc2b46ad3c433ec7f214.tar.gz
Cleanup: move cylinderuse_from_text() to equipment.c
Since this function doesn't act on a dive and is only related to cylinders, move it to equipment.c and equipment.h. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/equipment.c')
-rw-r--r--core/equipment.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/equipment.c b/core/equipment.c
index a0a09d372..c984aa0b7 100644
--- a/core/equipment.c
+++ b/core/equipment.c
@@ -16,6 +16,20 @@
#include "dive.h"
#include "display.h"
#include "divelist.h"
+#include "subsurface-string.h"
+
+const char *cylinderuse_text[NUM_GAS_USE] = {
+ QT_TRANSLATE_NOOP("gettextFromC", "OC-gas"), QT_TRANSLATE_NOOP("gettextFromC", "diluent"), QT_TRANSLATE_NOOP("gettextFromC", "oxygen"), QT_TRANSLATE_NOOP("gettextFromC", "not used")
+};
+
+int cylinderuse_from_text(const char *text)
+{
+ for (enum cylinderuse i = 0; i < NUM_GAS_USE; i++) {
+ if (same_string(text, cylinderuse_text[i]) || same_string(text, translate("gettextFromC", cylinderuse_text[i])))
+ return i;
+ }
+ return -1;
+}
/* placeholders for a few functions that we need to redesign for the Qt UI */
void add_cylinder_description(const cylinder_type_t *type)