mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
7b196a5ef9
commit
00abc04913
4 changed files with 18 additions and 53 deletions
|
@ -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));
|
||||
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; });
|
||||
}
|
||||
// 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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue