2014-05-30 17:38:27 +00:00
|
|
|
#ifndef DIVEPICTUREWIDGET_H
|
|
|
|
#define DIVEPICTUREWIDGET_H
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
#include <QListView>
|
|
|
|
#include <QThread>
|
|
|
|
|
2014-06-02 22:50:42 +00:00
|
|
|
class DivePictureModel : public QAbstractTableModel {
|
2014-05-30 18:16:00 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DivePictureModel(QObject *parent);
|
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-05-30 18:16:00 +00:00
|
|
|
void updateDivePictures(int divenr);
|
|
|
|
private:
|
|
|
|
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.
|
|
|
|
QHash<QString, QPixmap> stringPixmapCache;
|
2014-05-30 17:38:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DivePictureDelegate : QStyledItemDelegate {
|
|
|
|
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
|
|
|
};
|
|
|
|
|
2014-05-30 17:50:49 +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-05-30 17:38:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DivePictureThumbnailThread : public QThread {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|