media: turn DivePictureModel::pictures into std::vector

QVector doesn't have a function to insert a range of pictures,
which we will need for undo of image adding/deletion.

Moreover, std::vector gives us stronger guarantees. For example,
if capacity is large enough, it guarantees that there will be
no reallocation and thus iterators stay valid. I have not found
such a guarantee in the Qt docs.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-04-17 22:43:43 +02:00 committed by Dirk Hohndel
parent fe82cb32b9
commit 9962d47b56
2 changed files with 7 additions and 8 deletions

View file

@ -6,7 +6,6 @@
#include <QAbstractTableModel>
#include <QImage>
#include <QFuture>
// We use std::string instead of QString to use the same character-encoding
// as in the C core (UTF-8). This is crucial to guarantee the same sort-order.
@ -36,7 +35,7 @@ public slots:
void pictureOffsetChanged(dive *d, const QString filename, offset_t offset);
private:
DivePictureModel();
QVector<PictureEntry> pictures;
std::vector<PictureEntry> pictures;
int findPictureId(const std::string &filename); // Return -1 if not found
double zoomLevel; // -1.0: minimum, 0.0: standard, 1.0: maximum
int size;