diff options
Diffstat (limited to 'qt-models/divepicturemodel.cpp')
-rw-r--r-- | qt-models/divepicturemodel.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp index 7c9fb18c2..e73377d32 100644 --- a/qt-models/divepicturemodel.cpp +++ b/qt-models/divepicturemodel.cpp @@ -5,6 +5,7 @@ #include "core/imagedownloader.h" #include "core/picture.h" #include "core/qthelper.h" +#include "core/selection.h" #include "core/subsurface-qt/divelistnotifier.h" #include "commands/command.h" @@ -87,19 +88,15 @@ void DivePictureModel::updateDivePictures() Thumbnailer::instance()->clearWorkQueue(); } - int i; - struct dive *dive; - for_each_dive (i, dive) { - if (dive->selected) { - size_t first = pictures.size(); - FOR_EACH_PICTURE(dive) - pictures.push_back(PictureEntry(dive, *picture)); - - // Sort pictures of this dive by offset. - // Thus, the list will be sorted by (dive, offset). - std::sort(pictures.begin() + first, pictures.end(), - [](const PictureEntry &a, const PictureEntry &b) { return a.offsetSeconds < b.offsetSeconds; }); - } + for (struct dive *dive: getDiveSelection()) { + size_t first = pictures.size(); + FOR_EACH_PICTURE(dive) + pictures.push_back(PictureEntry(dive, *picture)); + + // Sort pictures of this dive by offset. + // Thus, the list will be sorted by (dive, offset). + std::sort(pictures.begin() + first, pictures.end(), + [](const PictureEntry &a, const PictureEntry &b) { return a.offsetSeconds < b.offsetSeconds; }); } updateThumbnails(); |