diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-07-15 22:16:56 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-07-18 05:42:55 -0700 |
commit | b862e028c6695e9adfdffc2b46ad3c433ec7f214 (patch) | |
tree | 79ab8cc4addc868daedc741dc688f4f38d1cffc6 | |
parent | 342d04631eca0b2cc6138d2361e41a29ffb982e0 (diff) | |
download | subsurface-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>
-rw-r--r-- | core/dive.c | 13 | ||||
-rw-r--r-- | core/dive.h | 2 | ||||
-rw-r--r-- | core/equipment.c | 14 | ||||
-rw-r--r-- | core/equipment.h | 1 |
4 files changed, 15 insertions, 15 deletions
diff --git a/core/dive.c b/core/dive.c index b53982066..c353d196e 100644 --- a/core/dive.c +++ b/core/dive.c @@ -23,10 +23,6 @@ * here */ struct dive displayed_dive; -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") -}; - // For user visible text but still not translated const char *divemode_text_ui[] = { QT_TRANSLATE_NOOP("gettextFromC", "Open circuit"), @@ -567,15 +563,6 @@ void copy_cylinders(const 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]) || same_string(text, translate("gettextFromC", cylinderuse_text[i]))) - return i; - } - return -1; -} - void copy_samples(const struct divecomputer *s, struct divecomputer *d) { /* instead of carefully copying them one by one and calling add_sample diff --git a/core/dive.h b/core/dive.h index ca42406d5..1be628151 100644 --- a/core/dive.h +++ b/core/dive.h @@ -314,8 +314,6 @@ extern int save_dive_sites_logic(const char *filename, bool select_only, bool an struct membuffer; extern void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool anonymize); -int cylinderuse_from_text(const char *text); - struct user_info { char *name; char *email; 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) diff --git a/core/equipment.h b/core/equipment.h index 7c7991a6e..f498a3738 100644 --- a/core/equipment.h +++ b/core/equipment.h @@ -44,6 +44,7 @@ typedef struct #define MAX_TANK_INFO (100) #define MAX_WS_INFO (100) +extern int cylinderuse_from_text(const char *text); extern void add_cylinder_description(const cylinder_type_t *); extern void add_weightsystem_description(const weightsystem_t *); extern bool cylinder_nodata(const cylinder_t *cyl); |