aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2016-01-11 16:16:48 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-11 15:47:07 -0800
commit9f4bc61f620fda99c2cb4dad5e016b844f0669d3 (patch)
treed6c37b60e37d0cb516130d6922e0dc868973f47f /subsurface-core/subsurface-qt/DiveObjectHelper.cpp
parent04704d02c87434c5ba88b9bfb2f5d51b7f3695b5 (diff)
downloadsubsurface-9f4bc61f620fda99c2cb4dad5e016b844f0669d3.tar.gz
Simplify: remove SAC 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/DiveObjectHelper.cpp')
-rw-r--r--subsurface-core/subsurface-qt/DiveObjectHelper.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
index a06e5bbcb..e39ba2fbb 100644
--- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
@@ -58,13 +58,6 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) :
}
m_gas = gases;
- if (d->sac) {
- const char *unit;
- int decimal;
- double value = get_volume_units(d->sac, &decimal, &unit);
- m_sac = QString::number(value, 'f', decimal).append(unit);
- }
-
for (int i = 0; i < MAX_CYLINDERS; i++)
m_cylinders << getFormattedCylinder(d, i);
@@ -186,7 +179,12 @@ QString DiveObjectHelper::gas() const
QString DiveObjectHelper::sac() const
{
- return m_sac;
+ if (!m_dive->sac)
+ return QString();
+ const char *unit;
+ int decimal;
+ double value = get_volume_units(m_dive->sac, &decimal, &unit);
+ QString::number(value, 'f', decimal).append(unit);
}
QStringList DiveObjectHelper::weights() const