2017-04-27 18:25:32 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-05-29 17:42:57 +00:00
|
|
|
#ifndef DIVEPICTUREMODEL_H
|
|
|
|
#define DIVEPICTUREMODEL_H
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <QImage>
|
|
|
|
#include <QFuture>
|
|
|
|
|
2017-12-09 23:07:46 +00:00
|
|
|
struct PictureEntry {
|
|
|
|
struct picture *picture;
|
|
|
|
QString filename;
|
2015-05-29 17:42:57 +00:00
|
|
|
QImage image;
|
|
|
|
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 13:14:18 +00:00
|
|
|
virtual void updateDivePictures();
|
2017-12-09 21:59:21 +00:00
|
|
|
void updateDivePicturesWhenDone(QList<QFuture<void>>);
|
2015-10-20 19:03:53 +00:00
|
|
|
void removePicture(const QString& fileUrl, bool last);
|
2017-12-03 08:19:26 +00:00
|
|
|
int rowDDStart, rowDDEnd;
|
2017-12-17 15:17:38 +00:00
|
|
|
public slots:
|
|
|
|
void setZoomLevel(int level);
|
2018-03-10 15:36:20 +00:00
|
|
|
void updateThumbnail(QString filename, QImage thumbnail);
|
2017-12-17 13:49:40 +00:00
|
|
|
private:
|
2015-05-29 17:42:57 +00:00
|
|
|
DivePictureModel();
|
2017-12-09 23:07:46 +00:00
|
|
|
QList<PictureEntry> pictures;
|
2017-12-17 15:17:38 +00:00
|
|
|
double zoomLevel; // -1.0: minimum, 0.0: standard, 1.0: maximum
|
2018-04-11 04:56:46 +00:00
|
|
|
int defaultSize;
|
|
|
|
int size;
|
2017-12-17 15:17:38 +00:00
|
|
|
void updateThumbnails();
|
2018-04-11 04:56:46 +00:00
|
|
|
void updateZoom();
|
2015-05-29 17:42:57 +00:00
|
|
|
};
|
|
|
|
|
2015-08-06 13:14:18 +00:00
|
|
|
#endif
|