diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2016-01-11 16:37:10 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-11 15:47:07 -0800 |
commit | 3a72699bfdac5d5c20f2a52543283e6f4ed9a24c (patch) | |
tree | d1fabf7a60552da6ddbb09396f98fb34c66fdfef /subsurface-core/subsurface-qt | |
parent | 28f4e12725a51bc10e7605c526fc9ecf23dc5758 (diff) | |
download | subsurface-3a72699bfdac5d5c20f2a52543283e6f4ed9a24c.tar.gz |
Simplify: remove the gas variable
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/subsurface-qt')
-rw-r--r-- | subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 37 | ||||
-rw-r--r-- | subsurface-core/subsurface-qt/DiveObjectHelper.h | 1 |
2 files changed, 19 insertions, 19 deletions
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index a947ea4e3..a3ecdf194 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -36,23 +36,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx) DiveObjectHelper::DiveObjectHelper(struct dive *d) : m_dive(d) { - int added = 0; - QString gas, gases; - for (int i = 0; i < MAX_CYLINDERS; i++) { - if (!is_cylinder_used(d, i)) - continue; - gas = d->cylinder[i].type.description; - gas += QString(!gas.isEmpty() ? " " : "") + gasname(&d->cylinder[i].gasmix); - // if has a description and if such gas is not already present - if (!gas.isEmpty() && gases.indexOf(gas) == -1) { - if (added > 0) - gases += QString(" / "); - gases += gas; - added++; - } - } - m_gas = gases; - for (int i = 0; i < MAX_CYLINDERS; i++) m_cylinders << getFormattedCylinder(d, i); @@ -171,7 +154,25 @@ QString DiveObjectHelper::tags() const QString DiveObjectHelper::gas() const { - return m_gas; + /*WARNING: here should be the gastlist, returned + * from the get_gas_string function or this is correct? + */ + QString gas, gases; + for (int i = 0; i < MAX_CYLINDERS; i++) { + if (!is_cylinder_used(m_dive, i)) + continue; + gas = m_dive->cylinder[i].type.description; + if (!gas.isEmpty()) + gas += QChar(' '); + gas += gasname(&m_dive->cylinder[i].gasmix); + // if has a description and if such gas is not already present + if (!gas.isEmpty() && gases.indexOf(gas) == -1) { + if (!gases.isEmpty()) + gases += QString(" / "); + gases += gas; + } + } + return gases; } QString DiveObjectHelper::sac() const diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index ba1a02236..160bbfb8e 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -64,7 +64,6 @@ public: private: QString m_date; QString m_time; - QString m_gas; QStringList m_weights; QStringList m_cylinders; struct dive *m_dive; |