2014-05-30 17:38:27 +00:00
|
|
|
#ifndef DIVEPICTUREWIDGET_H
|
|
|
|
#define DIVEPICTUREWIDGET_H
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <QListView>
|
|
|
|
#include <QThread>
|
2015-03-10 17:22:34 +00:00
|
|
|
#include <QFuture>
|
2014-05-30 17:38:27 +00:00
|
|
|
|
2015-02-26 13:39:42 +00:00
|
|
|
typedef QPair<QString, QByteArray> SHashedFilename;
|
|
|
|
|
2014-06-03 23:48:59 +00:00
|
|
|
struct PhotoHelper {
|
2014-06-03 22:34:36 +00:00
|
|
|
QImage image;
|
2014-08-05 19:37:14 +00:00
|
|
|
int offsetSeconds;
|
2014-06-03 22:34:36 +00:00
|
|
|
};
|
|
|
|
|
2015-02-26 13:39:42 +00:00
|
|
|
class SHashedImage : public QImage {
|
|
|
|
public:
|
|
|
|
SHashedImage(struct picture *picture);
|
|
|
|
};
|
|
|
|
|
2014-06-02 22:50:42 +00:00
|
|
|
class DivePictureModel : public QAbstractTableModel {
|
2014-06-03 23:48:59 +00:00
|
|
|
Q_OBJECT
|
2014-05-30 18:16:00 +00:00
|
|
|
public:
|
2014-06-03 22:04:50 +00:00
|
|
|
static DivePictureModel *instance();
|
2014-05-30 17:38:27 +00:00
|
|
|
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;
|
2014-07-02 20:58:06 +00:00
|
|
|
void updateDivePictures();
|
2015-03-10 17:22:34 +00:00
|
|
|
void updateDivePicturesWhenDone(QList<QFuture<void> >);
|
2014-07-30 02:03:32 +00:00
|
|
|
void removePicture(const QString& fileUrl);
|
2014-06-03 23:48:59 +00:00
|
|
|
|
2014-05-30 18:16:00 +00:00
|
|
|
private:
|
2014-06-03 22:04:50 +00:00
|
|
|
DivePictureModel();
|
2014-05-30 18:16:00 +00:00
|
|
|
int numberOfPictures;
|
2014-05-31 03:42:54 +00:00
|
|
|
// Currently, load the images on the fly
|
|
|
|
// Later, use a thread to load the images
|
|
|
|
// Later, save the thumbnails so we don't need to reopen every time.
|
2014-06-03 22:34:36 +00:00
|
|
|
QHash<QString, PhotoHelper> stringPixmapCache;
|
2014-05-30 17:38:27 +00:00
|
|
|
};
|
|
|
|
|
2014-06-03 23:48:59 +00:00
|
|
|
class DivePictureWidget : public QListView {
|
2014-05-30 17:38:27 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-05-30 17:50:49 +00:00
|
|
|
DivePictureWidget(QWidget *parent);
|
2014-06-27 12:16:55 +00:00
|
|
|
signals:
|
|
|
|
void photoDoubleClicked(const QString filePath);
|
|
|
|
private
|
|
|
|
slots:
|
|
|
|
void doubleClicked(const QModelIndex &index);
|
2014-05-30 17:38:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DivePictureThumbnailThread : public QThread {
|
|
|
|
};
|
|
|
|
|
2014-06-27 12:16:55 +00:00
|
|
|
#endif
|