diff options
Diffstat (limited to 'core/subsurface-qt/DiveObjectHelper.cpp')
-rw-r--r-- | core/subsurface-qt/DiveObjectHelper.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index e2847f7c9..9f694c513 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -360,3 +360,54 @@ QString DiveObjectHelper::firstGas() const gas = get_gas_string(m_dive->cylinder[0].gasmix); return gas; } + +QStringList DiveObjectHelper::suitList() const +{ + QStringList suits; + struct dive *d; + int i = 0; + for_each_dive (i, d) { + QString temp = d->suit; + if (!temp.isEmpty()) + suits << d->suit; + } + suits.removeDuplicates(); + suits.sort(); + return suits; +} + +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.removeDuplicates(); + buddies.sort(); + return buddies; +} + +QStringList DiveObjectHelper::divemasterList() const +{ + QStringList divemasters; + struct dive *d; + int i = 0; + for_each_dive (i, d) { + QString temp = d->divemaster; + if (!temp.isEmpty()) + divemasters << d->divemaster; + } + divemasters.removeDuplicates(); + divemasters.sort(); + return divemasters; +} |