2014-05-30 14:38:27 -03:00
|
|
|
#ifndef DIVEPICTUREWIDGET_H
|
|
|
|
#define DIVEPICTUREWIDGET_H
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
#include <QListView>
|
|
|
|
#include <QThread>
|
|
|
|
|
2014-06-03 19:34:36 -03:00
|
|
|
struct picture;
|
2014-06-03 16:48:59 -07:00
|
|
|
struct PhotoHelper {
|
2014-06-03 19:34:36 -03:00
|
|
|
QImage image;
|
|
|
|
struct picture *picture;
|
|
|
|
};
|
|
|
|
|
2014-06-02 19:50:42 -03:00
|
|
|
class DivePictureModel : public QAbstractTableModel {
|
2014-06-03 16:48:59 -07:00
|
|
|
Q_OBJECT
|
2014-05-30 15:16:00 -03:00
|
|
|
public:
|
2014-06-03 19:04:50 -03:00
|
|
|
static DivePictureModel *instance();
|
2014-05-30 14:38:27 -03: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 15:16:00 -03:00
|
|
|
void updateDivePictures(int divenr);
|
2014-06-03 16:48:59 -07:00
|
|
|
|
2014-05-30 15:16:00 -03:00
|
|
|
private:
|
2014-06-03 19:04:50 -03:00
|
|
|
DivePictureModel();
|
2014-05-30 15:16:00 -03:00
|
|
|
int numberOfPictures;
|
2014-05-31 00:42:54 -03: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 19:34:36 -03:00
|
|
|
QHash<QString, PhotoHelper> stringPixmapCache;
|
2014-05-30 14:38:27 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
class DivePictureDelegate : QStyledItemDelegate {
|
|
|
|
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
|
|
|
};
|
|
|
|
|
2014-06-03 16:48:59 -07:00
|
|
|
class DivePictureWidget : public QListView {
|
2014-05-30 14:38:27 -03:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-05-30 14:50:49 -03:00
|
|
|
DivePictureWidget(QWidget *parent);
|
2014-05-30 14:38:27 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
class DivePictureThumbnailThread : public QThread {
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|