summaryrefslogtreecommitdiffstats
path: root/subsurface-core
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2016-01-11 16:48:46 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-11 15:47:07 -0800
commitabd05f0d21ab98ad11daaeac63243c8a428b4881 (patch)
treea67c0699e43fc472a0206cf0590d36208f1076da /subsurface-core
parent7a740d25a8ee798e0aa6a76df8598a9e83d95c54 (diff)
downloadsubsurface-abd05f0d21ab98ad11daaeac63243c8a428b4881.tar.gz
Simplify: remove weigths and cylinders.
This finishes the first round of Simplication patches for the QML basecode. The second one will be about the preferences. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core')
-rw-r--r--subsurface-core/subsurface-qt/DiveObjectHelper.cpp23
-rw-r--r--subsurface-core/subsurface-qt/DiveObjectHelper.h2
2 files changed, 12 insertions, 13 deletions
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
index a03bd311c..51831efd8 100644
--- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
@@ -36,11 +36,6 @@ static QString getFormattedCylinder(struct dive *dive, unsigned int idx)
DiveObjectHelper::DiveObjectHelper(struct dive *d) :
m_dive(d)
{
- for (int i = 0; i < MAX_CYLINDERS; i++)
- m_cylinders << getFormattedCylinder(d, i);
-
- for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++)
- m_weights << getFormattedWeight(d, i);
}
DiveObjectHelper::~DiveObjectHelper()
@@ -186,14 +181,17 @@ QString DiveObjectHelper::sac() const
QStringList DiveObjectHelper::weights() const
{
- return m_weights;
+ QStringList weights;
+ for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++)
+ weights << getFormattedWeight(m_dive, i);
+ return weights;
}
QString DiveObjectHelper::weight(int idx) const
{
- if (idx < 0 || idx > m_weights.size() - 1)
+ if ( (idx < 0) || idx > MAX_WEIGHTSYSTEMS )
return QString(EMPTY_DIVE_STRING);
- return m_weights.at(idx);
+ return getFormattedWeight(m_dive, idx);
}
QString DiveObjectHelper::suit() const
@@ -203,14 +201,17 @@ QString DiveObjectHelper::suit() const
QStringList DiveObjectHelper::cylinders() const
{
- return m_cylinders;
+ QStringList cylinders;
+ for (int i = 0; i < MAX_CYLINDERS; i++)
+ cylinders << getFormattedCylinder(m_dive, i);
+ return cylinders;
}
QString DiveObjectHelper::cylinder(int idx) const
{
- if (idx < 0 || idx > m_cylinders.size() - 1)
+ if ( (idx < 0) || idx > MAX_CYLINDERS)
return QString(EMPTY_DIVE_STRING);
- return m_cylinders.at(idx);
+ return getFormattedCylinder(m_dive, idx);
}
QString DiveObjectHelper::trip() const
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h
index 5702535ba..4d1e1acb2 100644
--- a/subsurface-core/subsurface-qt/DiveObjectHelper.h
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h
@@ -62,8 +62,6 @@ public:
QString otu() const;
private:
- QStringList m_weights;
- QStringList m_cylinders;
struct dive *m_dive;
};
Q_DECLARE_METATYPE(DiveObjectHelper *)