summaryrefslogtreecommitdiffstats
path: root/core/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-09-30 00:01:24 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-03 10:01:13 -0700
commit00abc04913d8aef45be4e30f23d5ebc9914c8d54 (patch)
tree1a9d51c8680a6edb9278191510278d6ac8a62def /core/qthelper.cpp
parent7b196a5ef90ee96435ea762c7045ef47a6811a28 (diff)
downloadsubsurface-00abc04913d8aef45be4e30f23d5ebc9914c8d54.tar.gz
cleanup: use getDiveSelection() to loop over selected dives
getDiveSelection() returns a vector of the selected dives. Use that instead of looping over the dive table and checking manually. This removes a few lines of code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/qthelper.cpp')
-rw-r--r--core/qthelper.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 25c5fd7ce..7540045b3 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -19,6 +19,7 @@
#include "exif.h"
#include "file.h"
#include "picture.h"
+#include "selection.h"
#include "tag.h"
#include "trip.h"
#include "imagedownloader.h"
@@ -387,12 +388,9 @@ static bool lessThan(const QPair<QString, int> &a, const QPair<QString, int> &b)
QVector<QPair<QString, int>> selectedDivesGasUsed()
{
- int i, j;
- struct dive *d;
+ int j;
QMap<QString, int> gasUsed;
- for_each_dive (i, d) {
- if (!d->selected)
- continue;
+ for (dive *d: getDiveSelection()) {
volume_t *diveGases = get_gas_used(d);
for (j = 0; j < d->cylinders.nr; j++) {
if (diveGases[j].mliter) {