blob: 11849af5fb334d01c07330c43400cf8a2afb6381 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#include "divepicturewidget.h"
#include <dive.h>
void DivePictureDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyledItemDelegate::paint(painter, option, index);
}
DivePictureModel::DivePictureModel(QObject *parent): QAbstractTableModel(parent)
{
}
void DivePictureModel::updateDivePictures(int divenr)
{
beginRemoveRows(QModelIndex(), 0, numberOfPictures-1);
numberOfPictures = 0;
endRemoveRows();
struct dive *d = get_dive(divenr);
if (!d)
return;
// All pictures are set in *all* divecomputers. ( waste of memory if > 100 pictures? )
// so just get from the first one.
struct event *ev = d->dc.events;
while(ev){
if(ev->type == 123){ // 123 means PICTURE.
numberOfPictures++;
}
ev = ev->next;
}
if (numberOfPictures == 0)
return;
beginInsertRows(QModelIndex(), 0, numberOfPictures-1);
endInsertRows();
}
int DivePictureModel::columnCount(const QModelIndex &parent) const
{
}
QVariant DivePictureModel::data(const QModelIndex &index, int role) const
{
}
int DivePictureModel::rowCount(const QModelIndex &parent) const
{
return numberOfPictures;
}
DivePictureWidget::DivePictureWidget(QWidget *parent): QListView(parent)
{
}
|