From 572fc470718e4a11d5df60b37e7a2a91639285c7 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Sun, 28 Jan 2018 10:26:45 +0100 Subject: mobile cleanup: unduplicate code and do not loop over dives (2) See e6e1473e6. Exact same commit but here for the list of buddies. Signed-off-by: Jan Mulder --- core/subsurface-qt/DiveObjectHelper.cpp | 22 ---------------------- core/subsurface-qt/DiveObjectHelper.h | 2 -- 2 files changed, 24 deletions(-) (limited to 'core') diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index 4a7bc70f9..2e18b8f0a 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -429,28 +429,6 @@ QStringList DiveObjectHelper::locationList() const return locations; } -QStringList DiveObjectHelper::buddyList() const -{ - QStringList buddies; - struct dive *d; - int i = 0; - for_each_dive (i, d) { - QString temp = d->buddy; - if (!temp.isEmpty() && !temp.contains(",")){ - buddies << d->buddy; - } - else if (!temp.isEmpty()){ - QRegExp sep("(,\\s)"); - QStringList tempList = temp.split(sep); - buddies << tempList; - buddies << tr("Multiple Buddies"); - } - } - buddies.removeDuplicates(); - buddies.sort(); - return buddies; -} - QStringList DiveObjectHelper::divemasterList() const { QStringList divemasters; diff --git a/core/subsurface-qt/DiveObjectHelper.h b/core/subsurface-qt/DiveObjectHelper.h index a8ecc638c..28eaa6a41 100644 --- a/core/subsurface-qt/DiveObjectHelper.h +++ b/core/subsurface-qt/DiveObjectHelper.h @@ -47,7 +47,6 @@ class DiveObjectHelper : public QObject { Q_PROPERTY(QString startPressure READ startPressure CONSTANT) Q_PROPERTY(QString endPressure READ endPressure CONSTANT) Q_PROPERTY(QString firstGas READ firstGas CONSTANT) - Q_PROPERTY(QStringList buddyList READ buddyList CONSTANT) Q_PROPERTY(QStringList divemasterList READ divemasterList CONSTANT) Q_PROPERTY(QStringList locationList READ locationList CONSTANT) public: @@ -93,7 +92,6 @@ public: QString endPressure() const; QString firstGas() const; QStringList locationList() const; - QStringList buddyList() const; QStringList divemasterList() const; private: -- cgit v1.2.3-70-g09d2