diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/qthelper.cpp | 17 | ||||
-rw-r--r-- | core/qthelper.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp index ed2aeb924..fe06a7c00 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -1274,6 +1274,23 @@ QString get_gas_string(struct gasmix gas) return result; } +QStringList get_dive_gas_list(const struct dive *d) +{ + QStringList list; + for (int i = 0; i < d->cylinders.nr; i++) { + const cylinder_t *cyl = get_cylinder(d, i); + /* Check if we have the same gasmix two or more times + * If yes return more verbose string */ + int same_gas = same_gasmix_cylinder(cyl, i, d, true); + if (same_gas == -1) + list.push_back(get_gas_string(cyl->gasmix)); + else + list.push_back(get_gas_string(cyl->gasmix) + QString(" (%1 %2 ").arg(gettextFromC::tr("cyl.")).arg(i + 1) + + cyl->type.description + ")"); + } + return list; +} + QString get_taglist_string(struct tag_entry *tag_list) { char *buffer = taglist_get_tagstring(tag_list); diff --git a/core/qthelper.h b/core/qthelper.h index d78f65357..b380d2c8c 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -27,6 +27,7 @@ QString weight_string(int weight_in_grams); QString distance_string(int distanceInMeters); bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0); QString get_gas_string(struct gasmix gas); +QStringList get_dive_gas_list(const struct dive *d); QString get_taglist_string(struct tag_entry *tag_list); QStringList stringToList(const QString &s); void read_hashes(); |