2017-04-27 20:25:32 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-05-29 14:42:57 -03:00
|
|
|
#ifndef DIVEPICTUREMODEL_H
|
|
|
|
#define DIVEPICTUREMODEL_H
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <QImage>
|
|
|
|
#include <QFuture>
|
|
|
|
|
2017-12-10 00:07:46 +01:00
|
|
|
struct PictureEntry {
|
|
|
|
struct picture *picture;
|
|
|
|
QString filename;
|
2015-05-29 14:42:57 -03:00
|
|
|
QImage image;
|
2017-12-17 16:17:38 +01:00
|
|
|
QImage imageProfile; // For the profile widget keep a copy of a constant sized image
|
2015-05-29 14:42:57 -03:00
|
|
|
int offsetSeconds;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DivePictureModel : public QAbstractTableModel {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static DivePictureModel *instance();
|
|
|
|
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
2015-08-06 10:14:18 -03:00
|
|
|
virtual void updateDivePictures();
|
2017-12-09 22:59:21 +01:00
|
|
|
void updateDivePicturesWhenDone(QList<QFuture<void>>);
|
2015-10-20 21:03:53 +02:00
|
|
|
void removePicture(const QString& fileUrl, bool last);
|
2017-12-03 09:19:26 +01:00
|
|
|
int rowDDStart, rowDDEnd;
|
2017-12-17 16:17:38 +01:00
|
|
|
public slots:
|
|
|
|
void setZoomLevel(int level);
|
2017-12-17 14:49:40 +01:00
|
|
|
private:
|
2015-05-29 14:42:57 -03:00
|
|
|
DivePictureModel();
|
2017-12-10 00:07:46 +01:00
|
|
|
QList<PictureEntry> pictures;
|
2017-12-17 16:17:38 +01:00
|
|
|
double zoomLevel; // -1.0: minimum, 0.0: standard, 1.0: maximum
|
|
|
|
void updateThumbnails();
|
2015-05-29 14:42:57 -03:00
|
|
|
};
|
|
|
|
|
2015-08-06 10:14:18 -03:00
|
|
|
#endif
|